Re: apply pragma system_header to python headers

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Peter Eisentraut <peter(at)eisentraut(dot)org>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: apply pragma system_header to python headers
Date: 2023-11-06 15:30:28
Message-ID: 0e64f8fd-4007-9ad8-4514-86977c1234fa@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


On 2023-11-06 Mo 09:57, Tom Lane wrote:
> Peter Eisentraut <peter(at)eisentraut(dot)org> writes:
>> Analogous to 388e80132c (which was for Perl) but for Python, I propose
>> adding #pragma GCC system_header to plpython.h. Without it, you get
>> tons of warnings about -Wdeclaration-after-statement, starting with
>> Python 3.12. (In the past, I have regularly sent feedback to Python to
>> fix their header files, but this is getting old, and we have an easier
>> solution now.)
> +1 for the concept --- I was just noticing yesterday that my buildfarm
> warning scraping script is turning up some of these. However, we ought
> to try to minimize the amount of our own code that is subject to the
> pragma. So I think a prerequisite ought to be to get this out of
> plpython.h:
>
> /*
> * Used throughout, so it's easier to just include it everywhere.
> */
> #include "plpy_util.h"
>
> Alternatively, is there a way to reverse the effect of the
> pragma after we've included what we need?

There's "GCC diagnostic push" and "GCC diagnostic pop" but I don't know
if they apply to "GCC system_header". Instead of using "GCC
system_header" we could just ignore the warnings we're seeing. e.g. "GCC
diagnostic ignored \"-Wdeclaration-after-statement\""

cheers

andrew

--
Andrew Dunstan
EDB: https://www.enterprisedb.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2023-11-06 15:55:55 Re: Version 14/15 documentation Section "Alter Default Privileges"
Previous Message Bruce Momjian 2023-11-06 15:26:16 Re: Version 14/15 documentation Section "Alter Default Privileges"