This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
perldelta for 7601007
[perl5.git] / XSUB.h
diff --git a/XSUB.h b/XSUB.h
index 630fe7c..e5614fb 100644 (file)
--- a/XSUB.h
+++ b/XSUB.h
@@ -48,16 +48,15 @@ Used to access elements on the XSUB's stack.
 
 =for apidoc AmU||XS
 Macro to declare an XSUB and its C parameter list.  This is handled by
-C<xsubpp>.
+C<xsubpp>. It is the same as using the more explicit XS_EXTERNAL macro.
 
 =for apidoc AmU||XS_INTERNAL
 Macro to declare an XSUB and its C parameter list without exporting the symbols.
 This is handled by C<xsubpp> and generally preferable over exporting the XSUB
-symbols unnecessarily. This is handled by C<xsubpp>.
+symbols unnecessarily.
 
 =for apidoc AmU||XS_EXTERNAL
 Macro to declare an XSUB and its C parameter list explicitly exporting the symbols.
-This is handled by C<xsubpp>.
 
 =for apidoc Ams||dAX
 Sets up the C<ax> variable.
@@ -117,30 +116,25 @@ is a lexical $_ in scope.
  * below too if you change XSPROTO() here.
  */
 
-/* XSPROTO_INTERNAL and XS_INTERNAL are the static-linkage variants
- * of the default XSPROTO/XS macros. They are enabled by
- * a special XS verb that is still tbd.
+/* XS_INTERNAL is the explicit static-linkage variant of the default
+ * XS macro.
  *
- * XSPROTO_EXTERNAL/XS_EXTERNAL are (for now) exactly the same as
- * XSPROTO/XS, but if the default wrt. linkage changes in future, they
- * will allow users to explicitly mark XSUBs for exporting their
- * symbols.
+ * XS_EXTERNAL is the same as XS_INTERNAL except it does not include
+ * "STATIC", ie. it exports XSUB symbols. You probably don't want that.
  */
 
-#define XSPROTO_EXTERNAL(name) void name(pTHX_ CV* cv)
-#define XSPROTO_INTERNAL(name) STATIC void name(pTHX_ CV* cv)
-#define XSPROTO(name) XSPROTO_EXTERNAL(name)
+#define XSPROTO(name) void name(pTHX_ CV* cv)
 
 #undef XS
 #undef XS_EXTERNAL
 #undef XS_INTERNAL
 #if defined(__CYGWIN__) && defined(USE_DYNAMIC_LOADING)
-#  define XS_EXTERNAL(name) __declspec(dllexport) XSPROTO_EXTERNAL(name)
-#  define XS_INTERNAL(name) __declspec(dllexport) XSPROTO_INTERNAL(name)
+#  define XS_EXTERNAL(name) __declspec(dllexport) XSPROTO(name)
+#  define XS_INTERNAL(name) STATIC XSPROTO(name)
 #endif
 #if defined(__SYMBIAN32__)
-#  define XS_EXTERNAL(name) EXPORT_C XSPROTO_EXTERNAL(name)
-#  define XS_INTERNAL(name) EXPORT_C XSPROTO_INTERNAL(name)
+#  define XS_EXTERNAL(name) EXPORT_C XSPROTO(name)
+#  define XS_INTERNAL(name) EXPORT_C STATIC XSPROTO(name)
 #endif
 #ifndef XS_EXTERNAL
 #  if defined(HASATTRIBUTE_UNUSED) && !defined(__cplusplus)
@@ -148,25 +142,24 @@ is a lexical $_ in scope.
 #    define XS_INTERNAL(name) STATIC void name(pTHX_ CV* cv __attribute__unused__)
 #  else
 #    ifdef __cplusplus
-#      define XS_EXTERNAL(name) extern "C" XSPROTO_EXTERNAL(name)
-#      define XS_INTERNAL(name) extern "C" XSPROTO_INTERNAL(name)
+#      define XS_EXTERNAL(name) extern "C" XSPROTO(name)
+#      define XS_INTERNAL(name) static XSPROTO(name)
 #    else
-#      define XS_EXTERNAL(name) XSPROTO_EXTERNAL(name)
-#      define XS_INTERNAL(name) XSPROTO_INTERNAL(name)
+#      define XS_EXTERNAL(name) XSPROTO(name)
+#      define XS_INTERNAL(name) STATIC XSPROTO(name)
 #    endif
 #  endif
 #endif
 
-/* We currently default to exporting XSUB symbols */
+/* We do export xsub symbols by default for the public XS macro.
+ * Try explicitly using XS_INTERNAL/XS_EXTERNAL instead, please. */
 #define XS(name) XS_EXTERNAL(name)
-/* Apparently needed for SWIG: */
-#define XSPROTO(name) XSPROTO_EXTERNAL(name)
 
 #define dAX const I32 ax = (I32)(MARK - PL_stack_base + 1)
 
 #define dAXMARK                                \
        I32 ax = POPMARK;       \
-       register SV **mark = PL_stack_base + ax++
+       SV **mark = PL_stack_base + ax++
 
 #define dITEMS I32 items = (I32)(SP - MARK)
 
@@ -642,18 +635,16 @@ Rethrows a previously caught exception.  See L<perlguts/"Exception Handling">.
 #    define socketpair         PerlSock_socketpair
 #      endif   /* NETWARE && USE_STDIO */
 
-#    ifdef USE_SOCKETS_AS_HANDLES
-#      undef fd_set
-#      undef FD_SET
-#      undef FD_CLR
-#      undef FD_ISSET
-#      undef FD_ZERO
-#      define fd_set           Perl_fd_set
-#      define FD_SET(n,p)      PERL_FD_SET(n,p)
-#      define FD_CLR(n,p)      PERL_FD_CLR(n,p)
-#      define FD_ISSET(n,p)    PERL_FD_ISSET(n,p)
-#      define FD_ZERO(p)       PERL_FD_ZERO(p)
-#    endif     /* USE_SOCKETS_AS_HANDLES */
+#    undef fd_set
+#    undef FD_SET
+#    undef FD_CLR
+#    undef FD_ISSET
+#    undef FD_ZERO
+#    define fd_set             Perl_fd_set
+#    define FD_SET(n,p)                PERL_FD_SET(n,p)
+#    define FD_CLR(n,p)                PERL_FD_CLR(n,p)
+#    define FD_ISSET(n,p)      PERL_FD_ISSET(n,p)
+#    define FD_ZERO(p)         PERL_FD_ZERO(p)
 
 #  endif  /* NO_XSLOCKS */
 #endif  /* PERL_IMPLICIT_SYS && !PERL_CORE */
@@ -664,8 +655,8 @@ Rethrows a previously caught exception.  See L<perlguts/"Exception Handling">.
  * Local variables:
  * c-indentation-style: bsd
  * c-basic-offset: 4
- * indent-tabs-mode: t
+ * indent-tabs-mode: nil
  * End:
  *
- * ex: set ts=8 sts=4 sw=4 noet:
+ * ex: set ts=8 sts=4 sw=4 et:
  */