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

From: Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
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 19:18:30
Message-ID: CA+hUKGKRb6pCS-qZgvUQPa1Z8o3FZqO3vHpTkUKJRFxSTo9H3w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

On Wed, Jan 29, 2020 at 4:05 AM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> 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.

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.

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2020-01-28 19:39:48 Re: pgsql: Remove dependency on HeapTuple from predicate locking functions.
Previous Message Robert Haas 2020-01-28 15:37:00 Re: pgsql: Add a non-strict version of jsonb_set