Skip to content

Commit

Permalink
A more C++-friendly dNOOP.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
craigberry committed May 30, 2012
1 parent f8dbed5 commit 7db66e1
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions perl.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 7db66e1

Please sign in to comment.