Re: Why does load_external_function() return PGFunction?

From: Andres Freund <andres(at)anarazel(dot)de>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Why does load_external_function() return PGFunction?
Date: 2018-03-26 20:16:41
Message-ID: 20180326201641.lwny3mb7girclach@alap3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2018-03-26 11:31:36 -0700, Andres Freund wrote:
> On 2018-03-26 11:14:03 -0400, Robert Haas wrote:
> > On Sat, Mar 24, 2018 at 4:33 PM, Andres Freund <andres(at)anarazel(dot)de> wrote:
> > > I don't think it really changes the need, but it's worthwhile to note
> > > that gcc-8 warns about this now:
> > > /home/andres/src/postgresql/src/backend/postmaster/bgworker.c: In function ‘LookupBackgroundWorkerFunction’:
> > > /home/andres/src/postgresql/src/backend/postmaster/bgworker.c:1246:9: warning: cast between incompatible function types from ‘PGFunction’ {aka ‘long unsigned int (*)(struct FunctionCallInfoData *)’} to ‘void (*)(Datum)’ {aka ‘void (*)(long unsigned int)’} [-Wcast-function-type]
> > > return (bgworker_main_type)
> >
> > That's probably going to mean we need, or at least want, to do
> > something about this at some point. Warning-free compiles are
> > desirable.
>
> Right. We can suppress those if we want, either by adding another cast,
> or by adding -Wno-cast-function-type. The latter wouldn't be entirely a
> bad idea, it seems to be a warning of very limited benefit.

I dug up a thread about the introduction of the warning:
https://gcc.gnu.org/ml/gcc-patches/2017-10/msg00423.html

Sounds like we should add something like
typedef void (*GenericFuncPtr) (void);
or such? Similar to what Tom proposed upthread.

- Andres

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Rady, Doug 2018-03-26 20:23:48 Re: PATCH: pgbench - option to build using ppoll() for larger connection counts
Previous Message Vladimir Sitnikov 2018-03-26 20:09:55 Re: Proposal: http2 wire format