Re: pgsql: Remove dependency on HeapTuple from predicate locking functions.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
Cc: pgsql-committers <pgsql-committers(at)lists(dot)postgresql(dot)org>
Subject: Re: pgsql: Remove dependency on HeapTuple from predicate locking functions.
Date: 2020-01-28 15:05:36
Message-ID: 7230.1580223936@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Thomas Munro <thomas(dot)munro(at)gmail(dot)com> writes:
> On Tue, Jan 28, 2020 at 6:59 PM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)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

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Robert Haas 2020-01-28 15:36:32 Re: pgsql: Add a non-strict version of jsonb_set
Previous Message Heikki Linnakangas 2020-01-28 11:11:46 pgsql: Fix randAccess setting in ReadRecord()