summaryrefslogtreecommitdiff
path: root/perl.h
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2011-06-28 16:19:21 +0200
committerNicholas Clark <nick@ccl4.org>2011-07-04 17:43:24 +0200
commitbafdc25d6fdf3143c875c3440a49861ff1e19000 (patch)
tree04b0b895ad5efaecea0042ecdf713627f696b54f /perl.h
parent00f02a57b905350669ea478bce60c82b13e16425 (diff)
downloadperl-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.h11
1 files changed, 6 insertions, 5 deletions
diff --git a/perl.h b/perl.h
index a950e86bed..6e1038b5dc 100644
--- a/perl.h
+++ b/perl.h
@@ -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