public inbox for [email protected]  
help / color / mirror / Atom feed
From: Andres Freund <[email protected]>
To: Tom Lane <[email protected]>
Cc: Nazir Bilal Yavuz <[email protected]>
Cc: Peter Eisentraut <[email protected]>
Cc: Bertrand Drouvot <[email protected]>
Cc: [email protected]
Subject: Re: Enable -Wstrict-prototypes and -Wold-style-definition by default
Date: Wed, 18 Mar 2026 13:26:26 -0400
Message-ID: <pvwv3lp7te6nxbmb2mr6oiyxcwf5fq4vjbbtf5s2yu6bpyqn6z@k3gc2bjmlcbu> (raw)
In-Reply-To: <[email protected]>
References: <aa73q1aT0A3/vke/@ip-10-97-1-34.eu-west-3.compute.internal>
	<[email protected]>
	<[email protected]>
	<CAN55FZ1VDwJ-ZD092ChYf++huP+-S3Cg45tJ8jNH5wx2c4BHAg@mail.gmail.com>
	<[email protected]>

Hi,

On 2026-03-18 13:03:03 -0400, Tom Lane wrote:
> Nazir Bilal Yavuz <[email protected]> writes:
> > I got this warning while running headerscheck after this commit:
> 
> > ~/Desktop/projects/postgres/src/interfaces/ecpg/ecpglib/ecpglib_extern.h:221:40:
> > warning: function declaration isn’t a prototype [-Wstrict-prototypes]
> >   221 | void            ecpg_init_sqlca(struct sqlca_t *sqlca)
> 
> Yeah, I see that too.  I believe the problem is that headerscheck
> doesn't cause POSTGRES_ECPG_INTERNAL to become defined, so that
> what the compiler is seeing is (from sqlca.h):
> 
> 	#ifndef POSTGRES_ECPG_INTERNAL
> 	#define sqlca (*ECPGget_sqlca())
> 	#endif
> 
> and then
> 
> 	void		ecpg_init_sqlca(struct sqlca_t *sqlca);
> 
> Kinda surprising that that's not a syntax error.

Indeed.


I don't even really understand what that POSTGRES_ECPG_INTERNAL business is
about. Is that really just so we can use a local "sqlca" variable in some of
our own ecpglib code while code using ecpg can't do that?  Please tell me it
ain't so.


> We could plausibly fix this either by
> 
> (1) renaming ecpg_init_sqlca's parameter to something else;
> 
> (2) ensuring that POSTGRES_ECPG_INTERNAL is defined.  I'd be inclined
> to make ecpglib_extern.h do that rather than expecting headerscheck
> to know about it.

> Neither of these options are beautiful, but perhaps #1 is slightly
> less ugly.  Any preferences?

1) seems to be the preferrable approach. It's what code using ecpg already has
to do, right?

Greetings,

Andres Freund





view thread (18+ 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], [email protected], [email protected], [email protected], [email protected]
  Subject: Re: Enable -Wstrict-prototypes and -Wold-style-definition by default
  In-Reply-To: <pvwv3lp7te6nxbmb2mr6oiyxcwf5fq4vjbbtf5s2yu6bpyqn6z@k3gc2bjmlcbu>

* 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