From 7db66e12883f0832ca80164b723768b848187bda Mon Sep 17 00:00:00 2001 From: "Craig A. Berry" Date: Wed, 30 May 2012 18:57:51 -0500 Subject: [PATCH 1/1] A more C++-friendly dNOOP. The problem with Perl___notused under C++ is that in some cases it's merely extern, and in some cases (via the XS macro via the XSPROTO macro) it's extern "C". Object code analysis shows that you do actually get one mangled and one unmangled version of the symbol, which wouldn't matter since the whole point is to have something we never use. Except that one very picky C++ compiler (HP C++ for OpenVMS) sees what we're up to and slaps us down hard. Since declaration after statement has always been allowed in C++, just go ahead and do a real noop statement for C++ and avoid the use of an external symbol. --- perl.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git perl.h perl.h index 3d89f8a..798e7b7 100644 --- perl.h +++ perl.h @@ -359,7 +359,11 @@ /* 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. */ +#ifdef __cplusplus +#define dNOOP (void)0 +#else #define dNOOP extern int Perl___notused(void) +#endif #ifndef pTHX /* Don't bother defining tTHX and sTHX; using them outside -- 2.2.1-313-gcc831f2