Re: Tree-walker callbacks vs -Wdeprecated-non-prototype

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Tree-walker callbacks vs -Wdeprecated-non-prototype
Date: 2022-09-19 04:53:30
Message-ID: 259408.1663563210@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Thomas Munro <thomas(dot)munro(at)gmail(dot)com> writes:
> On Mon, Sep 19, 2022 at 3:39 PM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>> I also note that our existing code in this area would break pretty
>> thoroughly on such a machine, so this isn't making it worse.

> Yeah, I don't expect it to be a practical problem on any real system
> (that is, I don't expect any real calling convention to transfer a
> struct T * argument in a different place than void *). I just wanted
> to mention that it's a new liberty.

No, it's not, because the existing coding here is already assuming that.
The walker callbacks are generally declared as taking a "struct *"
second parameter, but expression_tree_walker et al think they are
passing a "void *" to them. Even if a platform ABI had some weird
special rule about how to call functions that you don't know the
argument list for, it wouldn't fix this because the walkers sure do know
what their arguments are. The only reason this code works today is that
in practice, "void *" *is* ABI-compatible with "struct *".

I'm not excited about creating a demonstrable opportunity for bugs
in order to make the code hypothetically more compatible with
hardware designs that are thirty years obsolete. (Hypothetical
in the sense that there's little reason to believe there would
be no other problems.)

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message John Naylor 2022-09-19 06:21:20 Re: Support for Rust
Previous Message John Naylor 2022-09-19 04:42:39 Re: Typo in xact.c