The reentrant API should always have prototypes.
authorCraig A. Berry <craigberry@mac.com>
Sun, 6 May 2012 20:09:07 +0000 (15:09 -0500)
committerCraig A. Berry <craigberry@mac.com>
Thu, 24 May 2012 13:44:13 +0000 (08:44 -0500)
reentr.c always defines and exports its functions even when
USE_REENTRANT_API is not defined (though they'll be empty functions
in that case).  In general we shouldn't be exporting functions
without providing prototypes for them, but specifically, when
compiling with C++, the prototype-less functions get their names
mangled.  So the purpose of defining the functions when we aren't
using them (to have a consistent API) is defeated because no one
looking for those functions under their proper names would be able
to find them.

So this makes us stop hiding the prototypes when USE_REENTRANT_API
is not defined.

embed.fnc
embed.h
proto.h

index b675cde..e18449a 100644 (file)
--- a/embed.fnc
+++ b/embed.fnc
@@ -983,12 +983,12 @@ p |void   |peep           |NULLOK OP* o
 p      |void   |rpeep          |NULLOK OP* o
 : Defined in doio.c, used only in pp_hot.c
 dopM   |PerlIO*|start_glob     |NN SV *tmpglob|NN IO *io
-#if defined(USE_REENTRANT_API)
+
 Ap     |void   |reentrant_size
 Ap     |void   |reentrant_init
 Ap     |void   |reentrant_free
 Anp    |void*  |reentrant_retry|NN const char *f|...
-#endif
+
 : "Very" special - can't use the O flag for this one:
 : (The rename from perl_atexit to Perl_call_atexit was in 864dbfa3ca8032ef)
 Ap     |void   |call_atexit    |ATEXIT_t fn|NULLOK void *ptr
diff --git a/embed.h b/embed.h
index f5d5e5d..62cd24e 100644 (file)
--- a/embed.h
+++ b/embed.h
 #define re_compile(a,b)                Perl_re_compile(aTHX_ a,b)
 #define re_intuit_start(a,b,c,d,e,f)   Perl_re_intuit_start(aTHX_ a,b,c,d,e,f)
 #define re_intuit_string(a)    Perl_re_intuit_string(aTHX_ a)
+#define reentrant_free()       Perl_reentrant_free(aTHX)
+#define reentrant_init()       Perl_reentrant_init(aTHX)
+#define reentrant_retry                Perl_reentrant_retry
+#define reentrant_size()       Perl_reentrant_size(aTHX)
 #define reg_named_buff_all(a,b)        Perl_reg_named_buff_all(aTHX_ a,b)
 #define reg_named_buff_exists(a,b,c)   Perl_reg_named_buff_exists(aTHX_ a,b,c)
 #define reg_named_buff_fetch(a,b,c)    Perl_reg_named_buff_fetch(aTHX_ a,b,c)
 #define PerlIO_unread(a,b,c)   Perl_PerlIO_unread(aTHX_ a,b,c)
 #define PerlIO_write(a,b,c)    Perl_PerlIO_write(aTHX_ a,b,c)
 #endif
-#if defined(USE_REENTRANT_API)
-#define reentrant_free()       Perl_reentrant_free(aTHX)
-#define reentrant_init()       Perl_reentrant_init(aTHX)
-#define reentrant_retry                Perl_reentrant_retry
-#define reentrant_size()       Perl_reentrant_size(aTHX)
-#endif
 #if defined(WIN32) || defined(__SYMBIAN32__) || defined(VMS)
 #define do_aspawn(a,b,c)       Perl_do_aspawn(aTHX_ a,b,c)
 #define do_spawn(a)            Perl_do_spawn(aTHX_ a)
diff --git a/proto.h b/proto.h
index 7214030..5630f6d 100644 (file)
--- a/proto.h
+++ b/proto.h
@@ -3158,6 +3158,14 @@ PERL_CALLCONV Malloc_t   Perl_realloc(Malloc_t where, MEM_SIZE nbytes)
                        __attribute__malloc__
                        __attribute__warn_unused_result__;
 
+PERL_CALLCONV void     Perl_reentrant_free(pTHX);
+PERL_CALLCONV void     Perl_reentrant_init(pTHX);
+PERL_CALLCONV void*    Perl_reentrant_retry(const char *f, ...)
+                       __attribute__nonnull__(1);
+#define PERL_ARGS_ASSERT_REENTRANT_RETRY       \
+       assert(f)
+
+PERL_CALLCONV void     Perl_reentrant_size(pTHX);
 /* PERL_CALLCONV OP*   Perl_ref(pTHX_ OP* o, I32 type); */
 PERL_CALLCONV HV *     Perl_refcounted_he_chain_2hv(pTHX_ const struct refcounted_he *c, U32 flags);
 PERL_CALLCONV SV *     Perl_refcounted_he_fetch_pv(pTHX_ const struct refcounted_he *chain, const char *key, U32 hash, U32 flags)
@@ -7676,16 +7684,6 @@ PERL_CALLCONV SSize_t    Perl_PerlIO_write(pTHX_ PerlIO *f, const void *vbuf, Size_
        assert(vbuf)
 
 #endif
-#if defined(USE_REENTRANT_API)
-PERL_CALLCONV void     Perl_reentrant_free(pTHX);
-PERL_CALLCONV void     Perl_reentrant_init(pTHX);
-PERL_CALLCONV void*    Perl_reentrant_retry(const char *f, ...)
-                       __attribute__nonnull__(1);
-#define PERL_ARGS_ASSERT_REENTRANT_RETRY       \
-       assert(f)
-
-PERL_CALLCONV void     Perl_reentrant_size(pTHX);
-#endif
 #if defined(WIN32) || defined(__SYMBIAN32__) || defined(VMS)
 PERL_CALLCONV int      Perl_do_aspawn(pTHX_ SV* really, SV** mark, SV** sp)
                        __attribute__nonnull__(pTHX_2)