From 6e1a54bbb184248fa9f2513d885a662711bd989a Mon Sep 17 00:00:00 2001 From: "Craig A. Berry" Date: Sun, 6 May 2012 15:09:07 -0500 Subject: [PATCH] The reentrant API should always have prototypes. 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 | 4 ++-- embed.h | 10 ++++------ proto.h | 18 ++++++++---------- 3 files changed, 14 insertions(+), 18 deletions(-) diff --git a/embed.fnc b/embed.fnc index 9546555..4d8abce 100644 --- a/embed.fnc +++ b/embed.fnc @@ -982,12 +982,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 f7db1e0..d4b87ee 100644 --- a/embed.h +++ b/embed.h @@ -437,6 +437,10 @@ #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) @@ -845,12 +849,6 @@ #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 143eee0..0e58472 100644 --- a/proto.h +++ b/proto.h @@ -3157,6 +3157,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) @@ -7680,16 +7688,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) -- 1.7.7.GIT