Thomas Munro <thomas.munro@gmail.com> writes:
> On Tue, Jan 28, 2020 at 6:59 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> anole's not terribly pleased with this:
>> "heapam.c", line 9137: error #2118: a void function may not return a value
>> return CheckForSerializableConflictOut(relation, xid, snapshot);
> Thanks. I pushed a fix.
> Wow, HP C spits out a lot of warnings.
It's pretty noisy, and most of 'em are useless :-(. But as for this
particular complaint, I don't really understand why gcc lets it slide.
The C99 standard is not exactly ambiguous about this:
6.8.6.4 The return statement
Constraints
[#1] A return statement with an expression shall not appear
in a function whose return type is void. A return statement
without an expression shall only appear in a function whose
return type is void.
There is absolutely no question that the original coding is illegal
per spec, and it isn't even a particularly useful shorthand; so why
can't we get even a warning about it?
regards, tom lane