From: Andy Lester Date: Fri, 31 Mar 2006 00:54:58 +0000 (-0600) Subject: Redo PERL_UNUSED_DECL X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=9ddc1e7af8675795ad0346c1274fd40d4096c50f;p=p5sagit%2Fp5-mst-13.2.git Redo PERL_UNUSED_DECL Message-ID: <20060331065458.GA28571@petdance.com> p4raw-id: //depot/perl@27649 --- diff --git a/malloc.c b/malloc.c index 94fcb15..4f0bb4a 100644 --- a/malloc.c +++ b/malloc.c @@ -409,7 +409,7 @@ # define pTHX void # define pTHX_ # ifdef HASATTRIBUTE_UNUSED -# define dTHX extern int Perl___notused PERL_UNUSED_DECL +# define dTHX PERL_UNUSED_DECL(extern int Perl___notused) # else # define dTHX extern int Perl___notused # endif diff --git a/perl.h b/perl.h index 35c17b1..9d2a0d7 100644 --- a/perl.h +++ b/perl.h @@ -137,7 +137,7 @@ # endif #endif -#define pVAR register struct perl_vars* const my_vars PERL_UNUSED_DECL +#define pVAR PERL_UNUSED_DECL(register struct perl_vars* const my_vars) #ifdef PERL_GLOBAL_STRUCT # define dVAR pVAR = (struct perl_vars*)PERL_GET_VARS() @@ -150,7 +150,7 @@ # define MULTIPLICITY # endif # define tTHX PerlInterpreter* -# define pTHX register tTHX my_perl PERL_UNUSED_DECL +# define pTHX PERL_UNUSED_DECL(register tTHX my_perl) # define aTHX my_perl # ifdef PERL_GLOBAL_STRUCT # define dTHXa(a) dVAR; pTHX = (tTHX)a @@ -197,24 +197,19 @@ #define CALLREG_INTUIT_STRING CALL_FPTR(PL_regint_string) #define CALLREGFREE CALL_FPTR(PL_regfree) -/* XXX The PERL_UNUSED_DECL suffix is unfortunately rather inflexible: - * it assumes that in all compilers the way to suppress an "unused" - * warning is to have a suffix. In some compilers that might be a - * a compiler pragma, e.g. #pragma unused(varname). */ - #if defined(__SYMBIAN32__) && defined(__GNUC__) # ifdef __cplusplus -# define PERL_UNUSED_DECL +# define PERL_UNUSED_DECL(x) /*@unused@*/ x # else -# define PERL_UNUSED_DECL __attribute__((unused)) +# define PERL_UNUSED_DECL(x) /*@unused@*/ x __attribute__((unused)) # endif #endif #ifndef PERL_UNUSED_DECL # if defined(HASATTRIBUTE_UNUSED) && !defined(__cplusplus) -# define PERL_UNUSED_DECL __attribute__unused__ +# define PERL_UNUSED_DECL(x) /*@unused@*/ x __attribute__unused__ # else -# define PERL_UNUSED_DECL +# define PERL_UNUSED_DECL(x) /*@unused@*/ x # endif #endif @@ -241,7 +236,7 @@ #endif #define NOOP (void)0 -#define dNOOP extern int Perl___notused PERL_UNUSED_DECL +#define dNOOP PERL_UNUSED_DECL(extern int Perl___notused) #ifndef pTHX /* Don't bother defining tTHX and sTHX; using them outside