Re: perl 5.36, C99, -Wdeclaration-after-statement -Wshadow=compatible-local

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>, pgsql-hackers(at)postgresql(dot)org, David Rowley <dgrowleyml(at)gmail(dot)com>, Dagfinn Ilmari Mannsåker <ilmari(at)ilmari(dot)org>
Subject: Re: perl 5.36, C99, -Wdeclaration-after-statement -Wshadow=compatible-local
Date: 2022-12-28 18:43:27
Message-ID: 356473.1672253007@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Andres Freund <andres(at)anarazel(dot)de> writes:
> The attached *prototype* patch is a slightly different spin on the idea of
> using -isystem: It adds a
> #pragma GCC system_header
> to plperl.h if supported by the compiler. That also avoids warnings from
> within plperl and subsidiary headers.

> I don't really have an opinion about whether using the pragma or -isystem is
> preferrable. I chose the pragma because it makes it easier to grep for headers
> where we chose to do this.

This seems like a reasonable answer. It feels quite a bit less magic
in the way that it suppresses warnings than -isystem, and also less
likely to have unexpected side-effects (I have a nasty feeling that
-isystem is more magic on macOS than elsewhere). So far it seems
like only the Perl headers have much of an issue, though I can
foresee Python coming along soon.

> In the compiler test, I chose to not check whether -Werror=unknown-pragmas is
> supported - it appears to be an old gcc flag, and the worst outcome is that
> HAVE_PRAGMA_SYSTEM_HEADER isn't defined.
> We could alternatively define HAVE_PRAGMA_SYSTEM_HEADER or such based on
> __GNUC__ being defined.

Hmm ... I guess the buildfarm would tell us whether that detection works
correctly on platforms where it matters. Let's keep it simple if we
can.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2022-12-28 20:13:23 Re: BUG #17717: Regression in vacuumdb (15 is slower than 10/11 and possible memory issue)
Previous Message Andres Freund 2022-12-28 18:24:55 Re: perl 5.36, C99, -Wdeclaration-after-statement -Wshadow=compatible-local