Peter Eisentraut <peter_e@gmx.net> writes:
> A small sidetrack here. I've managed to set up the Solaris Studio
> compiler on Linux and tried this out. It turns out these "statement not
> reached" warnings have nothing to do with knowledge about library
> functions such as abort() or exit() not returning. The warnings come
> mostly from loops that never end (except by returning from the function)
> and some other more silly cases where the supposed fallback return
> statement is clearly unnecessary. I think these should be fixed,
> because the code is wrong and could mask real errors if someone ever
> wanted to rearrange those loops or something.
> Patch attached. I tried this out with old and new versions of gcc,
> clang, and the Solaris compiler, and everyone was happy about. I didn't
> touch the regex code. And there's some archeological knowledge about
> Perl in there.
Hm. I seem to recall that at least some of these lines were themselves
put in to suppress compiler warnings. So we may just be moving the
warnings from one set of non-mainstream compilers to another set.
Still, we might as well try it and see if there's a net reduction.
(In some places we might need to tweak the code a bit harder than this,
to make it clearer that the unreachable spot is unreachable.)
regards, tom lane