Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1w2umI-000j45-0X for pgsql-hackers@arkaria.postgresql.org; Wed, 18 Mar 2026 17:33:54 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w2umG-00CxUf-39 for pgsql-hackers@arkaria.postgresql.org; Wed, 18 Mar 2026 17:33:52 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1w2umG-00CxUX-2F for pgsql-hackers@lists.postgresql.org; Wed, 18 Mar 2026 17:33:52 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1w2umE-00000000yKP-0SxY for pgsql-hackers@lists.postgresql.org; Wed, 18 Mar 2026 17:33:52 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 62IHXkPd803741; Wed, 18 Mar 2026 13:33:46 -0400 From: Tom Lane To: Andres Freund cc: Nazir Bilal Yavuz , Peter Eisentraut , Bertrand Drouvot , pgsql-hackers@lists.postgresql.org Subject: Re: Enable -Wstrict-prototypes and -Wold-style-definition by default In-reply-to: References: <44885d54-0376-46b3-b574-59e0e3098580@eisentraut.org> <784253.1773853383@sss.pgh.pa.us> Comments: In-reply-to Andres Freund message dated "Wed, 18 Mar 2026 13:26:26 -0400" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <803739.1773855226.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Wed, 18 Mar 2026 13:33:46 -0400 Message-ID: <803740.1773855226@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Andres Freund writes: > On 2026-03-18 13:03:03 -0400, Tom Lane wrote: >> 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 > 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 som= e of > our own ecpglib code while code using ecpg can't do that? Please tell m= e it > ain't so. Looks like it's so --- AFAICS, POSTGRES_ECPG_INTERNAL isn't tested anywhere except in this fragment in sqlca.h. >> 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 alrea= dy has > to do, right? I think that from the point of view of ecpg client applications, "sqlca" is supposed to be a library-defined global variable (and this macro is about making it thread-local). They'd not really have use for local variables named that. regards, tom lane