public inbox for [email protected]
help / color / mirror / Atom feedFrom: Thomas Munro <[email protected]>
To: Tom Lane <[email protected]>
Cc: pgsql-hackers <[email protected]>
Subject: Re: Tree-walker callbacks vs -Wdeprecated-non-prototype
Date: Mon, 19 Sep 2022 10:16:24 +1200
Message-ID: <CA+hUKGK=xCw9_V7tCMvpT5D83AH8ArotTw3W4s70Vhqr7VgZkg@mail.gmail.com> (raw)
In-Reply-To: <[email protected]>
References: <CA+hUKGKpHPDTv67Y+s6yiC8KH5OXeDg6a-twWo_xznKTcG0kSA@mail.gmail.com>
<[email protected]>
<[email protected]>
<[email protected]>
On Mon, Sep 19, 2022 at 8:57 AM Tom Lane <[email protected]> wrote:
> I think we ought to seriously consider the alternative of changing
> nodeFuncs.c about like I have here, but not touching the walkers/mutators,
> and silencing the resulting complaints about function type casting by
> doing the equivalent of
>
> - return expression_tree_walker(node, cost_qual_eval_walker,
> - (void *) context);
> + return expression_tree_walker(node,
> + (tree_walker_callback) cost_qual_eval_walker,
> + (void *) context);
>
> We could avoid touching all the call sites by turning
> expression_tree_walker and friends into macro wrappers that incorporate
> these casts. This is fairly annoying, in that it gives up the function
> type safety the C committee wants to impose on us; but I really think
> the data type safety that we're giving up in this version of the patch
> is a worse hazard.
But is it defined behaviour?
https://stackoverflow.com/questions/559581/casting-a-function-pointer-to-another-type
> BTW, I was distressed to discover that someone decided they could
> use ExecShutdownNode as a planstate_tree_walker() walker even though
> its argument list is not even the right length. I'm a bit flabbergasted
> that we seem to have gotten away with that so far, because I'd have
> thought for sure that it'd break some platform's convention for which
> argument gets passed where. I think we need to fix that, independently
> of what we do about the larger scope of these problems. To avoid an
> API break, I propose making ExecShutdownNode just be a one-liner that
> calls an internal ExecShutdownNode_walker() function. (I've not done
> it that way in the attached, though.)
Huh... wouldn't systems that pass arguments right-to-left on the stack
receive NULL for node? That'd include the SysV i386 convention used
on Linux, *BSD etc. But that can't be right or we'd know about it...
But certainly +1 for fixing that regardless.
view thread (19+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected]
Subject: Re: Tree-walker callbacks vs -Wdeprecated-non-prototype
In-Reply-To: <CA+hUKGK=xCw9_V7tCMvpT5D83AH8ArotTw3W4s70Vhqr7VgZkg@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox