Re: pgsql: Remove dependency on HeapTuple from predicate locking functions. - Mailing list pgsql-committers

From Tom Lane
Subject Re: pgsql: Remove dependency on HeapTuple from predicate locking functions.
Date
Msg-id 7230.1580223936@sss.pgh.pa.us
Whole thread Raw
In response to Re: pgsql: Remove dependency on HeapTuple from predicate locking functions.  (Thomas Munro <thomas.munro@gmail.com>)
Responses Re: pgsql: Remove dependency on HeapTuple from predicate locking functions.
List pgsql-committers
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



pgsql-committers by date:

Previous
From: Heikki Linnakangas
Date:
Subject: pgsql: Fix randAccess setting in ReadRecord()
Next
From: Robert Haas
Date:
Subject: Re: pgsql: Add a non-strict version of jsonb_set