perl/perl-5.33.5-Use-perl.h-versions-of-PERL_UNUSED_foo-in-XSUB.h.patch
2021-02-09 19:05:05 +01:00

44 lines
1.2 KiB
Diff

From 036189b0a003875df7bf09c7f7fd702267f549e5 Mon Sep 17 00:00:00 2001
From: Karl Williamson <khw@cpan.org>
Date: Sat, 26 Dec 2020 08:44:08 -0700
Subject: [PATCH] Use perl.h versions of PERL_UNUSED_foo in XSUB.h
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
This commit was applied to perl.h, but not to XSUB.h:
commit a730e3f230f364cffe49370f816f975ae7c9c403
Author: Jarkko Hietaniemi <jhi@iki.fi>
Date: Thu Sep 4 09:08:33 2014 -0400
Use sizeof() in UNUSED_ARG and UNUSED_VAR to avoid accessing the values.
The values might even be uninitialized in the case of PERL_UNUSED_VAR.
Signed-off-by: Petr Písař <ppisar@redhat.com>
---
XSUB.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/XSUB.h b/XSUB.h
index 616d813840..c1e3959885 100644
--- a/XSUB.h
+++ b/XSUB.h
@@ -108,10 +108,10 @@ is a lexical C<$_> in scope.
*/
#ifndef PERL_UNUSED_ARG
-# define PERL_UNUSED_ARG(x) ((void)x)
+# define PERL_UNUSED_ARG(x) ((void)sizeof(x))
#endif
#ifndef PERL_UNUSED_VAR
-# define PERL_UNUSED_VAR(x) ((void)x)
+# define PERL_UNUSED_VAR(x) ((void)sizeof(x))
#endif
#define ST(off) PL_stack_base[ax + (off)]
--
2.26.2