nbdkit/0002-perl-Move-GCC-diagnost...

51 lines
1.6 KiB
Diff

From 3c00f00e5c42633b25f2d54f852af9332bf6c3b7 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
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 <perl.h> header file, rather than later on when a macro
is used. Because the GCC diagnostic ignored line appeared after
<perl.h> 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 <assert.h>
#include <errno.h>
+/* perl.h contains multiple variable shadowing */
+#pragma GCC diagnostic ignored "-Wshadow"
+
#include <XSUB.h>
#include <EXTERN.h>
#include <perl.h>
@@ -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