Skip to content

Commit 7911101

Browse files
committed
XSUB.h: simplify XS_INTERNAL/XS_EXTERNAL macros
Ever since `__attribute__unused__` was added to the XSPROTO definition, the explicit `defined(HASATTRIBUTE_UNUSED)` check has become redundant. Also, the XS_INTERNAL definitions are functionally equivalent in all branches, so replace them by a single unconditional definition.
1 parent bc21a71 commit 7911101

File tree

1 file changed

+1
-9
lines changed

1 file changed

+1
-9
lines changed

XSUB.h

+1-9
Original file line numberDiff line numberDiff line change
@@ -122,9 +122,6 @@ is a lexical C<$_> in scope.
122122
* typedef SwigPerlWrapper *SwigPerlWrapperPtr;
123123
*
124124
* This code needs to be compilable under both C and C++.
125-
*
126-
* Don't forget to change the __attribute__unused__ version of XS()
127-
* below too if you change XSPROTO() here.
128125
*/
129126

130127
/* XS_INTERNAL is the explicit static-linkage variant of the default
@@ -141,17 +138,12 @@ is a lexical C<$_> in scope.
141138
#undef XS_INTERNAL
142139
#if defined(__CYGWIN__) && defined(USE_DYNAMIC_LOADING)
143140
# define XS_EXTERNAL(name) __declspec(dllexport) XSPROTO(name)
144-
# define XS_INTERNAL(name) STATIC XSPROTO(name)
145141
#elif defined(__cplusplus)
146142
# define XS_EXTERNAL(name) extern "C" XSPROTO(name)
147-
# define XS_INTERNAL(name) static XSPROTO(name)
148-
#elif defined(HASATTRIBUTE_UNUSED)
149-
# define XS_EXTERNAL(name) void name(pTHX_ CV* cv __attribute__unused__)
150-
# define XS_INTERNAL(name) STATIC void name(pTHX_ CV* cv __attribute__unused__)
151143
#else
152144
# define XS_EXTERNAL(name) XSPROTO(name)
153-
# define XS_INTERNAL(name) STATIC XSPROTO(name)
154145
#endif
146+
#define XS_INTERNAL(name) STATIC XSPROTO(name)
155147

156148
/* We do export xsub symbols by default for the public XS macro.
157149
* Try explicitly using XS_INTERNAL/XS_EXTERNAL instead, please. */

0 commit comments

Comments
 (0)