From 3c00f00e5c42633b25f2d54f852af9332bf6c3b7 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Sun, 19 Jun 2022 17:58:11 +0100 Subject: [PATCH] perl: Move GCC diagnostic ignored earlier Since updating to perl 5.36, the -Wshadow warn/error now occurs when including the header file, rather than later on when a macro is used. Because the GCC diagnostic ignored line appeared after was included it had no effect. Moving it before the inclusion works around this. The error was: In file included from /usr/lib64/perl5/CORE/perl.h:4155, from perl.c:47: /usr/lib64/perl5/CORE/sv_inline.h: In function 'Perl_newSV_type': /usr/lib64/perl5/CORE/handy.h:97:35: error: declaration of 'p_' shadows a previous local [-Werror=shadow] 97 | # define MUTABLE_PTR(p) ({ void *p_ = (p); p_; }) | ^~ (cherry picked from commit 754f1d46d14b8c97133885fb1422697177e40722) --- plugins/perl/perl.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/perl/perl.c b/plugins/perl/perl.c index 386d5052..26de0e54 100644 --- a/plugins/perl/perl.c +++ b/plugins/perl/perl.c @@ -42,6 +42,9 @@ #include #include +/* perl.h contains multiple variable shadowing */ +#pragma GCC diagnostic ignored "-Wshadow" + #include #include #include @@ -51,9 +54,6 @@ #include "cleanup.h" -/* Use of perl.h insists on shadowing my_perl during XS(). */ -#pragma GCC diagnostic ignored "-Wshadow" - static PerlInterpreter *my_perl; static const char *script; -- 2.31.1