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

From Thomas Munro
Subject Re: pgsql: Remove dependency on HeapTuple from predicate locking functions.
Date
Msg-id CA+hUKGKRb6pCS-qZgvUQPa1Z8o3FZqO3vHpTkUKJRFxSTo9H3w@mail.gmail.com
Whole thread Raw
In response to Re: pgsql: Remove dependency on HeapTuple from predicate locking functions.  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: pgsql: Remove dependency on HeapTuple from predicate locking functions.
List pgsql-committers
On Wed, Jan 29, 2020 at 4:05 AM Tom Lane <tgl@sss.pgh.pa.us> wrote:
> 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.

Maybe because it's allowed in C++, and pretty harmless.

> 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?

$ cat test.c
void f() {}
void g() { return f(); }
$ cc -c -Wall test.c
$ cc -c -Wpedantic test.c
test.c:2:12: warning: void function 'g' should not return void
expression [-Wpedantic]
void g() { return f(); }
           ^      ~~~
1 warning generated.

Many other constructs in PostgreSQL are rejected by that switch,
though, and I don't see a way to ask for just that one warning.



pgsql-committers by date:

Previous
From: Robert Haas
Date:
Subject: Re: pgsql: Add a non-strict version of jsonb_set
Next
From: Tom Lane
Date:
Subject: Re: pgsql: Remove dependency on HeapTuple from predicate locking functions.