summaryrefslogtreecommitdiff
path: root/perl.h
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2014-09-04 09:08:33 -0400
committerJarkko Hietaniemi <jhi@iki.fi>2014-09-04 09:39:46 -0400
commita730e3f230f364cffe49370f816f975ae7c9c403 (patch)
treecc5ae6ea714948d2f7e0262a2a25d4fe0082682d /perl.h
parent2313e9ca3be65223d835c40b25c76765e8c35547 (diff)
downloadperl-a730e3f230f364cffe49370f816f975ae7c9c403.tar.gz
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.
Diffstat (limited to 'perl.h')
-rw-r--r--perl.h7
1 files changed, 4 insertions, 3 deletions
diff --git a/perl.h b/perl.h
index 54a880e45e..de4374fb92 100644
--- a/perl.h
+++ b/perl.h
@@ -311,18 +311,19 @@
/* gcc -Wall:
* for silencing unused variables that are actually used most of the time,
- * but we cannot quite get rid of, such as "ax" in PPCODE+noargs xsubs
+ * but we cannot quite get rid of, such as "ax" in PPCODE+noargs xsubs,
+ * or variables/arguments that are used only in certain configurations.
*/
#ifndef PERL_UNUSED_ARG
# if defined(lint) && defined(S_SPLINT_S) /* www.splint.org */
# include <note.h>
# define PERL_UNUSED_ARG(x) NOTE(ARGUNUSED(x))
# else
-# define PERL_UNUSED_ARG(x) ((void)x)
+# define PERL_UNUSED_ARG(x) ((void)sizeof(x))
# endif
#endif
#ifndef PERL_UNUSED_VAR
-# define PERL_UNUSED_VAR(x) ((void)x)
+# define PERL_UNUSED_VAR(x) ((void)sizeof(x))
#endif
#if defined(USE_ITHREADS) || defined(PERL_GLOBAL_STRUCT)