From 349b520e234d80b6e0b5e71ce38de85721a7d943 Mon Sep 17 00:00:00 2001 From: Doug MacEachern Date: Wed, 13 Jun 2001 03:02:16 -0700 Subject: Re: ext/ + -Wall Message-ID: p4raw-id: //depot/perl@10566 --- XSUB.h | 5 +---- lib/ExtUtils/xsubpp | 9 +++++++++ perl.h | 6 ++++++ 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/XSUB.h b/XSUB.h index 74e37ed5f0..a5f8e591ad 100644 --- a/XSUB.h +++ b/XSUB.h @@ -66,10 +66,7 @@ handled automatically by C. # define XS(name) void name(pTHXo_ CV* cv) #endif -/* gcc -Wall: if an xsub has no arguments and PPCODE is used - * and none of ST, XSRETURN or XSprePUSH macros are used - * then `ax' (setup by dXSARGS) is unused. */ -#define dAX I32 ax PERL_UNUSED_DECL = MARK - PL_stack_base + 1 +#define dAX I32 ax = MARK - PL_stack_base + 1 #define dITEMS I32 items = SP - MARK diff --git a/lib/ExtUtils/xsubpp b/lib/ExtUtils/xsubpp index cadbf5c5c2..bc4d6ae916 100755 --- a/lib/ExtUtils/xsubpp +++ b/lib/ExtUtils/xsubpp @@ -1218,6 +1218,15 @@ EOF { print Q<<"EOF" if $cond } # if ($cond) # Perl_croak(aTHX_ "Usage: $pname($report_args)"); +EOF + + #gcc -Wall: if an xsub has no arguments and PPCODE is used + #it is likely none of ST, XSRETURN or XSprePUSH macros are used + #hence `ax' (setup by dXSARGS) is unused + #XXX: could breakup the dXSARGS; into dSP;dMARK;dITEMS + #but such a move could break third-party extensions + print Q<<"EOF" if $PPCODE and $num_args == 0; +# PERL_UNUSED_VAR(ax); /* -Wall */ EOF print Q<<"EOF" if $PPCODE; diff --git a/perl.h b/perl.h index 43e11504f0..457838f019 100644 --- a/perl.h +++ b/perl.h @@ -231,6 +231,12 @@ struct perl_thread; # define PERL_UNUSED_DECL #endif +/* gcc -Wall: + * for silencing unused variables that are actually used most of the time, + * but we cannot quite get rid of, such `ax' in PPCODE+noargs xsubs + */ +#define PERL_UNUSED_VAR(var) if (0) var = var + #define NOOP (void)0 #define dNOOP extern int Perl___notused PERL_UNUSED_DECL -- cgit v1.2.1