diff options
author | Jarkko Hietaniemi <jhi@iki.fi> | 2014-09-04 09:08:33 -0400 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2014-09-04 09:39:46 -0400 |
commit | a730e3f230f364cffe49370f816f975ae7c9c403 (patch) | |
tree | cc5ae6ea714948d2f7e0262a2a25d4fe0082682d /perl.h | |
parent | 2313e9ca3be65223d835c40b25c76765e8c35547 (diff) | |
download | perl-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.h | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -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) |