In perl.git, the branch blead has been updated <http://perl5.git.perl.org/perl.git/commitdiff/d1decf2be1b14ef34c794d5aa26039a5d0fd5ccd?hp=4a8dd740b55a404b1284797635911b22a8dd7013>
- Log ----------------------------------------------------------------- commit d1decf2be1b14ef34c794d5aa26039a5d0fd5ccd Author: Tony Cook <[email protected]> Date: Tue Jul 23 11:36:01 2013 +1000 Revert "Remove the non-inline function S_croak_memory_wrap from inline.h." This reverts commit 43387ee1abcd83c3c7586b7f7aa86e838d239aac. Which reverted parts of f019c49e380f764c1ead36fe3602184804292711, but that reversion may no longer be necessary. See [perl #116989] ----------------------------------------------------------------------- Summary of changes: embed.fnc | 2 +- embed.h | 1 + handy.h | 4 ++-- inline.h | 16 ++++++++++++++++ proto.h | 6 +++--- sv.c | 4 ++-- util.c | 14 +++----------- 7 files changed, 28 insertions(+), 19 deletions(-) diff --git a/embed.fnc b/embed.fnc index 93944ba..8aed92a 100644 --- a/embed.fnc +++ b/embed.fnc @@ -266,7 +266,6 @@ Anprd |void |croak_no_modify Anprd |void |croak_xs_usage |NN const CV *const cv \ |NN const char *const params npr |void |croak_no_mem -nroX |void |Perl_croak_memory_wrap nprX |void |croak_popstack #if defined(WIN32) norx |void |win32_croak_not_implemented|NN const char * fname @@ -1619,6 +1618,7 @@ Anpa |Malloc_t|safesysmalloc |MEM_SIZE nbytes Anpa |Malloc_t|safesyscalloc |MEM_SIZE elements|MEM_SIZE size Anpa |Malloc_t|safesysrealloc|Malloc_t where|MEM_SIZE nbytes Anp |Free_t |safesysfree |Malloc_t where +Asrnx |void |croak_memory_wrap #if defined(PERL_GLOBAL_STRUCT) Ap |struct perl_vars *|GetVars Ap |struct perl_vars*|init_global_struct diff --git a/embed.h b/embed.h index 4a0d28b..353357b 100644 --- a/embed.h +++ b/embed.h @@ -84,6 +84,7 @@ #ifndef PERL_IMPLICIT_CONTEXT #define croak Perl_croak #endif +#define croak_memory_wrap S_croak_memory_wrap #define croak_no_modify Perl_croak_no_modify #define croak_sv(a) Perl_croak_sv(aTHX_ a) #define croak_xs_usage Perl_croak_xs_usage diff --git a/handy.h b/handy.h index a763824..bc92ad9 100644 --- a/handy.h +++ b/handy.h @@ -1612,12 +1612,12 @@ PoisonWith(0xEF) for catching access to freed memory. * (U16)n > (size_t)~0/sizeof(U16) always being false. */ #ifdef PERL_MALLOC_WRAP #define MEM_WRAP_CHECK(n,t) \ - (void)(sizeof(t) > 1 && ((MEM_SIZE)(n)+0.0) > MEM_SIZE_MAX/sizeof(t) && (Perl_croak_memory_wrap(),0)) + (void)(sizeof(t) > 1 && ((MEM_SIZE)(n)+0.0) > MEM_SIZE_MAX/sizeof(t) && (croak_memory_wrap(),0)) #define MEM_WRAP_CHECK_1(n,t,a) \ (void)(sizeof(t) > 1 && ((MEM_SIZE)(n)+0.0) > MEM_SIZE_MAX/sizeof(t) && (Perl_croak_nocontext("%s",(a)),0)) #define MEM_WRAP_CHECK_(n,t) MEM_WRAP_CHECK(n,t), -#define PERL_STRLEN_ROUNDUP(n) ((void)(((n) > MEM_SIZE_MAX - 2 * PERL_STRLEN_ROUNDUP_QUANTUM) ? (Perl_croak_memory_wrap(),0):0),((n-1+PERL_STRLEN_ROUNDUP_QUANTUM)&~((MEM_SIZE)PERL_STRLEN_ROUNDUP_QUA ... [9 chars truncated] +#define PERL_STRLEN_ROUNDUP(n) ((void)(((n) > MEM_SIZE_MAX - 2 * PERL_STRLEN_ROUNDUP_QUANTUM) ? (croak_memory_wrap(),0):0),((n-1+PERL_STRLEN_ROUNDUP_QUANTUM)&~((MEM_SIZE)PERL_STRLEN_ROUNDUP_QUANTUM-1 ... [3 chars truncated] #else #define MEM_WRAP_CHECK(n,t) diff --git a/inline.h b/inline.h index 7aeb93d..2d09dcb 100644 --- a/inline.h +++ b/inline.h @@ -164,6 +164,22 @@ S_sv_or_pv_pos_u2b(pTHX_ SV *sv, const char *pv, STRLEN pos, STRLEN *lenp) } #endif +/* ------------------------------- handy.h ------------------------------- */ + +/* saves machine code for a common noreturn idiom typically used in Newx*() */ +#ifdef __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wunused-function" +#endif +static void +S_croak_memory_wrap(void) +{ + Perl_croak_nocontext("%s",PL_memory_wrap); +} +#ifdef __clang__ +#pragma clang diagnostic pop +#endif + /* ------------------------------- utf8.h ------------------------------- */ /* These exist only to replace the macros they formerly were so that their use diff --git a/proto.h b/proto.h index e1425d2..89c7316 100644 --- a/proto.h +++ b/proto.h @@ -23,9 +23,6 @@ PERL_CALLCONV int Perl_Gv_AMupdate(pTHX_ HV* stash, bool destructing) assert(stash) PERL_CALLCONV const char * Perl_PerlIO_context_layers(pTHX_ const char *mode); -PERL_CALLCONV_NO_RET void Perl_croak_memory_wrap(void) - __attribute__noreturn__; - PERL_CALLCONV void* Perl_Slab_Alloc(pTHX_ size_t sz) __attribute__malloc__ __attribute__warn_unused_result__; @@ -680,6 +677,9 @@ PERL_CALLCONV_NO_RET void Perl_croak(pTHX_ const char* pat, ...) __attribute__noreturn__ __attribute__format__null_ok__(__printf__,pTHX_1,pTHX_2); +PERL_STATIC_NO_RET void S_croak_memory_wrap(void) + __attribute__noreturn__; + PERL_CALLCONV_NO_RET void Perl_croak_no_mem(void) __attribute__noreturn__; diff --git a/sv.c b/sv.c index 0dfff05..a6917d0 100644 --- a/sv.c +++ b/sv.c @@ -11443,13 +11443,13 @@ Perl_sv_vcatpvfn_flags(pTHX_ SV *const sv, const char *const pat, const STRLEN p have = esignlen + zeros + elen; if (have < zeros) - Perl_croak_memory_wrap(); + croak_memory_wrap(); need = (have > width ? have : width); gap = need - have; if (need >= (((STRLEN)~0) - SvCUR(sv) - dotstrlen - 1)) - Perl_croak_memory_wrap(); + croak_memory_wrap(); SvGROW(sv, SvCUR(sv) + need + dotstrlen + 1); p = SvEND(sv); if (esignlen && fill == '0') { diff --git a/util.c b/util.c index f09cd92..be75796 100644 --- a/util.c +++ b/util.c @@ -297,12 +297,12 @@ Perl_safesyscalloc(MEM_SIZE count, MEM_SIZE size) #endif } else - Perl_croak_memory_wrap(); + croak_memory_wrap(); #ifdef PERL_TRACK_MEMPOOL if (sTHX <= MEM_SIZE_MAX - (MEM_SIZE)total_size) total_size += sTHX; else - Perl_croak_memory_wrap(); + croak_memory_wrap(); #endif #ifdef HAS_64K_LIMIT if (total_size > 0xffff) { @@ -1614,14 +1614,6 @@ Perl_croak_no_mem() my_exit(1); } -/* saves machine code for a common noreturn idiom typically used in Newx*() */ -void -Perl_croak_memory_wrap(void) -{ - Perl_croak_nocontext("%s",PL_memory_wrap); -} - - /* does not return, used only in POPSTACK */ void Perl_croak_popstack(void) @@ -2928,7 +2920,7 @@ Perl_repeatcpy(char *to, const char *from, I32 len, IV count) assert(len >= 0); if (count < 0) - Perl_croak_memory_wrap(); + croak_memory_wrap(); if (len == 1) memset(to, *from, count); -- Perl5 Master Repository
