diff options
author | Nicholas Clark <nick@ccl4.org> | 2011-06-28 16:19:21 +0200 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2011-07-04 17:43:24 +0200 |
commit | bafdc25d6fdf3143c875c3440a49861ff1e19000 (patch) | |
tree | 04b0b895ad5efaecea0042ecdf713627f696b54f /perl.h | |
parent | 00f02a57b905350669ea478bce60c82b13e16425 (diff) | |
download | perl-bafdc25d6fdf3143c875c3440a49861ff1e19000.tar.gz |
Change dNOOP to a function declaration.
Previously dNOOP would declare an unused variable, and where possible mark it
as "unused" to prevent compiler warnings. However, clang doesn't provide
attribute unused, so will produced screenfuls of warnings if invoked with
-Wunused-variable, hiding the real unused variable warnings.
Using a function declaration instead avoids these warnings.
We can't just use define dNOOP as nothing, or a comment, as it is used as
dNOOP;
and a bare semicolon is an error.
Diffstat (limited to 'perl.h')
-rw-r--r-- | perl.h | 11 |
1 files changed, 6 insertions, 5 deletions
@@ -354,11 +354,12 @@ #endif #define NOOP /*EMPTY*/(void)0 -#if !defined(HASATTRIBUTE_UNUSED) && defined(__cplusplus) -#define dNOOP /*EMPTY*/(void)0 /* Older g++ has no __attribute((unused))__ */ -#else -#define dNOOP extern int /*@unused@*/ Perl___notused PERL_UNUSED_DECL -#endif +/* cea2e8a9dd23747f accidentally lost the comment originally from the first + check in of thread.h, explaining why we need dNOOP at all: */ +/* Rats: if dTHR is just blank then the subsequent ";" throws an error */ +/* Declaring a *function*, instead of a variable, ensures that we don't rely + on being able to suppress "unused" warnings. */ +#define dNOOP extern int Perl___notused() #ifndef pTHX /* Don't bother defining tTHX and sTHX; using them outside |