From: Tom Lane <tgl@sss.pgh.pa.us>
To: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
Cc: Andres Freund <andres@anarazel.de>
Cc: pgsql-hackers <pgsql-hackers@postgresql.org>
Subject: Re: warnings for invalid function casts
Date: Fri, 03 Jul 2020 10:40:00 -0400
Message-ID: <931660.1593787200@sss.pgh.pa.us> (raw)
In-Reply-To: <c764383a-3f9e-f5ba-79d1-8824fe73340f@2ndquadrant.com>
References: <1e97628e-6447-b4fd-e230-d109cec2d584@2ndquadrant.com>
<474790.1593526505@sss.pgh.pa.us>
<20200630192135.nwlza2u57dy3qej4@alap3.anarazel.de>
<496552.1593545900@sss.pgh.pa.us>
<c764383a-3f9e-f5ba-79d1-8824fe73340f@2ndquadrant.com>
Peter Eisentraut <peter.eisentraut@2ndquadrant.com> writes:
> On 2020-06-30 21:38, Tom Lane wrote:
>> In any case, I think the issue here is what is the escape hatch for saying
>> that "I know this cast is okay, don't warn about it, thanks". Treating
>> "void (*) (void)" as special for that purpose is nothing more nor less
>> than a kluge, so another compiler might do it differently. Given the
>> POSIX restriction, I think we could reasonably use "void *" instead.
> I think gcc had to pick some escape hatch that is valid also outside of
> POSIX, so they just had to pick something. If we're disregarding
> support for these Harvard architecture type things, then we might as
> well use void * for easier notation.
As long as it's behind a typedef, the code will look the same in any
case ;-).
> Btw., one of the hunks in my patch was in PL/Python. I have found an
> equivalent change in the core Python code, which does make use of void
> (*) (void): https://github.com/python/cpython/commit/62be74290aca
Given that gcc explicitly documents "void (*) (void)" as being what
to use, they're going to have a hard time changing their minds about
that ... and gcc is dominant enough in this space that I suppose
other compilers would have to be compatible with it. So even though
it's theoretically bogus, I suppose we might as well go along with
it. The typedef will allow a centralized fix if we ever find a
better answer.
regards, tom lane
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: pgsql-hackers@postgresql.org
Cc: tgl@sss.pgh.pa.us, peter.eisentraut@2ndquadrant.com, andres@anarazel.de
Subject: Re: warnings for invalid function casts
In-Reply-To: <931660.1593787200@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox