diff --git a/XSUB.h b/XSUB.h index a957d53497f6..2249185be71e 100644 --- a/XSUB.h +++ b/XSUB.h @@ -159,35 +159,35 @@ is a lexical C<$_> in scope. #define dAX const I32 ax = (I32)(MARK - PL_stack_base + 1) -#define dAXMARK \ - I32 ax = POPMARK; \ - SV **mark = PL_stack_base + ax++ +#define dAXMARK \ + I32 ax = POPMARK; \ + SV **mark = PL_stack_base + ax++ #define dITEMS I32 items = (I32)(SP - MARK) #define dXSARGS \ - dSP; dAXMARK; dITEMS + dSP; dAXMARK; dITEMS /* These 3 macros are replacements for dXSARGS macro only in bootstrap. They factor out common code in every BOOT XSUB. Computation of vars mark and items will optimize away in most BOOT functions. Var ax can never be optimized away since BOOT must return &PL_sv_yes by default from xsubpp. Note these macros are not drop in replacements for dXSARGS since they set PL_xsubfilename. */ -#define dXSBOOTARGSXSAPIVERCHK \ - I32 ax = XS_BOTHVERSION_SETXSUBFN_POPMARK_BOOTCHECK; \ - SV **mark = PL_stack_base + ax - 1; dSP; dITEMS -#define dXSBOOTARGSAPIVERCHK \ - I32 ax = XS_APIVERSION_SETXSUBFN_POPMARK_BOOTCHECK; \ - SV **mark = PL_stack_base + ax - 1; dSP; dITEMS +#define dXSBOOTARGSXSAPIVERCHK \ + I32 ax = XS_BOTHVERSION_SETXSUBFN_POPMARK_BOOTCHECK; \ + SV **mark = PL_stack_base + ax - 1; dSP; dITEMS +#define dXSBOOTARGSAPIVERCHK \ + I32 ax = XS_APIVERSION_SETXSUBFN_POPMARK_BOOTCHECK; \ + SV **mark = PL_stack_base + ax - 1; dSP; dITEMS /* dXSBOOTARGSNOVERCHK has no API in xsubpp to choose it so do #undef dXSBOOTARGSXSAPIVERCHK #define dXSBOOTARGSXSAPIVERCHK dXSBOOTARGSNOVERCHK */ -#define dXSBOOTARGSNOVERCHK \ - I32 ax = XS_SETXSUBFN_POPMARK; \ - SV **mark = PL_stack_base + ax - 1; dSP; dITEMS +#define dXSBOOTARGSNOVERCHK \ + I32 ax = XS_SETXSUBFN_POPMARK; \ + SV **mark = PL_stack_base + ax - 1; dSP; dITEMS -#define dXSTARG \ - SV * const targ = ((PL_op->op_private & OPpENTERSUB_HASTARG)\ +#define dXSTARG \ + SV * const targ = ((PL_op->op_private & OPpENTERSUB_HASTARG) \ ? PAD_SV(PL_op->op_targ) : sv_newmortal()) /* Should be used before final PUSHi etc. if not in PPCODE section. */ @@ -206,8 +206,8 @@ is a lexical C<$_> in scope. #endif #define dXSFUNCTION(ret) XSINTERFACE_CVT(ret,XSFUNCTION) #define XSINTERFACE_FUNC(ret,cv,f) ((XSINTERFACE_CVT_ANON(ret))(f)) -#define XSINTERFACE_FUNC_SET(cv,f) \ - CvXSUBANY(cv).any_dxptr = (void (*) (pTHX_ void*))(f) +#define XSINTERFACE_FUNC_SET(cv,f) \ + CvXSUBANY(cv).any_dxptr = (void (*) (pTHX_ void*))(f) #define dUNDERBAR dNOOP #define UNDERBAR find_rundefsv() @@ -322,12 +322,12 @@ Rethrows a previously caught exception. See L. #define XST_mYES(i) (ST(i) = &PL_sv_yes ) #define XST_mUNDEF(i) (ST(i) = &PL_sv_undef) -#define XSRETURN(off) \ - STMT_START { \ - const IV tmpXSoff = (off); \ - assert(tmpXSoff >= 0);\ - PL_stack_sp = PL_stack_base + ax + (tmpXSoff - 1); \ - return; \ +#define XSRETURN(off) \ + STMT_START { \ + const IV tmpXSoff = (off); \ + assert(tmpXSoff >= 0); \ + PL_stack_sp = PL_stack_base + ax + (tmpXSoff - 1); \ + return; \ } STMT_END #define XSRETURN_IV(v) STMT_START { XST_mIV(0,v); XSRETURN(1); } STMT_END @@ -343,47 +343,47 @@ Rethrows a previously caught exception. See L. #define newXSproto(a,b,c,d) newXS_flags(a,b,c,d,0) #ifdef XS_VERSION -# define XS_VERSION_BOOTCHECK \ - Perl_xs_handshake(HS_KEY(FALSE, FALSE, "", XS_VERSION), HS_CXT, __FILE__, \ - items, ax, XS_VERSION) +# define XS_VERSION_BOOTCHECK \ + Perl_xs_handshake(HS_KEY(FALSE, FALSE, "", XS_VERSION), HS_CXT, __FILE__, \ + items, ax, XS_VERSION) #else # define XS_VERSION_BOOTCHECK #endif -#define XS_APIVERSION_BOOTCHECK \ +#define XS_APIVERSION_BOOTCHECK \ Perl_xs_handshake(HS_KEY(FALSE, FALSE, "v" PERL_API_VERSION_STRING, ""), \ HS_CXT, __FILE__, items, ax, "v" PERL_API_VERSION_STRING) /* public API, this is a combination of XS_VERSION_BOOTCHECK and XS_APIVERSION_BOOTCHECK in 1, and is backportable */ #ifdef XS_VERSION -# define XS_BOTHVERSION_BOOTCHECK \ - Perl_xs_handshake(HS_KEY(FALSE, FALSE, "v" PERL_API_VERSION_STRING, XS_VERSION), \ - HS_CXT, __FILE__, items, ax, "v" PERL_API_VERSION_STRING, XS_VERSION) +# define XS_BOTHVERSION_BOOTCHECK \ + Perl_xs_handshake(HS_KEY(FALSE, FALSE, "v" PERL_API_VERSION_STRING, XS_VERSION), \ + HS_CXT, __FILE__, items, ax, "v" PERL_API_VERSION_STRING, XS_VERSION) #else /* should this be a #error? if you want both checked, you better supply XS_VERSION right? */ # define XS_BOTHVERSION_BOOTCHECK XS_APIVERSION_BOOTCHECK #endif /* private API */ -#define XS_APIVERSION_POPMARK_BOOTCHECK \ - Perl_xs_handshake(HS_KEY(FALSE, TRUE, "v" PERL_API_VERSION_STRING, ""), \ +#define XS_APIVERSION_POPMARK_BOOTCHECK \ + Perl_xs_handshake(HS_KEY(FALSE, TRUE, "v" PERL_API_VERSION_STRING, ""), \ HS_CXT, __FILE__, "v" PERL_API_VERSION_STRING) #ifdef XS_VERSION -# define XS_BOTHVERSION_POPMARK_BOOTCHECK \ - Perl_xs_handshake(HS_KEY(FALSE, TRUE, "v" PERL_API_VERSION_STRING, XS_VERSION), \ - HS_CXT, __FILE__, "v" PERL_API_VERSION_STRING, XS_VERSION) +# define XS_BOTHVERSION_POPMARK_BOOTCHECK \ + Perl_xs_handshake(HS_KEY(FALSE, TRUE, "v" PERL_API_VERSION_STRING, XS_VERSION), \ + HS_CXT, __FILE__, "v" PERL_API_VERSION_STRING, XS_VERSION) #else /* should this be a #error? if you want both checked, you better supply XS_VERSION right? */ # define XS_BOTHVERSION_POPMARK_BOOTCHECK XS_APIVERSION_POPMARK_BOOTCHECK #endif -#define XS_APIVERSION_SETXSUBFN_POPMARK_BOOTCHECK \ - Perl_xs_handshake(HS_KEY(TRUE, TRUE, "v" PERL_API_VERSION_STRING, ""), \ +#define XS_APIVERSION_SETXSUBFN_POPMARK_BOOTCHECK \ + Perl_xs_handshake(HS_KEY(TRUE, TRUE, "v" PERL_API_VERSION_STRING, ""), \ HS_CXT, __FILE__, "v" PERL_API_VERSION_STRING) #ifdef XS_VERSION -# define XS_BOTHVERSION_SETXSUBFN_POPMARK_BOOTCHECK \ - Perl_xs_handshake(HS_KEY(TRUE, TRUE, "v" PERL_API_VERSION_STRING, XS_VERSION),\ - HS_CXT, __FILE__, "v" PERL_API_VERSION_STRING, XS_VERSION) +# define XS_BOTHVERSION_SETXSUBFN_POPMARK_BOOTCHECK \ + Perl_xs_handshake(HS_KEY(TRUE, TRUE, "v" PERL_API_VERSION_STRING, XS_VERSION), \ + HS_CXT, __FILE__, "v" PERL_API_VERSION_STRING, XS_VERSION) #else /* should this be a #error? if you want both checked, you better supply XS_VERSION right? */ # define XS_BOTHVERSION_SETXSUBFN_POPMARK_BOOTCHECK XS_APIVERSION_SETXSUBFN_POPMARK_BOOTCHECK @@ -393,7 +393,7 @@ Rethrows a previously caught exception. See L. Useful for static XS modules or debugging/testing scenarios. If this macro gets heavily used in the future, it should separated into a separate function independent of Perl_xs_handshake for efficiency */ -#define XS_SETXSUBFN_POPMARK \ +#define XS_SETXSUBFN_POPMARK \ Perl_xs_handshake(HS_KEY(TRUE, TRUE, "", "") | HSf_NOCHK, HS_CXT, __FILE__) #ifdef NO_XSLOCKS @@ -409,49 +409,49 @@ Rethrows a previously caught exception. See L. the *DB*_File modules */ -#define DBM_setFilter(db_type,code) \ - STMT_START { \ - if (db_type) \ - RETVAL = sv_mortalcopy(db_type); \ - ST(0) = RETVAL; \ - if (db_type && (code == &PL_sv_undef)) { \ - SvREFCNT_dec_NN(db_type); \ - db_type = NULL; \ - } \ - else if (code) { \ - if (db_type) \ - sv_setsv(db_type, code); \ - else \ - db_type = newSVsv(code); \ - } \ - } STMT_END - -#define DBM_ckFilter(arg,type,name) \ - STMT_START { \ - if (db->type) { \ - if (db->filtering) { \ - croak("recursion detected in %s", name); \ - } \ - ENTER; \ - SAVETMPS; \ - SAVEINT(db->filtering); \ - db->filtering = TRUE; \ - SAVE_DEFSV; \ - if (name[7] == 's') \ - arg = newSVsv(arg); \ - DEFSV_set(arg); \ - SvTEMP_off(arg); \ - PUSHMARK(SP); \ - PUTBACK; \ - (void) perl_call_sv(db->type, G_DISCARD); \ - SPAGAIN; \ - PUTBACK; \ - FREETMPS; \ - LEAVE; \ - if (name[7] == 's'){ \ - arg = sv_2mortal(arg); \ - } \ - } \ +#define DBM_setFilter(db_type,code) \ + STMT_START { \ + if (db_type) \ + RETVAL = sv_mortalcopy(db_type); \ + ST(0) = RETVAL; \ + if (db_type && (code == &PL_sv_undef)) { \ + SvREFCNT_dec_NN(db_type); \ + db_type = NULL; \ + } \ + else if (code) { \ + if (db_type) \ + sv_setsv(db_type, code); \ + else \ + db_type = newSVsv(code); \ + } \ + } STMT_END + +#define DBM_ckFilter(arg,type,name) \ + STMT_START { \ + if (db->type) { \ + if (db->filtering) { \ + croak("recursion detected in %s", name); \ + } \ + ENTER; \ + SAVETMPS; \ + SAVEINT(db->filtering); \ + db->filtering = TRUE; \ + SAVE_DEFSV; \ + if (name[7] == 's') \ + arg = newSVsv(arg); \ + DEFSV_set(arg); \ + SvTEMP_off(arg); \ + PUSHMARK(SP); \ + PUTBACK; \ + (void) perl_call_sv(db->type, G_DISCARD); \ + SPAGAIN; \ + PUTBACK; \ + FREETMPS; \ + LEAVE; \ + if (name[7] == 's'){ \ + arg = sv_2mortal(arg); \ + } \ + } \ } STMT_END #if 1 /* for compatibility */ diff --git a/av.h b/av.h index 9c8186b6a017..3c9158d88455 100644 --- a/av.h +++ b/av.h @@ -93,8 +93,8 @@ If all you need is to look up an array element, then prefer C. #define AvREALISH(av) (SvFLAGS(av) & (SVpav_REAL|SVpav_REIFY)) -#define AvFILL(av) \ - ((SvRMAGICAL((const SV *) (av)))\ +#define AvFILL(av) \ + ((SvRMAGICAL((const SV *) (av))) \ ? mg_size(MUTABLE_SV(av)) : AvFILLp(av)) #define av_top_index(av) AvFILL(av) #define av_tindex(av) av_top_index(av) @@ -102,8 +102,8 @@ If all you need is to look up an array element, then prefer C. /* Note that it doesn't make sense to do this: * SvGETMAGIC(av); IV x = av_tindex_nomg(av); */ -# define av_top_index_skip_len_mg(av) \ - (__ASSERT_(SvTYPE(av) == SVt_PVAV) AvFILLp(av)) +# define av_top_index_skip_len_mg(av) \ + (__ASSERT_(SvTYPE(av) == SVt_PVAV) AvFILLp(av)) # define av_tindex_skip_len_mg(av) av_top_index_skip_len_mg(av) #define NEGATIVE_INDICES_VAR "NEGATIVE_INDICES" diff --git a/cop.h b/cop.h index de36e7e21b46..1e7c104e6abd 100644 --- a/cop.h +++ b/cop.h @@ -42,11 +42,11 @@ typedef struct jmpenv JMPENV; #if defined DEBUGGING && !defined DEBUGGING_RE_ONLY # define JE_OLD_STACK_HWM_zero PL_start_env.je_old_stack_hwm = 0 -# define JE_OLD_STACK_HWM_save(je) \ - (je).je_old_stack_hwm = PL_curstackinfo->si_stack_hwm -# define JE_OLD_STACK_HWM_restore(je) \ - if (PL_curstackinfo->si_stack_hwm < (je).je_old_stack_hwm) \ - PL_curstackinfo->si_stack_hwm = (je).je_old_stack_hwm +# define JE_OLD_STACK_HWM_save(je) \ + (je).je_old_stack_hwm = PL_curstackinfo->si_stack_hwm +# define JE_OLD_STACK_HWM_restore(je) \ + if (PL_curstackinfo->si_stack_hwm < (je).je_old_stack_hwm) \ + PL_curstackinfo->si_stack_hwm = (je).je_old_stack_hwm #else # define JE_OLD_STACK_HWM_zero NOOP # define JE_OLD_STACK_HWM_save(je) NOOP @@ -63,15 +63,15 @@ typedef struct jmpenv JMPENV; * that thread the C stack of last thread to do an eval {}! */ -#define JMPENV_BOOTSTRAP \ - STMT_START { \ - PERL_POISON_EXPR(PoisonNew(&PL_start_env, 1, JMPENV));\ - PL_top_env = &PL_start_env; \ - PL_start_env.je_prev = NULL; \ - PL_start_env.je_ret = -1; \ - PL_start_env.je_mustcatch = TRUE; \ - PL_start_env.je_old_delaymagic = 0; \ - JE_OLD_STACK_HWM_zero; \ +#define JMPENV_BOOTSTRAP \ + STMT_START { \ + PERL_POISON_EXPR(PoisonNew(&PL_start_env, 1, JMPENV)); \ + PL_top_env = &PL_start_env; \ + PL_start_env.je_prev = NULL; \ + PL_start_env.je_ret = -1; \ + PL_start_env.je_mustcatch = TRUE; \ + PL_start_env.je_old_delaymagic = 0; \ + JE_OLD_STACK_HWM_zero; \ } STMT_END /* @@ -110,78 +110,78 @@ typedef struct jmpenv JMPENV; #define dJMPENV JMPENV cur_env -#define JMPENV_PUSH(v) \ - STMT_START { \ - DEBUG_l({ \ - int i = 0; \ - JMPENV *p = PL_top_env; \ - while (p) { i++; p = p->je_prev; } \ - Perl_deb(aTHX_ "JMPENV_PUSH pre level=%d in %s at %s:%d\n", \ - i, SAFE_FUNCTION__, __FILE__, __LINE__); \ - }); \ - cur_env.je_prev = PL_top_env; \ - JE_OLD_STACK_HWM_save(cur_env); \ - /* setjmp() is callable in limited contexts which does not */ \ - /* include assignment, so switch() instead */ \ - switch (PerlProc_setjmp(cur_env.je_buf, SCOPE_SAVES_SIGNAL_MASK)) { \ - case 0: cur_env.je_ret = 0; break; \ - case 1: cur_env.je_ret = 1; break; \ - case 2: cur_env.je_ret = 2; break; \ - case 3: cur_env.je_ret = 3; break; \ - default: Perl_croak(aTHX_ "panic: unexpected setjmp() result\n"); \ - } \ - JE_OLD_STACK_HWM_restore(cur_env); \ - PL_top_env = &cur_env; \ - cur_env.je_mustcatch = FALSE; \ - cur_env.je_old_delaymagic = PL_delaymagic; \ - DEBUG_l({ \ - int i = 0; \ - JMPENV *p = PL_top_env; \ - while (p) { i++; p = p->je_prev; } \ - Perl_deb(aTHX_ "JMPENV_PUSH level=%d ret=%d in %s at %s:%d\n", \ - i, cur_env.je_ret, SAFE_FUNCTION__, __FILE__, __LINE__); \ - }); \ - (v) = cur_env.je_ret; \ +#define JMPENV_PUSH(v) \ + STMT_START { \ + DEBUG_l({ \ + int i = 0; \ + JMPENV *p = PL_top_env; \ + while (p) { i++; p = p->je_prev; } \ + Perl_deb(aTHX_ "JMPENV_PUSH pre level=%d in %s at %s:%d\n", \ + i, SAFE_FUNCTION__, __FILE__, __LINE__); \ + }); \ + cur_env.je_prev = PL_top_env; \ + JE_OLD_STACK_HWM_save(cur_env); \ + /* setjmp() is callable in limited contexts which does not */ \ + /* include assignment, so switch() instead */ \ + switch (PerlProc_setjmp(cur_env.je_buf, SCOPE_SAVES_SIGNAL_MASK)) { \ + case 0: cur_env.je_ret = 0; break; \ + case 1: cur_env.je_ret = 1; break; \ + case 2: cur_env.je_ret = 2; break; \ + case 3: cur_env.je_ret = 3; break; \ + default: Perl_croak(aTHX_ "panic: unexpected setjmp() result\n"); \ + } \ + JE_OLD_STACK_HWM_restore(cur_env); \ + PL_top_env = &cur_env; \ + cur_env.je_mustcatch = FALSE; \ + cur_env.je_old_delaymagic = PL_delaymagic; \ + DEBUG_l({ \ + int i = 0; \ + JMPENV *p = PL_top_env; \ + while (p) { i++; p = p->je_prev; } \ + Perl_deb(aTHX_ "JMPENV_PUSH level=%d ret=%d in %s at %s:%d\n", \ + i, cur_env.je_ret, SAFE_FUNCTION__, __FILE__, __LINE__); \ + }); \ + (v) = cur_env.je_ret; \ } STMT_END -#define JMPENV_POP \ - STMT_START { \ - DEBUG_l({ \ - int i = -1; JMPENV *p = PL_top_env; \ - while (p) { i++; p = p->je_prev; } \ - Perl_deb(aTHX_ "JMPENV_POP level=%d in %s at %s:%d\n", \ - i, SAFE_FUNCTION__, __FILE__, __LINE__);}) \ - assert(PL_top_env == &cur_env); \ - PL_delaymagic = cur_env.je_old_delaymagic; \ - PL_top_env = cur_env.je_prev; \ +#define JMPENV_POP \ + STMT_START { \ + DEBUG_l({ \ + int i = -1; JMPENV *p = PL_top_env; \ + while (p) { i++; p = p->je_prev; } \ + Perl_deb(aTHX_ "JMPENV_POP level=%d in %s at %s:%d\n", \ + i, SAFE_FUNCTION__, __FILE__, __LINE__);}) \ + assert(PL_top_env == &cur_env); \ + PL_delaymagic = cur_env.je_old_delaymagic; \ + PL_top_env = cur_env.je_prev; \ } STMT_END -#define JMPENV_JUMP(v) \ - STMT_START { \ - DEBUG_l({ \ - int i = -1; JMPENV *p = PL_top_env; \ - while (p) { i++; p = p->je_prev; } \ +#define JMPENV_JUMP(v) \ + STMT_START { \ + DEBUG_l({ \ + int i = -1; JMPENV *p = PL_top_env; \ + while (p) { i++; p = p->je_prev; } \ Perl_deb(aTHX_ "JMPENV_JUMP(%d) level=%d in %s at %s:%d\n", \ (int)(v), i, SAFE_FUNCTION__, __FILE__, __LINE__);}) \ - if (PL_top_env->je_prev) { \ - assert((v) >= 0 && (v) <= 3); \ - PerlProc_longjmp(PL_top_env->je_buf, (v)); \ - } \ - if ((v) == 2) \ - PerlProc_exit(STATUS_EXIT); \ - PerlIO_printf(PerlIO_stderr(), "panic: top_env, v=%d\n", (int)(v)); \ - PerlProc_exit(1); \ + if (PL_top_env->je_prev) { \ + assert((v) >= 0 && (v) <= 3); \ + PerlProc_longjmp(PL_top_env->je_buf, (v)); \ + } \ + if ((v) == 2) \ + PerlProc_exit(STATUS_EXIT); \ + PerlIO_printf(PerlIO_stderr(), "panic: top_env, v=%d\n", (int)(v)); \ + PerlProc_exit(1); \ } STMT_END #define CATCH_GET (PL_top_env->je_mustcatch) -#define CATCH_SET(v) \ - STMT_START { \ - DEBUG_l( \ - Perl_deb(aTHX_ \ +#define CATCH_SET(v) \ + STMT_START { \ + DEBUG_l( \ + Perl_deb(aTHX_ \ "JUMPLEVEL set catch %d => %d (for %p) in %s at %s:%d\n", \ - PL_top_env->je_mustcatch, (v), (void*)PL_top_env, \ - SAFE_FUNCTION__, __FILE__, __LINE__);) \ - PL_top_env->je_mustcatch = (v); \ + PL_top_env->je_mustcatch, (v), (void*)PL_top_env, \ + SAFE_FUNCTION__, __FILE__, __LINE__);) \ + PL_top_env->je_mustcatch = (v); \ } STMT_END /* @@ -228,20 +228,20 @@ the octets. */ -#define cophh_fetch_pvn(cophh, key, keylen, hash, flags) \ - Perl_refcounted_he_fetch_pvn(aTHX_ cophh, key, keylen, hash, \ +#define cophh_fetch_pvn(cophh, key, keylen, hash, flags) \ + Perl_refcounted_he_fetch_pvn(aTHX_ cophh, key, keylen, hash, \ (flags & COPHH_KEY_UTF8)) -#define cophh_fetch_pvs(cophh, key, flags) \ - Perl_refcounted_he_fetch_pvn(aTHX_ cophh, STR_WITH_LEN(key), 0, \ +#define cophh_fetch_pvs(cophh, key, flags) \ + Perl_refcounted_he_fetch_pvn(aTHX_ cophh, STR_WITH_LEN(key), 0, \ (flags & COPHH_KEY_UTF8)) -#define cophh_fetch_pv(cophh, key, hash, flags) \ - Perl_refcounted_he_fetch_pv(aTHX_ cophh, key, hash, \ +#define cophh_fetch_pv(cophh, key, hash, flags) \ + Perl_refcounted_he_fetch_pv(aTHX_ cophh, key, hash, \ (flags & COPHH_KEY_UTF8)) -#define cophh_fetch_sv(cophh, key, hash, flags) \ - Perl_refcounted_he_fetch_sv(aTHX_ cophh, key, hash, \ +#define cophh_fetch_sv(cophh, key, hash, flags) \ + Perl_refcounted_he_fetch_sv(aTHX_ cophh, key, hash, \ (flags & COPHH_KEY_UTF8)) /* @@ -272,16 +272,16 @@ the octets. =cut */ -#define cophh_exists_pvn(cophh, key, keylen, hash, flags) \ +#define cophh_exists_pvn(cophh, key, keylen, hash, flags) \ cBOOL(Perl_refcounted_he_fetch_pvn(aTHX_ cophh, key, keylen, hash, flags | COPHH_EXISTS)) #define cophh_exists_pvs(cophh, key, flags) \ cBOOL(Perl_refcounted_he_fetch_pvn(aTHX_ cophh, STR_WITH_LEN(key), 0, flags | COPHH_EXISTS)) -#define cophh_exists_pv(cophh, key, hash, flags) \ +#define cophh_exists_pv(cophh, key, hash, flags) \ cBOOL(Perl_refcounted_he_fetch_pv(aTHX_ cophh, key, hash, flags | COPHH_EXISTS)) -#define cophh_exists_sv(cophh, key, hash, flags) \ +#define cophh_exists_sv(cophh, key, hash, flags) \ cBOOL(Perl_refcounted_he_fetch_sv(aTHX_ cophh, key, hash, flags | COPHH_EXISTS)) /* @@ -371,13 +371,13 @@ the octets. #define cophh_store_pvn(cophh, key, keylen, hash, value, flags) \ Perl_refcounted_he_new_pvn(aTHX_ cophh, key, keylen, hash, value, flags) -#define cophh_store_pvs(cophh, key, value, flags) \ +#define cophh_store_pvs(cophh, key, value, flags) \ Perl_refcounted_he_new_pvn(aTHX_ cophh, STR_WITH_LEN(key), 0, value, flags) -#define cophh_store_pv(cophh, key, hash, value, flags) \ +#define cophh_store_pv(cophh, key, hash, value, flags) \ Perl_refcounted_he_new_pv(aTHX_ cophh, key, hash, value, flags) -#define cophh_store_sv(cophh, key, hash, value, flags) \ +#define cophh_store_sv(cophh, key, hash, value, flags) \ Perl_refcounted_he_new_sv(aTHX_ cophh, key, hash, value, flags) /* @@ -414,18 +414,18 @@ the octets. =cut */ -#define cophh_delete_pvn(cophh, key, keylen, hash, flags) \ - Perl_refcounted_he_new_pvn(aTHX_ cophh, key, keylen, hash, \ +#define cophh_delete_pvn(cophh, key, keylen, hash, flags) \ + Perl_refcounted_he_new_pvn(aTHX_ cophh, key, keylen, hash, \ (SV *)NULL, flags) -#define cophh_delete_pvs(cophh, key, flags) \ - Perl_refcounted_he_new_pvn(aTHX_ cophh, STR_WITH_LEN(key), 0, \ +#define cophh_delete_pvs(cophh, key, flags) \ + Perl_refcounted_he_new_pvn(aTHX_ cophh, STR_WITH_LEN(key), 0, \ (SV *)NULL, flags) -#define cophh_delete_pv(cophh, key, hash, flags) \ +#define cophh_delete_pv(cophh, key, hash, flags) \ Perl_refcounted_he_new_pv(aTHX_ cophh, key, hash, (SV *)NULL, flags) -#define cophh_delete_sv(cophh, key, hash, flags) \ +#define cophh_delete_sv(cophh, key, hash, flags) \ Perl_refcounted_he_new_sv(aTHX_ cophh, key, hash, (SV *)NULL, flags) #include "mydtrace.h" @@ -557,9 +557,9 @@ typedef struct rcpv RCPV; # define CopFILE(c) ((c)->cop_file) # define CopFILE_LEN(c) (CopFILE(c) ? RCPV_LEN(CopFILE(c)) : 0) -# define CopFILEGV(c) \ - (CopFILE(c)\ - ? gv_fetchfile(CopFILE(c)) : NULL) +# define CopFILEGV(c) \ + (CopFILE(c) \ + ? gv_fetchfile(CopFILE(c)) : NULL) # define CopFILE_set_x(c,pv) ((c)->cop_file = rcpv_new((pv),0,RCPVf_USE_STRLEN)) # define CopFILE_setn_x(c,pv,l) ((c)->cop_file = rcpv_new((pv),(l),0)) @@ -567,57 +567,57 @@ typedef struct rcpv RCPV; # define CopFILE_copy_x(dst,src) ((dst)->cop_file = rcpv_copy((src)->cop_file)) /* change condition to 1 && to enable this debugging */ -# define CopFILE_debug(c,t,rk) \ - if (0 && (c)->cop_file) \ - PerlIO_printf(Perl_debug_log, \ - "%-14s THX:%p OP:%p PV:%p rc: " \ - "%6zu fn: '%.*s' at %s line %d\n", \ - (t), aTHX, (c), (c)->cop_file, \ - RCPV_REFCOUNT((c)->cop_file)-rk, \ - (int)RCPV_LEN((c)->cop_file), \ - (c)->cop_file,__FILE__,__LINE__) \ +# define CopFILE_debug(c,t,rk) \ + if (0 && (c)->cop_file) \ + PerlIO_printf(Perl_debug_log, \ + "%-14s THX:%p OP:%p PV:%p rc: " \ + "%6zu fn: '%.*s' at %s line %d\n", \ + (t), aTHX, (c), (c)->cop_file, \ + RCPV_REFCOUNT((c)->cop_file)-rk, \ + (int)RCPV_LEN((c)->cop_file), \ + (c)->cop_file,__FILE__,__LINE__) \ # define CopFILE_set(c,pv) \ - STMT_START { \ - CopFILE_set_x(c,pv); \ - CopFILE_debug(c,"CopFILE_set", 0); \ - } STMT_END + STMT_START { \ + CopFILE_set_x(c,pv); \ + CopFILE_debug(c,"CopFILE_set", 0); \ + } STMT_END # define CopFILE_setn(c,pv,l) \ - STMT_START { \ - CopFILE_setn_x(c,pv,l); \ - CopFILE_debug(c,"CopFILE_setn", 0); \ - } STMT_END - -# define CopFILE_copy(dst,src) \ - STMT_START { \ - CopFILE_copy_x((dst),(src)); \ - CopFILE_debug((dst),"CopFILE_copy", 0); \ - } STMT_END - -# define CopFILE_free(c) \ - STMT_START { \ - CopFILE_debug((c),"CopFILE_free", 1); \ - CopFILE_free_x(c); \ - } STMT_END - - -# define CopFILESV(c) \ - (CopFILE(c)\ - ? GvSV(gv_fetchfile(CopFILE(c))) : NULL) -# define CopFILEAV(c) \ - (CopFILE(c)\ - ? GvAV(gv_fetchfile(CopFILE(c))) : NULL) -# define CopFILEAVx(c) \ - (assert_(CopFILE(c))\ - GvAV(gv_fetchfile(CopFILE(c)))) + STMT_START { \ + CopFILE_setn_x(c,pv,l); \ + CopFILE_debug(c,"CopFILE_setn", 0); \ + } STMT_END + +# define CopFILE_copy(dst,src) \ + STMT_START { \ + CopFILE_copy_x((dst),(src)); \ + CopFILE_debug((dst),"CopFILE_copy", 0); \ + } STMT_END + +# define CopFILE_free(c) \ + STMT_START { \ + CopFILE_debug((c),"CopFILE_free", 1); \ + CopFILE_free_x(c); \ + } STMT_END + + +# define CopFILESV(c) \ + (CopFILE(c) \ + ? GvSV(gv_fetchfile(CopFILE(c))) : NULL) +# define CopFILEAV(c) \ + (CopFILE(c) \ + ? GvAV(gv_fetchfile(CopFILE(c))) : NULL) +# define CopFILEAVx(c) \ + (assert_(CopFILE(c)) \ + GvAV(gv_fetchfile(CopFILE(c)))) # define CopFILEAVn(c) (cop_file_avn(c)) # define CopSTASH(c) PL_stashpad[(c)->cop_stashoff] -# define CopSTASH_set(c,hv) \ - ((c)->cop_stashoff = (hv)\ - ? alloccopstash(hv) \ - : 0) +# define CopSTASH_set(c,hv) \ + ((c)->cop_stashoff = (hv) \ + ? alloccopstash(hv) \ + : 0) #else /* Above: yes threads; Below no threads */ @@ -634,12 +634,12 @@ typedef struct rcpv RCPV; # define CopFILEAVx(c) (GvAV(CopFILEGV(c))) # endif # define CopFILEAVn(c) (CopFILEGV(c) ? GvAVn(CopFILEGV(c)) : NULL) -# define CopFILE(c) \ - (CopFILEGV(c) /* +2 for '_<' */\ - ? GvNAME(CopFILEGV(c))+2 : NULL) -# define CopFILE_LEN(c) \ - (CopFILEGV(c) /* -2 for '_<' */\ - ? GvNAMELEN(CopFILEGV(c))-2 : 0) +# define CopFILE(c) \ + (CopFILEGV(c) /* +2 for '_<' */ \ + ? GvNAME(CopFILEGV(c))+2 : NULL) +# define CopFILE_LEN(c) \ + (CopFILEGV(c) /* -2 for '_<' */ \ + ? GvNAMELEN(CopFILEGV(c))-2 : 0) # define CopSTASH(c) ((c)->cop_stash) # define CopSTASH_set(c,hv) ((c)->cop_stash = (hv)) # define CopFILE_free(c) (SvREFCNT_dec(CopFILEGV(c)),(CopFILEGV(c) = NULL)) @@ -688,16 +688,16 @@ the octets. =cut */ -#define cop_hints_fetch_pvn(cop, key, keylen, hash, flags) \ +#define cop_hints_fetch_pvn(cop, key, keylen, hash, flags) \ cophh_fetch_pvn(CopHINTHASH_get(cop), key, keylen, hash, flags) -#define cop_hints_fetch_pvs(cop, key, flags) \ +#define cop_hints_fetch_pvs(cop, key, flags) \ cophh_fetch_pvs(CopHINTHASH_get(cop), key, flags) -#define cop_hints_fetch_pv(cop, key, hash, flags) \ +#define cop_hints_fetch_pv(cop, key, hash, flags) \ cophh_fetch_pv(CopHINTHASH_get(cop), key, hash, flags) -#define cop_hints_fetch_sv(cop, key, hash, flags) \ +#define cop_hints_fetch_sv(cop, key, hash, flags) \ cophh_fetch_sv(CopHINTHASH_get(cop), key, hash, flags) /* @@ -735,13 +735,13 @@ the octets. #define cop_hints_exists_pvn(cop, key, keylen, hash, flags) \ cophh_exists_pvn(CopHINTHASH_get(cop), key, keylen, hash, flags) -#define cop_hints_exists_pvs(cop, key, flags) \ +#define cop_hints_exists_pvs(cop, key, flags) \ cophh_exists_pvs(CopHINTHASH_get(cop), key, flags) -#define cop_hints_exists_pv(cop, key, hash, flags) \ +#define cop_hints_exists_pv(cop, key, hash, flags) \ cophh_exists_pv(CopHINTHASH_get(cop), key, hash, flags) -#define cop_hints_exists_sv(cop, key, hash, flags) \ +#define cop_hints_exists_sv(cop, key, hash, flags) \ cophh_exists_sv(CopHINTHASH_get(cop), key, hash, flags) /* @@ -754,7 +754,7 @@ be zero. =cut */ -#define cop_hints_2hv(cop, flags) \ +#define cop_hints_2hv(cop, flags) \ cophh_2hv(CopHINTHASH_get(cop), flags) /* @@ -788,9 +788,9 @@ by setting C<*flags> to 0 or C. #define OutCopFILE(c) CopFILE(c) #define CopHINTS_get(c) ((c)->cop_hints + 0) -#define CopHINTS_set(c, h) \ - STMT_START {\ - (c)->cop_hints = (h); \ +#define CopHINTS_set(c, h) \ + STMT_START { \ + (c)->cop_hints = (h); \ } STMT_END /* @@ -834,40 +834,40 @@ struct block_format { /* on debugging builds, poison cx afterwards so we know no code * uses it - because after doing cxstack_ix--, any ties, exceptions etc * may overwrite the current stack frame */ -# define CX_POP(cx) \ - assert(CX_CUR() == cx); \ - cxstack_ix--; \ - cx = NULL; +# define CX_POP(cx) \ + assert(CX_CUR() == cx); \ + cxstack_ix--; \ + cx = NULL; #else # define CX_POP(cx) cxstack_ix--; #endif -#define CX_PUSHSUB_GET_LVALUE_MASK(func) \ - /* If the context is indeterminate, then only the lvalue */ \ - /* flags that the caller also has are applicable. */ \ - ( \ - (PL_op->op_flags & OPf_WANT) \ - ? OPpENTERSUB_LVAL_MASK \ - : !(PL_op->op_private & OPpENTERSUB_LVAL_MASK) \ - ? 0 : (U8)func(aTHX) \ - ) +#define CX_PUSHSUB_GET_LVALUE_MASK(func) \ + /* If the context is indeterminate, then only the lvalue */ \ + /* flags that the caller also has are applicable. */ \ + ( \ + (PL_op->op_flags & OPf_WANT) \ + ? OPpENTERSUB_LVAL_MASK \ + : !(PL_op->op_private & OPpENTERSUB_LVAL_MASK) \ + ? 0 : (U8)func(aTHX) \ + ) /* Restore old @_ */ -#define CX_POP_SAVEARRAY(cx) \ - STMT_START { \ - AV *cx_pop_savearray_av = GvAV(PL_defgv); \ - GvAV(PL_defgv) = cx->blk_sub.savearray; \ - cx->blk_sub.savearray = NULL; \ - SvREFCNT_dec(cx_pop_savearray_av); \ +#define CX_POP_SAVEARRAY(cx) \ + STMT_START { \ + AV *cx_pop_savearray_av = GvAV(PL_defgv); \ + GvAV(PL_defgv) = cx->blk_sub.savearray; \ + cx->blk_sub.savearray = NULL; \ + SvREFCNT_dec(cx_pop_savearray_av); \ } STMT_END /* junk in @_ spells trouble when cloning CVs and in pp_caller(), so don't * leave any (a fast av_clear(ary), basically) */ -#define CLEAR_ARGARRAY(ary) \ - STMT_START { \ - AvMAX(ary) += AvARRAY(ary) - AvALLOC(ary); \ - AvARRAY(ary) = AvALLOC(ary); \ - AvFILLp(ary) = -1; \ +#define CLEAR_ARGARRAY(ary) \ + STMT_START { \ + AvMAX(ary) += AvARRAY(ary) - AvALLOC(ary); \ + AvARRAY(ary) = AvALLOC(ary); \ + AvFILLp(ary) = -1; \ } STMT_END @@ -924,12 +924,12 @@ struct block_loop { #endif }; -#define CxITERVAR(c) \ - (CxPADLOOP(c) \ - ? (c)->blk_loop.itervar_u.svp \ - : ((c)->cx_type & CXp_FOR_GV) \ - ? &GvSV((c)->blk_loop.itervar_u.gv) \ - : (SV **)&(c)->blk_loop.itervar_u.gv) +#define CxITERVAR(c) \ + (CxPADLOOP(c) \ + ? (c)->blk_loop.itervar_u.svp \ + : ((c)->cx_type & CXp_FOR_GV) \ + ? &GvSV((c)->blk_loop.itervar_u.gv) \ + : (SV **)&(c)->blk_loop.itervar_u.gv) #define CxLABEL(c) (CopLABEL((c)->blk_oldcop)) #define CxLABEL_len(c,len) (CopLABEL_len((c)->blk_oldcop, len)) @@ -996,16 +996,16 @@ struct block { #define blk_loop cx_u.cx_blk.blk_u.blku_loop #define blk_givwhen cx_u.cx_blk.blk_u.blku_givwhen -#define CX_DEBUG(cx, action) \ - DEBUG_l( \ - Perl_deb(aTHX_ "CX %ld %s %s (scope %ld,%ld) (save %ld,%ld) in %s at %s:%d\n",\ - (long)cxstack_ix, \ - action, \ - PL_block_type[CxTYPE(cx)], \ - (long)PL_scopestack_ix, \ - (long)(cx->blk_oldscopesp), \ - (long)PL_savestack_ix, \ - (long)(cx->blk_oldsaveix), \ +#define CX_DEBUG(cx, action) \ + DEBUG_l( \ + Perl_deb(aTHX_ "CX %ld %s %s (scope %ld,%ld) (save %ld,%ld) in %s at %s:%d\n", \ + (long)cxstack_ix, \ + action, \ + PL_block_type[CxTYPE(cx)], \ + (long)PL_scopestack_ix, \ + (long)(cx->blk_oldscopesp), \ + (long)PL_savestack_ix, \ + (long)(cx->blk_oldsaveix), \ SAFE_FUNCTION__, __FILE__, __LINE__)); @@ -1044,36 +1044,36 @@ struct subst { #define sb_rxres cx_u.cx_subst.sbu_rxres #define sb_rx cx_u.cx_subst.sbu_rx -# define CX_PUSHSUBST(cx) \ - CXINC, cx = CX_CUR(),\ - cx->blk_oldsaveix = oldsave, \ - cx->sb_iters = iters, \ - cx->sb_maxiters = maxiters, \ - cx->sb_rflags = r_flags, \ - cx->sb_rxtainted = rxtainted, \ - cx->sb_orig = orig, \ - cx->sb_dstr = dstr, \ - cx->sb_targ = targ, \ - cx->sb_s = s, \ - cx->sb_m = m, \ - cx->sb_strend = strend, \ - cx->sb_rxres = NULL, \ - cx->sb_rx = rx, \ - cx->cx_type = CXt_SUBST | (once ? CXp_ONCE : 0); \ - rxres_save(&cx->sb_rxres, rx); \ - (void)ReREFCNT_inc(rx); \ - SvREFCNT_inc_void_NN(targ) - -# define CX_POPSUBST(cx) \ - STMT_START { \ - REGEXP *re; \ - assert(CxTYPE(cx) == CXt_SUBST); \ - rxres_free(&cx->sb_rxres); \ - re = cx->sb_rx; \ - cx->sb_rx = NULL; \ - ReREFCNT_dec(re); \ - SvREFCNT_dec_NN(cx->sb_targ); \ - } STMT_END +# define CX_PUSHSUBST(cx) \ + CXINC, cx = CX_CUR(), \ + cx->blk_oldsaveix = oldsave, \ + cx->sb_iters = iters, \ + cx->sb_maxiters = maxiters, \ + cx->sb_rflags = r_flags, \ + cx->sb_rxtainted = rxtainted, \ + cx->sb_orig = orig, \ + cx->sb_dstr = dstr, \ + cx->sb_targ = targ, \ + cx->sb_s = s, \ + cx->sb_m = m, \ + cx->sb_strend = strend, \ + cx->sb_rxres = NULL, \ + cx->sb_rx = rx, \ + cx->cx_type = CXt_SUBST | (once ? CXp_ONCE : 0); \ + rxres_save(&cx->sb_rxres, rx); \ + (void)ReREFCNT_inc(rx); \ + SvREFCNT_inc_void_NN(targ) + +# define CX_POPSUBST(cx) \ + STMT_START { \ + REGEXP *re; \ + assert(CxTYPE(cx) == CXt_SUBST); \ + rxres_free(&cx->sb_rxres); \ + re = cx->sb_rx; \ + cx->sb_rx = NULL; \ + ReREFCNT_dec(re); \ + SvREFCNT_dec_NN(cx->sb_targ); \ + } STMT_END #endif #define CxONCE(cx) ((cx)->cx_type & CXp_ONCE) @@ -1140,21 +1140,21 @@ struct context { #define CXp_ONCE 0x10 /* What was sbu_once in struct subst */ #define CxTYPE(c) ((c)->cx_type & CXTYPEMASK) -#define CxTYPE_is_LOOP(c) \ - ( CxTYPE(cx) >= CXt_LOOP_ARY\ +#define CxTYPE_is_LOOP(c) \ + ( CxTYPE(cx) >= CXt_LOOP_ARY \ && CxTYPE(cx) <= CXt_LOOP_PLAIN) #define CxMULTICALL(c) ((c)->cx_type & CXp_MULTICALL) -#define CxREALEVAL(c) \ - (((c)->cx_type & (CXTYPEMASK|CXp_REAL))\ +#define CxREALEVAL(c) \ + (((c)->cx_type & (CXTYPEMASK|CXp_REAL)) \ == (CXt_EVAL|CXp_REAL)) -#define CxEVALBLOCK(c) \ - (((c)->cx_type & (CXTYPEMASK|CXp_EVALBLOCK))\ +#define CxEVALBLOCK(c) \ + (((c)->cx_type & (CXTYPEMASK|CXp_EVALBLOCK)) \ == (CXt_EVAL|CXp_EVALBLOCK)) -#define CxTRY(c) \ - (((c)->cx_type & (CXTYPEMASK|CXp_TRY))\ +#define CxTRY(c) \ + (((c)->cx_type & (CXTYPEMASK|CXp_TRY)) \ == (CXt_EVAL|CXp_TRY)) -#define CxFOREACH(c) \ - ( CxTYPE(cx) >= CXt_LOOP_ARY\ +#define CxFOREACH(c) \ + ( CxTYPE(cx) >= CXt_LOOP_ARY \ && CxTYPE(cx) <= CXt_LOOP_LIST) /* private flags for CXt_DEFER */ @@ -1260,7 +1260,7 @@ typedef struct stackinfo PERL_SI; #ifdef DEBUGGING # define SET_MARK_OFFSET \ - PL_curstackinfo->si_markoff = PL_markstack_ptr - PL_markstack + PL_curstackinfo->si_markoff = PL_markstack_ptr - PL_markstack #else # define SET_MARK_OFFSET NOOP #endif @@ -1271,14 +1271,14 @@ typedef struct stackinfo PERL_SI; # define PUSHSTACK_INIT_HWM(si) NOOP #endif -#define PUSHSTACKi(type) \ +#define PUSHSTACKi(type) \ STMT_START { \ PERL_SI *next = PL_curstackinfo->si_next; \ DEBUG_l({ \ int i = 0; PERL_SI *p = PL_curstackinfo; \ while (p) { i++; p = p->si_prev; } \ Perl_deb(aTHX_ "push STACKINFO %d in %s at %s:%d\n", \ - i, SAFE_FUNCTION__, __FILE__, __LINE__);}) \ + i, SAFE_FUNCTION__, __FILE__, __LINE__);}) \ if (!next) { \ next = new_stackinfo(32, 2048/sizeof(PERL_CONTEXT) - 1); \ next->si_prev = PL_curstackinfo; \ @@ -1298,29 +1298,29 @@ typedef struct stackinfo PERL_SI; /* POPSTACK works with PL_stack_sp, so it may need to be bracketed by * PUTBACK/SPAGAIN to flush/refresh any local SP that may be active */ -#define POPSTACK \ - STMT_START { \ - dSP; \ - PERL_SI * const prev = PL_curstackinfo->si_prev; \ - DEBUG_l({ \ - int i = -1; PERL_SI *p = PL_curstackinfo; \ - while (p) { i++; p = p->si_prev; } \ - Perl_deb(aTHX_ "pop STACKINFO %d in %s at %s:%d\n", \ - i, SAFE_FUNCTION__, __FILE__, __LINE__);}) \ - if (!prev) { \ - Perl_croak_popstack(); \ - } \ - SWITCHSTACK(PL_curstack,prev->si_stack); \ - /* don't free prev here, free them all at the END{} */ \ - PL_curstackinfo = prev; \ +#define POPSTACK \ + STMT_START { \ + dSP; \ + PERL_SI * const prev = PL_curstackinfo->si_prev; \ + DEBUG_l({ \ + int i = -1; PERL_SI *p = PL_curstackinfo; \ + while (p) { i++; p = p->si_prev; } \ + Perl_deb(aTHX_ "pop STACKINFO %d in %s at %s:%d\n", \ + i, SAFE_FUNCTION__, __FILE__, __LINE__);}) \ + if (!prev) { \ + Perl_croak_popstack(); \ + } \ + SWITCHSTACK(PL_curstack,prev->si_stack); \ + /* don't free prev here, free them all at the END{} */ \ + PL_curstackinfo = prev; \ } STMT_END -#define POPSTACK_TO(s) \ - STMT_START { \ - while (PL_curstack != s) { \ - dounwind(-1); \ - POPSTACK; \ - } \ +#define POPSTACK_TO(s) \ + STMT_START { \ + while (PL_curstack != s) { \ + dounwind(-1); \ + POPSTACK; \ + } \ } STMT_END /* @@ -1358,77 +1358,77 @@ See L. =cut */ -#define dMULTICALL \ - OP *multicall_cop; \ +#define dMULTICALL \ + OP *multicall_cop; \ bool multicall_oldcatch -#define PUSH_MULTICALL(the_cv) \ +#define PUSH_MULTICALL(the_cv) \ PUSH_MULTICALL_FLAGS(the_cv, 0) /* Like PUSH_MULTICALL, but allows you to specify extra flags * for the CX stack entry (this isn't part of the public API) */ -#define PUSH_MULTICALL_FLAGS(the_cv, flags) \ - STMT_START { \ - PERL_CONTEXT *cx; \ - CV * const _nOnclAshIngNamE_ = the_cv; \ - CV * const cv = _nOnclAshIngNamE_; \ - PADLIST * const padlist = CvPADLIST(cv); \ - multicall_oldcatch = CATCH_GET; \ - CATCH_SET(TRUE); \ - PUSHSTACKi(PERLSI_MULTICALL); \ - cx = cx_pushblock((CXt_SUB|CXp_MULTICALL|flags), (U8)gimme, \ - PL_stack_sp, PL_savestack_ix); \ - cx_pushsub(cx, cv, NULL, 0); \ - SAVEOP(); \ - if (!(flags & CXp_SUB_RE_FAKE)) \ - CvDEPTH(cv)++; \ - if (CvDEPTH(cv) >= 2) \ - Perl_pad_push(aTHX_ padlist, CvDEPTH(cv)); \ - PAD_SET_CUR_NOSAVE(padlist, CvDEPTH(cv)); \ - multicall_cop = CvSTART(cv); \ +#define PUSH_MULTICALL_FLAGS(the_cv, flags) \ + STMT_START { \ + PERL_CONTEXT *cx; \ + CV * const _nOnclAshIngNamE_ = the_cv; \ + CV * const cv = _nOnclAshIngNamE_; \ + PADLIST * const padlist = CvPADLIST(cv); \ + multicall_oldcatch = CATCH_GET; \ + CATCH_SET(TRUE); \ + PUSHSTACKi(PERLSI_MULTICALL); \ + cx = cx_pushblock((CXt_SUB|CXp_MULTICALL|flags), (U8)gimme, \ + PL_stack_sp, PL_savestack_ix); \ + cx_pushsub(cx, cv, NULL, 0); \ + SAVEOP(); \ + if (!(flags & CXp_SUB_RE_FAKE)) \ + CvDEPTH(cv)++; \ + if (CvDEPTH(cv) >= 2) \ + Perl_pad_push(aTHX_ padlist, CvDEPTH(cv)); \ + PAD_SET_CUR_NOSAVE(padlist, CvDEPTH(cv)); \ + multicall_cop = CvSTART(cv); \ } STMT_END -#define MULTICALL \ - STMT_START { \ - PL_op = multicall_cop; \ - CALLRUNOPS(aTHX); \ +#define MULTICALL \ + STMT_START { \ + PL_op = multicall_cop; \ + CALLRUNOPS(aTHX); \ } STMT_END -#define POP_MULTICALL \ - STMT_START { \ - PERL_CONTEXT *cx; \ - cx = CX_CUR(); \ - CX_LEAVE_SCOPE(cx); \ - cx_popsub_common(cx); \ - gimme = cx->blk_gimme; \ - PERL_UNUSED_VAR(gimme); /* for API */ \ - cx_popblock(cx); \ - CX_POP(cx); \ - POPSTACK; \ - CATCH_SET(multicall_oldcatch); \ - SPAGAIN; \ +#define POP_MULTICALL \ + STMT_START { \ + PERL_CONTEXT *cx; \ + cx = CX_CUR(); \ + CX_LEAVE_SCOPE(cx); \ + cx_popsub_common(cx); \ + gimme = cx->blk_gimme; \ + PERL_UNUSED_VAR(gimme); /* for API */ \ + cx_popblock(cx); \ + CX_POP(cx); \ + POPSTACK; \ + CATCH_SET(multicall_oldcatch); \ + SPAGAIN; \ } STMT_END /* Change the CV of an already-pushed MULTICALL CxSUB block. * (this isn't part of the public API) */ -#define CHANGE_MULTICALL_FLAGS(the_cv, flags) \ - STMT_START { \ - CV * const _nOnclAshIngNamE_ = the_cv; \ - CV * const cv = _nOnclAshIngNamE_; \ - PADLIST * const padlist = CvPADLIST(cv); \ - PERL_CONTEXT *cx = CX_CUR(); \ - assert(CxMULTICALL(cx)); \ - cx_popsub_common(cx); \ - cx->cx_type = (CXt_SUB|CXp_MULTICALL|flags); \ - cx_pushsub(cx, cv, NULL, 0); \ - if (!(flags & CXp_SUB_RE_FAKE)) \ - CvDEPTH(cv)++; \ - if (CvDEPTH(cv) >= 2) \ - Perl_pad_push(aTHX_ padlist, CvDEPTH(cv)); \ - PAD_SET_CUR_NOSAVE(padlist, CvDEPTH(cv)); \ - multicall_cop = CvSTART(cv); \ +#define CHANGE_MULTICALL_FLAGS(the_cv, flags) \ + STMT_START { \ + CV * const _nOnclAshIngNamE_ = the_cv; \ + CV * const cv = _nOnclAshIngNamE_; \ + PADLIST * const padlist = CvPADLIST(cv); \ + PERL_CONTEXT *cx = CX_CUR(); \ + assert(CxMULTICALL(cx)); \ + cx_popsub_common(cx); \ + cx->cx_type = (CXt_SUB|CXp_MULTICALL|flags); \ + cx_pushsub(cx, cv, NULL, 0); \ + if (!(flags & CXp_SUB_RE_FAKE)) \ + CvDEPTH(cv)++; \ + if (CvDEPTH(cv) >= 2) \ + Perl_pad_push(aTHX_ padlist, CvDEPTH(cv)); \ + PAD_SET_CUR_NOSAVE(padlist, CvDEPTH(cv)); \ + multicall_cop = CvSTART(cv); \ } STMT_END /* * ex: set ts=8 sts=4 sw=4 et: diff --git a/cv.h b/cv.h index 1fe35fcd84b8..d92f4ae28c34 100644 --- a/cv.h +++ b/cv.h @@ -50,10 +50,10 @@ See L. #define CvFILE(sv) ((XPVCV*)MUTABLE_PTR(SvANY(sv)))->xcv_file #ifdef USE_ITHREADS # define CvFILE_set_from_cop(sv, cop) \ - (CvFILE(sv) = savepv(CopFILE(cop)), CvDYNFILE_on(sv)) + (CvFILE(sv) = savepv(CopFILE(cop)), CvDYNFILE_on(sv)) #else # define CvFILE_set_from_cop(sv, cop) \ - (CvFILE(sv) = CopFILE(cop), CvDYNFILE_off(sv)) + (CvFILE(sv) = CopFILE(cop), CvDYNFILE_off(sv)) #endif #define CvFILEGV(sv) (gv_fetchfile(CvFILE(sv))) #define CvDEPTH(sv) (*Perl_CvDEPTH((const CV *)sv)) @@ -62,8 +62,8 @@ See L. #define CvDEPTHunsafe(sv) ((XPVCV*)MUTABLE_PTR(SvANY(sv)))->xcv_depth /* these CvPADLIST/CvRESERVED asserts can be reverted one day, once stabilized */ -#define CvPADLIST(sv) \ - (*(assert_(!CvISXSUB((CV*)(sv)))\ +#define CvPADLIST(sv) \ + (*(assert_(!CvISXSUB((CV*)(sv))) \ &(((XPVCV*)MUTABLE_PTR(SvANY(sv)))->xcv_padlist_u.xcv_padlist))) /* CvPADLIST_set is not public API, it can be removed one day, once stabilized */ #ifdef DEBUGGING @@ -71,16 +71,16 @@ See L. #else # define CvPADLIST_set(sv, padlist) (CvPADLIST(sv) = (padlist)) #endif -#define CvHSCXT(sv) \ - *(assert_(CvISXSUB((CV*)(sv)))\ +#define CvHSCXT(sv) \ + *(assert_(CvISXSUB((CV*)(sv))) \ &(((XPVCV*)MUTABLE_PTR(SvANY(sv)))->xcv_padlist_u.xcv_hscxt)) #ifdef DEBUGGING # if PTRSIZE == 8 -# define PoisonPADLIST(sv) \ - (((XPVCV*)MUTABLE_PTR(SvANY(sv)))->xcv_padlist_u.xcv_padlist = (PADLIST *)UINT64_C(0xEFEFEFEFEFEFEFEF)) +# define PoisonPADLIST(sv) \ + (((XPVCV*)MUTABLE_PTR(SvANY(sv)))->xcv_padlist_u.xcv_padlist = (PADLIST *)UINT64_C(0xEFEFEFEFEFEFEFEF)) # elif PTRSIZE == 4 -# define PoisonPADLIST(sv) \ - (((XPVCV*)MUTABLE_PTR(SvANY(sv)))->xcv_padlist_u.xcv_padlist = (PADLIST *)0xEFEFEFEF) +# define PoisonPADLIST(sv) \ + (((XPVCV*)MUTABLE_PTR(SvANY(sv)))->xcv_padlist_u.xcv_padlist = (PADLIST *)0xEFEFEFEF) # else # error unknown pointer size # endif @@ -93,21 +93,21 @@ See L. #define CvFLAGS(sv) ((XPVCV*)MUTABLE_PTR(SvANY(sv)))->xcv_flags /* These two are sometimes called on non-CVs */ -#define CvPROTO(sv) \ - ( \ - SvPOK(sv) \ - ? SvTYPE(sv) == SVt_PVCV && CvAUTOLOAD(sv) \ - ? SvEND(sv)+1 : SvPVX_const(sv) \ - : NULL \ - ) -#define CvPROTOLEN(sv) \ - ( \ - SvPOK(sv) \ - ? SvTYPE(sv) == SVt_PVCV && CvAUTOLOAD(sv) \ - ? SvLEN(sv)-SvCUR(sv)-2 \ - : SvCUR(sv) \ - : 0 \ - ) +#define CvPROTO(sv) \ + ( \ + SvPOK(sv) \ + ? SvTYPE(sv) == SVt_PVCV && CvAUTOLOAD(sv) \ + ? SvEND(sv)+1 : SvPVX_const(sv) \ + : NULL \ + ) +#define CvPROTOLEN(sv) \ + ( \ + SvPOK(sv) \ + ? SvTYPE(sv) == SVt_PVCV && CvAUTOLOAD(sv) \ + ? SvLEN(sv)-SvCUR(sv)-2 \ + : SvCUR(sv) \ + : 0 \ + ) /* CV has the `:method` attribute. This used to be called CVf_METHOD but is * renamed to avoid collision with an upcoming feature */ @@ -281,22 +281,22 @@ CvNAME_HEK(CV *sv) /* helper for the common pattern: CvNAMED(sv) ? CvNAME_HEK((CV *)sv) : GvNAME_HEK(CvGV(sv)) */ -#define CvGvNAME_HEK(sv) \ - (\ - CvNAMED((CV*)sv) ? \ - ((XPVCV*)MUTABLE_PTR(SvANY((SV*)sv)))->xcv_gv_u.xcv_hek\ - : GvNAME_HEK(CvGV( (SV*) sv)) \ +#define CvGvNAME_HEK(sv) \ + ( \ + CvNAMED((CV*)sv) ? \ + ((XPVCV*)MUTABLE_PTR(SvANY((SV*)sv)))->xcv_gv_u.xcv_hek \ + : GvNAME_HEK(CvGV( (SV*) sv)) \ ) /* This lowers the reference count of the previous value, but does *not* increment the reference count of the new value. */ -#define CvNAME_HEK_set(cv, hek) \ - (\ - CvNAME_HEK((CV *)(cv)) \ - ? unshare_hek(SvANY((CV *)(cv))->xcv_gv_u.xcv_hek) \ - : (void)0, \ +#define CvNAME_HEK_set(cv, hek) \ + ( \ + CvNAME_HEK((CV *)(cv)) \ + ? unshare_hek(SvANY((CV *)(cv))->xcv_gv_u.xcv_hek) \ + : (void)0, \ ((XPVCV*)MUTABLE_PTR(SvANY(cv)))->xcv_gv_u.xcv_hek = (hek), \ - CvNAMED_on(cv) \ + CvNAMED_on(cv) \ ) /* diff --git a/dosish.h b/dosish.h index b6c51fcd14bc..4c4bec1800ba 100644 --- a/dosish.h +++ b/dosish.h @@ -14,13 +14,13 @@ #endif #ifdef WIN32 -# define PERL_SYS_INIT_BODY(c,v) \ - MALLOC_CHECK_TAINT2(*c,*v) Perl_win32_init(c,v); PERLIO_INIT +# define PERL_SYS_INIT_BODY(c,v) \ + MALLOC_CHECK_TAINT2(*c,*v) Perl_win32_init(c,v); PERLIO_INIT # define PERL_SYS_TERM_BODY() Perl_win32_term() # define BIT_BUCKET "nul" #else -# define PERL_SYS_INIT_BODY(c,v) \ - MALLOC_CHECK_TAINT2(*c,*v); PERLIO_INIT +# define PERL_SYS_INIT_BODY(c,v) \ + MALLOC_CHECK_TAINT2(*c,*v); PERLIO_INIT # define BIT_BUCKET "\\dev\\nul" /* "wanna be like, umm, Newlined, or somethin?" */ #endif @@ -30,11 +30,11 @@ * BEWARE that using PerlIO in these will be using freed memory, so may appear * to work, but must NOT be retained in production code. */ #ifndef PERL_SYS_TERM_BODY -# define PERL_SYS_TERM_BODY() \ - ENV_TERM; USER_PROP_MUTEX_TERM; LOCALE_TERM; \ - HINTS_REFCNT_TERM; KEYWORD_PLUGIN_MUTEX_TERM; \ - OP_CHECK_MUTEX_TERM; OP_REFCNT_TERM; \ - PERLIO_TERM; MALLOC_TERM; +# define PERL_SYS_TERM_BODY() \ + ENV_TERM; USER_PROP_MUTEX_TERM; LOCALE_TERM; \ + HINTS_REFCNT_TERM; KEYWORD_PLUGIN_MUTEX_TERM; \ + OP_CHECK_MUTEX_TERM; OP_REFCNT_TERM; \ + PERLIO_TERM; MALLOC_TERM; #endif #define dXSUB_SYS dNOOP diff --git a/gv.h b/gv.h index 0385b1d35ffd..4e12efdd71c8 100644 --- a/gv.h +++ b/gv.h @@ -27,33 +27,33 @@ struct gp { #if defined (DEBUGGING) && defined(PERL_USE_GCC_BRACE_GROUPS) && !defined(__INTEL_COMPILER) -# define GvGP(gv) \ - ((GP *)(*({GV *const _gvgp = (GV *) (gv); \ - assert(SvTYPE(_gvgp) == SVt_PVGV || SvTYPE(_gvgp) == SVt_PVLV); \ - assert(isGV_with_GP(_gvgp)); \ - &((_gvgp)->sv_u.svu_gp);}))) -# define GvGP_set(gv,gp) \ - {GV *const _gvgp = (GV *) (gv); \ - assert(SvTYPE(_gvgp) == SVt_PVGV || SvTYPE(_gvgp) == SVt_PVLV); \ - assert(isGV_with_GP(_gvgp)); \ - (_gvgp)->sv_u.svu_gp = (gp); } -# define GvFLAGS(gv) \ - (*({GV *const _gvflags = (GV *) (gv); \ - assert(SvTYPE(_gvflags) == SVt_PVGV || SvTYPE(_gvflags) == SVt_PVLV); \ - assert(isGV_with_GP(_gvflags)); \ - &(GvXPVGV(_gvflags)->xpv_cur);})) -# define GvSTASH(gv) \ - (*({ GV * const _gvstash = (GV *) (gv); \ - assert(isGV_with_GP(_gvstash)); \ - assert(SvTYPE(_gvstash) == SVt_PVGV || SvTYPE(_gvstash) >= SVt_PVLV); \ - &(GvXPVGV(_gvstash)->xnv_u.xgv_stash); \ - })) -# define GvNAME_HEK(gv) \ - (*({ GV * const _gvname_hek = (GV *) (gv); \ - assert(isGV_with_GP(_gvname_hek)); \ - assert(SvTYPE(_gvname_hek) == SVt_PVGV || SvTYPE(_gvname_hek) >= SVt_PVLV); \ - &(GvXPVGV(_gvname_hek)->xiv_u.xivu_namehek); \ - })) +# define GvGP(gv) \ + ((GP *)(*({GV *const _gvgp = (GV *) (gv); \ + assert(SvTYPE(_gvgp) == SVt_PVGV || SvTYPE(_gvgp) == SVt_PVLV); \ + assert(isGV_with_GP(_gvgp)); \ + &((_gvgp)->sv_u.svu_gp);}))) +# define GvGP_set(gv,gp) \ + {GV *const _gvgp = (GV *) (gv); \ + assert(SvTYPE(_gvgp) == SVt_PVGV || SvTYPE(_gvgp) == SVt_PVLV); \ + assert(isGV_with_GP(_gvgp)); \ + (_gvgp)->sv_u.svu_gp = (gp); } +# define GvFLAGS(gv) \ + (*({GV *const _gvflags = (GV *) (gv); \ + assert(SvTYPE(_gvflags) == SVt_PVGV || SvTYPE(_gvflags) == SVt_PVLV); \ + assert(isGV_with_GP(_gvflags)); \ + &(GvXPVGV(_gvflags)->xpv_cur);})) +# define GvSTASH(gv) \ + (*({ GV * const _gvstash = (GV *) (gv); \ + assert(isGV_with_GP(_gvstash)); \ + assert(SvTYPE(_gvstash) == SVt_PVGV || SvTYPE(_gvstash) >= SVt_PVLV); \ + &(GvXPVGV(_gvstash)->xnv_u.xgv_stash); \ + })) +# define GvNAME_HEK(gv) \ + (*({ GV * const _gvname_hek = (GV *) (gv); \ + assert(isGV_with_GP(_gvname_hek)); \ + assert(SvTYPE(_gvname_hek) == SVt_PVGV || SvTYPE(_gvname_hek) >= SVt_PVLV); \ + &(GvXPVGV(_gvname_hek)->xiv_u.xivu_namehek); \ + })) # define GvNAME_get(gv) ({ assert(GvNAME_HEK(gv)); (char *)HEK_KEY(GvNAME_HEK(gv)); }) # define GvNAMELEN_get(gv) ({ assert(GvNAME_HEK(gv)); HEK_LEN(GvNAME_HEK(gv)); }) # define GvNAMEUTF8(gv) ({ assert(GvNAME_HEK(gv)); HEK_UTF8(GvNAME_HEK(gv)); }) @@ -100,41 +100,41 @@ Return the CV from the GV. #define GvSV(gv) (GvGP(gv)->gp_sv) #ifdef PERL_DONT_CREATE_GVSV -#define GvSVn(gv) \ - (*(GvGP(gv)->gp_sv ?\ - &(GvGP(gv)->gp_sv) : \ +#define GvSVn(gv) \ + (*(GvGP(gv)->gp_sv ? \ + &(GvGP(gv)->gp_sv) : \ &(GvGP(gv_SVadd(gv))->gp_sv))) #else #define GvSVn(gv) GvSV(gv) #endif #define GvREFCNT(gv) (GvGP(gv)->gp_refcnt) -#define GvIO(gv) \ - ( \ - (gv) \ - && ( \ - SvTYPE((const SV*)(gv)) == SVt_PVGV \ - || SvTYPE((const SV*)(gv)) == SVt_PVLV \ - ) \ - && GvGP(gv) \ - ? GvIOp(gv) \ - : NULL \ - ) +#define GvIO(gv) \ + ( \ + (gv) \ + && ( \ + SvTYPE((const SV*)(gv)) == SVt_PVGV \ + || SvTYPE((const SV*)(gv)) == SVt_PVLV \ + ) \ + && GvGP(gv) \ + ? GvIOp(gv) \ + : NULL \ + ) #define GvIOp(gv) (GvGP(gv)->gp_io) #define GvIOn(gv) (GvIO(gv) ? GvIOp(gv) : GvIOp(gv_IOadd(gv))) #define GvFORM(gv) (GvGP(gv)->gp_form) #define GvAV(gv) (GvGP(gv)->gp_av) -#define GvAVn(gv) \ - (GvGP(gv)->gp_av ?\ - GvGP(gv)->gp_av : \ +#define GvAVn(gv) \ + (GvGP(gv)->gp_av ? \ + GvGP(gv)->gp_av : \ GvGP(gv_AVadd(gv))->gp_av) #define GvHV(gv) ((GvGP(gv))->gp_hv) -#define GvHVn(gv) \ - (GvGP(gv)->gp_hv ?\ - GvGP(gv)->gp_hv : \ +#define GvHVn(gv) \ + (GvGP(gv)->gp_hv ? \ + GvGP(gv)->gp_hv : \ GvGP(gv_HVadd(gv))->gp_hv) #define GvCV(gv) ((CV*)GvGP(gv)->gp_cv) @@ -258,8 +258,8 @@ Return the CV from the GV. outside this range. */ -#define GV_NOADD_MASK \ - (SVf_UTF8|GV_NOADD_NOINIT|GV_NOEXPAND|GV_NOTQUAL|GV_ADDMG|GV_NO_SVGMAGIC) +#define GV_NOADD_MASK \ + (SVf_UTF8|GV_NOADD_NOINIT|GV_NOEXPAND|GV_NOTQUAL|GV_ADDMG|GV_NO_SVGMAGIC) /* The bit flags that don't cause gv_fetchpv() to add a symbol if not found (with the exception GV_ADDMG, which *might* cause the symbol to be added) */ @@ -271,8 +271,8 @@ Return the CV from the GV. #define gv_efullname3(sv,gv,prefix) gv_efullname4(sv,gv,prefix,TRUE) #define gv_fetchmethod(stash, name) gv_fetchmethod_autoload(stash, name, TRUE) #define gv_fetchsv_nomg(n,f,t) gv_fetchsv(n,(f)|GV_NO_SVGMAGIC,t) -#define gv_init(gv,stash,name,len,multi) \ - gv_init_pvn(gv,stash,name,len,GV_ADDMULTI*cBOOL(multi)) +#define gv_init(gv,stash,name,len,multi) \ + gv_init_pvn(gv,stash,name,len,GV_ADDMULTI*cBOOL(multi)) #define gv_fetchmeth(stash,name,len,level) gv_fetchmeth_pvn(stash, name, len, level, 0) #define gv_fetchmeth_autoload(stash,name,len,level) gv_fetchmeth_pvn_autoload(stash, name, len, level, 0) #define gv_fetchmethod_flags(stash,name,flags) gv_fetchmethod_pv_flags(stash, name, flags) @@ -283,15 +283,15 @@ Equivalent to C>. =cut */ -#define gv_autoload4(stash, name, len, autoload) \ - gv_autoload_pvn(stash, name, len, cBOOL(autoload)) +#define gv_autoload4(stash, name, len, autoload) \ + gv_autoload_pvn(stash, name, len, cBOOL(autoload)) #define newGVgen(pack) newGVgen_flags(pack, 0) -#define gv_method_changed(gv) \ - ( \ - assert_(isGV_with_GP(gv)) \ - GvREFCNT(gv) > 1 \ - ? (void)++PL_sub_generation \ - : mro_method_changed_in(GvSTASH(gv)) \ +#define gv_method_changed(gv) \ + ( \ + assert_(isGV_with_GP(gv)) \ + GvREFCNT(gv) > 1 \ + ? (void)++PL_sub_generation \ + : mro_method_changed_in(GvSTASH(gv)) \ ) /* diff --git a/handy.h b/handy.h index ed28b1c0628d..e0d049430f8e 100644 --- a/handy.h +++ b/handy.h @@ -123,11 +123,11 @@ definitely a reference SV that refers to an SV of the right type. */ #if defined(DEBUGGING) && defined(PERL_USE_GCC_BRACE_GROUPS) -# define xV_FROM_REF(XV, ref) \ - ({ SV *_ref = ref; \ - assert(SvROK(_ref)); \ - assert(SvTYPE(SvRV(_ref)) == SVt_PV ## XV); \ - (XV *)(SvRV(_ref)); }) +# define xV_FROM_REF(XV, ref) \ + ({ SV *_ref = ref; \ + assert(SvROK(_ref)); \ + assert(SvTYPE(SvRV(_ref)) == SVt_PV ## XV); \ + (XV *)(SvRV(_ref)); }) #else # define xV_FROM_REF(XV, ref) ((XV *)(SvRV(ref))) #endif @@ -365,8 +365,8 @@ We also use empty definition under Coverity since the __ASSERT_ checks often check for things that Really Cannot Happen, and Coverity detects that and gets all excited. */ -#if defined(DEBUGGING) && !defined(__COVERITY__) \ - && ! defined(PERL_SMALL_MACRO_BUFFER) +#if defined(DEBUGGING) && !defined(__COVERITY__) \ + && ! defined(PERL_SMALL_MACRO_BUFFER) # define __ASSERT_(statement) assert(statement), #else # define __ASSERT_(statement) @@ -458,37 +458,37 @@ Perl_xxx(aTHX_ ...) form for any API calls where it's used. /* STR_WITH_LEN() shortcuts */ #define newSVpvs(str) Perl_newSVpvn(aTHX_ STR_WITH_LEN(str)) -#define newSVpvs_flags(str,flags) \ +#define newSVpvs_flags(str,flags) \ Perl_newSVpvn_flags(aTHX_ STR_WITH_LEN(str), flags) #define newSVpvs_share(str) Perl_newSVpvn_share(aTHX_ STR_WITH_LEN(str), 0) #define sv_catpvs_flags(sv, str, flags) \ Perl_sv_catpvn_flags(aTHX_ sv, STR_WITH_LEN(str), flags) #define sv_catpvs_nomg(sv, str) \ Perl_sv_catpvn_flags(aTHX_ sv, STR_WITH_LEN(str), 0) -#define sv_catpvs(sv, str) \ +#define sv_catpvs(sv, str) \ Perl_sv_catpvn_flags(aTHX_ sv, STR_WITH_LEN(str), SV_GMAGIC) -#define sv_catpvs_mg(sv, str) \ +#define sv_catpvs_mg(sv, str) \ Perl_sv_catpvn_flags(aTHX_ sv, STR_WITH_LEN(str), SV_GMAGIC|SV_SMAGIC) #define sv_setpvs(sv, str) Perl_sv_setpvn(aTHX_ sv, STR_WITH_LEN(str)) #define sv_setpvs_mg(sv, str) Perl_sv_setpvn_mg(aTHX_ sv, STR_WITH_LEN(str)) -#define sv_setref_pvs(rv, classname, str) \ +#define sv_setref_pvs(rv, classname, str) \ Perl_sv_setref_pvn(aTHX_ rv, classname, STR_WITH_LEN(str)) #define savepvs(str) Perl_savepvn(aTHX_ STR_WITH_LEN(str)) #define savesharedpvs(str) Perl_savesharedpvn(aTHX_ STR_WITH_LEN(str)) -#define gv_stashpvs(str, create) \ +#define gv_stashpvs(str, create) \ Perl_gv_stashpvn(aTHX_ STR_WITH_LEN(str), create) -#define gv_fetchpvs(namebeg, flags, sv_type) \ +#define gv_fetchpvs(namebeg, flags, sv_type) \ Perl_gv_fetchpvn_flags(aTHX_ STR_WITH_LEN(namebeg), flags, sv_type) #define gv_fetchpvn gv_fetchpvn_flags -#define sv_catxmlpvs(dsv, str, utf8) \ +#define sv_catxmlpvs(dsv, str, utf8) \ Perl_sv_catxmlpvn(aTHX_ dsv, STR_WITH_LEN(str), utf8) #define lex_stuff_pvs(pv,flags) Perl_lex_stuff_pvn(aTHX_ STR_WITH_LEN(pv), flags) -#define get_cvs(str, flags) \ - Perl_get_cvn_flags(aTHX_ STR_WITH_LEN(str), (flags)) +#define get_cvs(str, flags) \ + Perl_get_cvn_flags(aTHX_ STR_WITH_LEN(str), (flags)) /* internal helpers */ /* Transitional */ @@ -508,12 +508,12 @@ Perl_xxx(aTHX_ ...) form for any API calls where it's used. # undef PERL_SUBVERSION #endif -#define PERL_JNP_TO_DECIMAL_(maJor,miNor,Patch) \ - /* '10*' leaves room for things like alpha, beta, releases */ \ - (10 * ((maJor) * 1000000) + ((miNor) * 1000) + (Patch)) -#define PERL_DECIMAL_VERSION_ \ - PERL_JNP_TO_DECIMAL_(PERL_VERSION_MAJOR, PERL_VERSION_MINOR, \ - PERL_VERSION_PATCH) +#define PERL_JNP_TO_DECIMAL_(maJor,miNor,Patch) \ + /* '10*' leaves room for things like alpha, beta, releases */ \ + (10 * ((maJor) * 1000000) + ((miNor) * 1000) + (Patch)) +#define PERL_DECIMAL_VERSION_ \ + PERL_JNP_TO_DECIMAL_(PERL_VERSION_MAJOR, PERL_VERSION_MINOR, \ + PERL_VERSION_PATCH) /* =for apidoc_section $versioning @@ -566,25 +566,25 @@ becomes /* N.B. These don't work if the patch version is 42 or 92, as those are what * '*' is in ASCII and EBCDIC respectively */ -# define PERL_VERSION_EQ(j,n,p) \ - (((p) == '*') \ - ? ( (j) == PERL_VERSION_MAJOR \ - && (n) == PERL_VERSION_MINOR) \ - : (PERL_DECIMAL_VERSION_ == PERL_JNP_TO_DECIMAL_(j,n,p))) +# define PERL_VERSION_EQ(j,n,p) \ + (((p) == '*') \ + ? ( (j) == PERL_VERSION_MAJOR \ + && (n) == PERL_VERSION_MINOR) \ + : (PERL_DECIMAL_VERSION_ == PERL_JNP_TO_DECIMAL_(j,n,p))) # define PERL_VERSION_NE(j,n,p) (! PERL_VERSION_EQ(j,n,p)) -# define PERL_VERSION_LT(j,n,p) \ - /* < '*' effectively means < 0 */\ - (PERL_DECIMAL_VERSION_ < PERL_JNP_TO_DECIMAL_( (j), \ - (n), \ - (((p) == '*') ? 0 : p))) +# define PERL_VERSION_LT(j,n,p) \ + /* < '*' effectively means < 0 */ \ + (PERL_DECIMAL_VERSION_ < PERL_JNP_TO_DECIMAL_( (j), \ + (n), \ + (((p) == '*') ? 0 : p))) # define PERL_VERSION_GE(j,n,p) (! PERL_VERSION_LT(j,n,p)) -# define PERL_VERSION_LE(j,n,p) \ - /* <= '*' effectively means < n+1 */\ - (PERL_DECIMAL_VERSION_ < PERL_JNP_TO_DECIMAL_( (j), \ - (((p) == '*') ? ((n)+1) : (n)), \ - (((p) == '*') ? 0 : p))) +# define PERL_VERSION_LE(j,n,p) \ + /* <= '*' effectively means < n+1 */ \ + (PERL_DECIMAL_VERSION_ < PERL_JNP_TO_DECIMAL_( (j), \ + (((p) == '*') ? ((n)+1) : (n)), \ + (((p) == '*') ? 0 : p))) # define PERL_VERSION_GT(j,n,p) (! PERL_VERSION_LE(j,n,p)) /* @@ -716,8 +716,8 @@ based on the underlying C library functions): #define memNE(s1,s2,l) (! memEQ(s1,s2,l)) /* memEQ and memNE where second comparand is a string constant */ -#define memEQs(s1, l, s2) \ - (((sizeof(s2)-1) == (l)) && memEQ((s1), ASSERT_IS_LITERAL(s2), (sizeof(s2)-1))) +#define memEQs(s1, l, s2) \ + (((sizeof(s2)-1) == (l)) && memEQ((s1), ASSERT_IS_LITERAL(s2), (sizeof(s2)-1))) #define memNEs(s1, l, s2) (! memEQs(s1, l, s2)) /* Keep these private until we decide it was a good idea */ @@ -725,18 +725,18 @@ based on the underlying C library functions): #define strBEGINs(s1,s2) (strncmp(s1,ASSERT_IS_LITERAL(s2), sizeof(s2)-1) == 0) -#define memBEGINs(s1, l, s2) \ - ( (Ptrdiff_t) (l) >= (Ptrdiff_t) sizeof(s2) - 1 \ - && memEQ(s1, ASSERT_IS_LITERAL(s2), sizeof(s2)-1)) -#define memBEGINPs(s1, l, s2) \ - ( (Ptrdiff_t) (l) > (Ptrdiff_t) sizeof(s2) - 1 \ - && memEQ(s1, ASSERT_IS_LITERAL(s2), sizeof(s2)-1)) -#define memENDs(s1, l, s2) \ - ( (Ptrdiff_t) (l) >= (Ptrdiff_t) sizeof(s2) - 1 \ - && memEQ(s1 + (l) - (sizeof(s2) - 1), ASSERT_IS_LITERAL(s2), sizeof(s2)-1)) -#define memENDPs(s1, l, s2) \ - ( (Ptrdiff_t) (l) > (Ptrdiff_t) sizeof(s2) \ - && memEQ(s1 + (l) - (sizeof(s2) - 1), ASSERT_IS_LITERAL(s2), sizeof(s2)-1)) +#define memBEGINs(s1, l, s2) \ + ( (Ptrdiff_t) (l) >= (Ptrdiff_t) sizeof(s2) - 1 \ + && memEQ(s1, ASSERT_IS_LITERAL(s2), sizeof(s2)-1)) +#define memBEGINPs(s1, l, s2) \ + ( (Ptrdiff_t) (l) > (Ptrdiff_t) sizeof(s2) - 1 \ + && memEQ(s1, ASSERT_IS_LITERAL(s2), sizeof(s2)-1)) +#define memENDs(s1, l, s2) \ + ( (Ptrdiff_t) (l) >= (Ptrdiff_t) sizeof(s2) - 1 \ + && memEQ(s1 + (l) - (sizeof(s2) - 1), ASSERT_IS_LITERAL(s2), sizeof(s2)-1)) +#define memENDPs(s1, l, s2) \ + ( (Ptrdiff_t) (l) > (Ptrdiff_t) sizeof(s2) \ + && memEQ(s1 + (l) - (sizeof(s2) - 1), ASSERT_IS_LITERAL(s2), sizeof(s2)-1)) #endif /* End of making macros private */ #define memLT(s1,s2,l) (memcmp(s1,s2,l) < 0) @@ -1457,9 +1457,9 @@ or casts #ifndef __COVERITY__ /* The '| 0' part in ASSERT_NOT_PTR ensures a compiler error if c is not * integer (like e.g., a pointer) */ -# define FITS_IN_8_BITS(c) \ - ( (sizeof(c) == 1)\ - || (((WIDEST_UTYPE) ASSERT_NOT_PTR(c)) >> 8) == 0) +# define FITS_IN_8_BITS(c) \ + ( (sizeof(c) == 1) \ + || (((WIDEST_UTYPE) ASSERT_NOT_PTR(c)) >> 8) == 0) #else # define FITS_IN_8_BITS(c) (1) #endif @@ -1469,9 +1469,9 @@ or casts * needed. (The NV casts stop any warnings about comparison always being true * if called with an unsigned. The cast preserves the sign, which is all we * care about.) */ -#define withinCOUNT(c, l, n) \ - (__ASSERT_((NV) (l) >= 0)\ - __ASSERT_((NV) (n) >= 0) \ +#define withinCOUNT(c, l, n) \ + (__ASSERT_((NV) (l) >= 0) \ + __ASSERT_((NV) (n) >= 0) \ withinCOUNT_KNOWN_VALID_((c), (l), (n))) /* For internal use only, this can be used in places where it is known that the @@ -1479,26 +1479,26 @@ or casts * inRANGE() below, calls this several times, but does all the necessary * asserts itself, once. The reason that this is necessary is that the * duplicate asserts were exceeding the internal limits of some compilers */ -#define withinCOUNT_KNOWN_VALID_(c, l, n) \ - ((((WIDEST_UTYPE) (c)) - ASSERT_NOT_PTR(l)) \ +#define withinCOUNT_KNOWN_VALID_(c, l, n) \ + ((((WIDEST_UTYPE) (c)) - ASSERT_NOT_PTR(l)) \ <= ((WIDEST_UTYPE) ASSERT_NOT_PTR(n))) /* Returns true if c is in the range l..u, where 'l' is non-negative * Written this way so that after optimization, only one conditional test is * needed. */ -#define inRANGE(c, l, u) \ - (__ASSERT_((NV) (l) >= 0) __ASSERT_((u) >= (l))\ - ( (sizeof(c) == sizeof(U8)) ? inRANGE_helper_(U8, (c), (l), ((u))) \ - : (sizeof(c) == sizeof(U16)) ? inRANGE_helper_(U16,(c), (l), ((u))) \ - : (sizeof(c) == sizeof(U32)) ? inRANGE_helper_(U32,(c), (l), ((u))) \ - : (__ASSERT_(sizeof(c) == sizeof(WIDEST_UTYPE)) \ - inRANGE_helper_(WIDEST_UTYPE,(c), (l), ((u)))))) +#define inRANGE(c, l, u) \ + (__ASSERT_((NV) (l) >= 0) __ASSERT_((u) >= (l)) \ + ( (sizeof(c) == sizeof(U8)) ? inRANGE_helper_(U8, (c), (l), ((u))) \ + : (sizeof(c) == sizeof(U16)) ? inRANGE_helper_(U16,(c), (l), ((u))) \ + : (sizeof(c) == sizeof(U32)) ? inRANGE_helper_(U32,(c), (l), ((u))) \ + : (__ASSERT_(sizeof(c) == sizeof(WIDEST_UTYPE)) \ + inRANGE_helper_(WIDEST_UTYPE,(c), (l), ((u)))))) /* For internal use, this is used by machine-generated code which generates * known valid calls, with a known sizeof(). This avoids the extra code and * asserts that were exceeding internal limits of some compilers. */ -#define inRANGE_helper_(cast, c, l, u) \ - withinCOUNT_KNOWN_VALID_(((cast) (c)), (l), ((u) - (l))) +#define inRANGE_helper_(cast, c, l, u) \ + withinCOUNT_KNOWN_VALID_(((cast) (c)), (l), ((u) - (l))) #ifdef EBCDIC # ifndef _ALL_SOURCE @@ -1627,9 +1627,9 @@ END_EXTERN_C /* For internal core Perl use only: the base macro for defining macros like * isALPHA */ -# define generic_isCC_(c, classnum) \ - cBOOL(FITS_IN_8_BITS(c)\ - && (PL_charclass[(U8) (c)] & CC_mask_(classnum))) +# define generic_isCC_(c, classnum) \ + cBOOL(FITS_IN_8_BITS(c) \ + && (PL_charclass[(U8) (c)] & CC_mask_(classnum))) /* The mask for the _A versions of the macros; it just adds in the bit for * ASCII. */ @@ -1638,10 +1638,10 @@ END_EXTERN_C /* For internal core Perl use only: the base macro for defining macros like * isALPHA_A. The foo_A version makes sure that both the desired bit and * the ASCII bit are present */ -# define generic_isCC_A_(c, classnum) \ - (FITS_IN_8_BITS(c)\ - && ((PL_charclass[(U8) (c)] & CC_mask_A_(classnum)) \ - == CC_mask_A_(classnum))) +# define generic_isCC_A_(c, classnum) \ + (FITS_IN_8_BITS(c) \ + && ((PL_charclass[(U8) (c)] & CC_mask_A_(classnum)) \ + == CC_mask_A_(classnum))) /* On ASCII platforms certain classes form a single range. It's faster to * special case these. isDIGIT is a single range on all platforms */ @@ -1692,18 +1692,18 @@ END_EXTERN_C /* Participates in a single-character fold with a character above 255 */ # if defined(PERL_IN_REGCOMP_C) || defined(PERL_IN_REGEXEC_C) -# define HAS_NONLATIN1_SIMPLE_FOLD_CLOSURE(c) \ - (( ! cBOOL(FITS_IN_8_BITS(c))) \ - || (PL_charclass[(U8) (c)] & CC_mask_(CC_NONLATIN1_SIMPLE_FOLD_))) +# define HAS_NONLATIN1_SIMPLE_FOLD_CLOSURE(c) \ + (( ! cBOOL(FITS_IN_8_BITS(c))) \ + || (PL_charclass[(U8) (c)] & CC_mask_(CC_NONLATIN1_SIMPLE_FOLD_))) # define IS_NON_FINAL_FOLD(c) generic_isCC_(c, CC_NON_FINAL_FOLD_) # define IS_IN_SOME_FOLD_L1(c) generic_isCC_(c, CC_IS_IN_SOME_FOLD_) # endif /* Like the above, but also can be part of a multi-char fold */ -# define HAS_NONLATIN1_FOLD_CLOSURE(c) \ - ( (! cBOOL(FITS_IN_8_BITS(c))) \ - || (PL_charclass[(U8) (c)] & CC_mask_(CC_NONLATIN1_FOLD_))) +# define HAS_NONLATIN1_FOLD_CLOSURE(c) \ + ( (! cBOOL(FITS_IN_8_BITS(c))) \ + || (PL_charclass[(U8) (c)] & CC_mask_(CC_NONLATIN1_FOLD_))) # define _isQUOTEMETA(c) generic_isCC_(c, CC_QUOTEMETA_) @@ -1719,44 +1719,44 @@ END_EXTERN_C * avoid EBCDIC vs. ASCII #ifdef's as much as possible. */ # define isDIGIT_A(c) inRANGE(c, '0', '9') # define isBLANK_A(c) ((c) == ' ' || (c) == '\t') -# define isSPACE_A(c) \ - (isBLANK_A(c)\ - || (c) == '\n' \ - || (c) == '\r' \ - || (c) == '\v' \ - || (c) == '\f') +# define isSPACE_A(c) \ + (isBLANK_A(c) \ + || (c) == '\n' \ + || (c) == '\r' \ + || (c) == '\v' \ + || (c) == '\f') /* On EBCDIC, there are gaps between 'i' and 'j'; 'r' and 's'. Same for * uppercase. The tests for those aren't necessary on ASCII, but hurt only * performance (if optimization isn't on), and allow the same code to be * used for both platform types */ -# define isLOWER_A(c) \ - inRANGE((c), 'a', 'i')\ - || inRANGE((c), 'j', 'r') \ - || inRANGE((c), 's', 'z') -# define isUPPER_A(c) \ - inRANGE((c), 'A', 'I')\ - || inRANGE((c), 'J', 'R') \ - || inRANGE((c), 'S', 'Z') +# define isLOWER_A(c) \ + inRANGE((c), 'a', 'i') \ + || inRANGE((c), 'j', 'r') \ + || inRANGE((c), 's', 'z') +# define isUPPER_A(c) \ + inRANGE((c), 'A', 'I') \ + || inRANGE((c), 'J', 'R') \ + || inRANGE((c), 'S', 'Z') # define isALPHA_A(c) (isUPPER_A(c) || isLOWER_A(c)) # define isALPHANUMERIC_A(c) (isALPHA_A(c) || isDIGIT_A(c)) # define isWORDCHAR_A(c) (isALPHANUMERIC_A(c) || (c) == '_') # define isIDFIRST_A(c) (isALPHA_A(c) || (c) == '_') -# define isXDIGIT_A(c) \ - ( isDIGIT_A(c)\ - || inRANGE((c), 'a', 'f') \ - || inRANGE((c), 'A', 'F') -# define isPUNCT_A(c) \ - ((c) == '-' || (c) == '!' || (c) == '"'\ - || (c) == '#' || (c) == '$' || (c) == '%' \ - || (c) == '&' || (c) == '\'' || (c) == '(' \ - || (c) == ')' || (c) == '*' || (c) == '+' \ - || (c) == ',' || (c) == '.' || (c) == '/' \ - || (c) == ':' || (c) == ';' || (c) == '<' \ - || (c) == '=' || (c) == '>' || (c) == '?' \ - || (c) == '@' || (c) == '[' || (c) == '\\' \ - || (c) == ']' || (c) == '^' || (c) == '_' \ - || (c) == '`' || (c) == '{' || (c) == '|' \ - || (c) == '}' || (c) == '~') +# define isXDIGIT_A(c) \ + ( isDIGIT_A(c) \ + || inRANGE((c), 'a', 'f') \ + || inRANGE((c), 'A', 'F') +# define isPUNCT_A(c) \ + ((c) == '-' || (c) == '!' || (c) == '"' \ + || (c) == '#' || (c) == '$' || (c) == '%' \ + || (c) == '&' || (c) == '\'' || (c) == '(' \ + || (c) == ')' || (c) == '*' || (c) == '+' \ + || (c) == ',' || (c) == '.' || (c) == '/' \ + || (c) == ':' || (c) == ';' || (c) == '<' \ + || (c) == '=' || (c) == '>' || (c) == '?' \ + || (c) == '@' || (c) == '[' || (c) == '\\' \ + || (c) == ']' || (c) == '^' || (c) == '_' \ + || (c) == '`' || (c) == '{' || (c) == '|' \ + || (c) == '}' || (c) == '~') # define isGRAPH_A(c) (isALPHANUMERIC_A(c) || isPUNCT_A(c)) # define isPRINT_A(c) (isGRAPH_A(c) || (c) == ' ') @@ -1764,26 +1764,26 @@ END_EXTERN_C /* The below is accurate for the 3 EBCDIC code pages traditionally * supported by perl. The only difference between them in the controls * is the position of \n, and that is represented symbolically below */ -# define isCNTRL_A(c) \ - ((c) == '\0' || (c) == '\a' || (c) == '\b'\ - || (c) == '\f' || (c) == '\n' || (c) == '\r' \ - || (c) == '\t' || (c) == '\v' \ - || inRANGE((c), 1, 3) /* SOH, STX, ETX */ \ - || (c) == 7F /* U+7F DEL */ \ - || inRANGE((c), 0x0E, 0x13) /* SO SI DLE \ - DC[1-3] */ \ - || (c) == 0x18 /* U+18 CAN */ \ - || (c) == 0x19 /* U+19 EOM */ \ - || inRANGE((c), 0x1C, 0x1F) /* [FGRU]S */ \ - || (c) == 0x26 /* U+17 ETB */ \ - || (c) == 0x27 /* U+1B ESC */ \ - || (c) == 0x2D /* U+05 ENQ */ \ - || (c) == 0x2E /* U+06 ACK */ \ - || (c) == 0x32 /* U+16 SYN */ \ - || (c) == 0x37 /* U+04 EOT */ \ - || (c) == 0x3C /* U+14 DC4 */ \ - || (c) == 0x3D /* U+15 NAK */ \ - || (c) == 0x3F)/* U+1A SUB */ +# define isCNTRL_A(c) \ + ((c) == '\0' || (c) == '\a' || (c) == '\b' \ + || (c) == '\f' || (c) == '\n' || (c) == '\r' \ + || (c) == '\t' || (c) == '\v' \ + || inRANGE((c), 1, 3) /* SOH, STX, ETX */ \ + || (c) == 7F /* U+7F DEL */ \ + || inRANGE((c), 0x0E, 0x13) /* SO SI DLE \ + DC[1-3] */ \ + || (c) == 0x18 /* U+18 CAN */ \ + || (c) == 0x19 /* U+19 EOM */ \ + || inRANGE((c), 0x1C, 0x1F) /* [FGRU]S */ \ + || (c) == 0x26 /* U+17 ETB */ \ + || (c) == 0x27 /* U+1B ESC */ \ + || (c) == 0x2D /* U+05 ENQ */ \ + || (c) == 0x2E /* U+06 ACK */ \ + || (c) == 0x32 /* U+16 SYN */ \ + || (c) == 0x37 /* U+04 EOT */ \ + || (c) == 0x3C /* U+14 DC4 */ \ + || (c) == 0x3D /* U+15 NAK */ \ + || (c) == 0x3F)/* U+1A SUB */ # define isASCII(c) (isCNTRL_A(c) || isPRINT_A(c)) # else /* isASCII is already defined for ASCII platforms, so can use that to define isCNTRL */ @@ -1799,53 +1799,53 @@ END_EXTERN_C # endif # define isALPHA_L1(c) (isUPPER_L1(c) || isLOWER_L1(c)) # define isALPHANUMERIC_L1(c) (isALPHA_L1(c) || isDIGIT_A(c)) -# define isBLANK_L1(c) \ - (isBLANK_A(c)\ - || (FITS_IN_8_BITS(c) \ - && NATIVE_TO_LATIN1((U8) c) == 0xA0)) +# define isBLANK_L1(c) \ + (isBLANK_A(c) \ + || (FITS_IN_8_BITS(c) \ + && NATIVE_TO_LATIN1((U8) c) == 0xA0)) # define isCNTRL_L1(c) (FITS_IN_8_BITS(c) && (! isPRINT_L1(c))) # define isGRAPH_L1(c) (isPRINT_L1(c) && (! isBLANK_L1(c))) -# define isLOWER_L1(c) \ - (isLOWER_A(c)\ - || (FITS_IN_8_BITS(c) \ - && (( NATIVE_TO_LATIN1((U8) c) >= 0xDF \ - && NATIVE_TO_LATIN1((U8) c) != 0xF7) \ - || NATIVE_TO_LATIN1((U8) c) == 0xAA \ - || NATIVE_TO_LATIN1((U8) c) == 0xBA \ - || NATIVE_TO_LATIN1((U8) c) == 0xB5))) -# define isPRINT_L1(c) \ - (isPRINT_A(c)\ - || (FITS_IN_8_BITS(c) \ - && NATIVE_TO_LATIN1((U8) c) >= 0xA0)) -# define isPUNCT_L1(c) \ - (isPUNCT_A(c)\ - || (FITS_IN_8_BITS(c) \ - && ( NATIVE_TO_LATIN1((U8) c) == 0xA1 \ - || NATIVE_TO_LATIN1((U8) c) == 0xA7 \ - || NATIVE_TO_LATIN1((U8) c) == 0xAB \ - || NATIVE_TO_LATIN1((U8) c) == 0xB6 \ - || NATIVE_TO_LATIN1((U8) c) == 0xB7 \ - || NATIVE_TO_LATIN1((U8) c) == 0xBB \ - || NATIVE_TO_LATIN1((U8) c) == 0xBF))) -# define isSPACE_L1(c) \ - (isSPACE_A(c)\ - || (FITS_IN_8_BITS(c) \ - && ( NATIVE_TO_LATIN1((U8) c) == 0x85 \ - || NATIVE_TO_LATIN1((U8) c) == 0xA0))) -# define isUPPER_L1(c) \ - (isUPPER_A(c)\ - || (FITS_IN_8_BITS(c) \ - && ( IN_RANGE(NATIVE_TO_LATIN1((U8) c), \ - 0xC0, 0xDE) \ - && NATIVE_TO_LATIN1((U8) c) != 0xD7))) +# define isLOWER_L1(c) \ + (isLOWER_A(c) \ + || (FITS_IN_8_BITS(c) \ + && (( NATIVE_TO_LATIN1((U8) c) >= 0xDF \ + && NATIVE_TO_LATIN1((U8) c) != 0xF7) \ + || NATIVE_TO_LATIN1((U8) c) == 0xAA \ + || NATIVE_TO_LATIN1((U8) c) == 0xBA \ + || NATIVE_TO_LATIN1((U8) c) == 0xB5))) +# define isPRINT_L1(c) \ + (isPRINT_A(c) \ + || (FITS_IN_8_BITS(c) \ + && NATIVE_TO_LATIN1((U8) c) >= 0xA0)) +# define isPUNCT_L1(c) \ + (isPUNCT_A(c) \ + || (FITS_IN_8_BITS(c) \ + && ( NATIVE_TO_LATIN1((U8) c) == 0xA1 \ + || NATIVE_TO_LATIN1((U8) c) == 0xA7 \ + || NATIVE_TO_LATIN1((U8) c) == 0xAB \ + || NATIVE_TO_LATIN1((U8) c) == 0xB6 \ + || NATIVE_TO_LATIN1((U8) c) == 0xB7 \ + || NATIVE_TO_LATIN1((U8) c) == 0xBB \ + || NATIVE_TO_LATIN1((U8) c) == 0xBF))) +# define isSPACE_L1(c) \ + (isSPACE_A(c) \ + || (FITS_IN_8_BITS(c) \ + && ( NATIVE_TO_LATIN1((U8) c) == 0x85 \ + || NATIVE_TO_LATIN1((U8) c) == 0xA0))) +# define isUPPER_L1(c) \ + (isUPPER_A(c) \ + || (FITS_IN_8_BITS(c) \ + && ( IN_RANGE(NATIVE_TO_LATIN1((U8) c), \ + 0xC0, 0xDE) \ + && NATIVE_TO_LATIN1((U8) c) != 0xD7))) # define isWORDCHAR_L1(c) (isIDFIRST_L1(c) || isDIGIT_A(c)) # define isIDFIRST_L1(c) (isALPHA_L1(c) || NATIVE_TO_LATIN1(c) == '_') -# define isCHARNAME_CONT(c) \ - (isWORDCHAR_L1(c)\ - || isBLANK_L1(c) \ - || (c) == '-' \ - || (c) == '(' \ - || (c) == ')') +# define isCHARNAME_CONT(c) \ + (isWORDCHAR_L1(c) \ + || isBLANK_L1(c) \ + || (c) == '-' \ + || (c) == '(' \ + || (c) == ')') /* The following are not fully accurate in the above-ASCII range. I (khw) * don't think it's necessary to be so for the purposes where this gets * compiled */ @@ -1858,10 +1858,10 @@ END_EXTERN_C * perl.h), and so a compiler error will be generated if one is attempted * to be used. And the above-Latin1 code points require Unicode tables to * be present, something unlikely to be the case when bootstrapping */ -# define generic_isCC_(c, classnum) \ - (FITS_IN_8_BITS(c) && S_bootstrap_ctype((U8) (c), (classnum), TRUE)) -# define generic_isCC_A_(c, classnum) \ - (FITS_IN_8_BITS(c) && S_bootstrap_ctype((U8) (c), (classnum), FALSE)) +# define generic_isCC_(c, classnum) \ + (FITS_IN_8_BITS(c) && S_bootstrap_ctype((U8) (c), (classnum), TRUE)) +# define generic_isCC_A_(c, classnum) \ + (FITS_IN_8_BITS(c) && S_bootstrap_ctype((U8) (c), (classnum), FALSE)) #endif /* End of no perl.h H_PERL */ #define isALPHANUMERIC(c) isALPHANUMERIC_A(c) @@ -1909,18 +1909,18 @@ END_EXTERN_C #define toTITLE_A(c) toTITLE(c) /* Use table lookup for speed; returns the input itself if is out-of-range */ -#define toLOWER_LATIN1(c) \ - ((! FITS_IN_8_BITS(c))\ - ? (c) \ +#define toLOWER_LATIN1(c) \ + ((! FITS_IN_8_BITS(c)) \ + ? (c) \ : PL_latin1_lc[ (U8) (c) ]) #define toLOWER_L1(c) toLOWER_LATIN1(c) /* Synonym for consistency */ /* Modified uc. Is correct uc except for three non-ascii chars which are * all mapped to one of them, and these need special handling; returns the * input itself if is out-of-range */ -#define toUPPER_LATIN1_MOD(c) \ - ((! FITS_IN_8_BITS(c))\ - ? (c) \ +#define toUPPER_LATIN1_MOD(c) \ + ((! FITS_IN_8_BITS(c)) \ + ? (c) \ : PL_mod_latin1_uc[ (U8) (c) ]) #ifdef USE_LOCALE_CTYPE # define IN_UTF8_CTYPE_LOCALE PL_in_utf8_CTYPE_locale @@ -1940,21 +1940,21 @@ END_EXTERN_C * test this is passed in 'non_utf8'. If 'c' is above 255, 0 is returned. For * accessing the full range of possible code points under locale rules, use the * macros based on generic_LC_uvchr_ instead of this. */ -#define generic_LC_base_(c, classnum, non_utf8_func) \ - (! FITS_IN_8_BITS(c) \ - ? 0 \ - : IN_UTF8_CTYPE_LOCALE \ - ? cBOOL(PL_charclass[(U8) (c)] & CC_mask_(classnum)) \ - : cBOOL(non_utf8_func(c))) +#define generic_LC_base_(c, classnum, non_utf8_func) \ + (! FITS_IN_8_BITS(c) \ + ? 0 \ + : IN_UTF8_CTYPE_LOCALE \ + ? cBOOL(PL_charclass[(U8) (c)] & CC_mask_(classnum)) \ + : cBOOL(non_utf8_func(c))) /* A helper macro for defining macros like isALPHA_LC. On systems without * proper locales, these reduce to, e.g., isALPHA_A */ #ifdef CTYPE256 # define generic_LC_(c, classnum, non_utf8_func) \ - generic_LC_base_(c, classnum, non_utf8_func) + generic_LC_base_(c, classnum, non_utf8_func) #else # define generic_LC_(c, classnum, non_utf8_func) \ - generic_isCC_A_(c, classnum) + generic_isCC_A_(c, classnum) #endif /* Below are the definitions for the locale-sensitive character classification @@ -2005,26 +2005,26 @@ END_EXTERN_C * ispunct(), and things that are \W, like ispunct(), arent't controls. Not * all possible weirdnesses are checked for, just ones that were detected on * actual Microsoft code pages */ -# define is_base_ALPHA(c) \ - (isalpha((U8) (c)) && ! is_base_PUNCT(c)) -# define is_base_ALPHANUMERIC(c) \ - (isalnum((U8) (c)) && ! is_base_PUNCT(c)) -# define is_base_CASED(c) \ - ((isupper((U8) (c)) || islower((U8) (c))) && ! is_base_PUNCT(c)) -# define is_base_DIGIT(c) \ - (isdigit((U8) (c)) && ! is_base_PUNCT(c)) -# define is_base_GRAPH(c) \ - (isgraph((U8) (c)) && ! is_base_CNTRL(c)) -# define is_base_LOWER(c) \ - (islower((U8) (c)) && ! is_base_PUNCT(c)) -# define is_base_PRINT(c) \ - (isprint((U8) (c)) && ! is_base_CNTRL(c)) -# define is_base_PUNCT(c) \ - (ispunct((U8) (c)) && ! is_base_CNTRL(c)) -# define is_base_UPPER(c) \ - (isupper((U8) (c)) && ! is_base_PUNCT(c)) -# define is_base_XDIGIT(c) \ - (isxdigit((U8) (c)) && ! is_base_PUNCT(c)) +# define is_base_ALPHA(c) \ + (isalpha((U8) (c)) && ! is_base_PUNCT(c)) +# define is_base_ALPHANUMERIC(c) \ + (isalnum((U8) (c)) && ! is_base_PUNCT(c)) +# define is_base_CASED(c) \ + ((isupper((U8) (c)) || islower((U8) (c))) && ! is_base_PUNCT(c)) +# define is_base_DIGIT(c) \ + (isdigit((U8) (c)) && ! is_base_PUNCT(c)) +# define is_base_GRAPH(c) \ + (isgraph((U8) (c)) && ! is_base_CNTRL(c)) +# define is_base_LOWER(c) \ + (islower((U8) (c)) && ! is_base_PUNCT(c)) +# define is_base_PRINT(c) \ + (isprint((U8) (c)) && ! is_base_CNTRL(c)) +# define is_base_PUNCT(c) \ + (ispunct((U8) (c)) && ! is_base_CNTRL(c)) +# define is_base_UPPER(c) \ + (isupper((U8) (c)) && ! is_base_PUNCT(c)) +# define is_base_XDIGIT(c) \ + (isxdigit((U8) (c)) && ! is_base_PUNCT(c)) #else /* For all other platforms, as far as we know, isdigit(), etc. work sanely @@ -2063,8 +2063,8 @@ END_EXTERN_C # define WRAP_U8_LC_(c, classnum, base) base(c) -#define isU8_ALPHANUMERIC_LC(c) \ - WRAP_U8_LC_((c), CC_ALPHANUMERIC_, is_base_ALPHANUMERIC) +#define isU8_ALPHANUMERIC_LC(c) \ + WRAP_U8_LC_((c), CC_ALPHANUMERIC_, is_base_ALPHANUMERIC) #define isU8_ALPHA_LC(c) WRAP_U8_LC_((c), CC_ALPHA_, is_base_ALPHA) #define isU8_ASCII_LC(c) WRAP_U8_LC_((c), CC_ASCII_, is_base_ASCII) #define isU8_BLANK_LC(c) WRAP_U8_LC_((c), CC_BLANK_, is_base_BLANK) @@ -2094,8 +2094,8 @@ END_EXTERN_C #define isASCII_LC(c) (FITS_IN_8_BITS(c) && isU8_ASCII_LC(c)) #define isALPHA_LC(c) generic_LC_(c, CC_ALPHA_, isU8_ALPHA_LC) -#define isALPHANUMERIC_LC(c) \ - generic_LC_(c, CC_ALPHANUMERIC_, isU8_ALPHANUMERIC_LC) +#define isALPHANUMERIC_LC(c) \ + generic_LC_(c, CC_ALPHANUMERIC_, isU8_ALPHANUMERIC_LC) #define isBLANK_LC(c) generic_LC_(c, CC_BLANK_, isU8_BLANK_LC) #define isCASED_LC(c) generic_LC_(c, CC_CASED_, isU8_CASED_LC) #define isCNTRL_LC(c) generic_LC_(c, CC_CNTRL_, isU8_CNTRL_LC) @@ -2121,12 +2121,12 @@ END_EXTERN_C * conform to the Unicode standard. */ /* This does not handle the anomalies in UTF-8 Turkic locales. */ -# define toLOWER_LC(c) \ - ((! FITS_IN_8_BITS(c))\ - ? (c) \ - : ((IN_UTF8_CTYPE_LOCALE) \ - ? PL_latin1_lc[ (U8) (c) ] \ - : ((U8) toU8_LOWER_LC(c)))) +# define toLOWER_LC(c) \ + ((! FITS_IN_8_BITS(c)) \ + ? (c) \ + : ((IN_UTF8_CTYPE_LOCALE) \ + ? PL_latin1_lc[ (U8) (c) ] \ + : ((U8) toU8_LOWER_LC(c)))) /* In this macro, note that the result can be larger than a byte in a UTF-8 * locale. It returns a single value, so can't adequately return the upper @@ -2134,18 +2134,18 @@ END_EXTERN_C * string of two values "SS"); instead it asserts against that under * DEBUGGING, and otherwise returns its input. It does not handle the * anomalies in UTF-8 Turkic locales. */ -# define toUPPER_LC(c) \ - ((! FITS_IN_8_BITS(c)) \ - ? (c) \ - : ((! IN_UTF8_CTYPE_LOCALE) \ - ? ((U8) toU8_UPPER_LC(c)) \ - : (UNLIKELY(((U8)(c)) == MICRO_SIGN) \ - ? GREEK_CAPITAL_LETTER_MU \ - : ((UNLIKELY(((U8) (c)) == LATIN_SMALL_LETTER_Y_WITH_DIAERESIS) \ - ? LATIN_CAPITAL_LETTER_Y_WITH_DIAERESIS \ - : (UNLIKELY(((U8)(c)) == LATIN_SMALL_LETTER_SHARP_S) \ - ? (__ASSERT_(0) (c)) /* Fail on Sharp S in DEBUGGING */ \ - : PL_mod_latin1_uc[ (U8) (c) ])))))) +# define toUPPER_LC(c) \ + ((! FITS_IN_8_BITS(c)) \ + ? (c) \ + : ((! IN_UTF8_CTYPE_LOCALE) \ + ? ((U8) toU8_UPPER_LC(c)) \ + : (UNLIKELY(((U8)(c)) == MICRO_SIGN) \ + ? GREEK_CAPITAL_LETTER_MU \ + : ((UNLIKELY(((U8) (c)) == LATIN_SMALL_LETTER_Y_WITH_DIAERESIS) \ + ? LATIN_CAPITAL_LETTER_Y_WITH_DIAERESIS \ + : (UNLIKELY(((U8)(c)) == LATIN_SMALL_LETTER_SHARP_S) \ + ? (__ASSERT_(0) (c)) /* Fail on Sharp S in DEBUGGING */ \ + : PL_mod_latin1_uc[ (U8) (c) ])))))) /* In this macro, note that the result can be larger than a byte in a UTF-8 * locale. It returns a single value, so can't adequately return the fold case @@ -2153,12 +2153,12 @@ END_EXTERN_C * two values "ss"); instead it asserts against that under DEBUGGING, and * otherwise returns its input. It does not handle the anomalies in UTF-8 * Turkic locales */ -# define toFOLD_LC(c) \ - ((UNLIKELY((c) == MICRO_SIGN) && IN_UTF8_CTYPE_LOCALE) \ - ? GREEK_SMALL_LETTER_MU \ - : (__ASSERT_( ! IN_UTF8_CTYPE_LOCALE \ - || LIKELY((c) != LATIN_SMALL_LETTER_SHARP_S)) \ - toLOWER_LC(c))) +# define toFOLD_LC(c) \ + ((UNLIKELY((c) == MICRO_SIGN) && IN_UTF8_CTYPE_LOCALE) \ + ? GREEK_SMALL_LETTER_MU \ + : (__ASSERT_( ! IN_UTF8_CTYPE_LOCALE \ + || LIKELY((c) != LATIN_SMALL_LETTER_SHARP_S)) \ + toLOWER_LC(c))) #endif #define isIDCONT(c) isWORDCHAR(c) @@ -2181,13 +2181,13 @@ END_EXTERN_C * don't, but experiments show that gcc optimizes them out anyway. */ /* Note that all ignore 'use bytes' */ -#define generic_uvchr_(classnum, above_latin1, c) \ - ((c) < 256\ +#define generic_uvchr_(classnum, above_latin1, c) \ + ((c) < 256 \ ? generic_isCC_(c, classnum) \ : above_latin1(c)) -#define generic_invlist_uvchr_(classnum, c) \ - ((c) < 256\ - ? generic_isCC_(c, classnum) \ +#define generic_invlist_uvchr_(classnum, c) \ + ((c) < 256 \ + ? generic_isCC_(c, classnum) \ : _is_uni_FOO(classnum, c)) #define isALPHA_uvchr(c) generic_invlist_uvchr_(CC_ALPHA_, c) #define isALPHANUMERIC_uvchr(c) generic_invlist_uvchr_(CC_ALPHANUMERIC_, c) @@ -2196,10 +2196,10 @@ END_EXTERN_C #define isCNTRL_uvchr(c) isCNTRL_L1(c) /* All controls are in Latin1 */ #define isDIGIT_uvchr(c) generic_invlist_uvchr_(CC_DIGIT_, c) #define isGRAPH_uvchr(c) generic_invlist_uvchr_(CC_GRAPH_, c) -#define isIDCONT_uvchr(c) \ - generic_uvchr_(CC_WORDCHAR_, _is_uni_perl_idcont, c) -#define isIDFIRST_uvchr(c) \ - generic_uvchr_(CC_IDFIRST_, _is_uni_perl_idstart, c) +#define isIDCONT_uvchr(c) \ + generic_uvchr_(CC_WORDCHAR_, _is_uni_perl_idcont, c) +#define isIDFIRST_uvchr(c) \ + generic_uvchr_(CC_IDFIRST_, _is_uni_perl_idstart, c) #define isLOWER_uvchr(c) generic_invlist_uvchr_(CC_LOWER_, c) #define isPRINT_uvchr(c) generic_invlist_uvchr_(CC_PRINT_, c) @@ -2247,41 +2247,41 @@ END_EXTERN_C * point, not just 0-255. Like generic_uvchr_, there are two versions, one for * simple class definitions; the other for more complex. These are like * generic_uvchr_, so see it for more info. */ -#define generic_LC_uvchr_(latin1, above_latin1, c) \ - (c < 256 ? latin1(c) : above_latin1(c)) -#define generic_LC_invlist_uvchr_(latin1, classnum, c) \ - (c < 256 ? latin1(c) : _is_uni_FOO(classnum, c)) +#define generic_LC_uvchr_(latin1, above_latin1, c) \ + (c < 256 ? latin1(c) : above_latin1(c)) +#define generic_LC_invlist_uvchr_(latin1, classnum, c) \ + (c < 256 ? latin1(c) : _is_uni_FOO(classnum, c)) #define isALPHA_LC_uvchr(c) generic_LC_invlist_uvchr_(isALPHA_LC, CC_ALPHA_, c) -#define isALPHANUMERIC_LC_uvchr(c) \ - generic_LC_invlist_uvchr_(isALPHANUMERIC_LC,\ +#define isALPHANUMERIC_LC_uvchr(c) \ + generic_LC_invlist_uvchr_(isALPHANUMERIC_LC, \ CC_ALPHANUMERIC_, c) #define isASCII_LC_uvchr(c) isASCII_LC(c) -#define isBLANK_LC_uvchr(c) \ - generic_LC_uvchr_(isBLANK_LC,\ +#define isBLANK_LC_uvchr(c) \ + generic_LC_uvchr_(isBLANK_LC, \ is_HORIZWS_cp_high, c) #define isCNTRL_LC_uvchr(c) (c < 256 ? isCNTRL_LC(c) : 0) #define isDIGIT_LC_uvchr(c) generic_LC_invlist_uvchr_(isDIGIT_LC, CC_DIGIT_, c) #define isGRAPH_LC_uvchr(c) generic_LC_invlist_uvchr_(isGRAPH_LC, CC_GRAPH_, c) -#define isIDCONT_LC_uvchr(c) \ - generic_LC_uvchr_(isIDCONT_LC,\ +#define isIDCONT_LC_uvchr(c) \ + generic_LC_uvchr_(isIDCONT_LC, \ _is_uni_perl_idcont, c) -#define isIDFIRST_LC_uvchr(c) \ - generic_LC_uvchr_(isIDFIRST_LC,\ +#define isIDFIRST_LC_uvchr(c) \ + generic_LC_uvchr_(isIDFIRST_LC, \ _is_uni_perl_idstart, c) #define isLOWER_LC_uvchr(c) generic_LC_invlist_uvchr_(isLOWER_LC, CC_LOWER_, c) #define isPRINT_LC_uvchr(c) generic_LC_invlist_uvchr_(isPRINT_LC, CC_PRINT_, c) #define isPSXSPC_LC_uvchr(c) isSPACE_LC_uvchr(c) #define isPUNCT_LC_uvchr(c) generic_LC_invlist_uvchr_(isPUNCT_LC, CC_PUNCT_, c) -#define isSPACE_LC_uvchr(c) \ - generic_LC_uvchr_(isSPACE_LC,\ +#define isSPACE_LC_uvchr(c) \ + generic_LC_uvchr_(isSPACE_LC, \ is_XPERLSPACE_cp_high, c) #define isUPPER_LC_uvchr(c) generic_LC_invlist_uvchr_(isUPPER_LC, CC_UPPER_, c) -#define isWORDCHAR_LC_uvchr(c) \ - generic_LC_invlist_uvchr_(isWORDCHAR_LC,\ +#define isWORDCHAR_LC_uvchr(c) \ + generic_LC_invlist_uvchr_(isWORDCHAR_LC, \ CC_WORDCHAR_, c) -#define isXDIGIT_LC_uvchr(c) \ - generic_LC_uvchr_(isXDIGIT_LC,\ +#define isXDIGIT_LC_uvchr(c) \ + generic_LC_uvchr_(isXDIGIT_LC, \ is_XDIGIT_cp_high, c) #define isBLANK_LC_uni(c) isBLANK_LC_uvchr(UNI_TO_NATIVE(c)) @@ -2309,44 +2309,44 @@ END_EXTERN_C # define _utf8_safe_assert(p,e) ((e) > (p)) #endif -#define generic_utf8_safe_(classnum, p, e, above_latin1) \ - ((! _utf8_safe_assert(p, e)) \ - ? (_force_out_malformed_utf8_message((U8 *) (p), (U8 *) (e), 0, 1), 0)\ - : (UTF8_IS_INVARIANT(*(p))) \ - ? generic_isCC_(*(p), classnum) \ - : (UTF8_IS_DOWNGRADEABLE_START(*(p)) \ - ? ((LIKELY((e) - (p) > 1 && UTF8_IS_CONTINUATION(*((p)+1)))) \ - ? generic_isCC_(EIGHT_BIT_UTF8_TO_NATIVE(*(p), *((p)+1 )), \ - classnum) \ - : (_force_out_malformed_utf8_message( \ - (U8 *) (p), (U8 *) (e), 0, 1), 0)) \ +#define generic_utf8_safe_(classnum, p, e, above_latin1) \ + ((! _utf8_safe_assert(p, e)) \ + ? (_force_out_malformed_utf8_message((U8 *) (p), (U8 *) (e), 0, 1), 0) \ + : (UTF8_IS_INVARIANT(*(p))) \ + ? generic_isCC_(*(p), classnum) \ + : (UTF8_IS_DOWNGRADEABLE_START(*(p)) \ + ? ((LIKELY((e) - (p) > 1 && UTF8_IS_CONTINUATION(*((p)+1)))) \ + ? generic_isCC_(EIGHT_BIT_UTF8_TO_NATIVE(*(p), *((p)+1 )), \ + classnum) \ + : (_force_out_malformed_utf8_message( \ + (U8 *) (p), (U8 *) (e), 0, 1), 0)) \ : above_latin1)) /* Like the above, but calls 'above_latin1(p)' to get the utf8 value. * 'above_latin1' can be a macro */ -#define generic_func_utf8_safe_(classnum, above_latin1, p, e) \ - generic_utf8_safe_(classnum, p, e, above_latin1(p, e)) -#define generic_non_invlist_utf8_safe_(classnum, above_latin1, p, e) \ - generic_utf8_safe_(classnum, p, e, \ - (UNLIKELY((e) - (p) < UTF8SKIP(p)) \ - ? (_force_out_malformed_utf8_message( \ - (U8 *) (p), (U8 *) (e), 0, 1), 0) \ - : above_latin1(p))) +#define generic_func_utf8_safe_(classnum, above_latin1, p, e) \ + generic_utf8_safe_(classnum, p, e, above_latin1(p, e)) +#define generic_non_invlist_utf8_safe_(classnum, above_latin1, p, e) \ + generic_utf8_safe_(classnum, p, e, \ + (UNLIKELY((e) - (p) < UTF8SKIP(p)) \ + ? (_force_out_malformed_utf8_message( \ + (U8 *) (p), (U8 *) (e), 0, 1), 0) \ + : above_latin1(p))) /* Like the above, but passes classnum to _isFOO_utf8(), instead of having an * 'above_latin1' parameter */ -#define generic_invlist_utf8_safe_(classnum, p, e) \ - generic_utf8_safe_(classnum, p, e, _is_utf8_FOO(classnum, p, e)) +#define generic_invlist_utf8_safe_(classnum, p, e) \ + generic_utf8_safe_(classnum, p, e, _is_utf8_FOO(classnum, p, e)) /* Like the above, but should be used only when it is known that there are no * characters in the upper-Latin1 range (128-255 on ASCII platforms) which the * class is TRUE for. Hence it can skip the tests for this range. * 'above_latin1' should include its arguments */ #define generic_utf8_safe_no_upper_latin1_(classnum, p, e, above_latin1) \ - (__ASSERT_(_utf8_safe_assert(p, e)) \ - (isASCII(*(p))) \ - ? generic_isCC_(*(p), classnum) \ - : (UTF8_IS_DOWNGRADEABLE_START(*(p))) \ - ? 0 /* Note that doesn't check validity for latin1 */ \ - : above_latin1) + (__ASSERT_(_utf8_safe_assert(p, e)) \ + (isASCII(*(p))) \ + ? generic_isCC_(*(p), classnum) \ + : (UTF8_IS_DOWNGRADEABLE_START(*(p))) \ + ? 0 /* Note that doesn't check validity for latin1 */ \ + : above_latin1) #define isALPHA_utf8(p, e) isALPHA_utf8_safe(p, e) @@ -2369,30 +2369,30 @@ END_EXTERN_C #define isXDIGIT_utf8(p, e) isXDIGIT_utf8_safe(p, e) #define isALPHA_utf8_safe(p, e) generic_invlist_utf8_safe_(CC_ALPHA_, p, e) -#define isALPHANUMERIC_utf8_safe(p, e) \ - generic_invlist_utf8_safe_(CC_ALPHANUMERIC_, p, e) -#define isASCII_utf8_safe(p, e) \ - /* Because ASCII is invariant under utf8, the non-utf8 macro \ - * works */ \ +#define isALPHANUMERIC_utf8_safe(p, e) \ + generic_invlist_utf8_safe_(CC_ALPHANUMERIC_, p, e) +#define isASCII_utf8_safe(p, e) \ + /* Because ASCII is invariant under utf8, the non-utf8 macro \ + * works */ \ (__ASSERT_(_utf8_safe_assert(p, e)) isASCII(*(p))) -#define isBLANK_utf8_safe(p, e) \ - generic_non_invlist_utf8_safe_(CC_BLANK_, is_HORIZWS_high, p, e) +#define isBLANK_utf8_safe(p, e) \ + generic_non_invlist_utf8_safe_(CC_BLANK_, is_HORIZWS_high, p, e) #ifdef EBCDIC /* Because all controls are UTF-8 invariants in EBCDIC, we can use this * more efficient macro instead of the more general one */ -# define isCNTRL_utf8_safe(p, e) \ - (__ASSERT_(_utf8_safe_assert(p, e)) isCNTRL_L1(*(p))) +# define isCNTRL_utf8_safe(p, e) \ + (__ASSERT_(_utf8_safe_assert(p, e)) isCNTRL_L1(*(p))) #else # define isCNTRL_utf8_safe(p, e) generic_utf8_safe_(CC_CNTRL_, p, e, 0) #endif -#define isDIGIT_utf8_safe(p, e) \ - generic_utf8_safe_no_upper_latin1_(CC_DIGIT_, p, e, \ - _is_utf8_FOO(CC_DIGIT_, p, e)) +#define isDIGIT_utf8_safe(p, e) \ + generic_utf8_safe_no_upper_latin1_(CC_DIGIT_, p, e, \ + _is_utf8_FOO(CC_DIGIT_, p, e)) #define isGRAPH_utf8_safe(p, e) generic_invlist_utf8_safe_(CC_GRAPH_, p, e) -#define isIDCONT_utf8_safe(p, e) \ - generic_func_utf8_safe_(CC_WORDCHAR_,\ +#define isIDCONT_utf8_safe(p, e) \ + generic_func_utf8_safe_(CC_WORDCHAR_, \ _is_utf8_perl_idcont, p, e) /* To prevent S_scan_word in toke.c from hanging, we have to make sure that @@ -2401,27 +2401,27 @@ END_EXTERN_C * ever wanted to know about. (In the ASCII range, there isn't a difference.) * This used to be not the XID version, but we decided to go with the more * modern Unicode definition */ -#define isIDFIRST_utf8_safe(p, e) \ - generic_func_utf8_safe_(CC_IDFIRST_, \ +#define isIDFIRST_utf8_safe(p, e) \ + generic_func_utf8_safe_(CC_IDFIRST_, \ _is_utf8_perl_idstart, (U8 *) (p), (U8 *) (e)) #define isLOWER_utf8_safe(p, e) generic_invlist_utf8_safe_(CC_LOWER_, p, e) #define isPRINT_utf8_safe(p, e) generic_invlist_utf8_safe_(CC_PRINT_, p, e) #define isPSXSPC_utf8_safe(p, e) isSPACE_utf8_safe(p, e) #define isPUNCT_utf8_safe(p, e) generic_invlist_utf8_safe_(CC_PUNCT_, p, e) -#define isSPACE_utf8_safe(p, e) \ +#define isSPACE_utf8_safe(p, e) \ generic_non_invlist_utf8_safe_(CC_SPACE_, is_XPERLSPACE_high, p, e) #define isUPPER_utf8_safe(p, e) generic_invlist_utf8_safe_(CC_UPPER_, p, e) -#define isVERTWS_utf8_safe(p, e) \ - generic_non_invlist_utf8_safe_(CC_VERTSPACE_, is_VERTWS_high, p, e) -#define isWORDCHAR_utf8_safe(p, e) \ - generic_invlist_utf8_safe_(CC_WORDCHAR_, p, e) -#define isXDIGIT_utf8_safe(p, e) \ - generic_utf8_safe_no_upper_latin1_(CC_XDIGIT_, p, e, \ - (UNLIKELY((e) - (p) < UTF8SKIP(p)) \ - ? (_force_out_malformed_utf8_message( \ - (U8 *) (p), (U8 *) (e), 0, 1), 0) \ - : is_XDIGIT_high(p))) +#define isVERTWS_utf8_safe(p, e) \ + generic_non_invlist_utf8_safe_(CC_VERTSPACE_, is_VERTWS_high, p, e) +#define isWORDCHAR_utf8_safe(p, e) \ + generic_invlist_utf8_safe_(CC_WORDCHAR_, p, e) +#define isXDIGIT_utf8_safe(p, e) \ + generic_utf8_safe_no_upper_latin1_(CC_XDIGIT_, p, e, \ + (UNLIKELY((e) - (p) < UTF8SKIP(p)) \ + ? (_force_out_malformed_utf8_message( \ + (U8 *) (p), (U8 *) (e), 0, 1), 0) \ + : is_XDIGIT_high(p))) #define toFOLD_utf8(p,e,s,l) toFOLD_utf8_safe(p,e,s,l) #define toLOWER_utf8(p,e,s,l) toLOWER_utf8_safe(p,e,s,l) @@ -2461,67 +2461,67 @@ END_EXTERN_C * isALPHA_LC_utf8_safe. These are like generic_utf8_, but if the first code * point in 'p' is within the 0-255 range, it uses locale rules from the * passed-in 'macro' parameter */ -#define generic_LC_utf8_safe_(macro, p, e, above_latin1) \ - (__ASSERT_(_utf8_safe_assert(p, e)) \ - (UTF8_IS_INVARIANT(*(p))) \ - ? macro(*(p)) \ - : (UTF8_IS_DOWNGRADEABLE_START(*(p)) \ - ? ((LIKELY((e) - (p) > 1 && UTF8_IS_CONTINUATION(*((p)+1)))) \ - ? macro(EIGHT_BIT_UTF8_TO_NATIVE(*(p), *((p)+1))) \ - : (_force_out_malformed_utf8_message( \ - (U8 *) (p), (U8 *) (e), 0, 1), 0)) \ - : above_latin1)) - -#define generic_LC_invlist_utf8_safe_(macro, classnum, p, e) \ - generic_LC_utf8_safe_(macro, p, e, \ - _is_utf8_FOO(classnum, p, e)) - -#define generic_LC_func_utf8_safe_(macro, above_latin1, p, e) \ - generic_LC_utf8_safe_(macro, p, e, above_latin1(p, e)) - -#define generic_LC_non_invlist_utf8_safe_(classnum, above_latin1, p, e) \ - generic_LC_utf8_safe_(classnum, p, e, \ - (UNLIKELY((e) - (p) < UTF8SKIP(p)) \ - ? (_force_out_malformed_utf8_message( \ - (U8 *) (p), (U8 *) (e), 0, 1), 0) \ - : above_latin1(p))) - -#define isALPHANUMERIC_LC_utf8_safe(p, e) \ - generic_LC_invlist_utf8_safe_(isALPHANUMERIC_LC, \ - CC_ALPHANUMERIC_, p, e) -#define isALPHA_LC_utf8_safe(p, e) \ - generic_LC_invlist_utf8_safe_(isALPHA_LC, CC_ALPHA_, p, e) -#define isASCII_LC_utf8_safe(p, e) \ - (__ASSERT_(_utf8_safe_assert(p, e)) isASCII_LC(*(p))) -#define isBLANK_LC_utf8_safe(p, e) \ - generic_LC_non_invlist_utf8_safe_(isBLANK_LC, is_HORIZWS_high, p, e) -#define isCNTRL_LC_utf8_safe(p, e) \ - generic_LC_utf8_safe_(isCNTRL_LC, p, e, 0) -#define isDIGIT_LC_utf8_safe(p, e) \ - generic_LC_invlist_utf8_safe_(isDIGIT_LC, CC_DIGIT_, p, e) -#define isGRAPH_LC_utf8_safe(p, e) \ - generic_LC_invlist_utf8_safe_(isGRAPH_LC, CC_GRAPH_, p, e) -#define isIDCONT_LC_utf8_safe(p, e) \ - generic_LC_func_utf8_safe_(isIDCONT_LC, \ - _is_utf8_perl_idcont, p, e) -#define isIDFIRST_LC_utf8_safe(p, e) \ - generic_LC_func_utf8_safe_(isIDFIRST_LC, \ - _is_utf8_perl_idstart, p, e) -#define isLOWER_LC_utf8_safe(p, e) \ - generic_LC_invlist_utf8_safe_(isLOWER_LC, CC_LOWER_, p, e) -#define isPRINT_LC_utf8_safe(p, e) \ - generic_LC_invlist_utf8_safe_(isPRINT_LC, CC_PRINT_, p, e) +#define generic_LC_utf8_safe_(macro, p, e, above_latin1) \ + (__ASSERT_(_utf8_safe_assert(p, e)) \ + (UTF8_IS_INVARIANT(*(p))) \ + ? macro(*(p)) \ + : (UTF8_IS_DOWNGRADEABLE_START(*(p)) \ + ? ((LIKELY((e) - (p) > 1 && UTF8_IS_CONTINUATION(*((p)+1)))) \ + ? macro(EIGHT_BIT_UTF8_TO_NATIVE(*(p), *((p)+1))) \ + : (_force_out_malformed_utf8_message( \ + (U8 *) (p), (U8 *) (e), 0, 1), 0)) \ + : above_latin1)) + +#define generic_LC_invlist_utf8_safe_(macro, classnum, p, e) \ + generic_LC_utf8_safe_(macro, p, e, \ + _is_utf8_FOO(classnum, p, e)) + +#define generic_LC_func_utf8_safe_(macro, above_latin1, p, e) \ + generic_LC_utf8_safe_(macro, p, e, above_latin1(p, e)) + +#define generic_LC_non_invlist_utf8_safe_(classnum, above_latin1, p, e) \ + generic_LC_utf8_safe_(classnum, p, e, \ + (UNLIKELY((e) - (p) < UTF8SKIP(p)) \ + ? (_force_out_malformed_utf8_message( \ + (U8 *) (p), (U8 *) (e), 0, 1), 0) \ + : above_latin1(p))) + +#define isALPHANUMERIC_LC_utf8_safe(p, e) \ + generic_LC_invlist_utf8_safe_(isALPHANUMERIC_LC, \ + CC_ALPHANUMERIC_, p, e) +#define isALPHA_LC_utf8_safe(p, e) \ + generic_LC_invlist_utf8_safe_(isALPHA_LC, CC_ALPHA_, p, e) +#define isASCII_LC_utf8_safe(p, e) \ + (__ASSERT_(_utf8_safe_assert(p, e)) isASCII_LC(*(p))) +#define isBLANK_LC_utf8_safe(p, e) \ + generic_LC_non_invlist_utf8_safe_(isBLANK_LC, is_HORIZWS_high, p, e) +#define isCNTRL_LC_utf8_safe(p, e) \ + generic_LC_utf8_safe_(isCNTRL_LC, p, e, 0) +#define isDIGIT_LC_utf8_safe(p, e) \ + generic_LC_invlist_utf8_safe_(isDIGIT_LC, CC_DIGIT_, p, e) +#define isGRAPH_LC_utf8_safe(p, e) \ + generic_LC_invlist_utf8_safe_(isGRAPH_LC, CC_GRAPH_, p, e) +#define isIDCONT_LC_utf8_safe(p, e) \ + generic_LC_func_utf8_safe_(isIDCONT_LC, \ + _is_utf8_perl_idcont, p, e) +#define isIDFIRST_LC_utf8_safe(p, e) \ + generic_LC_func_utf8_safe_(isIDFIRST_LC, \ + _is_utf8_perl_idstart, p, e) +#define isLOWER_LC_utf8_safe(p, e) \ + generic_LC_invlist_utf8_safe_(isLOWER_LC, CC_LOWER_, p, e) +#define isPRINT_LC_utf8_safe(p, e) \ + generic_LC_invlist_utf8_safe_(isPRINT_LC, CC_PRINT_, p, e) #define isPSXSPC_LC_utf8_safe(p, e) isSPACE_LC_utf8_safe(p, e) -#define isPUNCT_LC_utf8_safe(p, e) \ - generic_LC_invlist_utf8_safe_(isPUNCT_LC, CC_PUNCT_, p, e) -#define isSPACE_LC_utf8_safe(p, e) \ +#define isPUNCT_LC_utf8_safe(p, e) \ + generic_LC_invlist_utf8_safe_(isPUNCT_LC, CC_PUNCT_, p, e) +#define isSPACE_LC_utf8_safe(p, e) \ generic_LC_non_invlist_utf8_safe_(isSPACE_LC, is_XPERLSPACE_high, p, e) -#define isUPPER_LC_utf8_safe(p, e) \ - generic_LC_invlist_utf8_safe_(isUPPER_LC, CC_UPPER_, p, e) -#define isWORDCHAR_LC_utf8_safe(p, e) \ - generic_LC_invlist_utf8_safe_(isWORDCHAR_LC, CC_WORDCHAR_, p, e) -#define isXDIGIT_LC_utf8_safe(p, e) \ - generic_LC_non_invlist_utf8_safe_(isXDIGIT_LC, is_XDIGIT_high, p, e) +#define isUPPER_LC_utf8_safe(p, e) \ + generic_LC_invlist_utf8_safe_(isUPPER_LC, CC_UPPER_, p, e) +#define isWORDCHAR_LC_utf8_safe(p, e) \ + generic_LC_invlist_utf8_safe_(isWORDCHAR_LC, CC_WORDCHAR_, p, e) +#define isXDIGIT_LC_utf8_safe(p, e) \ + generic_LC_non_invlist_utf8_safe_(isXDIGIT_LC, is_XDIGIT_high, p, e) /* Macros for backwards compatibility and for completeness when the ASCII and * Latin1 values are identical */ @@ -2562,15 +2562,15 @@ END_EXTERN_C #ifndef EBCDIC # define toCTRL(c) (__ASSERT_(FITS_IN_8_BITS(c)) toUPPER(((U8)(c))) ^ 64) #else -# define toCTRL(c) \ - (__ASSERT_(FITS_IN_8_BITS(c))\ - ((isPRINT_A(c)) \ - ? (UNLIKELY((c) == '?') \ - ? QUESTION_MARK_CTRL \ - : (NATIVE_TO_LATIN1(toUPPER((U8) (c))) ^ 64)) \ - : (UNLIKELY((c) == QUESTION_MARK_CTRL) \ - ? '?' \ - : (LATIN1_TO_NATIVE(((U8) (c)) ^ 64))))) +# define toCTRL(c) \ + (__ASSERT_(FITS_IN_8_BITS(c)) \ + ((isPRINT_A(c)) \ + ? (UNLIKELY((c) == '?') \ + ? QUESTION_MARK_CTRL \ + : (NATIVE_TO_LATIN1(toUPPER((U8) (c))) ^ 64)) \ + : (UNLIKELY((c) == QUESTION_MARK_CTRL) \ + ? '?' \ + : (LATIN1_TO_NATIVE(((U8) (c)) ^ 64))))) #endif /* @@ -2587,16 +2587,16 @@ typedef U32 line_t; /* Helpful alias for version prescan */ #define is_LAX_VERSION(a,b) \ - (a != Perl_prescan_version(aTHX_ a, FALSE, b, NULL, NULL, NULL, NULL)) + (a != Perl_prescan_version(aTHX_ a, FALSE, b, NULL, NULL, NULL, NULL)) -#define is_STRICT_VERSION(a,b) \ - (a != Perl_prescan_version(aTHX_ a, TRUE, b, NULL, NULL, NULL, NULL)) +#define is_STRICT_VERSION(a,b) \ + (a != Perl_prescan_version(aTHX_ a, TRUE, b, NULL, NULL, NULL, NULL)) -#define BADVERSION(a,b,c) \ - if (b) { \ - *b = c; \ - } \ - return a; +#define BADVERSION(a,b,c) \ + if (b) { \ + *b = c; \ + } \ + return a; /* Converts a character KNOWN to represent a hexadecimal digit (0-9, A-F, or * a-f) to its numeric value without using any branches. The input is @@ -2607,10 +2607,10 @@ typedef U32 line_t; * position, and then to the eights position. Both are added together to form * 0 if the input is '0'-'9' and to form 9 if alpha. This is added to the * final four bits of the input to form the correct value. */ -#define XDIGIT_VALUE(c) \ - (__ASSERT_(isXDIGIT(c))\ - ((NATIVE_TO_LATIN1(c) >> 6) & 1) /* 1 if alpha; 0 if not */ \ - + ((NATIVE_TO_LATIN1(c) >> 3) & 8) /* 8 if alpha; 0 if not */ \ +#define XDIGIT_VALUE(c) \ + (__ASSERT_(isXDIGIT(c)) \ + ((NATIVE_TO_LATIN1(c) >> 6) & 1) /* 1 if alpha; 0 if not */ \ + + ((NATIVE_TO_LATIN1(c) >> 3) & 8) /* 8 if alpha; 0 if not */ \ + ((c) & 0xF)) /* 0-9 if input valid hex digit */ /* The argument is a string pointer, which is advanced. */ @@ -2635,9 +2635,9 @@ typedef U32 line_t; * exclusive 'or' to find that bit and then inverts it to form a mask, with * just a single 0, in the bit position where the upper- and lowercase differ. * */ -#define isALPHA_FOLD_EQ(c1, c2) \ - (__ASSERT_(isALPHA_A(c1) || isALPHA_A(c2)) \ - ((c1) & ~('A' ^ 'a')) == ((c2) & ~('A' ^ 'a'))) +#define isALPHA_FOLD_EQ(c1, c2) \ + (__ASSERT_(isALPHA_A(c1) || isALPHA_A(c2)) \ + ((c1) & ~('A' ^ 'a')) == ((c2) & ~('A' ^ 'a'))) #define isALPHA_FOLD_NE(c1, c2) (! isALPHA_FOLD_EQ((c1), (c2))) /* @@ -2763,9 +2763,9 @@ PoisonWith(0xEF) for catching access to freed memory. * max(n) * sizeof(t) > MEM_SIZE_MAX */ -# define _MEM_WRAP_NEEDS_RUNTIME_CHECK(n,t) \ - ( sizeof(MEM_SIZE) < sizeof(n) \ - || sizeof(t) > ((MEM_SIZE)1 << 8*(sizeof(MEM_SIZE) - sizeof(n)))) +# define _MEM_WRAP_NEEDS_RUNTIME_CHECK(n,t) \ + ( sizeof(MEM_SIZE) < sizeof(n) \ + || sizeof(t) > ((MEM_SIZE)1 << 8*(sizeof(MEM_SIZE) - sizeof(n)))) /* This is written in a slightly odd way to avoid various spurious * compiler warnings. We *want* to write the expression as @@ -2784,22 +2784,22 @@ PoisonWith(0xEF) for catching access to freed memory. * for X and hope that nothing else whines. */ -# define _MEM_WRAP_WILL_WRAP(n,t) \ - ((_MEM_WRAP_NEEDS_RUNTIME_CHECK(n,t) ? (MEM_SIZE)(n) : \ - MEM_SIZE_MAX/sizeof(t)) > MEM_SIZE_MAX/sizeof(t)) +# define _MEM_WRAP_WILL_WRAP(n,t) \ + ((_MEM_WRAP_NEEDS_RUNTIME_CHECK(n,t) ? (MEM_SIZE)(n) : \ + MEM_SIZE_MAX/sizeof(t)) > MEM_SIZE_MAX/sizeof(t)) -# define MEM_WRAP_CHECK(n,t) \ - (void)(UNLIKELY(_MEM_WRAP_WILL_WRAP(n,t)) \ - && (croak_memory_wrap(),0)) +# define MEM_WRAP_CHECK(n,t) \ + (void)(UNLIKELY(_MEM_WRAP_WILL_WRAP(n,t)) \ + && (croak_memory_wrap(),0)) -# define MEM_WRAP_CHECK_1(n,t,a) \ - (void)(UNLIKELY(_MEM_WRAP_WILL_WRAP(n,t)) \ - && (Perl_croak_nocontext("%s",(a)),0)) +# define MEM_WRAP_CHECK_1(n,t,a) \ + (void)(UNLIKELY(_MEM_WRAP_WILL_WRAP(n,t)) \ + && (Perl_croak_nocontext("%s",(a)),0)) /* "a" arg must be a string literal */ -# define MEM_WRAP_CHECK_s(n,t,a) \ - ( (void) (UNLIKELY(_MEM_WRAP_WILL_WRAP(n,t)) \ - && (Perl_croak_nocontext(ASSERT_IS_LITERAL(a)), 0))) +# define MEM_WRAP_CHECK_s(n,t,a) \ + ( (void) (UNLIKELY(_MEM_WRAP_WILL_WRAP(n,t)) \ + && (Perl_croak_nocontext(ASSERT_IS_LITERAL(a)), 0))) # define MEM_WRAP_CHECK_(n,t) MEM_WRAP_CHECK(n,t), @@ -2889,14 +2889,14 @@ enum mem_log_type { #define Newz(x,v,n,t) Newxz(v,n,t) #endif -#define Renew(v,n,t) \ - (v = (MEM_WRAP_CHECK_(n,t) (t*)MEM_LOG_REALLOC(n,t,v,saferealloc((Malloc_t)(v),(MEM_SIZE)((n)*sizeof(t)))))) +#define Renew(v,n,t) \ + (v = (MEM_WRAP_CHECK_(n,t) (t*)MEM_LOG_REALLOC(n,t,v,saferealloc((Malloc_t)(v),(MEM_SIZE)((n)*sizeof(t)))))) #define Renewc(v,n,t,c) \ - (v = (MEM_WRAP_CHECK_(n,t) (c*)MEM_LOG_REALLOC(n,t,v,saferealloc((Malloc_t)(v),(MEM_SIZE)((n)*sizeof(t)))))) + (v = (MEM_WRAP_CHECK_(n,t) (c*)MEM_LOG_REALLOC(n,t,v,saferealloc((Malloc_t)(v),(MEM_SIZE)((n)*sizeof(t)))))) #ifdef PERL_POISON #define Safefree(d) \ - ((d) ? (void)(safefree(MEM_LOG_FREE((Malloc_t)(d))), Poison(&(d), 1, Malloc_t)) : (void) 0) + ((d) ? (void)(safefree(MEM_LOG_FREE((Malloc_t)(d))), Poison(&(d), 1, Malloc_t)) : (void) 0) #else #define Safefree(d) safefree(MEM_LOG_FREE((Malloc_t)(d))) #endif @@ -2987,15 +2987,15 @@ last-inclusive range. shortcut macro defined without -DPERL_CORE. Neither codesearch.google.com nor CPAN::Unpack show any users outside the core. */ #ifdef PERL_CORE -# define deprecate(s) \ - Perl_ck_warner_d(aTHX_ packWARN(WARN_DEPRECATED),\ - "Use of " s " is deprecated") -# define deprecate_disappears_in(when,message) \ - Perl_ck_warner_d(aTHX_ packWARN(WARN_DEPRECATED), \ - message " is deprecated, and will disappear in Perl " when) -# define deprecate_fatal_in(when,message) \ - Perl_ck_warner_d(aTHX_ packWARN(WARN_DEPRECATED), \ - message " is deprecated, and will become fatal in Perl " when) +# define deprecate(s) \ + Perl_ck_warner_d(aTHX_ packWARN(WARN_DEPRECATED), \ + "Use of " s " is deprecated") +# define deprecate_disappears_in(when,message) \ + Perl_ck_warner_d(aTHX_ packWARN(WARN_DEPRECATED), \ + message " is deprecated, and will disappear in Perl " when) +# define deprecate_fatal_in(when,message) \ + Perl_ck_warner_d(aTHX_ packWARN(WARN_DEPRECATED), \ + message " is deprecated, and will become fatal in Perl " when) #endif /* Internal macros to deal with gids and uids */ @@ -3071,37 +3071,37 @@ last-inclusive range. /* 32 bit version */ #define PERL_XORSHIFT32_A(x) \ -STMT_START { \ - (x) ^= ((x) << 13); \ - (x) ^= ((x) >> 17); \ - (x) ^= ((x) << 5); \ -} STMT_END + STMT_START { \ + (x) ^= ((x) << 13); \ + (x) ^= ((x) >> 17); \ + (x) ^= ((x) << 5); \ + } STMT_END /* 64 bit version */ #define PERL_XORSHIFT64_A(x) \ -STMT_START { \ - (x) ^= ((x) << 13); \ - (x) ^= ((x) >> 7); \ - (x) ^= ((x) << 17); \ -} STMT_END + STMT_START { \ + (x) ^= ((x) << 13); \ + (x) ^= ((x) >> 7); \ + (x) ^= ((x) << 17); \ + } STMT_END /* 32 bit version */ #define PERL_XORSHIFT32_B(x) \ -STMT_START { \ - (x) ^= ((x) << 5); \ - (x) ^= ((x) >> 27); \ - (x) ^= ((x) << 8); \ -} STMT_END + STMT_START { \ + (x) ^= ((x) << 5); \ + (x) ^= ((x) >> 27); \ + (x) ^= ((x) << 8); \ + } STMT_END /* 64 bit version - currently this is unused, * it is provided here to complement the 32 bit _B * variant which IS used. */ #define PERL_XORSHIFT64_B(x) \ -STMT_START { \ - (x) ^= ((x) << 15); \ - (x) ^= ((x) >> 49); \ - (x) ^= ((x) << 26); \ -} STMT_END + STMT_START { \ + (x) ^= ((x) << 15); \ + (x) ^= ((x) >> 49); \ + (x) ^= ((x) << 26); \ + } STMT_END #endif /* PERL_HANDY_H_ */ diff --git a/hv.h b/hv.h index 906a21627b9e..f70a22a5ddcf 100644 --- a/hv.h +++ b/hv.h @@ -98,9 +98,9 @@ struct mro_meta { U32 destroy_gen; /* Generation number of DESTROY cache */ }; -#define MRO_GET_PRIVATE_DATA(smeta, which) \ - (((smeta)->mro_which && (which) == (smeta)->mro_which) \ - ? (smeta)->mro_linear_current \ +#define MRO_GET_PRIVATE_DATA(smeta, which) \ + (((smeta)->mro_which && (which) == (smeta)->mro_which) \ + ? (smeta)->mro_linear_current \ : Perl_mro_get_private_data(aTHX_ (smeta), (which))) /* Subject to change. @@ -315,47 +315,47 @@ whether it is valid to call C. /* Checking that hv is a valid package stash is the caller's responsibility */ -#define HvMROMETA(hv) \ - (HvAUX(hv)->xhv_mro_meta\ - ? HvAUX(hv)->xhv_mro_meta \ +#define HvMROMETA(hv) \ + (HvAUX(hv)->xhv_mro_meta \ + ? HvAUX(hv)->xhv_mro_meta \ : Perl_mro_meta_init(aTHX_ hv)) -#define HvNAME_HEK_NN(hv) \ - ( \ - HvAUX(hv)->xhv_name_count \ - ? *HvAUX(hv)->xhv_name_u.xhvnameu_names \ - : HvAUX(hv)->xhv_name_u.xhvnameu_name \ - ) +#define HvNAME_HEK_NN(hv) \ + ( \ + HvAUX(hv)->xhv_name_count \ + ? *HvAUX(hv)->xhv_name_u.xhvnameu_names \ + : HvAUX(hv)->xhv_name_u.xhvnameu_name \ + ) /* This macro may go away without notice. */ -#define HvNAME_HEK(hv) \ - (HvHasAUX(hv) && HvAUX(hv)->xhv_name_u.xhvnameu_name ? HvNAME_HEK_NN(hv) : NULL) -#define HvNAME_get(hv) \ - ((HvHasAUX(hv) && HvAUX(hv)->xhv_name_u.xhvnameu_name && HvNAME_HEK_NN(hv)) \ - ? HEK_KEY(HvNAME_HEK_NN(hv)) : NULL) -#define HvNAMELEN_get(hv) \ - ((HvHasAUX(hv) && HvAUX(hv)->xhv_name_u.xhvnameu_name && HvNAME_HEK_NN(hv)) \ - ? HEK_LEN(HvNAME_HEK_NN(hv)) : 0) -#define HvNAMEUTF8(hv) \ - ((HvHasAUX(hv) && HvAUX(hv)->xhv_name_u.xhvnameu_name && HvNAME_HEK_NN(hv)) \ - ? HEK_UTF8(HvNAME_HEK_NN(hv)) : 0) -#define HvENAME_HEK_NN(hv) \ - ( \ - HvAUX(hv)->xhv_name_count > 0 ? HvAUX(hv)->xhv_name_u.xhvnameu_names[0] : \ - HvAUX(hv)->xhv_name_count < -1 ? HvAUX(hv)->xhv_name_u.xhvnameu_names[1] : \ - HvAUX(hv)->xhv_name_count == -1 ? NULL : \ - HvAUX(hv)->xhv_name_u.xhvnameu_name \ - ) +#define HvNAME_HEK(hv) \ + (HvHasAUX(hv) && HvAUX(hv)->xhv_name_u.xhvnameu_name ? HvNAME_HEK_NN(hv) : NULL) +#define HvNAME_get(hv) \ + ((HvHasAUX(hv) && HvAUX(hv)->xhv_name_u.xhvnameu_name && HvNAME_HEK_NN(hv)) \ + ? HEK_KEY(HvNAME_HEK_NN(hv)) : NULL) +#define HvNAMELEN_get(hv) \ + ((HvHasAUX(hv) && HvAUX(hv)->xhv_name_u.xhvnameu_name && HvNAME_HEK_NN(hv)) \ + ? HEK_LEN(HvNAME_HEK_NN(hv)) : 0) +#define HvNAMEUTF8(hv) \ + ((HvHasAUX(hv) && HvAUX(hv)->xhv_name_u.xhvnameu_name && HvNAME_HEK_NN(hv)) \ + ? HEK_UTF8(HvNAME_HEK_NN(hv)) : 0) +#define HvENAME_HEK_NN(hv) \ + ( \ + HvAUX(hv)->xhv_name_count > 0 ? HvAUX(hv)->xhv_name_u.xhvnameu_names[0] : \ + HvAUX(hv)->xhv_name_count < -1 ? HvAUX(hv)->xhv_name_u.xhvnameu_names[1] : \ + HvAUX(hv)->xhv_name_count == -1 ? NULL : \ + HvAUX(hv)->xhv_name_u.xhvnameu_name \ + ) #define HvENAME_HEK(hv) \ - (HvHasAUX(hv) && HvAUX(hv)->xhv_name_u.xhvnameu_name ? HvENAME_HEK_NN(hv) : NULL) -#define HvENAME_get(hv) \ - ((HvHasAUX(hv) && HvAUX(hv)->xhv_name_u.xhvnameu_name && HvAUX(hv)->xhv_name_count != -1) \ - ? HEK_KEY(HvENAME_HEK_NN(hv)) : NULL) -#define HvENAMELEN_get(hv) \ - ((HvHasAUX(hv) && HvAUX(hv)->xhv_name_u.xhvnameu_name && HvAUX(hv)->xhv_name_count != -1) \ - ? HEK_LEN(HvENAME_HEK_NN(hv)) : 0) -#define HvENAMEUTF8(hv) \ - ((HvHasAUX(hv) && HvAUX(hv)->xhv_name_u.xhvnameu_name && HvAUX(hv)->xhv_name_count != -1) \ - ? HEK_UTF8(HvENAME_HEK_NN(hv)) : 0) + (HvHasAUX(hv) && HvAUX(hv)->xhv_name_u.xhvnameu_name ? HvENAME_HEK_NN(hv) : NULL) +#define HvENAME_get(hv) \ + ((HvHasAUX(hv) && HvAUX(hv)->xhv_name_u.xhvnameu_name && HvAUX(hv)->xhv_name_count != -1) \ + ? HEK_KEY(HvENAME_HEK_NN(hv)) : NULL) +#define HvENAMELEN_get(hv) \ + ((HvHasAUX(hv) && HvAUX(hv)->xhv_name_u.xhvnameu_name && HvAUX(hv)->xhv_name_count != -1) \ + ? HEK_LEN(HvENAME_HEK_NN(hv)) : 0) +#define HvENAMEUTF8(hv) \ + ((HvHasAUX(hv) && HvAUX(hv)->xhv_name_u.xhvnameu_name && HvAUX(hv)->xhv_name_count != -1) \ + ? HEK_UTF8(HvENAME_HEK_NN(hv)) : 0) /* * HvKEYS gets the number of keys that actually exist(), and is provided @@ -410,28 +410,28 @@ whether it is valid to call C. #define HeKFLAGS(he) HEK_FLAGS(HeKEY_hek(he)) #define HeVAL(he) (he)->he_valu.hent_val #define HeHASH(he) HEK_HASH(HeKEY_hek(he)) -#define HePV(he,lp) \ - ((HeKLEN(he) == HEf_SVKEY) ?\ - SvPV(HeKEY_sv(he),lp) : \ +#define HePV(he,lp) \ + ((HeKLEN(he) == HEf_SVKEY) ? \ + SvPV(HeKEY_sv(he),lp) : \ ((lp = HeKLEN(he)), HeKEY(he))) -#define HeUTF8(he) \ - ((HeKLEN(he) == HEf_SVKEY) ?\ - SvUTF8(HeKEY_sv(he)) : \ +#define HeUTF8(he) \ + ((HeKLEN(he) == HEf_SVKEY) ? \ + SvUTF8(HeKEY_sv(he)) : \ (U32)HeKUTF8(he)) -#define HeSVKEY(he) \ - ((HeKEY(he) &&\ - HeKLEN(he) == HEf_SVKEY) ? \ +#define HeSVKEY(he) \ + ((HeKEY(he) && \ + HeKLEN(he) == HEf_SVKEY) ? \ HeKEY_sv(he) : NULL) -#define HeSVKEY_force(he) \ - (HeKEY(he) ?\ - ((HeKLEN(he) == HEf_SVKEY) ? \ - HeKEY_sv(he) : \ - newSVpvn_flags(HeKEY(he), \ - HeKLEN(he), \ - SVs_TEMP | \ - ( HeKUTF8(he) ? SVf_UTF8 : 0 ))) : \ +#define HeSVKEY_force(he) \ + (HeKEY(he) ? \ + ((HeKLEN(he) == HEf_SVKEY) ? \ + HeKEY_sv(he) : \ + newSVpvn_flags(HeKEY(he), \ + HeKLEN(he), \ + SVs_TEMP | \ + ( HeKUTF8(he) ? SVf_UTF8 : 0 ))) : \ &PL_sv_undef) #define HeSVKEY_set(he,sv) ((HeKLEN(he) = HEf_SVKEY), (HeKEY_sv(he) = sv)) @@ -471,10 +471,10 @@ whether it is valid to call C. # define PERL_HV_ARRAY_ALLOC_BYTES(size) ((size) * sizeof(HE*)) #else # define MALLOC_OVERHEAD 16 -# define PERL_HV_ARRAY_ALLOC_BYTES(size) \ - (((size) < 64) \ - ? (size) * sizeof(HE*) \ - : (size) * sizeof(HE*) * 2 - MALLOC_OVERHEAD) +# define PERL_HV_ARRAY_ALLOC_BYTES(size) \ + (((size) < 64) \ + ? (size) * sizeof(HE*) \ + : (size) * sizeof(HE*) * 2 - MALLOC_OVERHEAD) #endif /* Flags for hv_iternext_flags. */ @@ -487,39 +487,39 @@ whether it is valid to call C. #define Perl_sharepvn(pv, len, hash) HEK_KEY(share_hek(pv, len, hash)) #define sharepvn(pv, len, hash) Perl_sharepvn(pv, len, hash) -#define share_hek_hek(hek) \ - (++(((struct shared_he *)(((char *)hek) \ - - STRUCT_OFFSET(struct shared_he, \ - shared_he_hek))) \ - ->shared_he_he.he_valu.hent_refcount), \ +#define share_hek_hek(hek) \ + (++(((struct shared_he *)(((char *)hek) \ + - STRUCT_OFFSET(struct shared_he, \ + shared_he_hek))) \ + ->shared_he_he.he_valu.hent_refcount), \ hek) -#define hv_store_ent(hv, keysv, val, hash) \ - ((HE *) hv_common((hv), (keysv), NULL, 0, 0, HV_FETCH_ISSTORE, \ +#define hv_store_ent(hv, keysv, val, hash) \ + ((HE *) hv_common((hv), (keysv), NULL, 0, 0, HV_FETCH_ISSTORE, \ (val), (hash))) -#define hv_exists_ent(hv, keysv, hash) \ +#define hv_exists_ent(hv, keysv, hash) \ cBOOL(hv_common((hv), (keysv), NULL, 0, 0, HV_FETCH_ISEXISTS, 0, (hash))) -#define hv_fetch_ent(hv, keysv, lval, hash) \ - ((HE *) hv_common((hv), (keysv), NULL, 0, 0, \ +#define hv_fetch_ent(hv, keysv, lval, hash) \ + ((HE *) hv_common((hv), (keysv), NULL, 0, 0, \ ((lval) ? HV_FETCH_LVALUE : 0), NULL, (hash))) #define hv_delete_ent(hv, key, flags, hash) \ (MUTABLE_SV(hv_common((hv), (key), NULL, 0, 0, (flags) | HV_DELETE, \ NULL, (hash)))) -#define hv_store_flags(hv, key, klen, val, hash, flags) \ - ((SV**) hv_common((hv), NULL, (key), (klen), (flags), \ - (HV_FETCH_ISSTORE|HV_FETCH_JUST_SV), (val), \ +#define hv_store_flags(hv, key, klen, val, hash, flags) \ + ((SV**) hv_common((hv), NULL, (key), (klen), (flags), \ + (HV_FETCH_ISSTORE|HV_FETCH_JUST_SV), (val), \ (hash))) -#define hv_store(hv, key, klen, val, hash) \ - ((SV**) hv_common_key_len((hv), (key), (klen), \ - (HV_FETCH_ISSTORE|HV_FETCH_JUST_SV), \ +#define hv_store(hv, key, klen, val, hash) \ + ((SV**) hv_common_key_len((hv), (key), (klen), \ + (HV_FETCH_ISSTORE|HV_FETCH_JUST_SV), \ (val), (hash))) -#define hv_exists(hv, key, klen) \ +#define hv_exists(hv, key, klen) \ cBOOL(hv_common_key_len((hv), (key), (klen), HV_FETCH_ISEXISTS, NULL, 0)) #define hv_fetch(hv, key, klen, lval) \ @@ -527,8 +527,8 @@ whether it is valid to call C. ? (HV_FETCH_JUST_SV | HV_FETCH_LVALUE) \ : HV_FETCH_JUST_SV, NULL, 0)) -#define hv_delete(hv, key, klen, flags) \ - (MUTABLE_SV(hv_common_key_len((hv), (key), (klen), \ +#define hv_delete(hv, key, klen, flags) \ + (MUTABLE_SV(hv_common_key_len((hv), (key), (klen), \ (flags) | HV_DELETE, NULL, 0))) /* Provide 's' suffix subs for constant strings (and avoid needing to count @@ -537,34 +537,34 @@ whether it is valid to call C. #define hv_existss(hv, key) \ hv_exists((hv), ASSERT_IS_LITERAL(key), (sizeof(key)-1)) -#define hv_fetchs(hv, key, lval) \ +#define hv_fetchs(hv, key, lval) \ hv_fetch((hv), ASSERT_IS_LITERAL(key), (sizeof(key)-1), (lval)) -#define hv_deletes(hv, key, flags) \ +#define hv_deletes(hv, key, flags) \ hv_delete((hv), ASSERT_IS_LITERAL(key), (sizeof(key)-1), (flags)) -#define hv_name_sets(hv, name, flags) \ +#define hv_name_sets(hv, name, flags) \ hv_name_set((hv),ASSERT_IS_LITERAL(name),(sizeof(name)-1), flags) #define hv_stores(hv, key, val) \ hv_store((hv), ASSERT_IS_LITERAL(key), (sizeof(key)-1), (val), 0) #ifdef PERL_CORE -# define hv_storehek(hv, hek, val) \ - hv_common((hv), NULL, HEK_KEY(hek), HEK_LEN(hek), HEK_UTF8(hek), \ - HV_FETCH_ISSTORE|HV_FETCH_JUST_SV, (val), HEK_HASH(hek)) -# define hv_fetchhek(hv, hek, lval) \ - ((SV **) \ - hv_common((hv), NULL, HEK_KEY(hek), HEK_LEN(hek), HEK_UTF8(hek), \ - (lval) \ - ? (HV_FETCH_JUST_SV | HV_FETCH_LVALUE) \ - : HV_FETCH_JUST_SV, \ - NULL, HEK_HASH(hek))) -# define hv_deletehek(hv, hek, flags) \ - hv_common((hv), NULL, HEK_KEY(hek), HEK_LEN(hek), HEK_UTF8(hek), \ - (flags)|HV_DELETE, NULL, HEK_HASH(hek)) -#define hv_existshek(hv, hek) \ - cBOOL(hv_common((hv), NULL, HEK_KEY(hek), HEK_LEN(hek), HEK_UTF8(hek), \ +# define hv_storehek(hv, hek, val) \ + hv_common((hv), NULL, HEK_KEY(hek), HEK_LEN(hek), HEK_UTF8(hek), \ + HV_FETCH_ISSTORE|HV_FETCH_JUST_SV, (val), HEK_HASH(hek)) +# define hv_fetchhek(hv, hek, lval) \ + ((SV **) \ + hv_common((hv), NULL, HEK_KEY(hek), HEK_LEN(hek), HEK_UTF8(hek), \ + (lval) \ + ? (HV_FETCH_JUST_SV | HV_FETCH_LVALUE) \ + : HV_FETCH_JUST_SV, \ + NULL, HEK_HASH(hek))) +# define hv_deletehek(hv, hek, flags) \ + hv_common((hv), NULL, HEK_KEY(hek), HEK_LEN(hek), HEK_UTF8(hek), \ + (flags)|HV_DELETE, NULL, HEK_HASH(hek)) +#define hv_existshek(hv, hek) \ + cBOOL(hv_common((hv), NULL, HEK_KEY(hek), HEK_LEN(hek), HEK_UTF8(hek), \ HV_FETCH_ISEXISTS, NULL, HEK_HASH(hek))) #endif @@ -612,7 +612,7 @@ instead of a string/length pair, and no precomputed hash. =cut */ -#define refcounted_he_fetch_pvs(chain, key, flags) \ +#define refcounted_he_fetch_pvs(chain, key, flags) \ Perl_refcounted_he_fetch_pvn(aTHX_ chain, STR_WITH_LEN(key), 0, flags) /* @@ -624,7 +624,7 @@ instead of a string/length pair, and no precomputed hash. =cut */ -#define refcounted_he_new_pvs(parent, key, value, flags) \ +#define refcounted_he_new_pvs(parent, key, value, flags) \ Perl_refcounted_he_new_pvn(aTHX_ parent, STR_WITH_LEN(key), 0, value, flags) /* Flag bits are HVhek_UTF8, HVhek_WASUTF8, then */ @@ -640,10 +640,10 @@ instead of a string/length pair, and no precomputed hash. #ifdef USE_ITHREADS /* A big expression to find the key offset */ -#define REF_HE_KEY(chain) \ - ((((chain->refcounted_he_data[0] & 0x60) == 0x40) \ - ? chain->refcounted_he_val.refcounted_he_u_len + 1 : 0) \ - + 1 + chain->refcounted_he_data) +#define REF_HE_KEY(chain) \ + ((((chain->refcounted_he_data[0] & 0x60) == 0x40) \ + ? chain->refcounted_he_val.refcounted_he_u_len + 1 : 0) \ + + 1 + chain->refcounted_he_data) #endif # ifdef USE_ITHREADS diff --git a/hv_func.h b/hv_func.h index 0e501ba5cd6a..9ec178d9b335 100644 --- a/hv_func.h +++ b/hv_func.h @@ -10,10 +10,10 @@ #define PERL_SEEN_HV_FUNC_H_ #include "hv_macro.h" -#if !( 0 \ - || defined(PERL_HASH_FUNC_SIPHASH) \ - || defined(PERL_HASH_FUNC_SIPHASH13) \ - || defined(PERL_HASH_FUNC_ZAPHOD32) \ +#if !( 0 \ + || defined(PERL_HASH_FUNC_SIPHASH) \ + || defined(PERL_HASH_FUNC_SIPHASH13) \ + || defined(PERL_HASH_FUNC_ZAPHOD32) \ ) # ifdef CAN64BITHASH # define PERL_HASH_FUNC_SIPHASH13 @@ -109,25 +109,25 @@ /* note the 4 in the below code comes from the fact the seed to initialize the SBOX is 128 bits */ #define PVT_PERL_HASH_SEED_BYTES ( PVT__PERL_HASH_SEED_BYTES + (int)( 4 * sizeof(U32)) ) -#define PVT_PERL_HASH_STATE_BYTES \ +#define PVT_PERL_HASH_STATE_BYTES \ ( PVT__PERL_HASH_STATE_BYTES + ( ( 1 + ( 256 * SBOX32_MAX_LEN ) ) * sizeof(U32) ) ) -#define PVT_PERL_HASH_SEED_STATE(seed,state) \ - STMT_START {\ - PVT__PERL_HASH_SEED_STATE(seed,state); \ - sbox32_seed_state128(seed + PVT__PERL_HASH_SEED_BYTES, state + PVT__PERL_HASH_STATE_BYTES); \ -} STMT_END +#define PVT_PERL_HASH_SEED_STATE(seed,state) \ + STMT_START { \ + PVT__PERL_HASH_SEED_STATE(seed,state); \ + sbox32_seed_state128(seed + PVT__PERL_HASH_SEED_BYTES, state + PVT__PERL_HASH_STATE_BYTES); \ + } STMT_END -#define PVT_PERL_HASH_WITH_STATE(state,str,len) \ +#define PVT_PERL_HASH_WITH_STATE(state,str,len) \ (LIKELY(len <= SBOX32_MAX_LEN) \ - ? sbox32_hash_with_state((state + PVT__PERL_HASH_STATE_BYTES),(U8*)(str),(len)) \ + ? sbox32_hash_with_state((state + PVT__PERL_HASH_STATE_BYTES),(U8*)(str),(len)) \ : PVT__PERL_HASH_WITH_STATE((state),(str),(len))) #endif -#define PERL_HASH_WITH_SEED(seed,hash,str,len) \ +#define PERL_HASH_WITH_SEED(seed,hash,str,len) \ (hash) = S_perl_hash_with_seed((const U8 *) seed, (const U8 *) str,len) -#define PERL_HASH_WITH_STATE(state,hash,str,len) \ +#define PERL_HASH_WITH_STATE(state,hash,str,len) \ (hash) = PVT_PERL_HASH_WITH_STATE((state),(U8*)(str),(len)) #define PERL_HASH_SEED_STATE(seed,state) PVT_PERL_HASH_SEED_STATE(seed,state) @@ -139,7 +139,7 @@ #define PERL_HASH_STATE_WORDS (PERL_HASH_STATE_BYTES/PVT__PERL_HASH_WORD_SIZE) #ifdef PERL_USE_SINGLE_CHAR_HASH_CACHE -#define PERL_HASH(state,str,len) \ +#define PERL_HASH(state,str,len) \ (hash) = ((len) < 2 ? ( (len) == 0 ? PL_hash_chars[256] : PL_hash_chars[(U8)(str)[0]] ) \ : PVT_PERL_HASH_WITH_STATE(PL_hash_state,(U8*)(str),(len))) #else @@ -165,9 +165,9 @@ * options). Repeat, you are *STRONGLY* encouraged not to use the value * provided here. */ -# define PERL_HASH_SEED \ - ((const U8 *)"A long string of pseudorandomly " \ - "chosen bytes for hashing in Perl") +# define PERL_HASH_SEED \ + ((const U8 *)"A long string of pseudorandomly " \ + "chosen bytes for hashing in Perl") # endif #endif diff --git a/hv_macro.h b/hv_macro.h index b3e747469a0a..92e2de2e0174 100644 --- a/hv_macro.h +++ b/hv_macro.h @@ -36,25 +36,25 @@ #define U8TO32_LE(ptr) (*((const U32*)(ptr))) #define U8TO64_LE(ptr) (*((const U64*)(ptr))) #else - #define U8TO16_LE(ptr) \ - (_shifted_octet(U16,(ptr),0, 0)|\ - _shifted_octet(U16,(ptr),1, 8)) + #define U8TO16_LE(ptr) \ + (_shifted_octet(U16,(ptr),0, 0)| \ + _shifted_octet(U16,(ptr),1, 8)) - #define U8TO32_LE(ptr) \ - (_shifted_octet(U32,(ptr),0, 0)|\ - _shifted_octet(U32,(ptr),1, 8)|\ - _shifted_octet(U32,(ptr),2,16)|\ - _shifted_octet(U32,(ptr),3,24)) + #define U8TO32_LE(ptr) \ + (_shifted_octet(U32,(ptr),0, 0)| \ + _shifted_octet(U32,(ptr),1, 8)| \ + _shifted_octet(U32,(ptr),2,16)| \ + _shifted_octet(U32,(ptr),3,24)) - #define U8TO64_LE(ptr) \ - (_shifted_octet(U64,(ptr),0, 0)|\ - _shifted_octet(U64,(ptr),1, 8)|\ - _shifted_octet(U64,(ptr),2,16)|\ - _shifted_octet(U64,(ptr),3,24)|\ - _shifted_octet(U64,(ptr),4,32)|\ - _shifted_octet(U64,(ptr),5,40)|\ - _shifted_octet(U64,(ptr),6,48)|\ - _shifted_octet(U64,(ptr),7,56)) + #define U8TO64_LE(ptr) \ + (_shifted_octet(U64,(ptr),0, 0)| \ + _shifted_octet(U64,(ptr),1, 8)| \ + _shifted_octet(U64,(ptr),2,16)| \ + _shifted_octet(U64,(ptr),3,24)| \ + _shifted_octet(U64,(ptr),4,32)| \ + _shifted_octet(U64,(ptr),5,40)| \ + _shifted_octet(U64,(ptr),6,48)| \ + _shifted_octet(U64,(ptr),7,56)) #endif #endif diff --git a/inline.h b/inline.h index bba2ed3fdf1f..a1f226f5c1e9 100644 --- a/inline.h +++ b/inline.h @@ -492,8 +492,8 @@ C>. */ -#define is_utf8_invariant_string(s, len) \ - is_utf8_invariant_string_loc(s, len, NULL) +#define is_utf8_invariant_string(s, len) \ + is_utf8_invariant_string_loc(s, len, NULL) /* =for apidoc is_utf8_invariant_string_loc @@ -532,11 +532,11 @@ Perl_is_utf8_invariant_string_loc(const U8* const s, STRLEN len, const U8 ** ep) * or'ing together the lowest bits of 'x'. Hopefully the final term gets * optimized out completely on a 32-bit system, and its mask gets optimized out * on a 64-bit system */ -# define PERL_IS_SUBWORD_ADDR(x) \ - (1 & ( PTR2nat(x)\ - | ( PTR2nat(x) >> 1) \ - | ( ( (PTR2nat(x) \ - & PERL_WORD_BOUNDARY_MASK) >> 2)))) +# define PERL_IS_SUBWORD_ADDR(x) \ + (1 & ( PTR2nat(x) \ + | ( PTR2nat(x) >> 1) \ + | ( ( (PTR2nat(x) \ + & PERL_WORD_BOUNDARY_MASK) >> 2)))) #ifndef EBCDIC @@ -577,8 +577,8 @@ Perl_is_utf8_invariant_string_loc(const U8* const s, STRLEN len, const U8 ** ep) return FALSE; } -# if BYTEORDER == 0x1234 || BYTEORDER == 0x12345678 \ - || BYTEORDER == 0x4321 || BYTEORDER == 0x87654321 +# if BYTEORDER == 0x1234 || BYTEORDER == 0x12345678 \ + || BYTEORDER == 0x4321 || BYTEORDER == 0x87654321 *ep = x + variant_byte_number(* (PERL_UINTMAX_T *) x); assert(*ep >= s && *ep < send); @@ -1506,32 +1506,32 @@ Perl_is_utf8_string_loclen(const U8 *s, STRLEN len, const U8 **ep, STRLEN *el) # define DFA_TEASE_APART_FF_ DFA_RETURN_FAILURE_ #endif -#define PERL_IS_UTF8_CHAR_DFA(s0, e, dfa_tab, \ - accept_action, \ - reject_action, \ - incomplete_char_action) \ - STMT_START { \ - const U8 * s = s0; \ - const U8 * e_ = e; \ - UV state = 0; \ - \ - PERL_NON_CORE_CHECK_EMPTY(s, e_); \ - \ - do { \ - state = dfa_tab[256 + state + dfa_tab[*s]]; \ - s++; \ - \ - if (state == 0) { /* Accepting state */ \ - accept_action; \ - } \ - \ - if (UNLIKELY(state == 1)) { /* Rejecting state */ \ - reject_action; \ - } \ - } while (s < e_); \ - \ - /* Here, dropped out of loop before end-of-char */ \ - incomplete_char_action; \ +#define PERL_IS_UTF8_CHAR_DFA(s0, e, dfa_tab, \ + accept_action, \ + reject_action, \ + incomplete_char_action) \ + STMT_START { \ + const U8 * s = s0; \ + const U8 * e_ = e; \ + UV state = 0; \ + \ + PERL_NON_CORE_CHECK_EMPTY(s, e_); \ + \ + do { \ + state = dfa_tab[256 + state + dfa_tab[*s]]; \ + s++; \ + \ + if (state == 0) { /* Accepting state */ \ + accept_action; \ + } \ + \ + if (UNLIKELY(state == 1)) { /* Rejecting state */ \ + reject_action; \ + } \ + } while (s < e_); \ + \ + /* Here, dropped out of loop before end-of-char */ \ + incomplete_char_action; \ } STMT_END @@ -1721,8 +1721,8 @@ See also C>. =cut */ -#define is_strict_utf8_string_loc(s, len, ep) \ - is_strict_utf8_string_loclen(s, len, ep, 0) +#define is_strict_utf8_string_loc(s, len, ep) \ + is_strict_utf8_string_loclen(s, len, ep, 0) /* @@ -1798,8 +1798,8 @@ See also C>. =cut */ -#define is_c9strict_utf8_string_loc(s, len, ep) \ - is_c9strict_utf8_string_loclen(s, len, ep, 0) +#define is_c9strict_utf8_string_loc(s, len, ep) \ + is_c9strict_utf8_string_loclen(s, len, ep, 0) /* @@ -1875,8 +1875,8 @@ See also C>. =cut */ -#define is_utf8_string_loc_flags(s, len, ep, flags) \ - is_utf8_string_loclen_flags(s, len, ep, 0, flags) +#define is_utf8_string_loc_flags(s, len, ep, flags) \ + is_utf8_string_loclen_flags(s, len, ep, 0, flags) /* The above 3 actual functions could have been moved into the more general one @@ -2237,8 +2237,8 @@ failure can be signalled without having to wait for the next read. =cut */ -#define is_utf8_valid_partial_char(s, e) \ - is_utf8_valid_partial_char_flags(s, e, 0) +#define is_utf8_valid_partial_char(s, e) \ + is_utf8_valid_partial_char_flags(s, e, 0) /* @@ -2328,8 +2328,8 @@ point. =cut */ -#define is_utf8_fixed_width_buf_flags(s, len, flags) \ - is_utf8_fixed_width_buf_loclen_flags(s, len, 0, 0, flags) +#define is_utf8_fixed_width_buf_flags(s, len, flags) \ + is_utf8_fixed_width_buf_loclen_flags(s, len, 0, 0, flags) /* @@ -2345,8 +2345,8 @@ See also C>. =cut */ -#define is_utf8_fixed_width_buf_loc_flags(s, len, loc, flags) \ - is_utf8_fixed_width_buf_loclen_flags(s, len, loc, 0, flags) +#define is_utf8_fixed_width_buf_loc_flags(s, len, loc, flags) \ + is_utf8_fixed_width_buf_loclen_flags(s, len, loc, 0, flags) /* @@ -2726,7 +2726,7 @@ Perl_cx_popblock(pTHX_ PERL_CONTEXT *cx) /* LEAVE_SCOPE() should have made this true. /(?{})/ cheats * and leaves a CX entry lying around for repeated use, so - * skip for multicall */ \ + * skip for multicall */ \ assert( (CxTYPE(cx) == CXt_SUB && CxMULTICALL(cx)) || PL_savestack_ix == cx->blk_oldsaveix); PL_curcop = cx->blk_oldcop; diff --git a/invlist_inline.h b/invlist_inline.h index fb836a8f4584..41882ead4696 100644 --- a/invlist_inline.h +++ b/invlist_inline.h @@ -9,13 +9,13 @@ #ifndef PERL_INVLIST_INLINE_H_ #define PERL_INVLIST_INLINE_H_ -#if defined(PERL_IN_UTF8_C) \ - || defined(PERL_IN_REGCOMP_C) \ - || defined(PERL_IN_REGEXEC_C) \ - || defined(PERL_IN_TOKE_C) \ - || defined(PERL_IN_PP_C) \ - || defined(PERL_IN_OP_C) \ - || defined(PERL_IN_DOOP_C) +#if defined(PERL_IN_UTF8_C) \ + || defined(PERL_IN_REGCOMP_C) \ + || defined(PERL_IN_REGEXEC_C) \ + || defined(PERL_IN_TOKE_C) \ + || defined(PERL_IN_PP_C) \ + || defined(PERL_IN_OP_C) \ + || defined(PERL_IN_DOOP_C) /* An element is in an inversion list iff its index is even numbered: 0, 2, 4, * etc */ diff --git a/iperlsys.h b/iperlsys.h index 0ba0bc1338b3..c2a91cb5d65f 100644 --- a/iperlsys.h +++ b/iperlsys.h @@ -198,85 +198,85 @@ struct IPerlStdIOInfo /* Now take FILE * via function table */ -# define PerlSIO_stdin \ - (*PL_StdIO->pStdin)(PL_StdIO) -# define PerlSIO_stdout \ - (*PL_StdIO->pStdout)(PL_StdIO) -# define PerlSIO_stderr \ - (*PL_StdIO->pStderr)(PL_StdIO) -# define PerlSIO_fopen(x,y) \ - (*PL_StdIO->pOpen)(PL_StdIO, (x),(y)) -# define PerlSIO_fclose(f) \ - (*PL_StdIO->pClose)(PL_StdIO, (f)) -# define PerlSIO_feof(f) \ - (*PL_StdIO->pEof)(PL_StdIO, (f)) -# define PerlSIO_ferror(f) \ - (*PL_StdIO->pError)(PL_StdIO, (f)) -# define PerlSIO_clearerr(f) \ - (*PL_StdIO->pClearerr)(PL_StdIO, (f)) -# define PerlSIO_fgetc(f) \ - (*PL_StdIO->pGetc)(PL_StdIO, (f)) -# define PerlSIO_get_base(f) \ - (*PL_StdIO->pGetBase)(PL_StdIO, (f)) -# define PerlSIO_get_bufsiz(f) \ - (*PL_StdIO->pGetBufsiz)(PL_StdIO, (f)) -# define PerlSIO_get_cnt(f) \ - (*PL_StdIO->pGetCnt)(PL_StdIO, (f)) -# define PerlSIO_get_ptr(f) \ - (*PL_StdIO->pGetPtr)(PL_StdIO, (f)) -# define PerlSIO_fputc(c,f) \ - (*PL_StdIO->pPutc)(PL_StdIO, (c),(f)) -# define PerlSIO_fputs(s,f) \ - (*PL_StdIO->pPuts)(PL_StdIO, (s),(f)) -# define PerlSIO_fflush(f) \ - (*PL_StdIO->pFlush)(PL_StdIO, (f)) -# define PerlSIO_fgets(s, n, f) \ - (*PL_StdIO->pGets)(PL_StdIO, s, n, (f)) -# define PerlSIO_ungetc(c,f) \ - (*PL_StdIO->pUngetc)(PL_StdIO, (c),(f)) -# define PerlSIO_fileno(f) \ - (*PL_StdIO->pFileno)(PL_StdIO, (f)) -# define PerlSIO_fdopen(f, s) \ - (*PL_StdIO->pFdopen)(PL_StdIO, (f),(s)) -# define PerlSIO_freopen(p, m, f) \ - (*PL_StdIO->pReopen)(PL_StdIO, (p), (m), (f)) -# define PerlSIO_fread(buf,sz,count,f) \ - (*PL_StdIO->pRead)(PL_StdIO, (buf), (sz), (count), (f)) -# define PerlSIO_fwrite(buf,sz,count,f) \ - (*PL_StdIO->pWrite)(PL_StdIO, (buf), (sz), (count), (f)) -# define PerlSIO_setbuf(f,b) \ - (*PL_StdIO->pSetBuf)(PL_StdIO, (f), (b)) -# define PerlSIO_setvbuf(f,b,t,s) \ - (*PL_StdIO->pSetVBuf)(PL_StdIO, (f),(b),(t),(s)) -# define PerlSIO_set_cnt(f,c) \ - (*PL_StdIO->pSetCnt)(PL_StdIO, (f), (c)) -# define PerlSIO_set_ptr(f,p) \ - (*PL_StdIO->pSetPtr)(PL_StdIO, (f), (p)) -# define PerlSIO_setlinebuf(f) \ - (*PL_StdIO->pSetlinebuf)(PL_StdIO, (f)) +# define PerlSIO_stdin \ + (*PL_StdIO->pStdin)(PL_StdIO) +# define PerlSIO_stdout \ + (*PL_StdIO->pStdout)(PL_StdIO) +# define PerlSIO_stderr \ + (*PL_StdIO->pStderr)(PL_StdIO) +# define PerlSIO_fopen(x,y) \ + (*PL_StdIO->pOpen)(PL_StdIO, (x),(y)) +# define PerlSIO_fclose(f) \ + (*PL_StdIO->pClose)(PL_StdIO, (f)) +# define PerlSIO_feof(f) \ + (*PL_StdIO->pEof)(PL_StdIO, (f)) +# define PerlSIO_ferror(f) \ + (*PL_StdIO->pError)(PL_StdIO, (f)) +# define PerlSIO_clearerr(f) \ + (*PL_StdIO->pClearerr)(PL_StdIO, (f)) +# define PerlSIO_fgetc(f) \ + (*PL_StdIO->pGetc)(PL_StdIO, (f)) +# define PerlSIO_get_base(f) \ + (*PL_StdIO->pGetBase)(PL_StdIO, (f)) +# define PerlSIO_get_bufsiz(f) \ + (*PL_StdIO->pGetBufsiz)(PL_StdIO, (f)) +# define PerlSIO_get_cnt(f) \ + (*PL_StdIO->pGetCnt)(PL_StdIO, (f)) +# define PerlSIO_get_ptr(f) \ + (*PL_StdIO->pGetPtr)(PL_StdIO, (f)) +# define PerlSIO_fputc(c,f) \ + (*PL_StdIO->pPutc)(PL_StdIO, (c),(f)) +# define PerlSIO_fputs(s,f) \ + (*PL_StdIO->pPuts)(PL_StdIO, (s),(f)) +# define PerlSIO_fflush(f) \ + (*PL_StdIO->pFlush)(PL_StdIO, (f)) +# define PerlSIO_fgets(s, n, f) \ + (*PL_StdIO->pGets)(PL_StdIO, s, n, (f)) +# define PerlSIO_ungetc(c,f) \ + (*PL_StdIO->pUngetc)(PL_StdIO, (c),(f)) +# define PerlSIO_fileno(f) \ + (*PL_StdIO->pFileno)(PL_StdIO, (f)) +# define PerlSIO_fdopen(f, s) \ + (*PL_StdIO->pFdopen)(PL_StdIO, (f),(s)) +# define PerlSIO_freopen(p, m, f) \ + (*PL_StdIO->pReopen)(PL_StdIO, (p), (m), (f)) +# define PerlSIO_fread(buf,sz,count,f) \ + (*PL_StdIO->pRead)(PL_StdIO, (buf), (sz), (count), (f)) +# define PerlSIO_fwrite(buf,sz,count,f) \ + (*PL_StdIO->pWrite)(PL_StdIO, (buf), (sz), (count), (f)) +# define PerlSIO_setbuf(f,b) \ + (*PL_StdIO->pSetBuf)(PL_StdIO, (f), (b)) +# define PerlSIO_setvbuf(f,b,t,s) \ + (*PL_StdIO->pSetVBuf)(PL_StdIO, (f),(b),(t),(s)) +# define PerlSIO_set_cnt(f,c) \ + (*PL_StdIO->pSetCnt)(PL_StdIO, (f), (c)) +# define PerlSIO_set_ptr(f,p) \ + (*PL_StdIO->pSetPtr)(PL_StdIO, (f), (p)) +# define PerlSIO_setlinebuf(f) \ + (*PL_StdIO->pSetlinebuf)(PL_StdIO, (f)) # define PerlSIO_printf Perl_fprintf_nocontext # define PerlSIO_stdoutf Perl_printf_nocontext -# define PerlSIO_vprintf(f,fmt,a) \ - (*PL_StdIO->pVprintf)(PL_StdIO, (f),(fmt),a) -# define PerlSIO_ftell(f) \ - (*PL_StdIO->pTell)(PL_StdIO, (f)) -# define PerlSIO_fseek(f,o,w) \ - (*PL_StdIO->pSeek)(PL_StdIO, (f),(o),(w)) -# define PerlSIO_fgetpos(f,p) \ - (*PL_StdIO->pGetpos)(PL_StdIO, (f),(p)) -# define PerlSIO_fsetpos(f,p) \ - (*PL_StdIO->pSetpos)(PL_StdIO, (f),(p)) -# define PerlSIO_rewind(f) \ - (*PL_StdIO->pRewind)(PL_StdIO, (f)) -# define PerlSIO_tmpfile() \ - (*PL_StdIO->pTmpfile)(PL_StdIO) -# define PerlSIO_init() \ - (*PL_StdIO->pInit)(PL_StdIO) +# define PerlSIO_vprintf(f,fmt,a) \ + (*PL_StdIO->pVprintf)(PL_StdIO, (f),(fmt),a) +# define PerlSIO_ftell(f) \ + (*PL_StdIO->pTell)(PL_StdIO, (f)) +# define PerlSIO_fseek(f,o,w) \ + (*PL_StdIO->pSeek)(PL_StdIO, (f),(o),(w)) +# define PerlSIO_fgetpos(f,p) \ + (*PL_StdIO->pGetpos)(PL_StdIO, (f),(p)) +# define PerlSIO_fsetpos(f,p) \ + (*PL_StdIO->pSetpos)(PL_StdIO, (f),(p)) +# define PerlSIO_rewind(f) \ + (*PL_StdIO->pRewind)(PL_StdIO, (f)) +# define PerlSIO_tmpfile() \ + (*PL_StdIO->pTmpfile)(PL_StdIO) +# define PerlSIO_init() \ + (*PL_StdIO->pInit)(PL_StdIO) # undef init_os_extras -# define init_os_extras() \ - (*PL_StdIO->pInitOSExtras)(PL_StdIO) -# define PerlSIO_fdupopen(f) \ - (*PL_StdIO->pFdupopen)(PL_StdIO, (f)) +# define init_os_extras() \ + (*PL_StdIO->pInitOSExtras)(PL_StdIO) +# define PerlSIO_fdupopen(f) \ + (*PL_StdIO->pFdupopen)(PL_StdIO, (f)) #else /* ! PERL_IMPLICIT_SYS */ @@ -320,11 +320,11 @@ struct IPerlStdIOInfo START_EXTERN_C int decc$ungetc(int __c, FILE *__stream); END_EXTERN_C -# define PerlSIO_ungetc(c,f) \ - ((c) == EOF ? EOF :\ - ((*(f) && !((*(f))->_flag & _IONBF) && \ - ((*(f))->_ptr > (*(f))->_base)) ? \ - ((*(f))->_cnt++, *(--(*(f))->_ptr) = (c)) : decc$ungetc(c,f))) +# define PerlSIO_ungetc(c,f) \ + ((c) == EOF ? EOF : \ + ((*(f) && !((*(f))->_flag & _IONBF) && \ + ((*(f))->_ptr > (*(f))->_base)) ? \ + ((*(f))->_cnt++, *(--(*(f))->_ptr) = (c)) : decc$ungetc(c,f))) # else # define PerlSIO_ungetc(c,f) ungetc(c,f) # endif @@ -405,29 +405,29 @@ struct IPerlDirInfo struct IPerlDir perlDirList; }; -# define PerlDir_mkdir(name, mode) \ - (*PL_Dir->pMakedir)(PL_Dir, (name), (mode)) -# define PerlDir_chdir(name) \ - (*PL_Dir->pChdir)(PL_Dir, (name)) -# define PerlDir_rmdir(name) \ - (*PL_Dir->pRmdir)(PL_Dir, (name)) -# define PerlDir_close(dir) \ - (*PL_Dir->pClose)(PL_Dir, (dir)) -# define PerlDir_open(name) \ - (*PL_Dir->pOpen)(PL_Dir, (name)) -# define PerlDir_read(dir) \ - (*PL_Dir->pRead)(PL_Dir, (dir)) -# define PerlDir_rewind(dir) \ - (*PL_Dir->pRewind)(PL_Dir, (dir)) -# define PerlDir_seek(dir, loc) \ - (*PL_Dir->pSeek)(PL_Dir, (dir), (loc)) -# define PerlDir_tell(dir) \ - (*PL_Dir->pTell)(PL_Dir, (dir)) +# define PerlDir_mkdir(name, mode) \ + (*PL_Dir->pMakedir)(PL_Dir, (name), (mode)) +# define PerlDir_chdir(name) \ + (*PL_Dir->pChdir)(PL_Dir, (name)) +# define PerlDir_rmdir(name) \ + (*PL_Dir->pRmdir)(PL_Dir, (name)) +# define PerlDir_close(dir) \ + (*PL_Dir->pClose)(PL_Dir, (dir)) +# define PerlDir_open(name) \ + (*PL_Dir->pOpen)(PL_Dir, (name)) +# define PerlDir_read(dir) \ + (*PL_Dir->pRead)(PL_Dir, (dir)) +# define PerlDir_rewind(dir) \ + (*PL_Dir->pRewind)(PL_Dir, (dir)) +# define PerlDir_seek(dir, loc) \ + (*PL_Dir->pSeek)(PL_Dir, (dir), (loc)) +# define PerlDir_tell(dir) \ + (*PL_Dir->pTell)(PL_Dir, (dir)) # ifdef WIN32 -# define PerlDir_mapA(dir) \ - (*PL_Dir->pMapPathA)(PL_Dir, (dir)) -# define PerlDir_mapW(dir) \ - (*PL_Dir->pMapPathW)(PL_Dir, (dir)) +# define PerlDir_mapA(dir) \ + (*PL_Dir->pMapPathA)(PL_Dir, (dir)) +# define PerlDir_mapW(dir) \ + (*PL_Dir->pMapPathW)(PL_Dir, (dir)) # endif # else /* ! PERL_IMPLICIT_SYS */ @@ -517,46 +517,46 @@ struct IPerlEnvInfo struct IPerlEnv perlEnvList; }; -# define PerlEnv_putenv(str) \ - (*PL_Env->pPutenv)(PL_Env,(str)) -# define PerlEnv_getenv(str) \ - (*PL_Env->pGetenv)(PL_Env,(str)) -# define PerlEnv_getenv_len(str,l) \ - (*PL_Env->pGetenv_len)(PL_Env,(str), (l)) -# define PerlEnv_clearenv() \ - (*PL_Env->pClearenv)(PL_Env) -# define PerlEnv_get_childenv() \ - (*PL_Env->pGetChildenv)(PL_Env) -# define PerlEnv_free_childenv(e) \ - (*PL_Env->pFreeChildenv)(PL_Env, (e)) -# define PerlEnv_get_childdir() \ - (*PL_Env->pGetChilddir)(PL_Env) -# define PerlEnv_free_childdir(d) \ - (*PL_Env->pFreeChilddir)(PL_Env, (d)) +# define PerlEnv_putenv(str) \ + (*PL_Env->pPutenv)(PL_Env,(str)) +# define PerlEnv_getenv(str) \ + (*PL_Env->pGetenv)(PL_Env,(str)) +# define PerlEnv_getenv_len(str,l) \ + (*PL_Env->pGetenv_len)(PL_Env,(str), (l)) +# define PerlEnv_clearenv() \ + (*PL_Env->pClearenv)(PL_Env) +# define PerlEnv_get_childenv() \ + (*PL_Env->pGetChildenv)(PL_Env) +# define PerlEnv_free_childenv(e) \ + (*PL_Env->pFreeChildenv)(PL_Env, (e)) +# define PerlEnv_get_childdir() \ + (*PL_Env->pGetChilddir)(PL_Env) +# define PerlEnv_free_childdir(d) \ + (*PL_Env->pFreeChilddir)(PL_Env, (d)) # ifdef HAS_ENVGETENV -# define PerlEnv_ENVgetenv(str) \ - (*PL_Env->pENVGetenv)(PL_Env,(str)) -# define PerlEnv_ENVgetenv_len(str,l) \ - (*PL_Env->pENVGetenv_len)(PL_Env,(str), (l)) +# define PerlEnv_ENVgetenv(str) \ + (*PL_Env->pENVGetenv)(PL_Env,(str)) +# define PerlEnv_ENVgetenv_len(str,l) \ + (*PL_Env->pENVGetenv_len)(PL_Env,(str), (l)) # else -# define PerlEnv_ENVgetenv(str) \ - PerlEnv_getenv((str)) -# define PerlEnv_ENVgetenv_len(str,l) \ - PerlEnv_getenv_len((str),(l)) +# define PerlEnv_ENVgetenv(str) \ + PerlEnv_getenv((str)) +# define PerlEnv_ENVgetenv_len(str,l) \ + PerlEnv_getenv_len((str),(l)) # endif -# define PerlEnv_uname(name) \ - (*PL_Env->pEnvUname)(PL_Env,(name)) +# define PerlEnv_uname(name) \ + (*PL_Env->pEnvUname)(PL_Env,(name)) # ifdef WIN32 -# define PerlEnv_os_id() \ - (*PL_Env->pEnvOsID)(PL_Env) -# define PerlEnv_lib_path(str, lenp) \ - (*PL_Env->pLibPath)(PL_Env,WIN32_NO_REGISTRY_M_(str)(lenp)) -# define PerlEnv_sitelib_path(str, lenp) \ - (*PL_Env->pSiteLibPath)(PL_Env,(str),(lenp)) -# define PerlEnv_vendorlib_path(str, lenp) \ - (*PL_Env->pVendorLibPath)(PL_Env,(str),(lenp)) -# define PerlEnv_get_child_IO(ptr) \ - (*PL_Env->pGetChildIO)(PL_Env, ptr) +# define PerlEnv_os_id() \ + (*PL_Env->pEnvOsID)(PL_Env) +# define PerlEnv_lib_path(str, lenp) \ + (*PL_Env->pLibPath)(PL_Env,WIN32_NO_REGISTRY_M_(str)(lenp)) +# define PerlEnv_sitelib_path(str, lenp) \ + (*PL_Env->pSiteLibPath)(PL_Env,(str),(lenp)) +# define PerlEnv_vendorlib_path(str, lenp) \ + (*PL_Env->pVendorLibPath)(PL_Env,(str),(lenp)) +# define PerlEnv_get_child_IO(ptr) \ + (*PL_Env->pGetChildIO)(PL_Env, ptr) # endif #else /* below is ! PERL_IMPLICIT_SYS */ @@ -564,10 +564,10 @@ struct IPerlEnvInfo /* Use the comma operator to return 0/non-zero, while avoiding putting * this in an inline function */ -# define PerlEnv_putenv(str) \ - (ENV_LOCK, (putenv(str)\ - ? (ENV_UNLOCK, 1) \ - : (ENV_UNLOCK, 0))) +# define PerlEnv_putenv(str) \ + (ENV_LOCK, (putenv(str) \ + ? (ENV_UNLOCK, 1) \ + : (ENV_UNLOCK, 0))) # else # define PerlEnv_putenv(str) putenv(str) # endif @@ -594,10 +594,10 @@ struct IPerlEnvInfo # define PerlEnv_get_childdir() win32_get_childdir() # define PerlEnv_free_childdir(d) win32_free_childdir((d)) # else -# define PerlEnv_clearenv(str) \ - (ENV_LOCK, (clearenv(str)\ - ? (ENV_UNLOCK, 1) \ - : (ENV_UNLOCK, 0))) +# define PerlEnv_clearenv(str) \ + (ENV_LOCK, (clearenv(str) \ + ? (ENV_UNLOCK, 1) \ + : (ENV_UNLOCK, 0))) # define PerlEnv_get_childenv() get_childenv() # define PerlEnv_free_childenv(e) free_childenv((e)) # define PerlEnv_get_childdir() get_childdir() @@ -693,62 +693,62 @@ struct IPerlLIOInfo struct IPerlLIO perlLIOList; }; -# define PerlLIO_access(file, mode) \ - (*PL_LIO->pAccess)(PL_LIO, (file), (mode)) -# define PerlLIO_chmod(file, mode) \ - (*PL_LIO->pChmod)(PL_LIO, (file), (mode)) -# define PerlLIO_chown(file, owner, group) \ - (*PL_LIO->pChown)(PL_LIO, (file), (owner), (group)) -# define PerlLIO_chsize(fd, size) \ - (*PL_LIO->pChsize)(PL_LIO, (fd), (size)) -# define PerlLIO_close(fd) \ - (*PL_LIO->pClose)(PL_LIO, (fd)) -# define PerlLIO_dup(fd) \ - (*PL_LIO->pDup)(PL_LIO, (fd)) -# define PerlLIO_dup2(fd1, fd2) \ - (*PL_LIO->pDup2)(PL_LIO, (fd1), (fd2)) -# define PerlLIO_flock(fd, op) \ - (*PL_LIO->pFlock)(PL_LIO, (fd), (op)) -# define PerlLIO_fstat(fd, buf) \ - (*PL_LIO->pFileStat)(PL_LIO, (fd), (buf)) -# define PerlLIO_ioctl(fd, u, buf) \ - (*PL_LIO->pIOCtl)(PL_LIO, (fd), (u), (buf)) -# define PerlLIO_isatty(fd) \ - (*PL_LIO->pIsatty)(PL_LIO, (fd)) -# define PerlLIO_link(oldname, newname) \ - (*PL_LIO->pLink)(PL_LIO, (oldname), (newname)) -# define PerlLIO_symlink(oldname, newname) \ - (*PL_LIO->pSymLink)(PL_LIO, (oldname), (newname)) -# define PerlLIO_readlink(path, buf, bufsiz) \ - (*PL_LIO->pReadLink)(PL_LIO, (path), (buf), (bufsiz)) -# define PerlLIO_lseek(fd, offset, mode) \ - (*PL_LIO->pLseek)(PL_LIO, (fd), (offset), (mode)) -# define PerlLIO_lstat(name, buf) \ - (*PL_LIO->pLstat)(PL_LIO, (name), (buf)) -# define PerlLIO_mktemp(file) \ - (*PL_LIO->pMktemp)(PL_LIO, (file)) -# define PerlLIO_open(file, flag) \ - (*PL_LIO->pOpen)(PL_LIO, (file), (flag)) -# define PerlLIO_open3(file, flag, perm) \ - (*PL_LIO->pOpen3)(PL_LIO, (file), (flag), (perm)) -# define PerlLIO_read(fd, buf, count) \ - (*PL_LIO->pRead)(PL_LIO, (fd), (buf), (count)) -# define PerlLIO_rename(oname, newname) \ - (*PL_LIO->pRename)(PL_LIO, (oname), (newname)) -# define PerlLIO_setmode(fd, mode) \ - (*PL_LIO->pSetmode)(PL_LIO, (fd), (mode)) -# define PerlLIO_stat(name, buf) \ - (*PL_LIO->pNameStat)(PL_LIO, (name), (buf)) -# define PerlLIO_tmpnam(str) \ - (*PL_LIO->pTmpnam)(PL_LIO, (str)) -# define PerlLIO_umask(mode) \ - (*PL_LIO->pUmask)(PL_LIO, (mode)) -# define PerlLIO_unlink(file) \ - (*PL_LIO->pUnlink)(PL_LIO, (file)) -# define PerlLIO_utime(file, time) \ - (*PL_LIO->pUtime)(PL_LIO, (file), (time)) -# define PerlLIO_write(fd, buf, count) \ - (*PL_LIO->pWrite)(PL_LIO, (fd), (buf), (count)) +# define PerlLIO_access(file, mode) \ + (*PL_LIO->pAccess)(PL_LIO, (file), (mode)) +# define PerlLIO_chmod(file, mode) \ + (*PL_LIO->pChmod)(PL_LIO, (file), (mode)) +# define PerlLIO_chown(file, owner, group) \ + (*PL_LIO->pChown)(PL_LIO, (file), (owner), (group)) +# define PerlLIO_chsize(fd, size) \ + (*PL_LIO->pChsize)(PL_LIO, (fd), (size)) +# define PerlLIO_close(fd) \ + (*PL_LIO->pClose)(PL_LIO, (fd)) +# define PerlLIO_dup(fd) \ + (*PL_LIO->pDup)(PL_LIO, (fd)) +# define PerlLIO_dup2(fd1, fd2) \ + (*PL_LIO->pDup2)(PL_LIO, (fd1), (fd2)) +# define PerlLIO_flock(fd, op) \ + (*PL_LIO->pFlock)(PL_LIO, (fd), (op)) +# define PerlLIO_fstat(fd, buf) \ + (*PL_LIO->pFileStat)(PL_LIO, (fd), (buf)) +# define PerlLIO_ioctl(fd, u, buf) \ + (*PL_LIO->pIOCtl)(PL_LIO, (fd), (u), (buf)) +# define PerlLIO_isatty(fd) \ + (*PL_LIO->pIsatty)(PL_LIO, (fd)) +# define PerlLIO_link(oldname, newname) \ + (*PL_LIO->pLink)(PL_LIO, (oldname), (newname)) +# define PerlLIO_symlink(oldname, newname) \ + (*PL_LIO->pSymLink)(PL_LIO, (oldname), (newname)) +# define PerlLIO_readlink(path, buf, bufsiz) \ + (*PL_LIO->pReadLink)(PL_LIO, (path), (buf), (bufsiz)) +# define PerlLIO_lseek(fd, offset, mode) \ + (*PL_LIO->pLseek)(PL_LIO, (fd), (offset), (mode)) +# define PerlLIO_lstat(name, buf) \ + (*PL_LIO->pLstat)(PL_LIO, (name), (buf)) +# define PerlLIO_mktemp(file) \ + (*PL_LIO->pMktemp)(PL_LIO, (file)) +# define PerlLIO_open(file, flag) \ + (*PL_LIO->pOpen)(PL_LIO, (file), (flag)) +# define PerlLIO_open3(file, flag, perm) \ + (*PL_LIO->pOpen3)(PL_LIO, (file), (flag), (perm)) +# define PerlLIO_read(fd, buf, count) \ + (*PL_LIO->pRead)(PL_LIO, (fd), (buf), (count)) +# define PerlLIO_rename(oname, newname) \ + (*PL_LIO->pRename)(PL_LIO, (oname), (newname)) +# define PerlLIO_setmode(fd, mode) \ + (*PL_LIO->pSetmode)(PL_LIO, (fd), (mode)) +# define PerlLIO_stat(name, buf) \ + (*PL_LIO->pNameStat)(PL_LIO, (name), (buf)) +# define PerlLIO_tmpnam(str) \ + (*PL_LIO->pTmpnam)(PL_LIO, (str)) +# define PerlLIO_umask(mode) \ + (*PL_LIO->pUmask)(PL_LIO, (mode)) +# define PerlLIO_unlink(file) \ + (*PL_LIO->pUnlink)(PL_LIO, (file)) +# define PerlLIO_utime(file, time) \ + (*PL_LIO->pUtime)(PL_LIO, (file), (time)) +# define PerlLIO_write(fd, buf, count) \ + (*PL_LIO->pWrite)(PL_LIO, (fd), (buf), (count)) #else /* ! PERL_IMPLICIT_SYS */ @@ -841,52 +841,52 @@ struct IPerlMemInfo }; /* Interpreter specific memory macros */ -# define PerlMem_malloc(size) \ - (*PL_Mem->pMalloc)(PL_Mem, (size)) -# define PerlMem_realloc(buf, size) \ - (*PL_Mem->pRealloc)(PL_Mem, (buf), (size)) -# define PerlMem_free(buf) \ - (*PL_Mem->pFree)(PL_Mem, (buf)) -# define PerlMem_calloc(num, size) \ - (*PL_Mem->pCalloc)(PL_Mem, (num), (size)) -# define PerlMem_get_lock() \ - (*PL_Mem->pGetLock)(PL_Mem) -# define PerlMem_free_lock() \ - (*PL_Mem->pFreeLock)(PL_Mem) -# define PerlMem_is_locked() \ - (*PL_Mem->pIsLocked)(PL_Mem) +# define PerlMem_malloc(size) \ + (*PL_Mem->pMalloc)(PL_Mem, (size)) +# define PerlMem_realloc(buf, size) \ + (*PL_Mem->pRealloc)(PL_Mem, (buf), (size)) +# define PerlMem_free(buf) \ + (*PL_Mem->pFree)(PL_Mem, (buf)) +# define PerlMem_calloc(num, size) \ + (*PL_Mem->pCalloc)(PL_Mem, (num), (size)) +# define PerlMem_get_lock() \ + (*PL_Mem->pGetLock)(PL_Mem) +# define PerlMem_free_lock() \ + (*PL_Mem->pFreeLock)(PL_Mem) +# define PerlMem_is_locked() \ + (*PL_Mem->pIsLocked)(PL_Mem) /* Shared memory macros */ -# define PerlMemShared_malloc(size) \ - (*PL_MemShared->pMalloc)(PL_MemShared, (size)) -# define PerlMemShared_realloc(buf, size) \ - (*PL_MemShared->pRealloc)(PL_MemShared, (buf), (size)) -# define PerlMemShared_free(buf) \ - (*PL_MemShared->pFree)(PL_MemShared, (buf)) -# define PerlMemShared_calloc(num, size) \ - (*PL_MemShared->pCalloc)(PL_MemShared, (num), (size)) -# define PerlMemShared_get_lock() \ - (*PL_MemShared->pGetLock)(PL_MemShared) -# define PerlMemShared_free_lock() \ - (*PL_MemShared->pFreeLock)(PL_MemShared) -# define PerlMemShared_is_locked() \ - (*PL_MemShared->pIsLocked)(PL_MemShared) +# define PerlMemShared_malloc(size) \ + (*PL_MemShared->pMalloc)(PL_MemShared, (size)) +# define PerlMemShared_realloc(buf, size) \ + (*PL_MemShared->pRealloc)(PL_MemShared, (buf), (size)) +# define PerlMemShared_free(buf) \ + (*PL_MemShared->pFree)(PL_MemShared, (buf)) +# define PerlMemShared_calloc(num, size) \ + (*PL_MemShared->pCalloc)(PL_MemShared, (num), (size)) +# define PerlMemShared_get_lock() \ + (*PL_MemShared->pGetLock)(PL_MemShared) +# define PerlMemShared_free_lock() \ + (*PL_MemShared->pFreeLock)(PL_MemShared) +# define PerlMemShared_is_locked() \ + (*PL_MemShared->pIsLocked)(PL_MemShared) /* Parse tree memory macros */ -# define PerlMemParse_malloc(size) \ - (*PL_MemParse->pMalloc)(PL_MemParse, (size)) -# define PerlMemParse_realloc(buf, size) \ - (*PL_MemParse->pRealloc)(PL_MemParse, (buf), (size)) -# define PerlMemParse_free(buf) \ - (*PL_MemParse->pFree)(PL_MemParse, (buf)) -# define PerlMemParse_calloc(num, size) \ - (*PL_MemParse->pCalloc)(PL_MemParse, (num), (size)) -# define PerlMemParse_get_lock() \ - (*PL_MemParse->pGetLock)(PL_MemParse) -# define PerlMemParse_free_lock() \ - (*PL_MemParse->pFreeLock)(PL_MemParse) -# define PerlMemParse_is_locked() \ - (*PL_MemParse->pIsLocked)(PL_MemParse) +# define PerlMemParse_malloc(size) \ + (*PL_MemParse->pMalloc)(PL_MemParse, (size)) +# define PerlMemParse_realloc(buf, size) \ + (*PL_MemParse->pRealloc)(PL_MemParse, (buf), (size)) +# define PerlMemParse_free(buf) \ + (*PL_MemParse->pFree)(PL_MemParse, (buf)) +# define PerlMemParse_calloc(num, size) \ + (*PL_MemParse->pCalloc)(PL_MemParse, (num), (size)) +# define PerlMemParse_get_lock() \ + (*PL_MemParse->pGetLock)(PL_MemParse) +# define PerlMemParse_free_lock() \ + (*PL_MemParse->pFreeLock)(PL_MemParse) +# define PerlMemParse_is_locked() \ + (*PL_MemParse->pIsLocked)(PL_MemParse) #else /* ! PERL_IMPLICIT_SYS */ @@ -1027,77 +1027,77 @@ struct IPerlProcInfo struct IPerlProc perlProcList; }; -# define PerlProc_abort() \ - (*PL_Proc->pAbort)(PL_Proc) -# define PerlProc_crypt(c,s) \ - (*PL_Proc->pCrypt)(PL_Proc, (c), (s)) -# define PerlProc_exit(s) \ - (*PL_Proc->pExit)(PL_Proc, (s)) -# define PerlProc__exit(s) \ - (*PL_Proc->p_Exit)(PL_Proc, (s)) -# define PerlProc_execl(c, w, x, y, z) \ - (*PL_Proc->pExecl)(PL_Proc, (c), (w), (x), (y), (z)) -# define PerlProc_execv(c, a) \ - (*PL_Proc->pExecv)(PL_Proc, (c), (a)) -# define PerlProc_execvp(c, a) \ - (*PL_Proc->pExecvp)(PL_Proc, (c), (a)) -# define PerlProc_getuid() \ - (*PL_Proc->pGetuid)(PL_Proc) -# define PerlProc_geteuid() \ - (*PL_Proc->pGeteuid)(PL_Proc) -# define PerlProc_getgid() \ - (*PL_Proc->pGetgid)(PL_Proc) -# define PerlProc_getegid() \ - (*PL_Proc->pGetegid)(PL_Proc) -# define PerlProc_getlogin() \ - (*PL_Proc->pGetlogin)(PL_Proc) -# define PerlProc_kill(i, a) \ - (*PL_Proc->pKill)(PL_Proc, (i), (a)) -# define PerlProc_killpg(i, a) \ - (*PL_Proc->pKillpg)(PL_Proc, (i), (a)) -# define PerlProc_pause() \ - (*PL_Proc->pPauseProc)(PL_Proc) -# define PerlProc_popen(c, m) \ - (*PL_Proc->pPopen)(PL_Proc, (c), (m)) -# define PerlProc_popen_list(m, n, a) \ - (*PL_Proc->pPopenList)(PL_Proc, (m), (n), (a)) -# define PerlProc_pclose(f) \ - (*PL_Proc->pPclose)(PL_Proc, (f)) -# define PerlProc_pipe(fd) \ - (*PL_Proc->pPipe)(PL_Proc, (fd)) -# define PerlProc_setuid(u) \ - (*PL_Proc->pSetuid)(PL_Proc, (u)) -# define PerlProc_setgid(g) \ - (*PL_Proc->pSetgid)(PL_Proc, (g)) -# define PerlProc_sleep(t) \ - (*PL_Proc->pSleep)(PL_Proc, (t)) -# define PerlProc_times(t) \ - (*PL_Proc->pTimes)(PL_Proc, (t)) -# define PerlProc_wait(t) \ - (*PL_Proc->pWait)(PL_Proc, (t)) -# define PerlProc_waitpid(p,s,f) \ - (*PL_Proc->pWaitpid)(PL_Proc, (p), (s), (f)) -# define PerlProc_signal(n, h) \ - (*PL_Proc->pSignal)(PL_Proc, (n), (h)) -# define PerlProc_fork() \ - (*PL_Proc->pFork)(PL_Proc) -# define PerlProc_getpid() \ - (*PL_Proc->pGetpid)(PL_Proc) +# define PerlProc_abort() \ + (*PL_Proc->pAbort)(PL_Proc) +# define PerlProc_crypt(c,s) \ + (*PL_Proc->pCrypt)(PL_Proc, (c), (s)) +# define PerlProc_exit(s) \ + (*PL_Proc->pExit)(PL_Proc, (s)) +# define PerlProc__exit(s) \ + (*PL_Proc->p_Exit)(PL_Proc, (s)) +# define PerlProc_execl(c, w, x, y, z) \ + (*PL_Proc->pExecl)(PL_Proc, (c), (w), (x), (y), (z)) +# define PerlProc_execv(c, a) \ + (*PL_Proc->pExecv)(PL_Proc, (c), (a)) +# define PerlProc_execvp(c, a) \ + (*PL_Proc->pExecvp)(PL_Proc, (c), (a)) +# define PerlProc_getuid() \ + (*PL_Proc->pGetuid)(PL_Proc) +# define PerlProc_geteuid() \ + (*PL_Proc->pGeteuid)(PL_Proc) +# define PerlProc_getgid() \ + (*PL_Proc->pGetgid)(PL_Proc) +# define PerlProc_getegid() \ + (*PL_Proc->pGetegid)(PL_Proc) +# define PerlProc_getlogin() \ + (*PL_Proc->pGetlogin)(PL_Proc) +# define PerlProc_kill(i, a) \ + (*PL_Proc->pKill)(PL_Proc, (i), (a)) +# define PerlProc_killpg(i, a) \ + (*PL_Proc->pKillpg)(PL_Proc, (i), (a)) +# define PerlProc_pause() \ + (*PL_Proc->pPauseProc)(PL_Proc) +# define PerlProc_popen(c, m) \ + (*PL_Proc->pPopen)(PL_Proc, (c), (m)) +# define PerlProc_popen_list(m, n, a) \ + (*PL_Proc->pPopenList)(PL_Proc, (m), (n), (a)) +# define PerlProc_pclose(f) \ + (*PL_Proc->pPclose)(PL_Proc, (f)) +# define PerlProc_pipe(fd) \ + (*PL_Proc->pPipe)(PL_Proc, (fd)) +# define PerlProc_setuid(u) \ + (*PL_Proc->pSetuid)(PL_Proc, (u)) +# define PerlProc_setgid(g) \ + (*PL_Proc->pSetgid)(PL_Proc, (g)) +# define PerlProc_sleep(t) \ + (*PL_Proc->pSleep)(PL_Proc, (t)) +# define PerlProc_times(t) \ + (*PL_Proc->pTimes)(PL_Proc, (t)) +# define PerlProc_wait(t) \ + (*PL_Proc->pWait)(PL_Proc, (t)) +# define PerlProc_waitpid(p,s,f) \ + (*PL_Proc->pWaitpid)(PL_Proc, (p), (s), (f)) +# define PerlProc_signal(n, h) \ + (*PL_Proc->pSignal)(PL_Proc, (n), (h)) +# define PerlProc_fork() \ + (*PL_Proc->pFork)(PL_Proc) +# define PerlProc_getpid() \ + (*PL_Proc->pGetpid)(PL_Proc) # define PerlProc_setjmp(b, n) Sigsetjmp((b), (n)) # define PerlProc_longjmp(b, n) Siglongjmp((b), (n)) # ifdef WIN32 -# define PerlProc_DynaLoad(f) \ - (*PL_Proc->pDynaLoader)(PL_Proc, (f)) -# define PerlProc_GetOSError(s,e) \ - (*PL_Proc->pGetOSError)(PL_Proc, (s), (e)) -# define PerlProc_spawnvp(m, c, a) \ - (*PL_Proc->pSpawnvp)(PL_Proc, (m), (c), (a)) +# define PerlProc_DynaLoad(f) \ + (*PL_Proc->pDynaLoader)(PL_Proc, (f)) +# define PerlProc_GetOSError(s,e) \ + (*PL_Proc->pGetOSError)(PL_Proc, (s), (e)) +# define PerlProc_spawnvp(m, c, a) \ + (*PL_Proc->pSpawnvp)(PL_Proc, (m), (c), (a)) # endif -# define PerlProc_lasthost() \ - (*PL_Proc->pLastHost)(PL_Proc) -# define PerlProc_gettimeofday(t,z) \ - (*PL_Proc->pGetTimeOfDay)(PL_Proc,(t),(z)) +# define PerlProc_lasthost() \ + (*PL_Proc->pLastHost)(PL_Proc) +# define PerlProc_gettimeofday(t,z) \ + (*PL_Proc->pGetTimeOfDay)(PL_Proc,(t),(z)) #else /* ! PERL_IMPLICIT_SYS */ @@ -1105,8 +1105,8 @@ struct IPerlProcInfo # define PerlProc_crypt(c,s) crypt((c), (s)) # define PerlProc_exit(s) exit((s)) # define PerlProc__exit(s) _exit((s)) -# define PerlProc_execl(c,w,x,y,z) \ - execl((c), (w), (x), (y), (z)) +# define PerlProc_execl(c,w,x,y,z) \ + execl((c), (w), (x), (y), (z)) # define PerlProc_execv(c, a) execv((c), (a)) # define PerlProc_execvp(c, a) execvp((c), (a)) # define PerlProc_getuid() getuid() @@ -1135,12 +1135,12 @@ struct IPerlProcInfo # define PerlProc_gettimeofday(t,z) gettimeofday((t),(z)) # ifdef WIN32 -# define PerlProc_DynaLoad(f) \ - win32_dynaload((f)) -# define PerlProc_GetOSError(s,e) \ - win32_str_os_error((s), (e)) -# define PerlProc_spawnvp(m, c, a) \ - win32_spawnvp((m), (c), (a)) +# define PerlProc_DynaLoad(f) \ + win32_dynaload((f)) +# define PerlProc_GetOSError(s,e) \ + win32_str_os_error((s), (e)) +# define PerlProc_spawnvp(m, c, a) \ + win32_spawnvp((m), (c), (a)) # undef PerlProc_signal # define PerlProc_signal(n, h) win32_signal((n), (h)) # endif @@ -1273,96 +1273,96 @@ struct IPerlSockInfo struct IPerlSock perlSockList; }; -# define PerlSock_htonl(x) \ - (*PL_Sock->pHtonl)(PL_Sock, x) -# define PerlSock_htons(x) \ - (*PL_Sock->pHtons)(PL_Sock, x) -# define PerlSock_ntohl(x) \ - (*PL_Sock->pNtohl)(PL_Sock, x) -# define PerlSock_ntohs(x) \ - (*PL_Sock->pNtohs)(PL_Sock, x) -# define PerlSock_accept(s, a, l) \ - (*PL_Sock->pAccept)(PL_Sock, s, a, l) -# define PerlSock_bind(s, n, l) \ - (*PL_Sock->pBind)(PL_Sock, s, n, l) -# define PerlSock_connect(s, n, l) \ - (*PL_Sock->pConnect)(PL_Sock, s, n, l) -# define PerlSock_endhostent() \ - (*PL_Sock->pEndhostent)(PL_Sock) -# define PerlSock_endnetent() \ - (*PL_Sock->pEndnetent)(PL_Sock) -# define PerlSock_endprotoent() \ - (*PL_Sock->pEndprotoent)(PL_Sock) -# define PerlSock_endservent() \ - (*PL_Sock->pEndservent)(PL_Sock) -# define PerlSock_gethostbyaddr(a, l, t) \ - (*PL_Sock->pGethostbyaddr)(PL_Sock, a, l, t) -# define PerlSock_gethostbyname(n) \ - (*PL_Sock->pGethostbyname)(PL_Sock, n) -# define PerlSock_gethostent() \ - (*PL_Sock->pGethostent)(PL_Sock) -# define PerlSock_gethostname(n, l) \ - (*PL_Sock->pGethostname)(PL_Sock, n, l) -# define PerlSock_getnetbyaddr(n, t) \ - (*PL_Sock->pGetnetbyaddr)(PL_Sock, n, t) -# define PerlSock_getnetbyname(c) \ - (*PL_Sock->pGetnetbyname)(PL_Sock, c) -# define PerlSock_getnetent() \ - (*PL_Sock->pGetnetent)(PL_Sock) -# define PerlSock_getpeername(s, n, l) \ - (*PL_Sock->pGetpeername)(PL_Sock, s, n, l) -# define PerlSock_getprotobyname(n) \ - (*PL_Sock->pGetprotobyname)(PL_Sock, n) -# define PerlSock_getprotobynumber(n) \ - (*PL_Sock->pGetprotobynumber)(PL_Sock, n) -# define PerlSock_getprotoent() \ - (*PL_Sock->pGetprotoent)(PL_Sock) -# define PerlSock_getservbyname(n, p) \ - (*PL_Sock->pGetservbyname)(PL_Sock, n, p) -# define PerlSock_getservbyport(port, p) \ - (*PL_Sock->pGetservbyport)(PL_Sock, port, p) -# define PerlSock_getservent() \ - (*PL_Sock->pGetservent)(PL_Sock) -# define PerlSock_getsockname(s, n, l) \ - (*PL_Sock->pGetsockname)(PL_Sock, s, n, l) -# define PerlSock_getsockopt(s,l,n,v,i) \ - (*PL_Sock->pGetsockopt)(PL_Sock, s, l, n, v, i) -# define PerlSock_inet_addr(c) \ - (*PL_Sock->pInetAddr)(PL_Sock, c) -# define PerlSock_inet_ntoa(i) \ - (*PL_Sock->pInetNtoa)(PL_Sock, i) -# define PerlSock_listen(s, b) \ - (*PL_Sock->pListen)(PL_Sock, s, b) -# define PerlSock_recv(s, b, l, f) \ - (*PL_Sock->pRecv)(PL_Sock, s, b, l, f) -# define PerlSock_recvfrom(s,b,l,f,from,fromlen) \ - (*PL_Sock->pRecvfrom)(PL_Sock, s, b, l, f, from, fromlen) -# define PerlSock_select(n, r, w, e, t) \ - (*PL_Sock->pSelect)(PL_Sock, n, (char*)r, (char*)w, (char*)e, t) -# define PerlSock_send(s, b, l, f) \ - (*PL_Sock->pSend)(PL_Sock, s, b, l, f) -# define PerlSock_sendto(s, b, l, f, t, tlen) \ - (*PL_Sock->pSendto)(PL_Sock, s, b, l, f, t, tlen) -# define PerlSock_sethostent(f) \ - (*PL_Sock->pSethostent)(PL_Sock, f) -# define PerlSock_setnetent(f) \ - (*PL_Sock->pSetnetent)(PL_Sock, f) -# define PerlSock_setprotoent(f) \ - (*PL_Sock->pSetprotoent)(PL_Sock, f) -# define PerlSock_setservent(f) \ - (*PL_Sock->pSetservent)(PL_Sock, f) -# define PerlSock_setsockopt(s, l, n, v, len) \ - (*PL_Sock->pSetsockopt)(PL_Sock, s, l, n, v, len) -# define PerlSock_shutdown(s, h) \ - (*PL_Sock->pShutdown)(PL_Sock, s, h) -# define PerlSock_socket(a, t, p) \ - (*PL_Sock->pSocket)(PL_Sock, a, t, p) -# define PerlSock_socketpair(a, t, p, f) \ - (*PL_Sock->pSocketpair)(PL_Sock, a, t, p, f) +# define PerlSock_htonl(x) \ + (*PL_Sock->pHtonl)(PL_Sock, x) +# define PerlSock_htons(x) \ + (*PL_Sock->pHtons)(PL_Sock, x) +# define PerlSock_ntohl(x) \ + (*PL_Sock->pNtohl)(PL_Sock, x) +# define PerlSock_ntohs(x) \ + (*PL_Sock->pNtohs)(PL_Sock, x) +# define PerlSock_accept(s, a, l) \ + (*PL_Sock->pAccept)(PL_Sock, s, a, l) +# define PerlSock_bind(s, n, l) \ + (*PL_Sock->pBind)(PL_Sock, s, n, l) +# define PerlSock_connect(s, n, l) \ + (*PL_Sock->pConnect)(PL_Sock, s, n, l) +# define PerlSock_endhostent() \ + (*PL_Sock->pEndhostent)(PL_Sock) +# define PerlSock_endnetent() \ + (*PL_Sock->pEndnetent)(PL_Sock) +# define PerlSock_endprotoent() \ + (*PL_Sock->pEndprotoent)(PL_Sock) +# define PerlSock_endservent() \ + (*PL_Sock->pEndservent)(PL_Sock) +# define PerlSock_gethostbyaddr(a, l, t) \ + (*PL_Sock->pGethostbyaddr)(PL_Sock, a, l, t) +# define PerlSock_gethostbyname(n) \ + (*PL_Sock->pGethostbyname)(PL_Sock, n) +# define PerlSock_gethostent() \ + (*PL_Sock->pGethostent)(PL_Sock) +# define PerlSock_gethostname(n, l) \ + (*PL_Sock->pGethostname)(PL_Sock, n, l) +# define PerlSock_getnetbyaddr(n, t) \ + (*PL_Sock->pGetnetbyaddr)(PL_Sock, n, t) +# define PerlSock_getnetbyname(c) \ + (*PL_Sock->pGetnetbyname)(PL_Sock, c) +# define PerlSock_getnetent() \ + (*PL_Sock->pGetnetent)(PL_Sock) +# define PerlSock_getpeername(s, n, l) \ + (*PL_Sock->pGetpeername)(PL_Sock, s, n, l) +# define PerlSock_getprotobyname(n) \ + (*PL_Sock->pGetprotobyname)(PL_Sock, n) +# define PerlSock_getprotobynumber(n) \ + (*PL_Sock->pGetprotobynumber)(PL_Sock, n) +# define PerlSock_getprotoent() \ + (*PL_Sock->pGetprotoent)(PL_Sock) +# define PerlSock_getservbyname(n, p) \ + (*PL_Sock->pGetservbyname)(PL_Sock, n, p) +# define PerlSock_getservbyport(port, p) \ + (*PL_Sock->pGetservbyport)(PL_Sock, port, p) +# define PerlSock_getservent() \ + (*PL_Sock->pGetservent)(PL_Sock) +# define PerlSock_getsockname(s, n, l) \ + (*PL_Sock->pGetsockname)(PL_Sock, s, n, l) +# define PerlSock_getsockopt(s,l,n,v,i) \ + (*PL_Sock->pGetsockopt)(PL_Sock, s, l, n, v, i) +# define PerlSock_inet_addr(c) \ + (*PL_Sock->pInetAddr)(PL_Sock, c) +# define PerlSock_inet_ntoa(i) \ + (*PL_Sock->pInetNtoa)(PL_Sock, i) +# define PerlSock_listen(s, b) \ + (*PL_Sock->pListen)(PL_Sock, s, b) +# define PerlSock_recv(s, b, l, f) \ + (*PL_Sock->pRecv)(PL_Sock, s, b, l, f) +# define PerlSock_recvfrom(s,b,l,f,from,fromlen) \ + (*PL_Sock->pRecvfrom)(PL_Sock, s, b, l, f, from, fromlen) +# define PerlSock_select(n, r, w, e, t) \ + (*PL_Sock->pSelect)(PL_Sock, n, (char*)r, (char*)w, (char*)e, t) +# define PerlSock_send(s, b, l, f) \ + (*PL_Sock->pSend)(PL_Sock, s, b, l, f) +# define PerlSock_sendto(s, b, l, f, t, tlen) \ + (*PL_Sock->pSendto)(PL_Sock, s, b, l, f, t, tlen) +# define PerlSock_sethostent(f) \ + (*PL_Sock->pSethostent)(PL_Sock, f) +# define PerlSock_setnetent(f) \ + (*PL_Sock->pSetnetent)(PL_Sock, f) +# define PerlSock_setprotoent(f) \ + (*PL_Sock->pSetprotoent)(PL_Sock, f) +# define PerlSock_setservent(f) \ + (*PL_Sock->pSetservent)(PL_Sock, f) +# define PerlSock_setsockopt(s, l, n, v, len) \ + (*PL_Sock->pSetsockopt)(PL_Sock, s, l, n, v, len) +# define PerlSock_shutdown(s, h) \ + (*PL_Sock->pShutdown)(PL_Sock, s, h) +# define PerlSock_socket(a, t, p) \ + (*PL_Sock->pSocket)(PL_Sock, a, t, p) +# define PerlSock_socketpair(a, t, p, f) \ + (*PL_Sock->pSocketpair)(PL_Sock, a, t, p, f) # ifdef WIN32 -# define PerlSock_closesocket(s) \ - (*PL_Sock->pClosesocket)(PL_Sock, s) +# define PerlSock_closesocket(s) \ + (*PL_Sock->pClosesocket)(PL_Sock, s) # endif #else /* ! PERL_IMPLICIT_SYS below */ @@ -1403,18 +1403,18 @@ struct IPerlSockInfo # define PerlSock_inet_ntoa(i) inet_ntoa(i) # define PerlSock_listen(s, b) listen(s, b) # define PerlSock_recv(s, b, l, f) recv(s, b, l, f) -# define PerlSock_recvfrom(s, b, l, f, from, fromlen) \ - recvfrom(s, b, l, f, from, fromlen) +# define PerlSock_recvfrom(s, b, l, f, from, fromlen) \ + recvfrom(s, b, l, f, from, fromlen) # define PerlSock_select(n, r, w, e, t) select(n, r, w, e, t) # define PerlSock_send(s, b, l, f) send(s, b, l, f) -# define PerlSock_sendto(s, b, l, f, t, tlen) \ - sendto(s, b, l, f, t, tlen) +# define PerlSock_sendto(s, b, l, f, t, tlen) \ + sendto(s, b, l, f, t, tlen) # define PerlSock_sethostent(f) sethostent(f) # define PerlSock_setnetent(f) setnetent(f) # define PerlSock_setprotoent(f) setprotoent(f) # define PerlSock_setservent(f) setservent(f) -# define PerlSock_setsockopt(s, l, n, v, len) \ - setsockopt(s, l, n, v, len) +# define PerlSock_setsockopt(s, l, n, v, len) \ + setsockopt(s, l, n, v, len) # define PerlSock_shutdown(s, h) shutdown(s, h) # define PerlSock_socket(a, t, p) socket(a, t, p) # define PerlSock_socketpair(a, t, p, f) socketpair(a, t, p, f) diff --git a/mg.h b/mg.h index 1fb0af50f007..3b38ad28eb7f 100644 --- a/mg.h +++ b/mg.h @@ -47,44 +47,44 @@ struct magic { #define MgTAINTEDDIR_off(mg) (mg->mg_flags &= ~MGf_TAINTEDDIR) /* Extracts the SV stored in mg, or NULL. */ -#define MgSV(mg) \ - (((int)((mg)->mg_len) == HEf_SVKEY) ?\ - MUTABLE_SV((mg)->mg_ptr) : \ +#define MgSV(mg) \ + (((int)((mg)->mg_len) == HEf_SVKEY) ? \ + MUTABLE_SV((mg)->mg_ptr) : \ NULL) /* If mg contains an SV, these extract the PV stored in that SV; otherwise, these extract the mg's mg_ptr/mg_len. These do NOT account for the SV's UTF8 flag, so handle with care. */ -#define MgPV(mg,lp) \ - ((((int)(lp = (mg)->mg_len)) == HEf_SVKEY) ?\ - SvPV(MUTABLE_SV((mg)->mg_ptr),lp) : \ +#define MgPV(mg,lp) \ + ((((int)(lp = (mg)->mg_len)) == HEf_SVKEY) ? \ + SvPV(MUTABLE_SV((mg)->mg_ptr),lp) : \ (mg)->mg_ptr) -#define MgPV_const(mg,lp) \ - ((((int)(lp = (mg)->mg_len)) == HEf_SVKEY) ?\ - SvPV_const(MUTABLE_SV((mg)->mg_ptr),lp) : \ +#define MgPV_const(mg,lp) \ + ((((int)(lp = (mg)->mg_len)) == HEf_SVKEY) ? \ + SvPV_const(MUTABLE_SV((mg)->mg_ptr),lp) : \ (const char*)(mg)->mg_ptr) -#define MgPV_nolen_const(mg) \ - (((((int)(mg)->mg_len)) == HEf_SVKEY) ?\ - SvPV_nolen_const(MUTABLE_SV((mg)->mg_ptr)) : \ +#define MgPV_nolen_const(mg) \ + (((((int)(mg)->mg_len)) == HEf_SVKEY) ? \ + SvPV_nolen_const(MUTABLE_SV((mg)->mg_ptr)) : \ (const char*)(mg)->mg_ptr) #define SvTIED_mg(sv,how) (SvRMAGICAL(sv) ? mg_find((sv),(how)) : NULL) -#define SvTIED_obj(sv,mg) \ +#define SvTIED_obj(sv,mg) \ ((mg)->mg_obj ? (mg)->mg_obj : sv_2mortal(newRV(sv))) #if defined(PERL_CORE) || defined(PERL_EXT) # define MgBYTEPOS(mg,sv,pv,len) S_MgBYTEPOS(aTHX_ mg,sv,pv,len) /* assumes get-magic and stringification have already occurred */ -# define MgBYTEPOS_set(mg,sv,pv,off) \ - (\ - assert_((mg)->mg_type == PERL_MAGIC_regex_global) \ - SvPOK(sv) && (!SvGMAGICAL(sv) || sv_only_taint_gmagic(sv)) \ - ? (mg)->mg_len = (off), (mg)->mg_flags |= MGf_BYTES \ - : ((mg)->mg_len = DO_UTF8(sv) \ - ? (SSize_t)utf8_length((U8 *)(pv), (U8 *)(pv)+(off)) \ - : (SSize_t)(off), \ - (mg)->mg_flags &= ~MGf_BYTES)) +# define MgBYTEPOS_set(mg,sv,pv,off) \ + ( \ + assert_((mg)->mg_type == PERL_MAGIC_regex_global) \ + SvPOK(sv) && (!SvGMAGICAL(sv) || sv_only_taint_gmagic(sv)) \ + ? (mg)->mg_len = (off), (mg)->mg_flags |= MGf_BYTES \ + : ((mg)->mg_len = DO_UTF8(sv) \ + ? (SSize_t)utf8_length((U8 *)(pv), (U8 *)(pv)+(off)) \ + : (SSize_t)(off), \ + (mg)->mg_flags &= ~MGf_BYTES)) #endif #define whichsig(pv) whichsig_pv(pv) diff --git a/mydtrace.h b/mydtrace.h index aae54ea6e4ed..3210bcd4b1a0 100644 --- a/mydtrace.h +++ b/mydtrace.h @@ -13,29 +13,29 @@ # include "perldtrace.h" -# define PERL_DTRACE_PROBE_ENTRY(cv) \ - if (PERL_SUB_ENTRY_ENABLED()) \ - Perl_dtrace_probe_call(aTHX_ cv, TRUE); +# define PERL_DTRACE_PROBE_ENTRY(cv) \ + if (PERL_SUB_ENTRY_ENABLED()) \ + Perl_dtrace_probe_call(aTHX_ cv, TRUE); -# define PERL_DTRACE_PROBE_RETURN(cv) \ - if (PERL_SUB_ENTRY_ENABLED()) \ - Perl_dtrace_probe_call(aTHX_ cv, FALSE); +# define PERL_DTRACE_PROBE_RETURN(cv) \ + if (PERL_SUB_ENTRY_ENABLED()) \ + Perl_dtrace_probe_call(aTHX_ cv, FALSE); -# define PERL_DTRACE_PROBE_FILE_LOADING(name) \ - if (PERL_SUB_ENTRY_ENABLED()) \ - Perl_dtrace_probe_load(aTHX_ name, TRUE); +# define PERL_DTRACE_PROBE_FILE_LOADING(name) \ + if (PERL_SUB_ENTRY_ENABLED()) \ + Perl_dtrace_probe_load(aTHX_ name, TRUE); -# define PERL_DTRACE_PROBE_FILE_LOADED(name) \ - if (PERL_SUB_ENTRY_ENABLED()) \ - Perl_dtrace_probe_load(aTHX_ name, FALSE); +# define PERL_DTRACE_PROBE_FILE_LOADED(name) \ + if (PERL_SUB_ENTRY_ENABLED()) \ + Perl_dtrace_probe_load(aTHX_ name, FALSE); -# define PERL_DTRACE_PROBE_OP(op) \ - if (PERL_OP_ENTRY_ENABLED()) \ - Perl_dtrace_probe_op(aTHX_ op); +# define PERL_DTRACE_PROBE_OP(op) \ + if (PERL_OP_ENTRY_ENABLED()) \ + Perl_dtrace_probe_op(aTHX_ op); -# define PERL_DTRACE_PROBE_PHASE(phase) \ - if (PERL_OP_ENTRY_ENABLED()) \ - Perl_dtrace_probe_phase(aTHX_ phase); +# define PERL_DTRACE_PROBE_PHASE(phase) \ + if (PERL_OP_ENTRY_ENABLED()) \ + Perl_dtrace_probe_phase(aTHX_ phase); #else diff --git a/op.h b/op.h index 11fbe71cf0be..ba84a767f2a4 100644 --- a/op.h +++ b/op.h @@ -47,29 +47,29 @@ typedef PERL_BITFIELD16 Optype; #ifdef BASEOP_DEFINITION #define BASEOP BASEOP_DEFINITION #else -#define BASEOP \ - OP* op_next; \ - OP* op_sibparent; \ - OP* (*op_ppaddr)(pTHX); \ - PADOFFSET op_targ; \ - PERL_BITFIELD16 op_type:9; \ - PERL_BITFIELD16 op_opt:1; \ - PERL_BITFIELD16 op_slabbed:1; \ - PERL_BITFIELD16 op_savefree:1; \ - PERL_BITFIELD16 op_static:1; \ - PERL_BITFIELD16 op_folded:1; \ - PERL_BITFIELD16 op_moresib:1; \ - PERL_BITFIELD16 op_spare:1; \ - U8 op_flags; \ +#define BASEOP \ + OP* op_next; \ + OP* op_sibparent; \ + OP* (*op_ppaddr)(pTHX); \ + PADOFFSET op_targ; \ + PERL_BITFIELD16 op_type:9; \ + PERL_BITFIELD16 op_opt:1; \ + PERL_BITFIELD16 op_slabbed:1; \ + PERL_BITFIELD16 op_savefree:1; \ + PERL_BITFIELD16 op_static:1; \ + PERL_BITFIELD16 op_folded:1; \ + PERL_BITFIELD16 op_moresib:1; \ + PERL_BITFIELD16 op_spare:1; \ + U8 op_flags; \ U8 op_private; #endif -#define OpTYPE_set(o,type) \ - STMT_START { \ - OP *o_ = (OP *)o; \ - OPCODE type_ = type; \ - o_->op_type = type_; \ - o_->op_ppaddr = PL_ppaddr[type_]; \ +#define OpTYPE_set(o,type) \ + STMT_START { \ + OP *o_ = (OP *)o; \ + OPCODE type_ = type; \ + o_->op_type = type_; \ + o_->op_ppaddr = PL_ppaddr[type_]; \ } STMT_END /* If op_type:9 is changed to :10, also change cx_pusheval() @@ -78,8 +78,8 @@ typedef PERL_BITFIELD16 Optype; types too to let VC pack them into the same 4 byte integer.*/ /* for efficiency, requires OPf_WANT_VOID == G_VOID etc */ -#define OP_GIMME(op,dfl) \ - (((op)->op_flags & OPf_WANT) ? ((op)->op_flags & OPf_WANT) : dfl) +#define OP_GIMME(op,dfl) \ + (((op)->op_flags & OPf_WANT) ? ((op)->op_flags & OPf_WANT) : dfl) #define OP_GIMME_REVERSE(flags) ((flags) & G_WANT) @@ -172,12 +172,12 @@ Deprecated. Use C instead. #define OPf_KNOW OPf_WANT #if !defined(PERL_CORE) && !defined(PERL_EXT) -# define GIMME \ - (PL_op->op_flags & OPf_WANT \ - ? ((PL_op->op_flags & OPf_WANT) == OPf_WANT_LIST \ - ? G_LIST \ - : G_SCALAR) \ - : dowantarray()) +# define GIMME \ + (PL_op->op_flags & OPf_WANT \ + ? ((PL_op->op_flags & OPf_WANT) == OPf_WANT_LIST \ + ? G_LIST \ + : G_SCALAR) \ + : dowantarray()) #endif @@ -295,8 +295,8 @@ struct pmop { }; #ifdef USE_ITHREADS -#define PM_GETRE(o) \ - (SvTYPE(PL_regex_pad[(o)->op_pmoffset]) == SVt_REGEXP\ +#define PM_GETRE(o) \ + (SvTYPE(PL_regex_pad[(o)->op_pmoffset]) == SVt_REGEXP \ ? (REGEXP*)(PL_regex_pad[(o)->op_pmoffset]) : NULL) /* The assignment is just to enforce type safety (or at least get a warning). */ @@ -306,10 +306,10 @@ struct pmop { more complex, and we'd have an AV with (SV*)NULL in it, which feels bad */ /* BEWARE - something that calls this macro passes (r) which has a side effect. */ -#define PM_SETRE(o,r) \ - STMT_START {\ - REGEXP *const _pm_setre = (r); \ - assert(_pm_setre); \ +#define PM_SETRE(o,r) \ + STMT_START { \ + REGEXP *const _pm_setre = (r); \ + assert(_pm_setre); \ PL_regex_pad[(o)->op_pmoffset] = MUTABLE_SV(_pm_setre); \ } STMT_END #else @@ -408,23 +408,23 @@ struct pmop { #ifdef USE_ITHREADS -# define PmopSTASH(o) \ - ((o)->op_pmflags & PMf_ONCE\ - ? PL_stashpad[(o)->op_pmstashstartu.op_pmstashoff] \ - : NULL) -# define PmopSTASH_set(o,hv) \ - (assert_((o)->op_pmflags & PMf_ONCE) \ - (o)->op_pmstashstartu.op_pmstashoff = \ - (hv) ? alloccopstash(hv) : 0) +# define PmopSTASH(o) \ + ((o)->op_pmflags & PMf_ONCE \ + ? PL_stashpad[(o)->op_pmstashstartu.op_pmstashoff] \ + : NULL) +# define PmopSTASH_set(o,hv) \ + (assert_((o)->op_pmflags & PMf_ONCE) \ + (o)->op_pmstashstartu.op_pmstashoff = \ + (hv) ? alloccopstash(hv) : 0) #else -# define PmopSTASH(o) \ - (((o)->op_pmflags & PMf_ONCE) ? (o)->op_pmstashstartu.op_pmstash : NULL) +# define PmopSTASH(o) \ + (((o)->op_pmflags & PMf_ONCE) ? (o)->op_pmstashstartu.op_pmstash : NULL) # if defined (DEBUGGING) && defined(PERL_USE_GCC_BRACE_GROUPS) -# define PmopSTASH_set(o,hv) \ - ({\ - assert((o)->op_pmflags & PMf_ONCE); \ - ((o)->op_pmstashstartu.op_pmstash = (hv)); \ - }) +# define PmopSTASH_set(o,hv) \ + ({ \ + assert((o)->op_pmflags & PMf_ONCE); \ + ((o)->op_pmstashstartu.op_pmstash = (hv)); \ + }) # else # define PmopSTASH_set(o,hv) ((o)->op_pmstashstartu.op_pmstash = (hv)) # endif @@ -532,18 +532,18 @@ typedef enum { # define cGVOPx_gv(o) ((GV*)PAD_SVl(cPADOPx(o)->op_padix)) # ifndef PERL_CORE # define IS_PADGV(v) (v && isGV(v)) -# define IS_PADCONST(v) \ - (v && (SvREADONLY(v) || (SvIsCOW(v) && !SvLEN(v)))) +# define IS_PADCONST(v) \ + (v && (SvREADONLY(v) || (SvIsCOW(v) && !SvLEN(v)))) # endif -# define cSVOPx_sv(v) \ - (cSVOPx(v)->op_sv\ - ? cSVOPx(v)->op_sv : PAD_SVl((v)->op_targ)) -# define cSVOPx_svp(v) \ - (cSVOPx(v)->op_sv\ - ? &cSVOPx(v)->op_sv : &PAD_SVl((v)->op_targ)) -# define cMETHOPx_meth(v) \ - (cMETHOPx(v)->op_u.op_meth_sv\ - ? cMETHOPx(v)->op_u.op_meth_sv : PAD_SVl((v)->op_targ)) +# define cSVOPx_sv(v) \ + (cSVOPx(v)->op_sv \ + ? cSVOPx(v)->op_sv : PAD_SVl((v)->op_targ)) +# define cSVOPx_svp(v) \ + (cSVOPx(v)->op_sv \ + ? &cSVOPx(v)->op_sv : &PAD_SVl((v)->op_targ)) +# define cMETHOPx_meth(v) \ + (cMETHOPx(v)->op_u.op_meth_sv \ + ? cMETHOPx(v)->op_u.op_meth_sv : PAD_SVl((v)->op_targ)) # define cMETHOPx_rclass(v) PAD_SVl(cMETHOPx(v)->op_rclass_targ) #else # define cGVOPx_gv(o) ((GV*)cSVOPx(o)->op_sv) @@ -693,8 +693,8 @@ least an C. /* no longer used anywhere in core */ #ifndef PERL_CORE -#define cv_ckproto(cv, gv, p) \ - cv_ckproto_len_flags((cv), (gv), (p), (p) ? strlen(p) : 0, 0) +#define cv_ckproto(cv, gv, p) \ + cv_ckproto_len_flags((cv), (gv), (p), (p) ? strlen(p) : 0, 0) #endif #ifdef PERL_CORE @@ -705,10 +705,10 @@ least an C. #include "reentr.h" #endif -#define NewOp(m,var,c,type) \ - (var = (type *) Perl_Slab_Alloc(aTHX_ c*sizeof(type))) -#define NewOpSz(m,var,size) \ - (var = (OP *) Perl_Slab_Alloc(aTHX_ size)) +#define NewOp(m,var,c,type) \ + (var = (type *) Perl_Slab_Alloc(aTHX_ c*sizeof(type))) +#define NewOpSz(m,var,size) \ + (var = (OP *) Perl_Slab_Alloc(aTHX_ size)) #define FreeOp(p) Perl_Slab_Free(aTHX_ p) /* @@ -756,29 +756,29 @@ struct opslab { }; # define OPSLOT_HEADER STRUCT_OFFSET(OPSLOT, opslot_op) -# define OpSLOT(o) \ - (assert_(o->op_slabbed)\ - (OPSLOT *)(((char *)o)-OPSLOT_HEADER)) +# define OpSLOT(o) \ + (assert_(o->op_slabbed) \ + (OPSLOT *)(((char *)o)-OPSLOT_HEADER)) /* the slab that owns this op */ -# define OpMySLAB(o) \ - ((OPSLAB*)((char *)((I32**)OpSLOT(o) - OpSLOT(o)->opslot_offset)-STRUCT_OFFSET(struct opslab, opslab_slots))) +# define OpMySLAB(o) \ + ((OPSLAB*)((char *)((I32**)OpSLOT(o) - OpSLOT(o)->opslot_offset)-STRUCT_OFFSET(struct opslab, opslab_slots))) /* the first (head) opslab of the chain in which this op is allocated */ -# define OpSLAB(o) \ - (OpMySLAB(o)->opslab_head) +# define OpSLAB(o) \ + (OpMySLAB(o)->opslab_head) /* calculate the slot given the owner slab and an offset */ #define OpSLOToff(slab, offset) \ ((OPSLOT*)(((I32 **)&(slab)->opslab_slots)+(offset))) -# define OpslabREFCNT_dec(slab) \ - (((slab)->opslab_refcnt == 1) \ - ? opslab_free_nopad(slab) \ - : (void)--(slab)->opslab_refcnt) +# define OpslabREFCNT_dec(slab) \ + (((slab)->opslab_refcnt == 1) \ + ? opslab_free_nopad(slab) \ + : (void)--(slab)->opslab_refcnt) /* Variant that does not null out the pads */ -# define OpslabREFCNT_dec_padok(slab) \ - (((slab)->opslab_refcnt == 1) \ - ? opslab_free(slab) \ - : (void)--(slab)->opslab_refcnt) +# define OpslabREFCNT_dec_padok(slab) \ + (((slab)->opslab_refcnt == 1) \ + ? opslab_free(slab) \ + : (void)--(slab)->opslab_refcnt) #endif struct block_hooks { @@ -834,41 +834,41 @@ preprocessing token; the type of C depends on C. #define BhkENTRY(hk, which) \ ((BhkFLAGS(hk) & BHKf_ ## which) ? ((hk)->which) : NULL) -#define BhkENABLE(hk, which) \ - STMT_START { \ +#define BhkENABLE(hk, which) \ + STMT_START { \ BhkFLAGS(hk) |= BHKf_ ## which; \ - assert(BhkENTRY(hk, which)); \ + assert(BhkENTRY(hk, which)); \ } STMT_END -#define BhkDISABLE(hk, which) \ - STMT_START { \ - BhkFLAGS(hk) &= ~(BHKf_ ## which); \ +#define BhkDISABLE(hk, which) \ + STMT_START { \ + BhkFLAGS(hk) &= ~(BHKf_ ## which); \ } STMT_END -#define BhkENTRY_set(hk, which, ptr) \ - STMT_START { \ - (hk)->which = ptr; \ - BhkENABLE(hk, which); \ +#define BhkENTRY_set(hk, which, ptr) \ + STMT_START { \ + (hk)->which = ptr; \ + BhkENABLE(hk, which); \ } STMT_END -#define CALL_BLOCK_HOOKS(which, arg) \ - STMT_START { \ - if (PL_blockhooks) { \ - SSize_t i; \ - for (i = av_top_index(PL_blockhooks); i >= 0; i--) { \ - SV *sv = AvARRAY(PL_blockhooks)[i]; \ - BHK *hk; \ - \ - assert(SvIOK(sv)); \ - if (SvUOK(sv)) \ - hk = INT2PTR(BHK *, SvUVX(sv)); \ - else \ - hk = INT2PTR(BHK *, SvIVX(sv)); \ - \ - if (BhkENTRY(hk, which)) \ - BhkENTRY(hk, which)(aTHX_ arg); \ - } \ - } \ +#define CALL_BLOCK_HOOKS(which, arg) \ + STMT_START { \ + if (PL_blockhooks) { \ + SSize_t i; \ + for (i = av_top_index(PL_blockhooks); i >= 0; i--) { \ + SV *sv = AvARRAY(PL_blockhooks)[i]; \ + BHK *hk; \ + \ + assert(SvIOK(sv)); \ + if (SvUOK(sv)) \ + hk = INT2PTR(BHK *, SvUVX(sv)); \ + else \ + hk = INT2PTR(BHK *, SvIVX(sv)); \ + \ + if (BhkENTRY(hk, which)) \ + BhkENTRY(hk, which)(aTHX_ arg); \ + } \ + } \ } STMT_END /* flags for rv2cv_op_cv */ @@ -961,26 +961,26 @@ typedef enum { #define XOPd_xop_class OA_BASEOP #define XOPd_xop_peep ((Perl_cpeep_t)0) -#define XopENTRY_set(xop, which, to) \ - STMT_START { \ - (xop)->which = (to); \ +#define XopENTRY_set(xop, which, to) \ + STMT_START { \ + (xop)->which = (to); \ (xop)->xop_flags |= XOPf_ ## which; \ } STMT_END -#define XopENTRY(xop, which) \ +#define XopENTRY(xop, which) \ ((XopFLAGS(xop) & XOPf_ ## which) ? (xop)->which : XOPd_ ## which) -#define XopENTRYCUSTOM(o, which) \ +#define XopENTRYCUSTOM(o, which) \ (Perl_custom_op_get_field(aTHX_ o, XOPe_ ## which).which) #define XopDISABLE(xop, which) ((xop)->xop_flags &= ~XOPf_ ## which) -#define XopENABLE(xop, which) \ - STMT_START { \ +#define XopENABLE(xop, which) \ + STMT_START { \ (xop)->xop_flags |= XOPf_ ## which; \ - assert(XopENTRY(xop, which)); \ + assert(XopENTRY(xop, which)); \ } STMT_END -#define Perl_custom_op_xop(x) \ +#define Perl_custom_op_xop(x) \ (Perl_custom_op_get_field(x, XOPe_xop_ptr).xop_ptr) /* @@ -1046,16 +1046,16 @@ C is non-null. For a higher-level interface, see C>. =cut */ -#define OP_NAME(o) \ - ((o)->op_type == OP_CUSTOM\ - ? XopENTRYCUSTOM(o, xop_name) \ +#define OP_NAME(o) \ + ((o)->op_type == OP_CUSTOM \ + ? XopENTRYCUSTOM(o, xop_name) \ : PL_op_name[(o)->op_type]) -#define OP_DESC(o) \ - ((o)->op_type == OP_CUSTOM\ - ? XopENTRYCUSTOM(o, xop_desc) \ +#define OP_DESC(o) \ + ((o)->op_type == OP_CUSTOM \ + ? XopENTRYCUSTOM(o, xop_desc) \ : PL_op_desc[(o)->op_type]) -#define OP_CLASS(o) \ - ((o)->op_type == OP_CUSTOM\ +#define OP_CLASS(o) \ + ((o)->op_type == OP_CUSTOM \ ? XopENTRYCUSTOM(o, xop_class) \ : (PL_opargs[(o)->op_type] & OA_CLASS_MASK)) @@ -1064,19 +1064,19 @@ C is non-null. For a higher-level interface, see C>. #define OP_TYPE_ISNT(o, type) ((o) && (o)->op_type != (type)) #define OP_TYPE_ISNT_NN(o, type) ((o)->op_type != (type)) -#define OP_TYPE_IS_OR_WAS_NN(o, type) \ - ( ((o)->op_type == OP_NULL \ - ? (o)->op_targ \ - : (o)->op_type) \ +#define OP_TYPE_IS_OR_WAS_NN(o, type) \ + ( ((o)->op_type == OP_NULL \ + ? (o)->op_targ \ + : (o)->op_type) \ == (type) ) -#define OP_TYPE_IS_OR_WAS(o, type) \ +#define OP_TYPE_IS_OR_WAS(o, type) \ ( (o) && OP_TYPE_IS_OR_WAS_NN(o, type) ) -#define OP_TYPE_ISNT_AND_WASNT_NN(o, type) \ - ( ((o)->op_type == OP_NULL \ - ? (o)->op_targ \ - : (o)->op_type) \ +#define OP_TYPE_ISNT_AND_WASNT_NN(o, type) \ + ( ((o)->op_type == OP_NULL \ + ? (o)->op_targ \ + : (o)->op_type) \ != (type) ) #define OP_TYPE_ISNT_AND_WASNT(o, type) \ @@ -1088,9 +1088,9 @@ C is non-null. For a higher-level interface, see C>. #define OpHAS_SIBLING(o) (cBOOL((o)->op_moresib)) #define OpSIBLING(o) (0 + (o)->op_moresib ? (o)->op_sibparent : NULL) #define OpMORESIB_set(o, sib) ((o)->op_moresib = 1, (o)->op_sibparent = (sib)) -#define OpLASTSIB_set(o, parent) \ +#define OpLASTSIB_set(o, parent) \ ((o)->op_moresib = 0, (o)->op_sibparent = (parent)) -#define OpMAYBESIB_set(o, sib, parent) \ +#define OpMAYBESIB_set(o, sib, parent) \ ((o)->op_sibparent = ((o)->op_moresib = cBOOL(sib)) ? (sib) : (parent)) #if !defined(PERL_CORE) && !defined(PERL_EXT) @@ -1154,9 +1154,9 @@ C is non-null. For a higher-level interface, see C>. #define MDEREF_SHIFT 7 #if defined(PERL_IN_DOOP_C) || defined(PERL_IN_PP_C) -# define FATAL_ABOVE_FF_MSG \ - "Use of strings with code points over 0xFF as arguments to " \ - "%s operator is not allowed" +# define FATAL_ABOVE_FF_MSG \ + "Use of strings with code points over 0xFF as arguments to " \ + "%s operator is not allowed" #endif #if defined(PERL_IN_OP_C) || defined(PERL_IN_DOOP_C) || defined(PERL_IN_PERL_C) # define TR_UNMAPPED (UV)-1 diff --git a/op_reg_common.h b/op_reg_common.h index 1273cb6f2195..39671592dc1a 100644 --- a/op_reg_common.h +++ b/op_reg_common.h @@ -150,7 +150,7 @@ get_regex_charset(const U32 flags) * (2**n - 1) is n 1 bits, so the below gets the contiguous bits between the * beginning and ending shifts */ #if RXf_PMf_COMPILETIME != ((nBIT_MASK(_RXf_PMf_SHIFT_COMPILETIME)) \ - & (~(nBIT_MASK( RXf_PMf_STD_PMMOD_SHIFT)))) + & (~(nBIT_MASK( RXf_PMf_STD_PMMOD_SHIFT)))) # error RXf_PMf_COMPILETIME is invalid #endif diff --git a/pad.h b/pad.h index 06db2225bc0f..bd68235dd1d0 100644 --- a/pad.h +++ b/pad.h @@ -55,18 +55,18 @@ struct padnamelist { # define PERL_PADNAME_MINIMAL #endif -#define _PADNAME_BASE \ - char * xpadn_pv; \ - HV * xpadn_ourstash; \ - union { \ - HV * xpadn_typestash; \ - CV * xpadn_protocv; \ - } xpadn_type_u; \ - U32 xpadn_low; \ - U32 xpadn_high; \ - U32 xpadn_refcnt; \ - int xpadn_gen; \ - U8 xpadn_len; \ +#define _PADNAME_BASE \ + char * xpadn_pv; \ + HV * xpadn_ourstash; \ + union { \ + HV * xpadn_typestash; \ + CV * xpadn_protocv; \ + } xpadn_type_u; \ + U32 xpadn_low; \ + U32 xpadn_high; \ + U32 xpadn_refcnt; \ + int xpadn_gen; \ + U8 xpadn_len; \ U8 xpadn_flags struct padname { @@ -84,7 +84,7 @@ struct padname_with_str { #undef _PADNAME_BASE -#define PADNAME_FROM_PV(s) \ +#define PADNAME_FROM_PV(s) \ ((PADNAME *)((s) - STRUCT_OFFSET(struct padname_with_str, xpadn_str))) @@ -92,9 +92,9 @@ struct padname_with_str { * flagging that a lexical is being introduced, or has not yet left scope */ #define PERL_PADSEQ_INTRO U32_MAX -#define COP_SEQMAX_INC \ - (PL_cop_seqmax++, \ - (void)(PL_cop_seqmax == PERL_PADSEQ_INTRO && PL_cop_seqmax++)) +#define COP_SEQMAX_INC \ + (PL_cop_seqmax++, \ + (void)(PL_cop_seqmax == PERL_PADSEQ_INTRO && PL_cop_seqmax++)) /* B.xs needs these for the benefit of B::Deparse */ @@ -140,18 +140,18 @@ typedef enum { # define pad_peg(label) #ifdef DEBUGGING -# define ASSERT_CURPAD_LEGAL(label) \ - pad_peg(label); \ - if (PL_comppad ? (AvARRAY(PL_comppad) != PL_curpad) : (PL_curpad != 0)) \ - Perl_croak(aTHX_ "panic: illegal pad in %s: 0x%" UVxf "[0x%" UVxf "]",\ - label, PTR2UV(PL_comppad), PTR2UV(PL_curpad)); - - -# define ASSERT_CURPAD_ACTIVE(label) \ - pad_peg(label); \ - if (!PL_comppad || (AvARRAY(PL_comppad) != PL_curpad)) \ - Perl_croak(aTHX_ "panic: invalid pad in %s: 0x%" UVxf "[0x%" UVxf "]",\ - label, PTR2UV(PL_comppad), PTR2UV(PL_curpad)); +# define ASSERT_CURPAD_LEGAL(label) \ + pad_peg(label); \ + if (PL_comppad ? (AvARRAY(PL_comppad) != PL_curpad) : (PL_curpad != 0)) \ + Perl_croak(aTHX_ "panic: illegal pad in %s: 0x%" UVxf "[0x%" UVxf "]", \ + label, PTR2UV(PL_comppad), PTR2UV(PL_curpad)); + + +# define ASSERT_CURPAD_ACTIVE(label) \ + pad_peg(label); \ + if (!PL_comppad || (AvARRAY(PL_comppad) != PL_curpad)) \ + Perl_croak(aTHX_ "panic: invalid pad in %s: 0x%" UVxf "[0x%" UVxf "]", \ + label, PTR2UV(PL_comppad), PTR2UV(PL_curpad)); #else # define ASSERT_CURPAD_LEGAL(label) # define ASSERT_CURPAD_ACTIVE(label) @@ -317,8 +317,8 @@ Restore the old pad saved into the local variable C by C #define PadnamePV(pn) (pn)->xpadn_pv #define PadnameLEN(pn) (pn)->xpadn_len #define PadnameUTF8(pn) 1 -#define PadnameSV(pn) \ - newSVpvn_flags(PadnamePV(pn), PadnameLEN(pn), SVs_TEMP|SVf_UTF8) +#define PadnameSV(pn) \ + newSVpvn_flags(PadnamePV(pn), PadnameLEN(pn), SVs_TEMP|SVf_UTF8) #define PadnameFLAGS(pn) (pn)->xpadn_flags #define PadnameIsOUR(pn) cBOOL((pn)->xpadn_ourstash) #define PadnameOURSTASH(pn) (pn)->xpadn_ourstash @@ -373,45 +373,45 @@ Restore the old pad saved into the local variable C by C #define PAD_SVl(po) (PL_curpad[po]) -#define PAD_BASE_SV(padlist, po) \ - (PadlistARRAY(padlist)[1]) \ - ? AvARRAY(MUTABLE_AV((PadlistARRAY(padlist)[1])))[po] \ - : NULL; +#define PAD_BASE_SV(padlist, po) \ + (PadlistARRAY(padlist)[1]) \ + ? AvARRAY(MUTABLE_AV((PadlistARRAY(padlist)[1])))[po] \ + : NULL; -#define PAD_SET_CUR_NOSAVE(padlist,nth) \ - PL_comppad = (PAD*) (PadlistARRAY(padlist)[nth]); \ - PL_curpad = AvARRAY(PL_comppad); \ - DEBUG_Xv(PerlIO_printf(Perl_debug_log, \ - "Pad 0x%" UVxf "[0x%" UVxf "] set_cur depth=%d\n", \ - PTR2UV(PL_comppad), PTR2UV(PL_curpad), (int)(nth))); +#define PAD_SET_CUR_NOSAVE(padlist,nth) \ + PL_comppad = (PAD*) (PadlistARRAY(padlist)[nth]); \ + PL_curpad = AvARRAY(PL_comppad); \ + DEBUG_Xv(PerlIO_printf(Perl_debug_log, \ + "Pad 0x%" UVxf "[0x%" UVxf "] set_cur depth=%d\n", \ + PTR2UV(PL_comppad), PTR2UV(PL_curpad), (int)(nth))); -#define PAD_SET_CUR(padlist,nth) \ - SAVECOMPPAD(); \ - PAD_SET_CUR_NOSAVE(padlist,nth); +#define PAD_SET_CUR(padlist,nth) \ + SAVECOMPPAD(); \ + PAD_SET_CUR_NOSAVE(padlist,nth); -#define PAD_SAVE_SETNULLPAD() \ - SAVECOMPPAD();\ +#define PAD_SAVE_SETNULLPAD() \ + SAVECOMPPAD(); \ PL_comppad = NULL; PL_curpad = NULL; \ DEBUG_Xv(PerlIO_printf(Perl_debug_log, "Pad set_null\n")); -#define PAD_SAVE_LOCAL(opad,npad) \ - opad = PL_comppad; \ - PL_comppad = (npad); \ - PL_curpad = PL_comppad ? AvARRAY(PL_comppad) : NULL; \ - DEBUG_Xv(PerlIO_printf(Perl_debug_log, \ - "Pad 0x%" UVxf "[0x%" UVxf "] save_local\n", \ - PTR2UV(PL_comppad), PTR2UV(PL_curpad))); +#define PAD_SAVE_LOCAL(opad,npad) \ + opad = PL_comppad; \ + PL_comppad = (npad); \ + PL_curpad = PL_comppad ? AvARRAY(PL_comppad) : NULL; \ + DEBUG_Xv(PerlIO_printf(Perl_debug_log, \ + "Pad 0x%" UVxf "[0x%" UVxf "] save_local\n", \ + PTR2UV(PL_comppad), PTR2UV(PL_curpad))); -#define PAD_RESTORE_LOCAL(opad) \ - assert(!opad || !SvIS_FREED(opad)); \ - PL_comppad = opad; \ - PL_curpad = PL_comppad ? AvARRAY(PL_comppad) : NULL; \ - DEBUG_Xv(PerlIO_printf(Perl_debug_log, \ - "Pad 0x%" UVxf "[0x%" UVxf "] restore_local\n", \ - PTR2UV(PL_comppad), PTR2UV(PL_curpad))); +#define PAD_RESTORE_LOCAL(opad) \ + assert(!opad || !SvIS_FREED(opad)); \ + PL_comppad = opad; \ + PL_curpad = PL_comppad ? AvARRAY(PL_comppad) : NULL; \ + DEBUG_Xv(PerlIO_printf(Perl_debug_log, \ + "Pad 0x%" UVxf "[0x%" UVxf "] restore_local\n", \ + PTR2UV(PL_comppad), PTR2UV(PL_curpad))); /* @@ -467,10 +467,10 @@ ling pad (lvalue) to C. #define PAD_COMPNAME_OURSTASH(po) (PadnameOURSTASH(PAD_COMPNAME_SV(po))) -#define PAD_COMPNAME_GEN(po) \ +#define PAD_COMPNAME_GEN(po) \ ((STRLEN)PadnamelistARRAY(PL_comppad_name)[po]->xpadn_gen) -#define PAD_COMPNAME_GEN_set(po, gen) \ +#define PAD_COMPNAME_GEN_set(po, gen) \ (PadnamelistARRAY(PL_comppad_name)[po]->xpadn_gen = (gen)) @@ -524,7 +524,7 @@ instead of a string/length pair. =cut */ -#define pad_findmy_pvs(name,flags) \ +#define pad_findmy_pvs(name,flags) \ Perl_pad_findmy_pvn(aTHX_ STR_WITH_LEN(name), flags) /* diff --git a/parser.h b/parser.h index 35a33701a5f4..96f5db04c20f 100644 --- a/parser.h +++ b/parser.h @@ -136,9 +136,9 @@ typedef struct yy_parser { # define LEX_EVALBYTES 0x00000004 # define LEX_START_COPIED 0x00000008 # define LEX_DONT_CLOSE_RSFP 0x00000010 -# define LEX_START_FLAGS \ - (LEX_START_SAME_FILTER|LEX_START_COPIED \ - |LEX_IGNORE_UTF8_HINTS|LEX_EVALBYTES|LEX_DONT_CLOSE_RSFP) +# define LEX_START_FLAGS \ + (LEX_START_SAME_FILTER|LEX_START_COPIED \ + |LEX_IGNORE_UTF8_HINTS|LEX_EVALBYTES|LEX_DONT_CLOSE_RSFP) #endif /* flags for parser API */ diff --git a/perl.h b/perl.h index f241849af25a..b56cf20380cc 100644 --- a/perl.h +++ b/perl.h @@ -60,7 +60,7 @@ is used in functions that take a thread context initial parameter. * NOTE 2: headers lie. Do not expect that if HAS_C99 gets to be true, * all the C99 features are there and are correct. */ -#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || \ +#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || \ defined(_STDC_C99) || defined(__c99) # define HAS_C99 1 #endif @@ -230,70 +230,70 @@ Now a no-op. #define CALLREGCOMP(sv, flags) Perl_pregcomp(aTHX_ (sv),(flags)) #define CALLREGCOMP_ENG(prog, sv, flags) (prog)->comp(aTHX_ sv, flags) -#define CALLREGEXEC(prog,stringarg,strend,strbeg,minend,sv,data,flags) \ - RX_ENGINE(prog)->exec(aTHX_ (prog),(stringarg),(strend), \ +#define CALLREGEXEC(prog,stringarg,strend,strbeg,minend,sv,data,flags) \ + RX_ENGINE(prog)->exec(aTHX_ (prog),(stringarg),(strend), \ (strbeg),(minend),(sv),(data),(flags)) -#define CALLREG_INTUIT_START(prog,sv,strbeg,strpos,strend,flags,data) \ - RX_ENGINE(prog)->intuit(aTHX_ (prog), (sv), (strbeg), (strpos), \ +#define CALLREG_INTUIT_START(prog,sv,strbeg,strpos,strend,flags,data) \ + RX_ENGINE(prog)->intuit(aTHX_ (prog), (sv), (strbeg), (strpos), \ (strend),(flags),(data)) #define CALLREG_INTUIT_STRING(prog) \ RX_ENGINE(prog)->checkstr(aTHX_ (prog)) -#define CALLREGFREE(prog) \ +#define CALLREGFREE(prog) \ Perl_pregfree(aTHX_ (prog)) -#define CALLREGFREE_PVT(prog) \ +#define CALLREGFREE_PVT(prog) \ if(prog && RX_ENGINE(prog)) RX_ENGINE(prog)->rxfree(aTHX_ (prog)) -#define CALLREG_NUMBUF_FETCH(rx,paren,usesv) \ +#define CALLREG_NUMBUF_FETCH(rx,paren,usesv) \ RX_ENGINE(rx)->numbered_buff_FETCH(aTHX_ (rx),(paren),(usesv)) -#define CALLREG_NUMBUF_STORE(rx,paren,value) \ +#define CALLREG_NUMBUF_STORE(rx,paren,value) \ RX_ENGINE(rx)->numbered_buff_STORE(aTHX_ (rx),(paren),(value)) -#define CALLREG_NUMBUF_LENGTH(rx,sv,paren) \ +#define CALLREG_NUMBUF_LENGTH(rx,sv,paren) \ RX_ENGINE(rx)->numbered_buff_LENGTH(aTHX_ (rx),(sv),(paren)) -#define CALLREG_NAMED_BUFF_FETCH(rx, key, flags) \ +#define CALLREG_NAMED_BUFF_FETCH(rx, key, flags) \ RX_ENGINE(rx)->named_buff(aTHX_ (rx), (key), NULL, ((flags) | RXapif_FETCH)) #define CALLREG_NAMED_BUFF_STORE(rx, key, value, flags) \ RX_ENGINE(rx)->named_buff(aTHX_ (rx), (key), (value), ((flags) | RXapif_STORE)) -#define CALLREG_NAMED_BUFF_DELETE(rx, key, flags) \ +#define CALLREG_NAMED_BUFF_DELETE(rx, key, flags) \ RX_ENGINE(rx)->named_buff(aTHX_ (rx),(key), NULL, ((flags) | RXapif_DELETE)) #define CALLREG_NAMED_BUFF_CLEAR(rx, flags) \ RX_ENGINE(rx)->named_buff(aTHX_ (rx), NULL, NULL, ((flags) | RXapif_CLEAR)) -#define CALLREG_NAMED_BUFF_EXISTS(rx, key, flags) \ +#define CALLREG_NAMED_BUFF_EXISTS(rx, key, flags) \ RX_ENGINE(rx)->named_buff(aTHX_ (rx), (key), NULL, ((flags) | RXapif_EXISTS)) -#define CALLREG_NAMED_BUFF_FIRSTKEY(rx, flags) \ +#define CALLREG_NAMED_BUFF_FIRSTKEY(rx, flags) \ RX_ENGINE(rx)->named_buff_iter(aTHX_ (rx), NULL, ((flags) | RXapif_FIRSTKEY)) -#define CALLREG_NAMED_BUFF_NEXTKEY(rx, lastkey, flags) \ +#define CALLREG_NAMED_BUFF_NEXTKEY(rx, lastkey, flags) \ RX_ENGINE(rx)->named_buff_iter(aTHX_ (rx), (lastkey), ((flags) | RXapif_NEXTKEY)) -#define CALLREG_NAMED_BUFF_SCALAR(rx, flags) \ +#define CALLREG_NAMED_BUFF_SCALAR(rx, flags) \ RX_ENGINE(rx)->named_buff(aTHX_ (rx), NULL, NULL, ((flags) | RXapif_SCALAR)) -#define CALLREG_NAMED_BUFF_COUNT(rx) \ +#define CALLREG_NAMED_BUFF_COUNT(rx) \ RX_ENGINE(rx)->named_buff(aTHX_ (rx), NULL, NULL, RXapif_REGNAMES_COUNT) -#define CALLREG_NAMED_BUFF_ALL(rx, flags) \ +#define CALLREG_NAMED_BUFF_ALL(rx, flags) \ RX_ENGINE(rx)->named_buff(aTHX_ (rx), NULL, NULL, flags) #define CALLREG_PACKAGE(rx) \ RX_ENGINE(rx)->qr_package(aTHX_ (rx)) #if defined(USE_ITHREADS) -# define CALLREGDUPE(prog,param) \ - Perl_re_dup(aTHX_ (prog),(param)) +# define CALLREGDUPE(prog,param) \ + Perl_re_dup(aTHX_ (prog),(param)) -# define CALLREGDUPE_PVT(prog,param) \ - (prog ? RX_ENGINE(prog)->dupe(aTHX_ (prog),(param)) \ - : (REGEXP *)NULL) +# define CALLREGDUPE_PVT(prog,param) \ + (prog ? RX_ENGINE(prog)->dupe(aTHX_ (prog),(param)) \ + : (REGEXP *)NULL) #endif /* some compilers impersonate gcc */ @@ -526,8 +526,8 @@ compilation causes it be used just some times. * (insane errors ensue). * g++ does not give insane errors now (RMB 2008-01-30, gcc 4.2.2). */ -#if defined(PERL_GCC_PEDANTIC) || \ - (defined(__GNUC__) && defined(__cplusplus) && \ +#if defined(PERL_GCC_PEDANTIC) || \ + (defined(__GNUC__) && defined(__cplusplus) && \ (PERL_GCC_VERSION_LT(4,2,0))) # ifndef PERL_GCC_BRACE_GROUPS_FORBIDDEN # define PERL_GCC_BRACE_GROUPS_FORBIDDEN @@ -602,9 +602,9 @@ __typeof__ and nothing else. #if defined(__clang__) || defined(__clang) || PERL_GCC_VERSION_GE(4,6,0) # define GCC_DIAG_PRAGMA(x) _Pragma (#x) /* clang has "clang diagnostic" pragmas, but also understands gcc. */ -# define GCC_DIAG_IGNORE(x) \ - _Pragma("GCC diagnostic push")\ - GCC_DIAG_PRAGMA(GCC diagnostic ignored #x) +# define GCC_DIAG_IGNORE(x) \ + _Pragma("GCC diagnostic push") \ + GCC_DIAG_PRAGMA(GCC diagnostic ignored #x) # define GCC_DIAG_RESTORE _Pragma("GCC diagnostic pop") #else # define GCC_DIAG_IGNORE(w) @@ -617,9 +617,9 @@ __typeof__ and nothing else. /* for clang specific pragmas */ #if defined(__clang__) || defined(__clang) # define CLANG_DIAG_PRAGMA(x) _Pragma (#x) -# define CLANG_DIAG_IGNORE(x) \ - _Pragma("clang diagnostic push")\ - CLANG_DIAG_PRAGMA(clang diagnostic ignored #x) +# define CLANG_DIAG_IGNORE(x) \ + _Pragma("clang diagnostic push") \ + CLANG_DIAG_PRAGMA(clang diagnostic ignored #x) # define CLANG_DIAG_RESTORE _Pragma("clang diagnostic pop") #else # define CLANG_DIAG_IGNORE(w) @@ -631,9 +631,9 @@ __typeof__ and nothing else. #define CLANG_DIAG_RESTORE_STMT CLANG_DIAG_RESTORE NOOP #if defined(_MSC_VER) -# define MSVC_DIAG_IGNORE(x) \ - __pragma(warning(push))\ - __pragma(warning(disable : x)) +# define MSVC_DIAG_IGNORE(x) \ + __pragma(warning(push)) \ + __pragma(warning(disable : x)) # define MSVC_DIAG_RESTORE __pragma(warning(pop)) #else # define MSVC_DIAG_IGNORE(x) @@ -960,10 +960,10 @@ violations are fatal. # define TAINT_IF(c) if (UNLIKELY(c)) { TAINT; } /* Conditionally taint */ # define TAINT_ENV() if (UNLIKELY(PL_tainting)) { taint_env(); } /* croak or warn if tainting */ -# define TAINT_PROPER(s) \ - if (UNLIKELY(PL_tainting)) {\ - taint_proper(NULL, s); \ - } +# define TAINT_PROPER(s) \ + if (UNLIKELY(PL_tainting)) { \ + taint_proper(NULL, s); \ + } # define TAINT_set(s) (PL_tainted = cBOOL(s)) # define TAINT_get (cBOOL(UNLIKELY(PL_tainted))) /* Is something tainted? */ # define TAINTING_get (cBOOL(UNLIKELY(PL_tainting))) @@ -1081,12 +1081,12 @@ violations are fatal. * sync. */ #if ! defined(NO_LOCALE) -# if ! defined(NO_POSIX_2008_LOCALE) \ - && defined(HAS_NEWLOCALE) \ - && defined(HAS_USELOCALE) \ - && defined(HAS_DUPLOCALE) \ - && defined(HAS_FREELOCALE) \ - && defined(LC_ALL_MASK) +# if ! defined(NO_POSIX_2008_LOCALE) \ + && defined(HAS_NEWLOCALE) \ + && defined(HAS_USELOCALE) \ + && defined(HAS_DUPLOCALE) \ + && defined(HAS_FREELOCALE) \ + && defined(LC_ALL_MASK) /* For simplicity, the code is written to assume that any platform advanced * enough to have the Posix 2008 locale functions has LC_ALL. The final @@ -1102,8 +1102,8 @@ violations are fatal. #ifdef USE_LOCALE # define HAS_SKIP_LOCALE_INIT /* Solely for XS code to test for this #define */ -# if !defined(NO_LOCALE_COLLATE) && defined(LC_COLLATE) \ - && defined(HAS_STRXFRM) +# if !defined(NO_LOCALE_COLLATE) && defined(LC_COLLATE) \ + && defined(HAS_STRXFRM) # define USE_LOCALE_COLLATE # endif # if !defined(NO_LOCALE_CTYPE) && defined(LC_CTYPE) @@ -1234,9 +1234,9 @@ violations are fatal. /* Use POSIX 2008 locales if available, and no alternative exists * ('setlocale()' is the alternative); or is threaded and not forbidden to * use them */ -# if defined(HAS_POSIX_2008_LOCALE) && ( ! defined(HAS_SETLOCALE) \ - || ( defined(USE_LOCALE_THREADS) \ - && ! defined(NO_POSIX_2008_LOCALE))) +# if defined(HAS_POSIX_2008_LOCALE) && ( ! defined(HAS_SETLOCALE) \ + || ( defined(USE_LOCALE_THREADS) \ + && ! defined(NO_POSIX_2008_LOCALE))) # define USE_POSIX_2008_LOCALE # endif @@ -1255,17 +1255,17 @@ violations are fatal. * appropriate */ # ifdef USE_POSIX_2008_LOCALE # if defined(HAS_QUERYLOCALE) \ - /* Has this internal undocumented item for nl_langinfo() */ \ - || ( defined(_NL_LOCALE_NAME) \ - /* And asked for */ \ - && defined(USE_NL_LOCALE_NAME) \ - /* We need the below because we will be calling it within a \ - * macro, can't have it get messed up by another thread. */ \ - && defined(HAS_THREAD_SAFE_NL_LANGINFO_L) \ - /* On systems that accept any locale name, the real \ - * underlying locale is often returned by this internal \ - * item, so we can't use it */ \ - && ! defined(SETLOCALE_ACCEPTS_ANY_LOCALE_NAME)) + /* Has this internal undocumented item for nl_langinfo() */ \ + || ( defined(_NL_LOCALE_NAME) \ + /* And asked for */ \ + && defined(USE_NL_LOCALE_NAME) \ + /* We need the below because we will be calling it within a \ + * macro, can't have it get messed up by another thread. */ \ + && defined(HAS_THREAD_SAFE_NL_LANGINFO_L) \ + /* On systems that accept any locale name, the real \ + * underlying locale is often returned by this internal \ + * item, so we can't use it */ \ + && ! defined(SETLOCALE_ACCEPTS_ANY_LOCALE_NAME)) # define USE_QUERYLOCALE # endif # endif @@ -1297,9 +1297,9 @@ violations are fatal. /* POSIX 2008 and Windows with thread-safe locales keep locale information * in libc data. Therefore we must inform their libc's when the context * switches */ -# if defined(MULTIPLICITY) && ( defined(USE_POSIX_2008_LOCALE) \ - || ( defined(WIN32) \ - && defined(USE_THREAD_SAFE_LOCALE))) +# if defined(MULTIPLICITY) && ( defined(USE_POSIX_2008_LOCALE) \ + || ( defined(WIN32) \ + && defined(USE_THREAD_SAFE_LOCALE))) # define USE_PERL_SWITCH_LOCALE_CONTEXT # endif #endif @@ -1535,29 +1535,29 @@ Use L to declare variables of the maximum usable size on this platform. #ifdef PERL_CORE /* byte-swapping functions for big-/little-endian conversion */ -# define _swab_16_(x) \ - ((U16)(\ - (((U16)(x) & UINT16_C(0x00ff)) << 8) | \ - (((U16)(x) & UINT16_C(0xff00)) >> 8) )) - -# define _swab_32_(x) \ - ((U32)(\ - (((U32)(x) & UINT32_C(0x000000ff)) << 24) | \ - (((U32)(x) & UINT32_C(0x0000ff00)) << 8) | \ - (((U32)(x) & UINT32_C(0x00ff0000)) >> 8) | \ - (((U32)(x) & UINT32_C(0xff000000)) >> 24) )) +# define _swab_16_(x) \ + ((U16)( \ + (((U16)(x) & UINT16_C(0x00ff)) << 8) | \ + (((U16)(x) & UINT16_C(0xff00)) >> 8) )) + +# define _swab_32_(x) \ + ((U32)( \ + (((U32)(x) & UINT32_C(0x000000ff)) << 24) | \ + (((U32)(x) & UINT32_C(0x0000ff00)) << 8) | \ + (((U32)(x) & UINT32_C(0x00ff0000)) >> 8) | \ + (((U32)(x) & UINT32_C(0xff000000)) >> 24) )) # ifdef HAS_QUAD -# define _swab_64_(x) \ - ((U64)(\ - (((U64)(x) & UINT64_C(0x00000000000000ff)) << 56) | \ - (((U64)(x) & UINT64_C(0x000000000000ff00)) << 40) | \ - (((U64)(x) & UINT64_C(0x0000000000ff0000)) << 24) | \ - (((U64)(x) & UINT64_C(0x00000000ff000000)) << 8) | \ - (((U64)(x) & UINT64_C(0x000000ff00000000)) >> 8) | \ - (((U64)(x) & UINT64_C(0x0000ff0000000000)) >> 24) | \ - (((U64)(x) & UINT64_C(0x00ff000000000000)) >> 40) | \ - (((U64)(x) & UINT64_C(0xff00000000000000)) >> 56) )) +# define _swab_64_(x) \ + ((U64)( \ + (((U64)(x) & UINT64_C(0x00000000000000ff)) << 56) | \ + (((U64)(x) & UINT64_C(0x000000000000ff00)) << 40) | \ + (((U64)(x) & UINT64_C(0x0000000000ff0000)) << 24) | \ + (((U64)(x) & UINT64_C(0x00000000ff000000)) << 8) | \ + (((U64)(x) & UINT64_C(0x000000ff00000000)) >> 8) | \ + (((U64)(x) & UINT64_C(0x0000ff0000000000)) >> 24) | \ + (((U64)(x) & UINT64_C(0x00ff000000000000)) >> 40) | \ + (((U64)(x) & UINT64_C(0xff00000000000000)) >> 56) )) # endif /* Maximum level of recursion */ @@ -1665,25 +1665,25 @@ Use L to declare variables of the maximum usable size on this platform. # define safecalloc Perl_calloc # define saferealloc Perl_realloc # define safefree Perl_mfree -# define CHECK_MALLOC_TOO_LATE_FOR_(code) \ - STMT_START {\ - if (!TAINTING_get && MallocCfg_ptr[MallocCfg_cfg_env_read]) \ - code; \ - } STMT_END -# define CHECK_MALLOC_TOO_LATE_FOR(ch) \ - CHECK_MALLOC_TOO_LATE_FOR_(MALLOC_TOO_LATE_FOR(ch)) +# define CHECK_MALLOC_TOO_LATE_FOR_(code) \ + STMT_START { \ + if (!TAINTING_get && MallocCfg_ptr[MallocCfg_cfg_env_read]) \ + code; \ + } STMT_END +# define CHECK_MALLOC_TOO_LATE_FOR(ch) \ + CHECK_MALLOC_TOO_LATE_FOR_(MALLOC_TOO_LATE_FOR(ch)) # define panic_write2(s) write(2, s, strlen(s)) -# define CHECK_MALLOC_TAINT(newval) \ - CHECK_MALLOC_TOO_LATE_FOR_( \ - if (newval) { \ - PERL_UNUSED_RESULT(panic_write2("panic: tainting with $ENV{PERL_MALLOC_OPT}\n"));\ - exit(1); }) -# define MALLOC_CHECK_TAINT(argc,argv,env) \ - STMT_START { \ - if (doing_taint(argc,argv,env)) { \ - MallocCfg_ptr[MallocCfg_skip_cfg_env] = 1; \ - } \ - } STMT_END; +# define CHECK_MALLOC_TAINT(newval) \ + CHECK_MALLOC_TOO_LATE_FOR_( \ + if (newval) { \ + PERL_UNUSED_RESULT(panic_write2("panic: tainting with $ENV{PERL_MALLOC_OPT}\n")); \ + exit(1); }) +# define MALLOC_CHECK_TAINT(argc,argv,env) \ + STMT_START { \ + if (doing_taint(argc,argv,env)) { \ + MallocCfg_ptr[MallocCfg_skip_cfg_env] = 1; \ + } \ + } STMT_END; #else /* MYMALLOC */ # define safemalloc safesysmalloc # define safecalloc safesyscalloc @@ -1947,54 +1947,54 @@ any magic. #define ERRSV GvSVn(PL_errgv) /* contains inlined gv_add_by_type */ -#define CLEAR_ERRSV() \ - STMT_START {\ - SV ** const svp = &GvSV(PL_errgv); \ - if (!*svp) { \ - *svp = newSVpvs(""); \ - } else if (SvREADONLY(*svp)) { \ - SvREFCNT_dec_NN(*svp); \ - *svp = newSVpvs(""); \ - } else { \ - SV *const errsv = *svp; \ - SvPVCLEAR(errsv); \ - SvPOK_only(errsv); \ - if (SvMAGICAL(errsv)) { \ - mg_free(errsv); \ - } \ - } \ +#define CLEAR_ERRSV() \ + STMT_START { \ + SV ** const svp = &GvSV(PL_errgv); \ + if (!*svp) { \ + *svp = newSVpvs(""); \ + } else if (SvREADONLY(*svp)) { \ + SvREFCNT_dec_NN(*svp); \ + *svp = newSVpvs(""); \ + } else { \ + SV *const errsv = *svp; \ + SvPVCLEAR(errsv); \ + SvPOK_only(errsv); \ + if (SvMAGICAL(errsv)) { \ + mg_free(errsv); \ + } \ + } \ } STMT_END /* contains inlined gv_add_by_type */ -#define SANE_ERRSV() \ - STMT_START {\ - SV ** const svp = &GvSV(PL_errgv); \ - if (!*svp) { \ - *svp = newSVpvs(""); \ - } else if (SvREADONLY(*svp)) { \ - SV *dupsv = newSVsv(*svp); \ - SvREFCNT_dec_NN(*svp); \ - *svp = dupsv; \ - } else { \ - SV *const errsv = *svp; \ - if (SvMAGICAL(errsv)) { \ - mg_free(errsv); \ - } \ - } \ +#define SANE_ERRSV() \ + STMT_START { \ + SV ** const svp = &GvSV(PL_errgv); \ + if (!*svp) { \ + *svp = newSVpvs(""); \ + } else if (SvREADONLY(*svp)) { \ + SV *dupsv = newSVsv(*svp); \ + SvREFCNT_dec_NN(*svp); \ + *svp = dupsv; \ + } else { \ + SV *const errsv = *svp; \ + if (SvMAGICAL(errsv)) { \ + mg_free(errsv); \ + } \ + } \ } STMT_END #ifdef PERL_CORE # define DEFSV (0 + GvSVn(PL_defgv)) -# define DEFSV_set(sv) \ - (SvREFCNT_dec(GvSV(PL_defgv)), GvSV(PL_defgv) = SvREFCNT_inc(sv)) -# define SAVE_DEFSV \ - ( \ - save_gp(PL_defgv, 0), \ - GvINTRO_off(PL_defgv), \ - SAVEGENERICSV(GvSV(PL_defgv)), \ - GvSV(PL_defgv) = NULL \ - ) +# define DEFSV_set(sv) \ + (SvREFCNT_dec(GvSV(PL_defgv)), GvSV(PL_defgv) = SvREFCNT_inc(sv)) +# define SAVE_DEFSV \ + ( \ + save_gp(PL_defgv, 0), \ + GvINTRO_off(PL_defgv), \ + SAVEGENERICSV(GvSV(PL_defgv)), \ + GvSV(PL_defgv) = NULL \ + ) #else # define DEFSV GvSVn(PL_defgv) # define DEFSV_set(sv) (GvSV(PL_defgv) = (sv)) @@ -2971,34 +2971,34 @@ extern long double Perl_my_frexpl(long double x, int *e); # endif #endif -#if !defined(Perl_fp_class_inf) && \ - defined(Perl_fp_class_pinf) && defined(Perl_fp_class_ninf) -# define Perl_fp_class_inf(x) \ - (Perl_fp_class_pinf(x) || Perl_fp_class_ninf(x)) +#if !defined(Perl_fp_class_inf) && \ + defined(Perl_fp_class_pinf) && defined(Perl_fp_class_ninf) +# define Perl_fp_class_inf(x) \ + (Perl_fp_class_pinf(x) || Perl_fp_class_ninf(x)) #endif -#if !defined(Perl_fp_class_nan) && \ - defined(Perl_fp_class_snan) && defined(Perl_fp_class_qnan) -# define Perl_fp_class_nan(x) \ - (Perl_fp_class_snan(x) || Perl_fp_class_qnan(x)) +#if !defined(Perl_fp_class_nan) && \ + defined(Perl_fp_class_snan) && defined(Perl_fp_class_qnan) +# define Perl_fp_class_nan(x) \ + (Perl_fp_class_snan(x) || Perl_fp_class_qnan(x)) #endif #if !defined(Perl_fp_class_zero) && \ - defined(Perl_fp_class_pzero) && defined(Perl_fp_class_nzero) + defined(Perl_fp_class_pzero) && defined(Perl_fp_class_nzero) # define Perl_fp_class_zero(x) \ - (Perl_fp_class_pzero(x) || Perl_fp_class_nzero(x)) + (Perl_fp_class_pzero(x) || Perl_fp_class_nzero(x)) #endif #if !defined(Perl_fp_class_norm) && \ - defined(Perl_fp_class_pnorm) && defined(Perl_fp_class_nnorm) + defined(Perl_fp_class_pnorm) && defined(Perl_fp_class_nnorm) # define Perl_fp_class_norm(x) \ - (Perl_fp_class_pnorm(x) || Perl_fp_class_nnorm(x)) + (Perl_fp_class_pnorm(x) || Perl_fp_class_nnorm(x)) #endif -#if !defined(Perl_fp_class_denorm) && \ - defined(Perl_fp_class_pdenorm) && defined(Perl_fp_class_ndenorm) -# define Perl_fp_class_denorm(x) \ - (Perl_fp_class_pdenorm(x) || Perl_fp_class_ndenorm(x)) +#if !defined(Perl_fp_class_denorm) && \ + defined(Perl_fp_class_pdenorm) && defined(Perl_fp_class_ndenorm) +# define Perl_fp_class_denorm(x) \ + (Perl_fp_class_pdenorm(x) || Perl_fp_class_ndenorm(x)) #endif #ifndef Perl_isnan @@ -3528,11 +3528,11 @@ typedef struct padname PADNAME; * fp ops behaving strangely (Inf + 1 resulting in zero, for example). */ #ifdef __osf__ # include -# define PERL_SYS_FPU_INIT \ - STMT_START { \ - ieee_set_fp_control(IEEE_TRAP_ENABLE_INV); \ - signal(SIGFPE, SIG_IGN); \ - } STMT_END +# define PERL_SYS_FPU_INIT \ + STMT_START { \ + ieee_set_fp_control(IEEE_TRAP_ENABLE_INV); \ + signal(SIGFPE, SIG_IGN); \ + } STMT_END #endif /* In IRIX the default for Flush to Zero bit is true, * which means that results going below the minimum of normal @@ -3546,13 +3546,13 @@ typedef struct padname PADNAME; * incantation, though, like the below. */ #ifdef __sgi # include -# define PERL_SYS_FPU_INIT \ - STMT_START { \ - union fpc_csr csr; \ - csr.fc_word = get_fpc_csr(); \ - csr.fc_struct.flush = 0; \ - set_fpc_csr(csr.fc_word); \ - } STMT_END +# define PERL_SYS_FPU_INIT \ + STMT_START { \ + union fpc_csr csr; \ + csr.fc_word = get_fpc_csr(); \ + csr.fc_struct.flush = 0; \ + set_fpc_csr(csr.fc_word); \ + } STMT_END #endif #ifndef PERL_SYS_FPU_INIT @@ -3620,15 +3620,15 @@ freeing any remaining Perl interpreters. * (6.1 means really clang 3.6), so needs extra hijinks * (could probably also test the contents of __apple_build_version__). */ -#if defined(USE_ITHREADS) && defined(I_PTHREAD) && \ - defined(__clang__) && \ - !defined(SWIG) && \ - ((!defined(__apple_build_version__) && \ - ((__clang_major__ == 3 && __clang_minor__ >= 6) || \ - (__clang_major__ >= 4))) || \ - (defined(__apple_build_version__) && \ - ((__clang_major__ == 6 && __clang_minor__ >= 1) || \ - (__clang_major__ >= 7)))) +#if defined(USE_ITHREADS) && defined(I_PTHREAD) && \ + defined(__clang__) && \ + !defined(SWIG) && \ + ((!defined(__apple_build_version__) && \ + ((__clang_major__ == 3 && __clang_minor__ >= 6) || \ + (__clang_major__ >= 4))) || \ + (defined(__apple_build_version__) && \ + ((__clang_major__ == 6 && __clang_minor__ >= 1) || \ + (__clang_major__ >= 7)))) # define PERL_TSA__(x) __attribute__((x)) # define PERL_TSA_ACTIVE #else @@ -3639,7 +3639,7 @@ freeing any remaining Perl interpreters. /* PERL_TSA_CAPABILITY() is used to annotate typedefs. * typedef old_type PERL_TSA_CAPABILITY("mutex") new_type; */ -#define PERL_TSA_CAPABILITY(x) \ +#define PERL_TSA_CAPABILITY(x) \ PERL_TSA__(capability(x)) /* In the below examples the mutex must be lexically visible, usually @@ -3649,7 +3649,7 @@ freeing any remaining Perl interpreters. * * Foo foo PERL_TSA_GUARDED_BY(mutex); */ -#define PERL_TSA_GUARDED_BY(x) \ +#define PERL_TSA_GUARDED_BY(x) \ PERL_TSA__(guarded_by(x)) /* PERL_TSA_PT_GUARDED_BY() is used to annotate global pointers. @@ -3657,7 +3657,7 @@ freeing any remaining Perl interpreters. * * Foo* ptr PERL_TSA_PT_GUARDED_BY(mutex); */ -#define PERL_TSA_PT_GUARDED_BY(x) \ +#define PERL_TSA_PT_GUARDED_BY(x) \ PERL_TSA__(pt_guarded_by(x)) /* PERL_TSA_REQUIRES() is used to annotate functions. @@ -3665,7 +3665,7 @@ freeing any remaining Perl interpreters. * * void Foo() PERL_TSA_REQUIRES(mutex); */ -#define PERL_TSA_REQUIRES(x) \ +#define PERL_TSA_REQUIRES(x) \ PERL_TSA__(requires_capability(x)) /* PERL_TSA_EXCLUDES() is used to annotate functions. @@ -3676,7 +3676,7 @@ freeing any remaining Perl interpreters. * * void Foo() PERL_TSA_EXCLUDES(mutex); */ -#define PERL_TSA_EXCLUDES(x) \ +#define PERL_TSA_EXCLUDES(x) \ PERL_TSA__(locks_excluded(x)) /* PERL_TSA_ACQUIRE() is used to annotate functions. @@ -3784,7 +3784,7 @@ EXTERN_C int perl_tsa_mutex_unlock(perl_mutex* mutex) * platform from the existing UNIX or Native status values. */ -# define STATUS_EXIT \ +# define STATUS_EXIT \ (((I32)PL_statusvalue_vms == -1 ? SS$_ABORT : PL_statusvalue_vms) | \ (VMSISH_HUSHED ? STS$M_INHIB_MSG : 0)) @@ -3810,7 +3810,7 @@ EXTERN_C int perl_tsa_mutex_unlock(perl_mutex* mutex) have different values in them. */ -# define STATUS_NATIVE_CHILD_SET(n) \ +# define STATUS_NATIVE_CHILD_SET(n) \ STMT_START { \ I32 evalue = (I32)n; \ if (evalue == EVMSERR) { \ @@ -3843,23 +3843,23 @@ EXTERN_C int perl_tsa_mutex_unlock(perl_mutex* mutex) * relationship at all to errno values. * This is used when Perl is forcing errno to have a specific value. */ -# define STATUS_UNIX_SET(n) \ - STMT_START { \ - I32 evalue = (I32)n; \ - PL_statusvalue = evalue; \ - if (PL_statusvalue != -1) { \ - if (PL_statusvalue != EVMSERR) { \ - PL_statusvalue &= 0xFFFF; \ - if (MY_POSIX_EXIT) \ - PL_statusvalue_vms=PL_statusvalue ? SS$_ABORT : SS$_NORMAL;\ - else PL_statusvalue_vms = Perl_unix_status_to_vms(evalue); \ - } \ - else { \ - PL_statusvalue_vms = vaxc$errno; \ - } \ - } \ - else PL_statusvalue_vms = SS$_ABORT; \ - set_vaxc_errno(PL_statusvalue_vms); \ +# define STATUS_UNIX_SET(n) \ + STMT_START { \ + I32 evalue = (I32)n; \ + PL_statusvalue = evalue; \ + if (PL_statusvalue != -1) { \ + if (PL_statusvalue != EVMSERR) { \ + PL_statusvalue &= 0xFFFF; \ + if (MY_POSIX_EXIT) \ + PL_statusvalue_vms=PL_statusvalue ? SS$_ABORT : SS$_NORMAL; \ + else PL_statusvalue_vms = Perl_unix_status_to_vms(evalue); \ + } \ + else { \ + PL_statusvalue_vms = vaxc$errno; \ + } \ + } \ + else PL_statusvalue_vms = SS$_ABORT; \ + set_vaxc_errno(PL_statusvalue_vms); \ } STMT_END /* STATUS_UNIX_EXIT_SET - Takes a UNIX/POSIX exit code and sets @@ -3877,32 +3877,32 @@ EXTERN_C int perl_tsa_mutex_unlock(perl_mutex* mutex) * it will be passed through as a VMS status. */ -# define STATUS_UNIX_EXIT_SET(n) \ - STMT_START { \ - I32 evalue = (I32)n; \ - PL_statusvalue = evalue; \ - if (MY_POSIX_EXIT) { \ - if (evalue <= 0xFF00) { \ - if (evalue > 0xFF) \ - evalue = ((U8) (evalue >> child_offset_bits)); \ - PL_statusvalue_vms = \ - (C_FAC_POSIX | (evalue << 3 ) | \ - ((evalue == 1) ? (STS$K_ERROR | STS$M_INHIB_MSG) : 1)); \ - } else /* forgive them Perl, for they have sinned */ \ - PL_statusvalue_vms = evalue; \ - } else { \ - if (evalue == 0) \ - PL_statusvalue_vms = SS$_NORMAL; \ - else if (evalue <= 0xFF00) \ - PL_statusvalue_vms = SS$_ABORT; \ - else { /* forgive them Perl, for they have sinned */ \ - if (evalue != EVMSERR) PL_statusvalue_vms = evalue; \ - else PL_statusvalue_vms = vaxc$errno; \ - /* And obviously used a VMS status value instead of UNIX */ \ - PL_statusvalue = EVMSERR; \ - } \ - set_vaxc_errno(PL_statusvalue_vms); \ - } \ +# define STATUS_UNIX_EXIT_SET(n) \ + STMT_START { \ + I32 evalue = (I32)n; \ + PL_statusvalue = evalue; \ + if (MY_POSIX_EXIT) { \ + if (evalue <= 0xFF00) { \ + if (evalue > 0xFF) \ + evalue = ((U8) (evalue >> child_offset_bits)); \ + PL_statusvalue_vms = \ + (C_FAC_POSIX | (evalue << 3 ) | \ + ((evalue == 1) ? (STS$K_ERROR | STS$M_INHIB_MSG) : 1)); \ + } else /* forgive them Perl, for they have sinned */ \ + PL_statusvalue_vms = evalue; \ + } else { \ + if (evalue == 0) \ + PL_statusvalue_vms = SS$_NORMAL; \ + else if (evalue <= 0xFF00) \ + PL_statusvalue_vms = SS$_ABORT; \ + else { /* forgive them Perl, for they have sinned */ \ + if (evalue != EVMSERR) PL_statusvalue_vms = evalue; \ + else PL_statusvalue_vms = vaxc$errno; \ + /* And obviously used a VMS status value instead of UNIX */ \ + PL_statusvalue = EVMSERR; \ + } \ + set_vaxc_errno(PL_statusvalue_vms); \ + } \ } STMT_END @@ -3923,18 +3923,18 @@ EXTERN_C int perl_tsa_mutex_unlock(perl_mutex* mutex) * passed through. */ -# define STATUS_EXIT_SET(n) \ - STMT_START { \ - I32 evalue = (I32)n; \ - PL_statusvalue = evalue; \ - if (MY_POSIX_EXIT) \ - if (evalue > 255) PL_statusvalue_vms = evalue; else { \ - PL_statusvalue_vms = \ - (C_FAC_POSIX | (evalue << 3 ) | \ - ((evalue == 1) ? (STS$K_ERROR | STS$M_INHIB_MSG) : 1));} \ - else \ - PL_statusvalue_vms = evalue ? evalue : SS$_NORMAL; \ - set_vaxc_errno(PL_statusvalue_vms); \ +# define STATUS_EXIT_SET(n) \ + STMT_START { \ + I32 evalue = (I32)n; \ + PL_statusvalue = evalue; \ + if (MY_POSIX_EXIT) \ + if (evalue > 255) PL_statusvalue_vms = evalue; else { \ + PL_statusvalue_vms = \ + (C_FAC_POSIX | (evalue << 3 ) | \ + ((evalue == 1) ? (STS$K_ERROR | STS$M_INHIB_MSG) : 1));} \ + else \ + PL_statusvalue_vms = evalue ? evalue : SS$_NORMAL; \ + set_vaxc_errno(PL_statusvalue_vms); \ } STMT_END @@ -3943,29 +3943,29 @@ EXTERN_C int perl_tsa_mutex_unlock(perl_mutex* mutex) (PL_statusvalue = 0, PL_statusvalue_vms = SS$_NORMAL) /* This macro forces a failure status */ -# define STATUS_ALL_FAILURE \ - (PL_statusvalue = 1,\ - vaxc$errno = PL_statusvalue_vms = MY_POSIX_EXIT ? \ - (C_FAC_POSIX | (1 << 3) | STS$K_ERROR | STS$M_INHIB_MSG) : SS$_ABORT) +# define STATUS_ALL_FAILURE \ + (PL_statusvalue = 1, \ + vaxc$errno = PL_statusvalue_vms = MY_POSIX_EXIT ? \ + (C_FAC_POSIX | (1 << 3) | STS$K_ERROR | STS$M_INHIB_MSG) : SS$_ABORT) #elif defined(__amigaos4__) /* A somewhat experimental attempt to simulate posix return code values */ # define STATUS_NATIVE PL_statusvalue_posix -# define STATUS_NATIVE_CHILD_SET(n) \ - STMT_START { \ - PL_statusvalue_posix = (n); \ - if (PL_statusvalue_posix < 0) { \ - PL_statusvalue = -1; \ - } \ - else { \ - PL_statusvalue = n << 8; \ - } \ +# define STATUS_NATIVE_CHILD_SET(n) \ + STMT_START { \ + PL_statusvalue_posix = (n); \ + if (PL_statusvalue_posix < 0) { \ + PL_statusvalue = -1; \ + } \ + else { \ + PL_statusvalue = n << 8; \ + } \ } STMT_END -# define STATUS_UNIX_SET(n) \ - STMT_START { \ - PL_statusvalue = (n); \ - if (PL_statusvalue != -1) \ - PL_statusvalue &= 0xFFFF; \ +# define STATUS_UNIX_SET(n) \ + STMT_START { \ + PL_statusvalue = (n); \ + if (PL_statusvalue != -1) \ + PL_statusvalue &= 0xFFFF; \ } STMT_END # define STATUS_UNIX_EXIT_SET(n) STATUS_UNIX_SET(n) # define STATUS_EXIT_SET(n) STATUS_UNIX_SET(n) @@ -3977,47 +3977,47 @@ EXTERN_C int perl_tsa_mutex_unlock(perl_mutex* mutex) #else # define STATUS_NATIVE PL_statusvalue_posix # if defined(WCOREDUMP) -# define STATUS_NATIVE_CHILD_SET(n) \ - STMT_START { \ - PL_statusvalue_posix = (n); \ - if (PL_statusvalue_posix == -1) \ - PL_statusvalue = -1; \ - else { \ - PL_statusvalue = \ +# define STATUS_NATIVE_CHILD_SET(n) \ + STMT_START { \ + PL_statusvalue_posix = (n); \ + if (PL_statusvalue_posix == -1) \ + PL_statusvalue = -1; \ + else { \ + PL_statusvalue = \ (WIFEXITED(PL_statusvalue_posix) ? (WEXITSTATUS(PL_statusvalue_posix) << 8) : 0) | \ (WIFSIGNALED(PL_statusvalue_posix) ? (WTERMSIG(PL_statusvalue_posix) & 0x7F) : 0) | \ (WIFSIGNALED(PL_statusvalue_posix) && WCOREDUMP(PL_statusvalue_posix) ? 0x80 : 0); \ - } \ + } \ } STMT_END # elif defined(WIFEXITED) -# define STATUS_NATIVE_CHILD_SET(n) \ - STMT_START { \ - PL_statusvalue_posix = (n); \ - if (PL_statusvalue_posix == -1) \ - PL_statusvalue = -1; \ - else { \ - PL_statusvalue = \ +# define STATUS_NATIVE_CHILD_SET(n) \ + STMT_START { \ + PL_statusvalue_posix = (n); \ + if (PL_statusvalue_posix == -1) \ + PL_statusvalue = -1; \ + else { \ + PL_statusvalue = \ (WIFEXITED(PL_statusvalue_posix) ? (WEXITSTATUS(PL_statusvalue_posix) << 8) : 0) | \ (WIFSIGNALED(PL_statusvalue_posix) ? (WTERMSIG(PL_statusvalue_posix) & 0x7F) : 0); \ - } \ + } \ } STMT_END # else -# define STATUS_NATIVE_CHILD_SET(n) \ - STMT_START { \ - PL_statusvalue_posix = (n); \ - if (PL_statusvalue_posix == -1) \ - PL_statusvalue = -1; \ - else { \ - PL_statusvalue = \ - PL_statusvalue_posix & 0xFFFF; \ - } \ +# define STATUS_NATIVE_CHILD_SET(n) \ + STMT_START { \ + PL_statusvalue_posix = (n); \ + if (PL_statusvalue_posix == -1) \ + PL_statusvalue = -1; \ + else { \ + PL_statusvalue = \ + PL_statusvalue_posix & 0xFFFF; \ + } \ } STMT_END # endif -# define STATUS_UNIX_SET(n) \ - STMT_START { \ - PL_statusvalue = (n); \ - if (PL_statusvalue != -1) \ - PL_statusvalue &= 0xFFFF; \ +# define STATUS_UNIX_SET(n) \ + STMT_START { \ + PL_statusvalue = (n); \ + if (PL_statusvalue != -1) \ + PL_statusvalue &= 0xFFFF; \ } STMT_END # define STATUS_UNIX_EXIT_SET(n) STATUS_UNIX_SET(n) # define STATUS_EXIT_SET(n) STATUS_UNIX_SET(n) @@ -4076,10 +4076,10 @@ out there, Solaris being the most prominent. /* the traditional thread-unsafe notion of "current interpreter". */ #ifndef PERL_SET_INTERP -# define PERL_SET_INTERP(i) \ - STMT_START { PL_curinterp = (PerlInterpreter*)(i); \ - PERL_SET_NON_tTHX_CONTEXT(i); \ - } STMT_END +# define PERL_SET_INTERP(i) \ + STMT_START { PL_curinterp = (PerlInterpreter*)(i); \ + PERL_SET_NON_tTHX_CONTEXT(i); \ + } STMT_END #endif #ifndef PERL_GET_INTERP @@ -4242,10 +4242,10 @@ hint to the compiler that this condition is likely to be false. STATIC_ASSERT_STMT expands to a statement and is suitable for use inside a function. */ -#if (! defined(__IBMC__) || __IBMC__ >= 1210) \ - && (( defined(static_assert) && ( defined(_ISOC11_SOURCE) \ - || (__STDC_VERSION__ - 0) >= 201101L)) \ - || (defined(__cplusplus) && __cplusplus >= 201103L)) +#if (! defined(__IBMC__) || __IBMC__ >= 1210) \ + && (( defined(static_assert) && ( defined(_ISOC11_SOURCE) \ + || (__STDC_VERSION__ - 0) >= 201101L)) \ + || (defined(__cplusplus) && __cplusplus >= 201103L)) /* XXX static_assert is a macro defined in in C11 or a compiler builtin in C++11. But IBM XL C V11 does not support _Static_assert, no matter what says. @@ -4256,10 +4256,10 @@ hint to the compiler that this condition is likely to be false. 'typedef char x[n]' where n is not a compile-time constant. We want to enforce constantness. */ -# define STATIC_ASSERT_2(COND, SUFFIX) \ - typedef struct { \ - unsigned int _static_assertion_failed_##SUFFIX : (COND) ? 1 : -1; \ - } _static_assertion_failed_##SUFFIX PERL_UNUSED_DECL +# define STATIC_ASSERT_2(COND, SUFFIX) \ + typedef struct { \ + unsigned int _static_assertion_failed_##SUFFIX : (COND) ? 1 : -1; \ + } _static_assertion_failed_##SUFFIX PERL_UNUSED_DECL # define STATIC_ASSERT_1(COND, SUFFIX) STATIC_ASSERT_2(COND, SUFFIX) # define STATIC_ASSERT_DECL(COND) STATIC_ASSERT_1(COND, __LINE__) #endif @@ -4295,10 +4295,10 @@ intrinsic function, see its documents for more details. # define ASSUME(x) assert(x) #elif __has_builtin(__builtin_assume) # if defined(__clang__) || defined(__clang) -# define ASSUME(x) \ - CLANG_DIAG_IGNORE(-Wassume)\ - __builtin_assume (x) \ - CLANG_DIAG_RESTORE +# define ASSUME(x) \ + CLANG_DIAG_IGNORE(-Wassume) \ + __builtin_assume (x) \ + CLANG_DIAG_RESTORE # else # define ASSUME(x) __builtin_assume(x) # endif @@ -4317,10 +4317,10 @@ intrinsic function, see its documents for more details. #endif #ifdef HAS_BUILTIN_UNREACHABLE -# define NOT_REACHED \ - STMT_START { \ - ASSUME(!"UNREACHABLE"); __builtin_unreachable(); \ - } STMT_END +# define NOT_REACHED \ + STMT_START { \ + ASSUME(!"UNREACHABLE"); __builtin_unreachable(); \ + } STMT_END # undef HAS_BUILTIN_UNREACHABLE /* Don't leak out this internal symbol */ #elif ! defined(__GNUC__) && (defined(__sun) || defined(__hpux)) /* These just complain that NOT_REACHED isn't reached */ @@ -4361,8 +4361,8 @@ intrinsic function, see its documents for more details. */ # define USEMYBINMODE /**/ # include /* for setmode() prototype */ -# define my_binmode(fp, iotype, mode) \ - cBOOL(PerlLIO_setmode(fileno(fp), mode) != -1) +# define my_binmode(fp, iotype, mode) \ + cBOOL(PerlLIO_setmode(fileno(fp), mode) != -1) #endif #ifdef __CYGWIN__ @@ -4399,14 +4399,14 @@ union any { typedef I32 (*filter_t) (pTHX_ int, SV *, int); #define FILTER_READ(idx, sv, len) filter_read(idx, sv, len) -#define FILTER_DATA(idx) \ - (PL_parser ? AvARRAY(PL_parser->rsfp_filters)[idx] : NULL) -#define FILTER_ISREADER(idx) \ - (PL_parser && PL_parser->rsfp_filters \ - && idx >= AvFILLp(PL_parser->rsfp_filters)) -#define PERL_FILTER_EXISTS(i) \ - (PL_parser && PL_parser->rsfp_filters \ - && (Size_t) (i) < av_count(PL_parser->rsfp_filters)) +#define FILTER_DATA(idx) \ + (PL_parser ? AvARRAY(PL_parser->rsfp_filters)[idx] : NULL) +#define FILTER_ISREADER(idx) \ + (PL_parser && PL_parser->rsfp_filters \ + && idx >= AvFILLp(PL_parser->rsfp_filters)) +#define PERL_FILTER_EXISTS(i) \ + (PL_parser && PL_parser->rsfp_filters \ + && (Size_t) (i) < av_count(PL_parser->rsfp_filters)) #if defined(_AIX) && !defined(_AIX43) #if defined(USE_REENTRANT) || defined(_REENTRANT) || defined(_THREAD_SAFE) @@ -4533,8 +4533,8 @@ typedef struct crypt_data { /* straight from /usr/include/crypt.h */ typedef struct magic_state MGS; /* struct magic_state defined in mg.c */ -#if defined(PERL_IN_REGCOMP_C) || defined(PERL_IN_REGEXEC_C) \ - || defined(PERL_EXT_RE_BUILD) +#if defined(PERL_IN_REGCOMP_C) || defined(PERL_IN_REGEXEC_C) \ + || defined(PERL_EXT_RE_BUILD) /* These have to be predeclared, as they are used in proto.h which is #included * before their definitions in regcomp.h. */ @@ -4645,11 +4645,11 @@ my_swap16(const U16 x) { # define htovl(x) vtohl(x) # define htovs(x) vtohs(x) #elif BYTEORDER == 0x4321 || BYTEORDER == 0x87654321 -# define vtohl(x) \ - ((((x)&0xFF)<<24)\ - +(((x)>>24)&0xFF) \ - +(((x)&0x0000FF00)<<8) \ - +(((x)&0x00FF0000)>>8) ) +# define vtohl(x) \ + ((((x)&0xFF)<<24) \ + +(((x)>>24)&0xFF) \ + +(((x)&0x0000FF00)<<8) \ + +(((x)&0x00FF0000)>>8) ) # define vtohs(x) ((((x)&0xFF)<<8) + (((x)>>8)&0xFF)) # define htovl(x) vtohl(x) # define htovs(x) vtohs(x) @@ -4704,21 +4704,21 @@ Cast an NV to UV while avoiding undefined C behavior #define I_V(what) (cast_iv((NV)(what))) #define U_V(what) (cast_uv((NV)(what))) #else -#define I_32(n) \ - ((n) < I32_MAX_P1 ? ((n) < I32_MIN ? I32_MIN : (I32) (n))\ - : ((n) < U32_MAX_P1 ? (I32)(U32) (n) \ +#define I_32(n) \ + ((n) < I32_MAX_P1 ? ((n) < I32_MIN ? I32_MIN : (I32) (n)) \ + : ((n) < U32_MAX_P1 ? (I32)(U32) (n) \ : ((n) > 0 ? (I32) U32_MAX : 0 /* NaN */))) -#define U_32(n) \ - ((n) < 0.0 ? ((n) < I32_MIN ? (UV) I32_MIN : (U32)(I32) (n))\ - : ((n) < U32_MAX_P1 ? (U32) (n) \ +#define U_32(n) \ + ((n) < 0.0 ? ((n) < I32_MIN ? (UV) I32_MIN : (U32)(I32) (n)) \ + : ((n) < U32_MAX_P1 ? (U32) (n) \ : ((n) > 0 ? U32_MAX : 0 /* NaN */))) -#define I_V(n) \ - (LIKELY((n) < IV_MAX_P1) ? (UNLIKELY((n) < IV_MIN) ? IV_MIN : (IV) (n))\ - : (LIKELY((n) < UV_MAX_P1) ? (IV)(UV) (n) \ +#define I_V(n) \ + (LIKELY((n) < IV_MAX_P1) ? (UNLIKELY((n) < IV_MIN) ? IV_MIN : (IV) (n)) \ + : (LIKELY((n) < UV_MAX_P1) ? (IV)(UV) (n) \ : ((n) > 0 ? (IV)UV_MAX : 0 /* NaN */))) -#define U_V(n) \ - ((n) < 0.0 ? (UNLIKELY((n) < IV_MIN) ? (UV) IV_MIN : (UV)(IV) (n))\ - : (LIKELY((n) < UV_MAX_P1) ? (UV) (n) \ +#define U_V(n) \ + ((n) < 0.0 ? (UNLIKELY((n) < IV_MIN) ? (UV) IV_MIN : (UV)(IV) (n)) \ + : (LIKELY((n) < UV_MAX_P1) ? (UV) (n) \ : ((n) > 0 ? UV_MAX : 0 /* NaN */))) #endif @@ -4778,13 +4778,13 @@ Gid_t getegid (void); #endif #ifndef Perl_error_log -# define Perl_error_log \ - (PL_stderrgv\ - && isGV(PL_stderrgv) \ - && GvIOp(PL_stderrgv) \ - && IoOFP(GvIOp(PL_stderrgv)) \ - ? IoOFP(GvIOp(PL_stderrgv)) \ - : PerlIO_stderr()) +# define Perl_error_log \ + (PL_stderrgv \ + && isGV(PL_stderrgv) \ + && GvIOp(PL_stderrgv) \ + && IoOFP(GvIOp(PL_stderrgv)) \ + ? IoOFP(GvIOp(PL_stderrgv)) \ + : PerlIO_stderr()) #endif @@ -4824,9 +4824,9 @@ Gid_t getegid (void); #define DEBUG_TOP_FLAG 0x80000000 /* -D was given --> PL_debug |= FLAG */ /* Both flags have to be set */ -# define DEBUG_BOTH_FLAGS_TEST_(flag1, flag2) \ - UNLIKELY((PL_debug & ((flag1)|(flag2))) \ - == ((flag1)|(flag2))) +# define DEBUG_BOTH_FLAGS_TEST_(flag1, flag2) \ + UNLIKELY((PL_debug & ((flag1)|(flag2))) \ + == ((flag1)|(flag2))) # define DEBUG_p_TEST_ UNLIKELY(PL_debug & DEBUG_p_FLAG) # define DEBUG_s_TEST_ UNLIKELY(PL_debug & DEBUG_s_FLAG) @@ -4860,12 +4860,12 @@ Gid_t getegid (void); # ifndef DEBUG_LOCALE_INITIALIZATION_ # define DEBUG_LOCALE_INITIALIZATION_ 0 # endif -# define DEBUG_L_TEST_ \ - ( UNLIKELY(DEBUG_LOCALE_INITIALIZATION_) \ - || UNLIKELY(PL_debug & DEBUG_L_FLAG)) -# define DEBUG_Lv_TEST_ \ - ( UNLIKELY(DEBUG_LOCALE_INITIALIZATION_) \ - || UNLIKELY(DEBUG_BOTH_FLAGS_TEST_(DEBUG_L_FLAG, DEBUG_v_FLAG))) +# define DEBUG_L_TEST_ \ + ( UNLIKELY(DEBUG_LOCALE_INITIALIZATION_) \ + || UNLIKELY(PL_debug & DEBUG_L_FLAG)) +# define DEBUG_Lv_TEST_ \ + ( UNLIKELY(DEBUG_LOCALE_INITIALIZATION_) \ + || UNLIKELY(DEBUG_BOTH_FLAGS_TEST_(DEBUG_L_FLAG, DEBUG_v_FLAG))) # define DEBUG_i_TEST_ UNLIKELY(PL_debug & DEBUG_i_FLAG) # define DEBUG_y_TEST_ UNLIKELY(PL_debug & DEBUG_y_FLAG) # define DEBUG_Xv_TEST_ DEBUG_BOTH_FLAGS_TEST_(DEBUG_X_FLAG, DEBUG_v_FLAG) @@ -4923,17 +4923,17 @@ Gid_t getegid (void); /* Temporarily turn off memory debugging in case the a * does memory allocation, either directly or indirectly. */ -# define DEBUG_m(a) \ - STMT_START { \ - if (PERL_GET_INTERP) { \ - dTHX; \ - if (DEBUG_m_TEST) { \ - PL_debug &= ~DEBUG_m_FLAG; \ - a; \ - PL_debug |= DEBUG_m_FLAG; \ - } \ - } \ - } STMT_END +# define DEBUG_m(a) \ + STMT_START { \ + if (PERL_GET_INTERP) { \ + dTHX; \ + if (DEBUG_m_TEST) { \ + PL_debug &= ~DEBUG_m_FLAG; \ + a; \ + PL_debug |= DEBUG_m_FLAG; \ + } \ + } \ + } STMT_END /* These allow you to customize your debugging output for specialized, * generally temporary ad-hoc purposes. For example, if you need 'errno' @@ -4947,8 +4947,8 @@ Gid_t getegid (void); * Other potential things include displaying timestamps, location information, * which thread, etc. Heres an example with both errno and location info: * - * #define DEBUG_PRE_STMTS dSAVE_ERRNO; \ - * PerlIO_printf(Perl_debug_log, "%s:%d: ", __FILE__, __LINE__); + * #define DEBUG_PRE_STMTS dSAVE_ERRNO; \ + * PerlIO_printf(Perl_debug_log, "%s:%d: ", __FILE__, __LINE__); * #define DEBUG_POST RESTORE_ERRNO; * * All DEBUG statements in the compiled scope will be have these extra @@ -4962,21 +4962,21 @@ Gid_t getegid (void); # define DEBUG_POST_STMTS #endif -# define DEBUG__(t, a) \ - STMT_START { \ - if (t) { \ - DEBUG_PRE_STMTS a; DEBUG_POST_STMTS \ - } \ - } STMT_END +# define DEBUG__(t, a) \ + STMT_START { \ + if (t) { \ + DEBUG_PRE_STMTS a; DEBUG_POST_STMTS \ + } \ + } STMT_END # define DEBUG_f(a) DEBUG__(DEBUG_f_TEST, a) /* For re_comp.c, re_exec.c, assume -Dr has been specified */ # ifdef PERL_EXT_RE_BUILD -# define DEBUG_r(a) \ - STMT_START {\ - DEBUG_PRE_STMTS a; DEBUG_POST_STMTS \ - } STMT_END; +# define DEBUG_r(a) \ + STMT_START { \ + DEBUG_PRE_STMTS a; DEBUG_POST_STMTS \ + } STMT_END; # else # define DEBUG_r(a) DEBUG__(DEBUG_r_TEST, a) # endif /* PERL_EXT_RE_BUILD */ @@ -5080,20 +5080,20 @@ Gid_t getegid (void); #endif /* DEBUGGING */ -#define DEBUG_SCOPE(where) \ - DEBUG_l( \ - Perl_deb(aTHX_ "%s scope %ld (savestack=%ld) at %s:%d\n", \ - where, (long)PL_scopestack_ix, (long)PL_savestack_ix, \ +#define DEBUG_SCOPE(where) \ + DEBUG_l( \ + Perl_deb(aTHX_ "%s scope %ld (savestack=%ld) at %s:%d\n", \ + where, (long)PL_scopestack_ix, (long)PL_savestack_ix, \ __FILE__, __LINE__)); /* Keep the old croak based assert for those who want it, and as a fallback if the platform is so heretically non-ANSI that it can't assert. */ -#define Perl_assert(what) \ - PERL_DEB2(\ - ((what) ? ((void) 0) : \ - (Perl_croak_nocontext("Assertion %s failed: file \"" __FILE__ \ - "\", line %d", STRINGIFY(what), __LINE__), \ +#define Perl_assert(what) \ + PERL_DEB2( \ + ((what) ? ((void) 0) : \ + (Perl_croak_nocontext("Assertion %s failed: file \"" __FILE__ \ + "\", line %d", STRINGIFY(what), __LINE__), \ (void) 0)), ((void)0)) /* assert() gets defined if DEBUGGING. @@ -5210,11 +5210,11 @@ typedef Sighandler_t Sigsave_t; EXTERN_C void PerlIO_teardown(void); # ifdef USE_ITHREADS # define PERLIO_INIT MUTEX_INIT(&PL_perlio_mutex) -# define PERLIO_TERM \ - STMT_START { \ - PerlIO_teardown(); \ - MUTEX_DESTROY(&PL_perlio_mutex);\ - } STMT_END +# define PERLIO_TERM \ + STMT_START { \ + PerlIO_teardown(); \ + MUTEX_DESTROY(&PL_perlio_mutex); \ + } STMT_END # else # define PERLIO_INIT # define PERLIO_TERM PerlIO_teardown() @@ -5226,17 +5226,17 @@ EXTERN_C void PerlIO_teardown(void); #ifdef MYMALLOC # ifdef MUTEX_INIT_CALLS_MALLOC -# define MALLOC_INIT \ - STMT_START { \ - PL_malloc_mutex = NULL; \ - MUTEX_INIT(&PL_malloc_mutex); \ - } STMT_END -# define MALLOC_TERM \ - STMT_START { \ - perl_mutex tmp = PL_malloc_mutex; \ - PL_malloc_mutex = NULL; \ - MUTEX_DESTROY(&tmp); \ - } STMT_END +# define MALLOC_INIT \ + STMT_START { \ + PL_malloc_mutex = NULL; \ + MUTEX_INIT(&PL_malloc_mutex); \ + } STMT_END +# define MALLOC_TERM \ + STMT_START { \ + perl_mutex tmp = PL_malloc_mutex; \ + PL_malloc_mutex = NULL; \ + MUTEX_DESTROY(&tmp); \ + } STMT_END # else # define MALLOC_INIT MUTEX_INIT(&PL_malloc_mutex) # define MALLOC_TERM MUTEX_DESTROY(&PL_malloc_mutex) @@ -5272,10 +5272,10 @@ struct perl_memory_debug_header { #if defined (PERL_TRACK_MEMPOOL) || defined (PERL_DEBUG_READONLY_COW) -# define PERL_MEMORY_DEBUG_HEADER_SIZE \ - (sizeof(struct perl_memory_debug_header) + \ - (MEM_ALIGNBYTES - sizeof(struct perl_memory_debug_header) \ - %MEM_ALIGNBYTES) % MEM_ALIGNBYTES) +# define PERL_MEMORY_DEBUG_HEADER_SIZE \ + (sizeof(struct perl_memory_debug_header) + \ + (MEM_ALIGNBYTES - sizeof(struct perl_memory_debug_header) \ + %MEM_ALIGNBYTES) % MEM_ALIGNBYTES) #else # define PERL_MEMORY_DEBUG_HEADER_SIZE 0 @@ -5283,18 +5283,18 @@ struct perl_memory_debug_header { #ifdef PERL_TRACK_MEMPOOL # ifdef PERL_DEBUG_READONLY_COW -# define INIT_TRACK_MEMPOOL(header, interp) \ - STMT_START { \ - (header).interpreter = (interp); \ - (header).prev = (header).next = &(header); \ - (header).readonly = 0; \ - } STMT_END +# define INIT_TRACK_MEMPOOL(header, interp) \ + STMT_START { \ + (header).interpreter = (interp); \ + (header).prev = (header).next = &(header); \ + (header).readonly = 0; \ + } STMT_END # else -# define INIT_TRACK_MEMPOOL(header, interp) \ - STMT_START { \ - (header).interpreter = (interp); \ - (header).prev = (header).next = &(header); \ - } STMT_END +# define INIT_TRACK_MEMPOOL(header, interp) \ + STMT_START { \ + (header).interpreter = (interp); \ + (header).prev = (header).next = &(header); \ + } STMT_END # endif # else # define INIT_TRACK_MEMPOOL(header, interp) @@ -5310,7 +5310,7 @@ struct perl_memory_debug_header { #else # if defined(HAS_MALLOC_SIZE) && !defined(PERL_DEBUG_READONLY_COW) # ifdef PERL_TRACK_MEMPOOL -# define Perl_safesysmalloc_size(where) \ +# define Perl_safesysmalloc_size(where) \ (malloc_size(((char *)(where)) - PERL_MEMORY_DEBUG_HEADER_SIZE) - PERL_MEMORY_DEBUG_HEADER_SIZE) # else # define Perl_safesysmalloc_size(where) malloc_size(where) @@ -5318,7 +5318,7 @@ struct perl_memory_debug_header { # endif # ifdef HAS_MALLOC_GOOD_SIZE # ifdef PERL_TRACK_MEMPOOL -# define Perl_malloc_good_size(how_much) \ +# define Perl_malloc_good_size(how_much) \ (malloc_good_size((how_much) + PERL_MEMORY_DEBUG_HEADER_SIZE) - PERL_MEMORY_DEBUG_HEADER_SIZE) # else # define Perl_malloc_good_size(how_much) malloc_good_size(how_much) @@ -5348,14 +5348,14 @@ EXTERN_C char **environ; /* environment variables supplied via exec */ #include "patchlevel.h" #undef PERL_PATCHLEVEL_H_IMPLICIT -#define PERL_VERSION_STRING \ - STRINGIFY(PERL_REVISION) "."\ - STRINGIFY(PERL_VERSION) "." \ +#define PERL_VERSION_STRING \ + STRINGIFY(PERL_REVISION) "." \ + STRINGIFY(PERL_VERSION) "." \ STRINGIFY(PERL_SUBVERSION) -#define PERL_API_VERSION_STRING \ - STRINGIFY(PERL_API_REVISION) "."\ - STRINGIFY(PERL_API_VERSION) "." \ +#define PERL_API_VERSION_STRING \ + STRINGIFY(PERL_API_REVISION) "." \ + STRINGIFY(PERL_API_VERSION) "." \ STRINGIFY(PERL_API_SUBVERSION) START_EXTERN_C @@ -5650,9 +5650,9 @@ EXTCONST unsigned char PL_mod_latin1_uc[] = { 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, -# if UNICODE_MAJOR_VERSION > 2 \ - || (UNICODE_MAJOR_VERSION == 2 && UNICODE_DOT_VERSION >= 1 \ - && UNICODE_DOT_DOT_VERSION >= 8) +# if UNICODE_MAJOR_VERSION > 2 \ + || (UNICODE_MAJOR_VERSION == 2 && UNICODE_DOT_VERSION >= 1 \ + && UNICODE_DOT_DOT_VERSION >= 8) 255 /*sharp s*/, # else /* uc(sharp s) is 'sharp s' itself in early unicode */ 223, @@ -5815,9 +5815,9 @@ EXTCONST char PL_bincompat_options[]; #endif #ifndef PERL_SET_PHASE -# define PERL_SET_PHASE(new_phase) \ - PERL_DTRACE_PROBE_PHASE(new_phase); \ - PL_phase = new_phase; +# define PERL_SET_PHASE(new_phase) \ + PERL_DTRACE_PROBE_PHASE(new_phase); \ + PL_phase = new_phase; #endif /* The interpreter phases. If these ever change, PL_phase_names right below will @@ -5967,9 +5967,9 @@ typedef enum { 0x80000000 */ -#define HINT_ALL_STRICT \ - HINT_STRICT_REFS\ - | HINT_STRICT_SUBS \ +#define HINT_ALL_STRICT \ + HINT_STRICT_REFS \ + | HINT_STRICT_SUBS \ | HINT_STRICT_VARS #ifdef USE_STRICT_BY_DEFAULT @@ -5985,8 +5985,8 @@ typedef enum { #define SAWAMPERSAND_RIGHT 4 /* saw $' */ #ifndef PERL_SAWAMPERSAND -# define PL_sawampersand \ - (SAWAMPERSAND_LEFT|SAWAMPERSAND_MIDDLE|SAWAMPERSAND_RIGHT) +# define PL_sawampersand \ + (SAWAMPERSAND_LEFT|SAWAMPERSAND_MIDDLE|SAWAMPERSAND_RIGHT) #endif /* Used for debugvar magic */ @@ -6014,9 +6014,9 @@ struct perl_debug_pad { }; #define PERL_DEBUG_PAD(i) &(PL_debug_pad.pad[i]) -#define PERL_DEBUG_PAD_ZERO(i) \ - (SvPVX(PERL_DEBUG_PAD(i))[0] = 0,\ - (((XPV*) SvANY(PERL_DEBUG_PAD(i)))->xpv_cur = 0), \ +#define PERL_DEBUG_PAD_ZERO(i) \ + (SvPVX(PERL_DEBUG_PAD(i))[0] = 0, \ + (((XPV*) SvANY(PERL_DEBUG_PAD(i)))->xpv_cur = 0), \ PERL_DEBUG_PAD(i)) /* Enable variables which are pointers to functions */ @@ -6103,9 +6103,9 @@ struct interpreter { EXTCONST U16 PL_interp_size INIT(sizeof(struct interpreter)); -# define PERL_INTERPRETER_SIZE_UPTO_MEMBER(member) \ - STRUCT_OFFSET(struct interpreter, member) + \ - sizeof(((struct interpreter*)0)->member) +# define PERL_INTERPRETER_SIZE_UPTO_MEMBER(member) \ + STRUCT_OFFSET(struct interpreter, member) + \ + sizeof(((struct interpreter*)0)->member) /* This will be useful for subsequent releases, because this has to be the same in your libperl as in main(), else you have a mismatch and must abort. @@ -6234,13 +6234,13 @@ EXTCONST runops_proc_t PL_runops_dbg #define PERL_MAGIC_VTABLE_MASK 0x3F /* can this type of magic be attached to a readonly SV? */ -#define PERL_MAGIC_TYPE_READONLY_ACCEPTABLE(t) \ +#define PERL_MAGIC_TYPE_READONLY_ACCEPTABLE(t) \ (PL_magic_data[(U8)(t)] & PERL_MAGIC_READONLY_ACCEPTABLE) /* Is this type of magic container magic (%ENV, $1 etc), * or value magic (pos, taint etc)? */ -#define PERL_MAGIC_TYPE_IS_VALUE_MAGIC(t) \ +#define PERL_MAGIC_TYPE_IS_VALUE_MAGIC(t) \ (PL_magic_data[(U8)(t)] & PERL_MAGIC_VALUE_MAGIC) #include "mg_vtable.h" @@ -6323,11 +6323,11 @@ EXTCONST U8 PL_deBruijn_bitpos_tab64[]; #endif #ifdef USE_PERL_SWITCH_LOCALE_CONTEXT -# define PERL_SET_LOCALE_CONTEXT(i) \ - STMT_START { \ - if (UNLIKELY(PL_veto_switch_non_tTHX_context)) \ - Perl_switch_locale_context(); \ - } STMT_END +# define PERL_SET_LOCALE_CONTEXT(i) \ + STMT_START { \ + if (UNLIKELY(PL_veto_switch_non_tTHX_context)) \ + Perl_switch_locale_context(); \ + } STMT_END #else # define PERL_SET_LOCALE_CONTEXT(i) NOOP #endif @@ -6336,8 +6336,8 @@ EXTCONST U8 PL_deBruijn_bitpos_tab64[]; * in a library instead of perl's tTHX structure. This macro is to be used to * handle those when tTHX is changed. Only locale handling is currently known * to be affected. */ -#define PERL_SET_NON_tTHX_CONTEXT(i) \ - STMT_START { PERL_SET_LOCALE_CONTEXT(i); } STMT_END +#define PERL_SET_NON_tTHX_CONTEXT(i) \ + STMT_START { PERL_SET_LOCALE_CONTEXT(i); } STMT_END #ifndef PERL_GET_CONTEXT @@ -6852,8 +6852,8 @@ typedef struct am_table_short AMTS; # endif #endif /* _FASTMATH */ -#define PERLDB_ALL \ - (PERLDBf_SUB | PERLDBf_LINE |\ +#define PERLDB_ALL \ + (PERLDBf_SUB | PERLDBf_LINE | \ PERLDBf_NOOPT | PERLDBf_INTER | \ PERLDBf_SUBLINE| PERLDBf_SINGLE| \ PERLDBf_NAMEEVAL| PERLDBf_NAMEANON | \ @@ -6914,17 +6914,17 @@ typedef struct am_table_short AMTS; /* Returns TRUE if the plain locale pragma without a parameter is in effect. * */ -# define IN_LOCALE_RUNTIME \ - (PL_curcop\ - && CopHINTS_get(PL_curcop) & HINT_LOCALE) +# define IN_LOCALE_RUNTIME \ + (PL_curcop \ + && CopHINTS_get(PL_curcop) & HINT_LOCALE) /* Returns TRUE if either form of the locale pragma is in effect */ -# define IN_SOME_LOCALE_FORM_RUNTIME \ - cBOOL(CopHINTS_get(PL_curcop) & (HINT_LOCALE|HINT_LOCALE_PARTIAL)) +# define IN_SOME_LOCALE_FORM_RUNTIME \ + cBOOL(CopHINTS_get(PL_curcop) & (HINT_LOCALE|HINT_LOCALE_PARTIAL)) # define IN_LOCALE_COMPILETIME cBOOL(PL_hints & HINT_LOCALE) -# define IN_SOME_LOCALE_FORM_COMPILETIME \ - cBOOL(PL_hints & (HINT_LOCALE|HINT_LOCALE_PARTIAL)) +# define IN_SOME_LOCALE_FORM_COMPILETIME \ + cBOOL(PL_hints & (HINT_LOCALE|HINT_LOCALE_PARTIAL)) /* =for apidoc_section $locale @@ -6947,28 +6947,28 @@ the plain locale pragma without a parameter (S>) is in effect. =cut */ -# define IN_LOCALE \ - (IN_PERL_COMPILETIME ? IN_LOCALE_COMPILETIME : IN_LOCALE_RUNTIME) -# define IN_SOME_LOCALE_FORM \ - (IN_PERL_COMPILETIME ? IN_SOME_LOCALE_FORM_COMPILETIME \ - : IN_SOME_LOCALE_FORM_RUNTIME) +# define IN_LOCALE \ + (IN_PERL_COMPILETIME ? IN_LOCALE_COMPILETIME : IN_LOCALE_RUNTIME) +# define IN_SOME_LOCALE_FORM \ + (IN_PERL_COMPILETIME ? IN_SOME_LOCALE_FORM_COMPILETIME \ + : IN_SOME_LOCALE_FORM_RUNTIME) # define IN_LC_ALL_COMPILETIME IN_LOCALE_COMPILETIME # define IN_LC_ALL_RUNTIME IN_LOCALE_RUNTIME # define IN_LC_PARTIAL_COMPILETIME cBOOL(PL_hints & HINT_LOCALE_PARTIAL) -# define IN_LC_PARTIAL_RUNTIME \ - (PL_curcop && CopHINTS_get(PL_curcop) & HINT_LOCALE_PARTIAL) +# define IN_LC_PARTIAL_RUNTIME \ + (PL_curcop && CopHINTS_get(PL_curcop) & HINT_LOCALE_PARTIAL) -# define IN_LC_COMPILETIME(category) \ - ( IN_LC_ALL_COMPILETIME \ - || ( IN_LC_PARTIAL_COMPILETIME \ +# define IN_LC_COMPILETIME(category) \ + ( IN_LC_ALL_COMPILETIME \ + || ( IN_LC_PARTIAL_COMPILETIME \ && Perl__is_in_locale_category(aTHX_ TRUE, (category)))) -# define IN_LC_RUNTIME(category) \ - (IN_LC_ALL_RUNTIME || (IN_LC_PARTIAL_RUNTIME \ - && Perl__is_in_locale_category(aTHX_ FALSE, (category)))) -# define IN_LC(category) \ - (IN_LC_COMPILETIME(category) || IN_LC_RUNTIME(category)) +# define IN_LC_RUNTIME(category) \ + (IN_LC_ALL_RUNTIME || (IN_LC_PARTIAL_RUNTIME \ + && Perl__is_in_locale_category(aTHX_ FALSE, (category)))) +# define IN_LC(category) \ + (IN_LC_COMPILETIME(category) || IN_LC_RUNTIME(category)) # if defined (PERL_CORE) || defined (PERL_IN_XSUB_RE) @@ -6979,12 +6979,12 @@ the plain locale pragma without a parameter (S>) is in effect. * instead it makes sense to minimize space used and do all the work in * the rarely called function */ # ifdef USE_LOCALE_CTYPE -# define CHECK_AND_WARN_PROBLEMATIC_LOCALE_ \ - STMT_START { \ - if (UNLIKELY(PL_warn_locale)) { \ - Perl__warn_problematic_locale(); \ - } \ - } STMT_END +# define CHECK_AND_WARN_PROBLEMATIC_LOCALE_ \ + STMT_START { \ + if (UNLIKELY(PL_warn_locale)) { \ + Perl__warn_problematic_locale(); \ + } \ + } STMT_END # else # define CHECK_AND_WARN_PROBLEMATIC_LOCALE_ # endif @@ -6994,27 +6994,27 @@ the plain locale pragma without a parameter (S>) is in effect. * and will do so if enabled. The first takes a single code point * argument; the 2nd, is a pointer to the first byte of the UTF-8 encoded * string, and an end position which it won't try to read past */ -# define _CHECK_AND_OUTPUT_WIDE_LOCALE_CP_MSG(cp) \ - STMT_START { \ - if (! IN_UTF8_CTYPE_LOCALE && ckWARN(WARN_LOCALE)) { \ - Perl_warner(aTHX_ packWARN(WARN_LOCALE), \ - "Wide character (U+%" UVXf ") in %s",\ - (UV) cp, OP_DESC(PL_op)); \ - } \ - } STMT_END - -# define _CHECK_AND_OUTPUT_WIDE_LOCALE_UTF8_MSG(s, send) \ - STMT_START { /* Check if to warn before doing the conversion work */\ - if (! IN_UTF8_CTYPE_LOCALE && ckWARN(WARN_LOCALE)) { \ - UV cp = utf8_to_uvchr_buf((U8 *) (s), (U8 *) (send), NULL); \ - Perl_warner(aTHX_ packWARN(WARN_LOCALE), \ - "Wide character (U+%" UVXf ") in %s", \ - (cp == 0) \ - ? UNICODE_REPLACEMENT \ - : (UV) cp, \ - OP_DESC(PL_op)); \ - } \ - } STMT_END +# define _CHECK_AND_OUTPUT_WIDE_LOCALE_CP_MSG(cp) \ + STMT_START { \ + if (! IN_UTF8_CTYPE_LOCALE && ckWARN(WARN_LOCALE)) { \ + Perl_warner(aTHX_ packWARN(WARN_LOCALE), \ + "Wide character (U+%" UVXf ") in %s", \ + (UV) cp, OP_DESC(PL_op)); \ + } \ + } STMT_END + +# define _CHECK_AND_OUTPUT_WIDE_LOCALE_UTF8_MSG(s, send) \ + STMT_START { /* Check if to warn before doing the conversion work */ \ + if (! IN_UTF8_CTYPE_LOCALE && ckWARN(WARN_LOCALE)) { \ + UV cp = utf8_to_uvchr_buf((U8 *) (s), (U8 *) (send), NULL); \ + Perl_warner(aTHX_ packWARN(WARN_LOCALE), \ + "Wide character (U+%" UVXf ") in %s", \ + (cp == 0) \ + ? UNICODE_REPLACEMENT \ + : (UV) cp, \ + OP_DESC(PL_op)); \ + } \ + } STMT_END # endif /* PERL_CORE or PERL_IN_XSUB_RE */ #else /* No locale usage */ @@ -7063,50 +7063,50 @@ the plain locale pragma without a parameter (S>) is in effect. * https://clang.llvm.org/docs/ThreadSafetyAnalysis.html#conditional-locks */ # define LOCALE_LOCK_(cond_to_panic_if_already_locked) \ - STMT_START { \ - CLANG_DIAG_IGNORE(-Wthread-safety) \ - if (LIKELY(PL_locale_mutex_depth <= 0)) { \ - DEBUG_Lv(PerlIO_printf(Perl_debug_log, \ - "%s: %d: locking locale; depth=1\n", \ - __FILE__, __LINE__)); \ - MUTEX_LOCK(&PL_locale_mutex); \ - PL_locale_mutex_depth = 1; \ - } \ - else { \ - PL_locale_mutex_depth++; \ - DEBUG_Lv(PerlIO_printf(Perl_debug_log, \ - "%s: %d: avoided locking locale; new depth=%d\n", \ - __FILE__, __LINE__, PL_locale_mutex_depth)); \ - if (cond_to_panic_if_already_locked) { \ - locale_panic_("Trying to lock locale incompatibly: " \ - STRINGIFY(cond_to_panic_if_already_locked)); \ - } \ - } \ - CLANG_DIAG_RESTORE \ - } STMT_END + STMT_START { \ + CLANG_DIAG_IGNORE(-Wthread-safety) \ + if (LIKELY(PL_locale_mutex_depth <= 0)) { \ + DEBUG_Lv(PerlIO_printf(Perl_debug_log, \ + "%s: %d: locking locale; depth=1\n", \ + __FILE__, __LINE__)); \ + MUTEX_LOCK(&PL_locale_mutex); \ + PL_locale_mutex_depth = 1; \ + } \ + else { \ + PL_locale_mutex_depth++; \ + DEBUG_Lv(PerlIO_printf(Perl_debug_log, \ + "%s: %d: avoided locking locale; new depth=%d\n", \ + __FILE__, __LINE__, PL_locale_mutex_depth)); \ + if (cond_to_panic_if_already_locked) { \ + locale_panic_("Trying to lock locale incompatibly: " \ + STRINGIFY(cond_to_panic_if_already_locked)); \ + } \ + } \ + CLANG_DIAG_RESTORE \ + } STMT_END # define LOCALE_UNLOCK_ \ - STMT_START { \ - if (LIKELY(PL_locale_mutex_depth == 1)) { \ - DEBUG_Lv(PerlIO_printf(Perl_debug_log, \ - "%s: %d: unlocking locale; new depth=0\n", \ - __FILE__, __LINE__)); \ - PL_locale_mutex_depth = 0; \ - MUTEX_UNLOCK(&PL_locale_mutex); \ - } \ - else if (PL_locale_mutex_depth <= 0) { \ - DEBUG_L(PerlIO_printf(Perl_debug_log, \ - "%s: %d: ignored attempt to unlock already" \ - " unlocked locale; depth unchanged at %d\n", \ + STMT_START { \ + if (LIKELY(PL_locale_mutex_depth == 1)) { \ + DEBUG_Lv(PerlIO_printf(Perl_debug_log, \ + "%s: %d: unlocking locale; new depth=0\n", \ + __FILE__, __LINE__)); \ + PL_locale_mutex_depth = 0; \ + MUTEX_UNLOCK(&PL_locale_mutex); \ + } \ + else if (PL_locale_mutex_depth <= 0) { \ + DEBUG_L(PerlIO_printf(Perl_debug_log, \ + "%s: %d: ignored attempt to unlock already" \ + " unlocked locale; depth unchanged at %d\n", \ + __FILE__, __LINE__, PL_locale_mutex_depth)); \ + } \ + else { \ + PL_locale_mutex_depth--; \ + DEBUG_Lv(PerlIO_printf(Perl_debug_log, \ + "%s: %d: avoided unlocking locale; new depth=%d\n", \ __FILE__, __LINE__, PL_locale_mutex_depth)); \ - } \ - else { \ - PL_locale_mutex_depth--; \ - DEBUG_Lv(PerlIO_printf(Perl_debug_log, \ - "%s: %d: avoided unlocking locale; new depth=%d\n", \ - __FILE__, __LINE__, PL_locale_mutex_depth)); \ - } \ - } STMT_END + } \ + } STMT_END # if defined(USE_THREADS) && ! defined(USE_THREAD_SAFE_LOCALE) @@ -7115,8 +7115,8 @@ the plain locale pragma without a parameter (S>) is in effect. # define SETLOCALE_LOCK LOCALE_LOCK_(0) # define SETLOCALE_UNLOCK LOCALE_UNLOCK_ # ifdef USE_LOCALE_NUMERIC -# define LC_NUMERIC_LOCK(cond_to_panic_if_already_locked) \ - LOCALE_LOCK_(cond_to_panic_if_already_locked) +# define LC_NUMERIC_LOCK(cond_to_panic_if_already_locked) \ + LOCALE_LOCK_(cond_to_panic_if_already_locked) # define LC_NUMERIC_UNLOCK LOCALE_UNLOCK_ # endif # endif @@ -7125,24 +7125,24 @@ the plain locale pragma without a parameter (S>) is in effect. # define LOCALE_TERM_POSIX_2008_ NOOP # else /* We have a locale object holding the 'C' locale for Posix 2008 */ -# define LOCALE_TERM_POSIX_2008_ \ - STMT_START { \ - if (PL_C_locale_obj) { \ - /* Make sure we aren't using the locale \ - * space we are about to free */ \ - uselocale(LC_GLOBAL_LOCALE); \ - freelocale(PL_C_locale_obj); \ - PL_C_locale_obj = (locale_t) NULL; \ - } \ - } STMT_END +# define LOCALE_TERM_POSIX_2008_ \ + STMT_START { \ + if (PL_C_locale_obj) { \ + /* Make sure we aren't using the locale \ + * space we are about to free */ \ + uselocale(LC_GLOBAL_LOCALE); \ + freelocale(PL_C_locale_obj); \ + PL_C_locale_obj = (locale_t) NULL; \ + } \ + } STMT_END # endif # define LOCALE_INIT MUTEX_INIT(&PL_locale_mutex) -# define LOCALE_TERM \ - STMT_START {\ - LOCALE_TERM_POSIX_2008_; \ - MUTEX_DESTROY(&PL_locale_mutex); \ - } STMT_END +# define LOCALE_TERM \ + STMT_START { \ + LOCALE_TERM_POSIX_2008_; \ + MUTEX_DESTROY(&PL_locale_mutex); \ + } STMT_END #endif /* There are some locale-related functions which may need locking only because @@ -7170,16 +7170,16 @@ the plain locale pragma without a parameter (S>) is in effect. /* setlocale() generally returns in a global static buffer, but not on Windows * when operating in thread-safe mode */ #if defined(WIN32) && defined(USE_THREAD_SAFE_LOCALE) -# define POSIX_SETLOCALE_LOCK \ - STMT_START { \ - if (_configthreadlocale(0) == _DISABLE_PER_THREAD_LOCALE) \ - gwLOCALE_LOCK; \ - } STMT_END -# define POSIX_SETLOCALE_UNLOCK \ - STMT_START { \ - if (_configthreadlocale(0) == _DISABLE_PER_THREAD_LOCALE) \ - gwLOCALE_UNLOCK; \ - } STMT_END +# define POSIX_SETLOCALE_LOCK \ + STMT_START { \ + if (_configthreadlocale(0) == _DISABLE_PER_THREAD_LOCALE) \ + gwLOCALE_LOCK; \ + } STMT_END +# define POSIX_SETLOCALE_UNLOCK \ + STMT_START { \ + if (_configthreadlocale(0) == _DISABLE_PER_THREAD_LOCALE) \ + gwLOCALE_UNLOCK; \ + } STMT_END #else # define POSIX_SETLOCALE_LOCK gwLOCALE_LOCK # define POSIX_SETLOCALE_UNLOCK gwLOCALE_UNLOCK @@ -7197,10 +7197,10 @@ the plain locale pragma without a parameter (S>) is in effect. * that, and a read ENV lock to prevent other threads that have nothing to do * with locales here from changing the environment. */ #ifdef SETLOCALE_LOCK -# define gwENVr_LOCALEr_LOCK \ - STMT_START { SETLOCALE_LOCK; ENV_READ_LOCK; } STMT_END -# define gwENVr_LOCALEr_UNLOCK \ - STMT_START { ENV_READ_UNLOCK; SETLOCALE_UNLOCK; } STMT_END +# define gwENVr_LOCALEr_LOCK \ + STMT_START { SETLOCALE_LOCK; ENV_READ_LOCK; } STMT_END +# define gwENVr_LOCALEr_UNLOCK \ + STMT_START { ENV_READ_UNLOCK; SETLOCALE_UNLOCK; } STMT_END #else # define gwENVr_LOCALEr_LOCK ENV_LOCK # define gwENVr_LOCALEr_UNLOCK ENV_UNLOCK @@ -7418,129 +7418,129 @@ cannot have changed since the precalculation. /* We can lock the category to stay in the C locale, making requests to the * contrary be noops, in the dynamic scope by setting PL_numeric_standard to 2. * */ -# define NOT_IN_NUMERIC_UNDERLYING_ \ - (! PL_numeric_underlying && PL_numeric_standard < 2) +# define NOT_IN_NUMERIC_UNDERLYING_ \ + (! PL_numeric_underlying && PL_numeric_standard < 2) -# define DECLARATION_FOR_LC_NUMERIC_MANIPULATION \ - void (*_restore_LC_NUMERIC_function)(pTHX) = NULL +# define DECLARATION_FOR_LC_NUMERIC_MANIPULATION \ + void (*_restore_LC_NUMERIC_function)(pTHX) = NULL # define STORE_LC_NUMERIC_SET_TO_NEEDED_IN(in) \ - STMT_START { \ - bool _in_lc_numeric = (in); \ - LC_NUMERIC_LOCK( \ - ( ( _in_lc_numeric && NOT_IN_NUMERIC_UNDERLYING_) \ - || (! _in_lc_numeric && NOT_IN_NUMERIC_STANDARD_))); \ - if (_in_lc_numeric) { \ - if (NOT_IN_NUMERIC_UNDERLYING_) { \ - Perl_set_numeric_underlying(aTHX); \ - _restore_LC_NUMERIC_function \ - = &Perl_set_numeric_standard; \ - } \ - } \ - else { \ - if (NOT_IN_NUMERIC_STANDARD_) { \ - Perl_set_numeric_standard(aTHX); \ - _restore_LC_NUMERIC_function \ - = &Perl_set_numeric_underlying; \ - } \ - } \ - } STMT_END - -# define STORE_LC_NUMERIC_SET_TO_NEEDED() \ - STORE_LC_NUMERIC_SET_TO_NEEDED_IN(IN_LC(LC_NUMERIC)) - -# define RESTORE_LC_NUMERIC() \ - STMT_START { \ - if (_restore_LC_NUMERIC_function) { \ - _restore_LC_NUMERIC_function(aTHX); \ - } \ - LC_NUMERIC_UNLOCK; \ - } STMT_END + STMT_START { \ + bool _in_lc_numeric = (in); \ + LC_NUMERIC_LOCK( \ + ( ( _in_lc_numeric && NOT_IN_NUMERIC_UNDERLYING_) \ + || (! _in_lc_numeric && NOT_IN_NUMERIC_STANDARD_))); \ + if (_in_lc_numeric) { \ + if (NOT_IN_NUMERIC_UNDERLYING_) { \ + Perl_set_numeric_underlying(aTHX); \ + _restore_LC_NUMERIC_function \ + = &Perl_set_numeric_standard; \ + } \ + } \ + else { \ + if (NOT_IN_NUMERIC_STANDARD_) { \ + Perl_set_numeric_standard(aTHX); \ + _restore_LC_NUMERIC_function \ + = &Perl_set_numeric_underlying; \ + } \ + } \ + } STMT_END + +# define STORE_LC_NUMERIC_SET_TO_NEEDED() \ + STORE_LC_NUMERIC_SET_TO_NEEDED_IN(IN_LC(LC_NUMERIC)) + +# define RESTORE_LC_NUMERIC() \ + STMT_START { \ + if (_restore_LC_NUMERIC_function) { \ + _restore_LC_NUMERIC_function(aTHX); \ + } \ + LC_NUMERIC_UNLOCK; \ + } STMT_END /* The next two macros should be rarely used, and only after being sure that * this is what is needed */ # define SET_NUMERIC_STANDARD() \ - STMT_START { \ - DEBUG_Lv(PerlIO_printf(Perl_debug_log, \ - "%s: %d: lc_numeric standard=%d\n", \ + STMT_START { \ + DEBUG_Lv(PerlIO_printf(Perl_debug_log, \ + "%s: %d: lc_numeric standard=%d\n", \ + __FILE__, __LINE__, PL_numeric_standard)); \ + if (UNLIKELY(NOT_IN_NUMERIC_STANDARD_)) { \ + Perl_set_numeric_standard(aTHX); \ + } \ + DEBUG_Lv(PerlIO_printf(Perl_debug_log, \ + "%s: %d: lc_numeric standard=%d\n", \ __FILE__, __LINE__, PL_numeric_standard)); \ - if (UNLIKELY(NOT_IN_NUMERIC_STANDARD_)) { \ - Perl_set_numeric_standard(aTHX); \ - } \ - DEBUG_Lv(PerlIO_printf(Perl_debug_log, \ - "%s: %d: lc_numeric standard=%d\n", \ - __FILE__, __LINE__, PL_numeric_standard)); \ - } STMT_END + } STMT_END -# define SET_NUMERIC_UNDERLYING() \ - STMT_START { \ - /*assert(PL_locale_mutex_depth > 0);*/ \ - if (NOT_IN_NUMERIC_UNDERLYING_) { \ - Perl_set_numeric_underlying(aTHX); \ - } \ - } STMT_END +# define SET_NUMERIC_UNDERLYING() \ + STMT_START { \ + /*assert(PL_locale_mutex_depth > 0);*/ \ + if (NOT_IN_NUMERIC_UNDERLYING_) { \ + Perl_set_numeric_underlying(aTHX); \ + } \ + } STMT_END /* The rest of these LC_NUMERIC macros toggle to one or the other state, with * the RESTORE_foo ones called to switch back, but only if need be */ # define STORE_LC_NUMERIC_SET_STANDARD() \ - STMT_START { \ - LC_NUMERIC_LOCK(NOT_IN_NUMERIC_STANDARD_); \ - if (NOT_IN_NUMERIC_STANDARD_) { \ - _restore_LC_NUMERIC_function = &Perl_set_numeric_underlying;\ - Perl_set_numeric_standard(aTHX); \ - } \ - } STMT_END + STMT_START { \ + LC_NUMERIC_LOCK(NOT_IN_NUMERIC_STANDARD_); \ + if (NOT_IN_NUMERIC_STANDARD_) { \ + _restore_LC_NUMERIC_function = &Perl_set_numeric_underlying; \ + Perl_set_numeric_standard(aTHX); \ + } \ + } STMT_END /* Rarely, we want to change to the underlying locale even outside of 'use * locale'. This is principally in the POSIX:: functions */ # define STORE_LC_NUMERIC_FORCE_TO_UNDERLYING() \ - STMT_START { \ - LC_NUMERIC_LOCK(NOT_IN_NUMERIC_UNDERLYING_); \ - if (NOT_IN_NUMERIC_UNDERLYING_) { \ - Perl_set_numeric_underlying(aTHX); \ - _restore_LC_NUMERIC_function = &Perl_set_numeric_standard; \ - } \ - } STMT_END + STMT_START { \ + LC_NUMERIC_LOCK(NOT_IN_NUMERIC_UNDERLYING_); \ + if (NOT_IN_NUMERIC_UNDERLYING_) { \ + Perl_set_numeric_underlying(aTHX); \ + _restore_LC_NUMERIC_function = &Perl_set_numeric_standard; \ + } \ + } STMT_END /* Lock/unlock to the C locale until unlock is called. This needs to be * recursively callable. [perl #128207] */ # define LOCK_LC_NUMERIC_STANDARD() \ - STMT_START { \ - DEBUG_Lv(PerlIO_printf(Perl_debug_log, \ - "%s: %d: lc_numeric_standard now locked to depth %d\n", \ - __FILE__, __LINE__, PL_numeric_standard)); \ - __ASSERT_(PL_numeric_standard) \ - PL_numeric_standard++; \ - } STMT_END + STMT_START { \ + DEBUG_Lv(PerlIO_printf(Perl_debug_log, \ + "%s: %d: lc_numeric_standard now locked to depth %d\n", \ + __FILE__, __LINE__, PL_numeric_standard)); \ + __ASSERT_(PL_numeric_standard) \ + PL_numeric_standard++; \ + } STMT_END # define UNLOCK_LC_NUMERIC_STANDARD() \ - STMT_START { \ - if (PL_numeric_standard > 1) { \ - PL_numeric_standard--; \ - } \ - else { \ - assert(0); \ - } \ - DEBUG_Lv(PerlIO_printf(Perl_debug_log, \ - "%s: %d: ", __FILE__, __LINE__); \ - if (PL_numeric_standard <= 1) \ - PerlIO_printf(Perl_debug_log, \ - "lc_numeric_standard now unlocked\n");\ - else PerlIO_printf(Perl_debug_log, \ - "lc_numeric_standard lock decremented to depth %d\n", \ - PL_numeric_standard););\ - } STMT_END - -# define WITH_LC_NUMERIC_SET_TO_NEEDED_IN(in_lc_numeric, block) \ - STMT_START { \ - DECLARATION_FOR_LC_NUMERIC_MANIPULATION; \ - STORE_LC_NUMERIC_SET_TO_NEEDED_IN(in_lc_numeric); \ - block; \ - RESTORE_LC_NUMERIC(); \ - } STMT_END; - -# define WITH_LC_NUMERIC_SET_TO_NEEDED(block) \ - WITH_LC_NUMERIC_SET_TO_NEEDED_IN(IN_LC(LC_NUMERIC), block) + STMT_START { \ + if (PL_numeric_standard > 1) { \ + PL_numeric_standard--; \ + } \ + else { \ + assert(0); \ + } \ + DEBUG_Lv(PerlIO_printf(Perl_debug_log, \ + "%s: %d: ", __FILE__, __LINE__); \ + if (PL_numeric_standard <= 1) \ + PerlIO_printf(Perl_debug_log, \ + "lc_numeric_standard now unlocked\n"); \ + else PerlIO_printf(Perl_debug_log, \ + "lc_numeric_standard lock decremented to depth %d\n", \ + PL_numeric_standard);); \ + } STMT_END + +# define WITH_LC_NUMERIC_SET_TO_NEEDED_IN(in_lc_numeric, block) \ + STMT_START { \ + DECLARATION_FOR_LC_NUMERIC_MANIPULATION; \ + STORE_LC_NUMERIC_SET_TO_NEEDED_IN(in_lc_numeric); \ + block; \ + RESTORE_LC_NUMERIC(); \ + } STMT_END; + +# define WITH_LC_NUMERIC_SET_TO_NEEDED(block) \ + WITH_LC_NUMERIC_SET_TO_NEEDED_IN(IN_LC(LC_NUMERIC), block) #else /* !USE_LOCALE_NUMERIC */ @@ -7555,10 +7555,10 @@ cannot have changed since the precalculation. # define RESTORE_LC_NUMERIC() # define LOCK_LC_NUMERIC_STANDARD() # define UNLOCK_LC_NUMERIC_STANDARD() -# define WITH_LC_NUMERIC_SET_TO_NEEDED_IN(in_lc_numeric, block) \ - STMT_START { block; } STMT_END -# define WITH_LC_NUMERIC_SET_TO_NEEDED(block) \ - STMT_START { block; } STMT_END +# define WITH_LC_NUMERIC_SET_TO_NEEDED_IN(in_lc_numeric, block) \ + STMT_START { block; } STMT_END +# define WITH_LC_NUMERIC_SET_TO_NEEDED(block) \ + STMT_START { block; } STMT_END #endif /* !USE_LOCALE_NUMERIC */ @@ -7600,10 +7600,10 @@ cannot have changed since the precalculation. * is always done in the same order. These should always be invoked, like all * locks really, at such a low level that its just a libc call that is wrapped, * so as to prevent recursive calls which could deadlock. */ -#define ENVr_LOCALEr_LOCK \ - STMT_START { LOCALE_READ_LOCK; ENV_READ_LOCK; } STMT_END -#define ENVr_LOCALEr_UNLOCK \ - STMT_START { ENV_READ_UNLOCK; LOCALE_READ_UNLOCK; } STMT_END +#define ENVr_LOCALEr_LOCK \ + STMT_START { LOCALE_READ_LOCK; ENV_READ_LOCK; } STMT_END +#define ENVr_LOCALEr_UNLOCK \ + STMT_START { ENV_READ_UNLOCK; LOCALE_READ_UNLOCK; } STMT_END /* These time-related functions all requre that the environment and locale * don't change while they are executing (at least in glibc; this appears to be @@ -7802,15 +7802,15 @@ C. #define Strtod my_strtod -#if defined(HAS_STRTOD) \ - || defined(USE_QUADMATH) \ - || (defined(HAS_STRTOLD) && defined(HAS_LONG_DOUBLE) \ - && defined(USE_LONG_DOUBLE)) +#if defined(HAS_STRTOD) \ + || defined(USE_QUADMATH) \ + || (defined(HAS_STRTOLD) && defined(HAS_LONG_DOUBLE) \ + && defined(USE_LONG_DOUBLE)) # define Perl_strtod Strtod #endif -#if !defined(Strtol) && defined(USE_64_BIT_INT) && defined(IV_IS_QUAD) && \ - (QUADKIND == QUAD_IS_LONG_LONG || QUADKIND == QUAD_IS___INT64) +#if !defined(Strtol) && defined(USE_64_BIT_INT) && defined(IV_IS_QUAD) && \ + (QUADKIND == QUAD_IS_LONG_LONG || QUADKIND == QUAD_IS___INT64) # ifdef __hpux # define strtoll __strtoll /* secret handshake */ # endif @@ -7832,8 +7832,8 @@ C. /* It would be more fashionable to use Strtol() to define atol() * (as is done for Atoul(), see below) but for backward compatibility * we just assume atol(). */ -# if defined(USE_64_BIT_INT) && defined(IV_IS_QUAD) && defined(HAS_ATOLL) && \ - (QUADKIND == QUAD_IS_LONG_LONG || QUADKIND == QUAD_IS___INT64) +# if defined(USE_64_BIT_INT) && defined(IV_IS_QUAD) && defined(HAS_ATOLL) && \ + (QUADKIND == QUAD_IS_LONG_LONG || QUADKIND == QUAD_IS___INT64) # ifdef WIN64 # define atoll _atoi64 /* secret handshake */ # endif @@ -7843,8 +7843,8 @@ C. # endif #endif -#if !defined(Strtoul) && defined(USE_64_BIT_INT) && defined(UV_IS_QUAD) && \ - (QUADKIND == QUAD_IS_LONG_LONG || QUADKIND == QUAD_IS___INT64) +#if !defined(Strtoul) && defined(USE_64_BIT_INT) && defined(UV_IS_QUAD) && \ + (QUADKIND == QUAD_IS_LONG_LONG || QUADKIND == QUAD_IS___INT64) # ifdef __hpux # define strtoull __strtoull /* secret handshake */ # endif @@ -7869,13 +7869,13 @@ C. # define Atoul(s) Strtoul(s, NULL, 10) #endif -#define grok_bin(s,lp,fp,rp) \ - grok_bin_oct_hex(s, lp, fp, rp, 1, CC_BINDIGIT_, 'b') -#define grok_oct(s,lp,fp,rp) \ - (*(fp) |= PERL_SCAN_DISALLOW_PREFIX, \ - grok_bin_oct_hex(s, lp, fp, rp, 3, CC_OCTDIGIT_, '\0')) -#define grok_hex(s,lp,fp,rp) \ - grok_bin_oct_hex(s, lp, fp, rp, 4, CC_XDIGIT_, 'x') +#define grok_bin(s,lp,fp,rp) \ + grok_bin_oct_hex(s, lp, fp, rp, 1, CC_BINDIGIT_, 'b') +#define grok_oct(s,lp,fp,rp) \ + (*(fp) |= PERL_SCAN_DISALLOW_PREFIX, \ + grok_bin_oct_hex(s, lp, fp, rp, 3, CC_OCTDIGIT_, '\0')) +#define grok_hex(s,lp,fp,rp) \ + grok_bin_oct_hex(s, lp, fp, rp, 4, CC_XDIGIT_, 'x') #ifndef PERL_SCRIPT_MODE #define PERL_SCRIPT_MODE "r" @@ -7977,28 +7977,28 @@ C. /* Creates and zeroes the per-interpreter data. * (We allocate my_cxtp in a Perl SV so that it will be released when * the interpreter goes away.) */ -# define MY_CXT_INIT \ - my_cxt_t *my_cxtp = \ - (my_cxt_t*)Perl_my_cxt_init(aTHX_ MY_CXT_INIT_ARG, sizeof(my_cxt_t)); \ - PERL_UNUSED_VAR(my_cxtp) -# define MY_CXT_INIT_INTERP(my_perl) \ - my_cxt_t *my_cxtp = \ - (my_cxt_t*)Perl_my_cxt_init(my_perl, MY_CXT_INIT_ARG, sizeof(my_cxt_t)); \ - PERL_UNUSED_VAR(my_cxtp) +# define MY_CXT_INIT \ + my_cxt_t *my_cxtp = \ + (my_cxt_t*)Perl_my_cxt_init(aTHX_ MY_CXT_INIT_ARG, sizeof(my_cxt_t)); \ + PERL_UNUSED_VAR(my_cxtp) +# define MY_CXT_INIT_INTERP(my_perl) \ + my_cxt_t *my_cxtp = \ + (my_cxt_t*)Perl_my_cxt_init(my_perl, MY_CXT_INIT_ARG, sizeof(my_cxt_t)); \ + PERL_UNUSED_VAR(my_cxtp) /* This declaration should be used within all functions that use the * interpreter-local data. */ -# define dMY_CXT \ - my_cxt_t *my_cxtp = (my_cxt_t *)PL_my_cxt_list[MY_CXT_INDEX] -# define dMY_CXT_INTERP(my_perl) \ - my_cxt_t *my_cxtp = (my_cxt_t *)(my_perl)->Imy_cxt_list[MY_CXT_INDEX] +# define dMY_CXT \ + my_cxt_t *my_cxtp = (my_cxt_t *)PL_my_cxt_list[MY_CXT_INDEX] +# define dMY_CXT_INTERP(my_perl) \ + my_cxt_t *my_cxtp = (my_cxt_t *)(my_perl)->Imy_cxt_list[MY_CXT_INDEX] /* Clones the per-interpreter data. */ -# define MY_CXT_CLONE \ - my_cxt_t *my_cxtp = (my_cxt_t*)SvPVX(newSV(sizeof(my_cxt_t)-1));\ - void * old_my_cxtp = PL_my_cxt_list[MY_CXT_INDEX]; \ - PL_my_cxt_list[MY_CXT_INDEX] = my_cxtp; \ - Copy(old_my_cxtp, my_cxtp, 1, my_cxt_t); +# define MY_CXT_CLONE \ + my_cxt_t *my_cxtp = (my_cxt_t*)SvPVX(newSV(sizeof(my_cxt_t)-1)); \ + void * old_my_cxtp = PL_my_cxt_list[MY_CXT_INDEX]; \ + PL_my_cxt_list[MY_CXT_INDEX] = my_cxtp; \ + Copy(old_my_cxtp, my_cxtp, 1, my_cxt_t); @@ -8187,18 +8187,18 @@ extern void moncontrol(int); #define PERL_UNICODE_UTF8CACHEASSERT_FLAG 0x0100 #define PERL_UNICODE_STD_FLAG \ - (PERL_UNICODE_STDIN_FLAG | \ - PERL_UNICODE_STDOUT_FLAG | \ - PERL_UNICODE_STDERR_FLAG) + (PERL_UNICODE_STDIN_FLAG | \ + PERL_UNICODE_STDOUT_FLAG | \ + PERL_UNICODE_STDERR_FLAG) -#define PERL_UNICODE_INOUT_FLAG \ - (PERL_UNICODE_IN_FLAG | \ - PERL_UNICODE_OUT_FLAG) +#define PERL_UNICODE_INOUT_FLAG \ + (PERL_UNICODE_IN_FLAG | \ + PERL_UNICODE_OUT_FLAG) #define PERL_UNICODE_DEFAULT_FLAGS \ - (PERL_UNICODE_STD_FLAG | \ - PERL_UNICODE_INOUT_FLAG | \ - PERL_UNICODE_LOCALE_FLAG) + (PERL_UNICODE_STD_FLAG | \ + PERL_UNICODE_INOUT_FLAG | \ + PERL_UNICODE_LOCALE_FLAG) #define PERL_UNICODE_ALL_FLAGS 0x01ff @@ -8248,7 +8248,7 @@ so no C. #endif #define do_open(g, n, l, a, rm, rp, sf) \ - do_openn(g, n, l, a, rm, rp, sf, (SV **) NULL, 0) + do_openn(g, n, l, a, rm, rp, sf, (SV **) NULL, 0) #ifdef PERL_DEFAULT_DO_EXEC3_IMPLEMENTATION # define do_exec(cmd) do_exec3(cmd,0,0) #endif @@ -8313,8 +8313,8 @@ Allows one ending \0 #define PERL_PV_ESCAPE_NON_WC 0x040000 #define PERL_PV_ESCAPE_TRUNC_MIDDLE 0x080000 -#define PERL_PV_PRETTY_QUOTEDPREFIX \ - (\ +#define PERL_PV_PRETTY_QUOTEDPREFIX \ + ( \ PERL_PV_PRETTY_ELLIPSES | \ PERL_PV_PRETTY_QUOTE | \ PERL_PV_ESCAPE_NONASCII | \ @@ -8327,27 +8327,27 @@ Allows one ending \0 #define PERL_PV_PRETTY_DUMP PERL_PV_PRETTY_ELLIPSES|PERL_PV_PRETTY_QUOTE #define PERL_PV_PRETTY_REGPROP PERL_PV_PRETTY_ELLIPSES|PERL_PV_PRETTY_LTGT|PERL_PV_ESCAPE_RE|PERL_PV_ESCAPE_NONASCII -#if DOUBLEKIND == DOUBLE_IS_VAX_F_FLOAT || \ - DOUBLEKIND == DOUBLE_IS_VAX_D_FLOAT || \ +#if DOUBLEKIND == DOUBLE_IS_VAX_F_FLOAT || \ + DOUBLEKIND == DOUBLE_IS_VAX_D_FLOAT || \ DOUBLEKIND == DOUBLE_IS_VAX_G_FLOAT # define DOUBLE_IS_VAX_FLOAT #else # define DOUBLE_IS_IEEE_FORMAT #endif -#if DOUBLEKIND == DOUBLE_IS_IEEE_754_32_BIT_LITTLE_ENDIAN || \ - DOUBLEKIND == DOUBLE_IS_IEEE_754_64_BIT_LITTLE_ENDIAN || \ +#if DOUBLEKIND == DOUBLE_IS_IEEE_754_32_BIT_LITTLE_ENDIAN || \ + DOUBLEKIND == DOUBLE_IS_IEEE_754_64_BIT_LITTLE_ENDIAN || \ DOUBLEKIND == DOUBLE_IS_IEEE_754_128_BIT_LITTLE_ENDIAN # define DOUBLE_LITTLE_ENDIAN #endif -#if DOUBLEKIND == DOUBLE_IS_IEEE_754_32_BIT_BIG_ENDIAN || \ - DOUBLEKIND == DOUBLE_IS_IEEE_754_64_BIT_BIG_ENDIAN || \ +#if DOUBLEKIND == DOUBLE_IS_IEEE_754_32_BIT_BIG_ENDIAN || \ + DOUBLEKIND == DOUBLE_IS_IEEE_754_64_BIT_BIG_ENDIAN || \ DOUBLEKIND == DOUBLE_IS_IEEE_754_128_BIT_BIG_ENDIAN # define DOUBLE_BIG_ENDIAN #endif -#if DOUBLEKIND == DOUBLE_IS_IEEE_754_64_BIT_MIXED_ENDIAN_LE_BE || \ +#if DOUBLEKIND == DOUBLE_IS_IEEE_754_64_BIT_MIXED_ENDIAN_LE_BE || \ DOUBLEKIND == DOUBLE_IS_IEEE_754_64_BIT_MIXED_ENDIAN_BE_LE # define DOUBLE_MIX_ENDIAN #endif @@ -8424,25 +8424,25 @@ Allows one ending \0 #if defined(LONG_DOUBLEKIND) && LONG_DOUBLEKIND != LONG_DOUBLE_IS_DOUBLE -# if LONG_DOUBLEKIND == LONG_DOUBLE_IS_IEEE_754_128_BIT_LITTLE_ENDIAN || \ - LONG_DOUBLEKIND == LONG_DOUBLE_IS_X86_80_BIT_LITTLE_ENDIAN || \ - LONG_DOUBLEKIND == LONG_DOUBLE_IS_DOUBLEDOUBLE_128_BIT_LE_LE +# if LONG_DOUBLEKIND == LONG_DOUBLE_IS_IEEE_754_128_BIT_LITTLE_ENDIAN || \ + LONG_DOUBLEKIND == LONG_DOUBLE_IS_X86_80_BIT_LITTLE_ENDIAN || \ + LONG_DOUBLEKIND == LONG_DOUBLE_IS_DOUBLEDOUBLE_128_BIT_LE_LE # define LONGDOUBLE_LITTLE_ENDIAN # endif -# if LONG_DOUBLEKIND == LONG_DOUBLE_IS_IEEE_754_128_BIT_BIG_ENDIAN || \ - LONG_DOUBLEKIND == LONG_DOUBLE_IS_X86_80_BIT_BIG_ENDIAN || \ - LONG_DOUBLEKIND == LONG_DOUBLE_IS_DOUBLEDOUBLE_128_BIT_BE_BE +# if LONG_DOUBLEKIND == LONG_DOUBLE_IS_IEEE_754_128_BIT_BIG_ENDIAN || \ + LONG_DOUBLEKIND == LONG_DOUBLE_IS_X86_80_BIT_BIG_ENDIAN || \ + LONG_DOUBLEKIND == LONG_DOUBLE_IS_DOUBLEDOUBLE_128_BIT_BE_BE # define LONGDOUBLE_BIG_ENDIAN # endif -# if LONG_DOUBLEKIND == LONG_DOUBLE_IS_DOUBLEDOUBLE_128_BIT_LE_BE || \ - LONG_DOUBLEKIND == LONG_DOUBLE_IS_DOUBLEDOUBLE_128_BIT_BE_LE +# if LONG_DOUBLEKIND == LONG_DOUBLE_IS_DOUBLEDOUBLE_128_BIT_LE_BE || \ + LONG_DOUBLEKIND == LONG_DOUBLE_IS_DOUBLEDOUBLE_128_BIT_BE_LE # define LONGDOUBLE_MIX_ENDIAN # endif # if LONG_DOUBLEKIND == LONG_DOUBLE_IS_X86_80_BIT_LITTLE_ENDIAN || \ - LONG_DOUBLEKIND == LONG_DOUBLE_IS_X86_80_BIT_BIG_ENDIAN + LONG_DOUBLEKIND == LONG_DOUBLE_IS_X86_80_BIT_BIG_ENDIAN # define LONGDOUBLE_X86_80_BIT # ifdef USE_LONG_DOUBLE # undef NV_IMPLICIT_BIT @@ -8450,10 +8450,10 @@ Allows one ending \0 # endif # endif -# if LONG_DOUBLEKIND == LONG_DOUBLE_IS_DOUBLEDOUBLE_128_BIT_LE_LE || \ - LONG_DOUBLEKIND == LONG_DOUBLE_IS_DOUBLEDOUBLE_128_BIT_BE_BE || \ - LONG_DOUBLEKIND == LONG_DOUBLE_IS_DOUBLEDOUBLE_128_BIT_LE_BE || \ - LONG_DOUBLEKIND == LONG_DOUBLE_IS_DOUBLEDOUBLE_128_BIT_BE_LE +# if LONG_DOUBLEKIND == LONG_DOUBLE_IS_DOUBLEDOUBLE_128_BIT_LE_LE || \ + LONG_DOUBLEKIND == LONG_DOUBLE_IS_DOUBLEDOUBLE_128_BIT_BE_BE || \ + LONG_DOUBLEKIND == LONG_DOUBLE_IS_DOUBLEDOUBLE_128_BIT_LE_BE || \ + LONG_DOUBLEKIND == LONG_DOUBLE_IS_DOUBLEDOUBLE_128_BIT_BE_LE # define LONGDOUBLE_DOUBLEDOUBLE # endif @@ -8635,17 +8635,17 @@ GCC_DIAG_RESTORE_DECL; since a mismatch across compilation units causes undefined behavior. It also prevents warnings from LTO builds. */ -# if !defined(USE_QUADMATH) && \ - (NVSIZE == LONG_DOUBLESIZE && defined(LONGDBLINFBYTES) || \ - NVSIZE == DOUBLESIZE && defined(DOUBLEINFBYTES)) +# if !defined(USE_QUADMATH) && \ + (NVSIZE == LONG_DOUBLESIZE && defined(LONGDBLINFBYTES) || \ + NVSIZE == DOUBLESIZE && defined(DOUBLEINFBYTES)) INFNAN_U8_NV_DECL PL_inf; # else INFNAN_NV_U8_DECL PL_inf; # endif -# if !defined(USE_QUADMATH) && \ - (NVSIZE == LONG_DOUBLESIZE && defined(LONGDBLNANBYTES) || \ - NVSIZE == DOUBLESIZE && defined(DOUBLENANBYTES)) +# if !defined(USE_QUADMATH) && \ + (NVSIZE == LONG_DOUBLESIZE && defined(LONGDBLNANBYTES) || \ + NVSIZE == DOUBLESIZE && defined(DOUBLENANBYTES)) INFNAN_U8_NV_DECL PL_nan; # else INFNAN_NV_U8_DECL PL_nan; @@ -8826,15 +8826,15 @@ END_EXTERN_C #define NV_NAN_QS_BYTE(nvp) (((U8*)(nvp))[NV_NAN_QS_BYTE_OFFSET]) /* NV_NAN_QS_BIT is the bit to test in the NV_NAN_QS_BYTE_OFFSET * for the quiet/signaling */ -#if defined(USE_LONG_DOUBLE) && \ - (LONG_DOUBLEKIND == LONG_DOUBLE_IS_X86_80_BIT_LITTLE_ENDIAN || \ - LONG_DOUBLEKIND == LONG_DOUBLE_IS_X86_80_BIT_BIG_ENDIAN) +#if defined(USE_LONG_DOUBLE) && \ + (LONG_DOUBLEKIND == LONG_DOUBLE_IS_X86_80_BIT_LITTLE_ENDIAN || \ + LONG_DOUBLEKIND == LONG_DOUBLE_IS_X86_80_BIT_BIG_ENDIAN) # define NV_NAN_QS_BIT_SHIFT 6 /* 0x40 */ -#elif defined(USE_LONG_DOUBLE) && \ - (LONG_DOUBLEKIND == LONG_DOUBLE_IS_DOUBLEDOUBLE_128_BIT_LE_LE || \ - LONG_DOUBLEKIND == LONG_DOUBLE_IS_DOUBLEDOUBLE_128_BIT_BE_BE || \ - LONG_DOUBLEKIND == LONG_DOUBLE_IS_DOUBLEDOUBLE_128_BIT_LE_BE || \ - LONG_DOUBLEKIND == LONG_DOUBLE_IS_DOUBLEDOUBLE_128_BIT_BE_LE) +#elif defined(USE_LONG_DOUBLE) && \ + (LONG_DOUBLEKIND == LONG_DOUBLE_IS_DOUBLEDOUBLE_128_BIT_LE_LE || \ + LONG_DOUBLEKIND == LONG_DOUBLE_IS_DOUBLEDOUBLE_128_BIT_BE_BE || \ + LONG_DOUBLEKIND == LONG_DOUBLE_IS_DOUBLEDOUBLE_128_BIT_LE_BE || \ + LONG_DOUBLEKIND == LONG_DOUBLE_IS_DOUBLEDOUBLE_128_BIT_BE_LE) # define NV_NAN_QS_BIT_SHIFT 3 /* 0x08, but not via NV_NAN_BITS */ #else # define NV_NAN_QS_BIT_SHIFT ((NV_NAN_BITS) % 8) /* usually 3, or 0x08 */ @@ -8843,7 +8843,7 @@ END_EXTERN_C /* NV_NAN_QS_BIT_OFFSET is the bit offset from the beginning of a NV * (bytes ordered big-endianly) for the quiet/signaling bit * for the quiet/signaling */ -#define NV_NAN_QS_BIT_OFFSET \ +#define NV_NAN_QS_BIT_OFFSET \ (8 * (NV_NAN_QS_BYTE_OFFSET) + (NV_NAN_QS_BIT_SHIFT)) /* NV_NAN_QS_QUIET (always defined) is true if the NV_NAN_QS_QS_BIT being * on indicates quiet NaN. NV_NAN_QS_SIGNALING (also always defined) @@ -8855,17 +8855,17 @@ END_EXTERN_C /* NV_NAN_IS_QUIET() returns true if the NV behind nvp is a NaN, * whether it is a quiet NaN, NV_NAN_IS_SIGNALING() if a signaling NaN. * Note however that these do not check whether the nvp is a NaN. */ -#define NV_NAN_IS_QUIET(nvp) \ +#define NV_NAN_IS_QUIET(nvp) \ (NV_NAN_QS_TEST(nvp) == (NV_NAN_QS_QUIET ? NV_NAN_QS_BIT : 0)) -#define NV_NAN_IS_SIGNALING(nvp) \ +#define NV_NAN_IS_SIGNALING(nvp) \ (NV_NAN_QS_TEST(nvp) == (NV_NAN_QS_QUIET ? 0 : NV_NAN_QS_BIT)) -#define NV_NAN_SET_QUIET(nvp) \ - (NV_NAN_QS_QUIET ? \ - (NV_NAN_QS_BYTE(nvp) |= NV_NAN_QS_BIT) : \ +#define NV_NAN_SET_QUIET(nvp) \ + (NV_NAN_QS_QUIET ? \ + (NV_NAN_QS_BYTE(nvp) |= NV_NAN_QS_BIT) : \ (NV_NAN_QS_BYTE(nvp) &= ~NV_NAN_QS_BIT)) -#define NV_NAN_SET_SIGNALING(nvp) \ - (NV_NAN_QS_QUIET ? \ - (NV_NAN_QS_BYTE(nvp) &= ~NV_NAN_QS_BIT) : \ +#define NV_NAN_SET_SIGNALING(nvp) \ + (NV_NAN_QS_QUIET ? \ + (NV_NAN_QS_BYTE(nvp) &= ~NV_NAN_QS_BIT) : \ (NV_NAN_QS_BYTE(nvp) |= NV_NAN_QS_BIT)) #define NV_NAN_QS_XOR(nvp) (NV_NAN_QS_BYTE(nvp) ^= NV_NAN_QS_BIT) @@ -8875,34 +8875,34 @@ END_EXTERN_C * 0xFF means "don't go here".*/ /* Shorthands to avoid typoses. */ -#define NV_NAN_PAYLOAD_MASK_SKIP_EIGHT \ - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 -#define NV_NAN_PAYLOAD_PERM_SKIP_EIGHT \ - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff -#define NV_NAN_PAYLOAD_PERM_0_TO_7 \ - 0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7 -#define NV_NAN_PAYLOAD_PERM_7_TO_0 \ - 0x7, 0x6, 0x5, 0x4, 0x3, 0x2, 0x1, 0x0 -#define NV_NAN_PAYLOAD_MASK_IEEE_754_128_LE \ - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, \ - 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x00, 0x00 +#define NV_NAN_PAYLOAD_MASK_SKIP_EIGHT \ + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 +#define NV_NAN_PAYLOAD_PERM_SKIP_EIGHT \ + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff +#define NV_NAN_PAYLOAD_PERM_0_TO_7 \ + 0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7 +#define NV_NAN_PAYLOAD_PERM_7_TO_0 \ + 0x7, 0x6, 0x5, 0x4, 0x3, 0x2, 0x1, 0x0 +#define NV_NAN_PAYLOAD_MASK_IEEE_754_128_LE \ + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, \ + 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x00, 0x00 #define NV_NAN_PAYLOAD_PERM_IEEE_754_128_LE \ - NV_NAN_PAYLOAD_PERM_0_TO_7, \ - 0x8, 0x9, 0xa, 0xb, 0xc, 0xd, 0xFF, 0xFF -#define NV_NAN_PAYLOAD_MASK_IEEE_754_128_BE \ - 0x00, 0x00, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, \ - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff -#define NV_NAN_PAYLOAD_PERM_IEEE_754_128_BE \ - 0xFF, 0xFF, 0xd, 0xc, 0xb, 0xa, 0x9, 0x8, \ - NV_NAN_PAYLOAD_PERM_7_TO_0 -#define NV_NAN_PAYLOAD_MASK_IEEE_754_64_LE \ - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x07, 0x00 -#define NV_NAN_PAYLOAD_PERM_IEEE_754_64_LE \ - 0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0xFF -#define NV_NAN_PAYLOAD_MASK_IEEE_754_64_BE \ - 0x00, 0x07, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff -#define NV_NAN_PAYLOAD_PERM_IEEE_754_64_BE \ - 0xFF, 0x6, 0x5, 0x4, 0x3, 0x2, 0x1, 0x0 + NV_NAN_PAYLOAD_PERM_0_TO_7, \ + 0x8, 0x9, 0xa, 0xb, 0xc, 0xd, 0xFF, 0xFF +#define NV_NAN_PAYLOAD_MASK_IEEE_754_128_BE \ + 0x00, 0x00, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, \ + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff +#define NV_NAN_PAYLOAD_PERM_IEEE_754_128_BE \ + 0xFF, 0xFF, 0xd, 0xc, 0xb, 0xa, 0x9, 0x8, \ + NV_NAN_PAYLOAD_PERM_7_TO_0 +#define NV_NAN_PAYLOAD_MASK_IEEE_754_64_LE \ + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x07, 0x00 +#define NV_NAN_PAYLOAD_PERM_IEEE_754_64_LE \ + 0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0xFF +#define NV_NAN_PAYLOAD_MASK_IEEE_754_64_BE \ + 0x00, 0x07, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff +#define NV_NAN_PAYLOAD_PERM_IEEE_754_64_BE \ + 0xFF, 0x6, 0x5, 0x4, 0x3, 0x2, 0x1, 0x0 #if defined(USE_LONG_DOUBLE) && NVSIZE > DOUBLESIZE # if LONG_DOUBLEKIND == LONG_DOUBLE_IS_IEEE_754_128_BIT_LITTLE_ENDIAN @@ -8913,47 +8913,47 @@ END_EXTERN_C # define NV_NAN_PAYLOAD_PERM NV_NAN_PAYLOAD_PERM_IEEE_754_128_BE # elif LONG_DOUBLEKIND == LONG_DOUBLE_IS_X86_80_BIT_LITTLE_ENDIAN # if LONG_DOUBLESIZE == 10 -# define NV_NAN_PAYLOAD_MASK \ - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1f, \ - 0x00, 0x00 -# define NV_NAN_PAYLOAD_PERM \ - NV_NAN_PAYLOAD_PERM_0_TO_7, 0xFF, 0xFF +# define NV_NAN_PAYLOAD_MASK \ + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1f, \ + 0x00, 0x00 +# define NV_NAN_PAYLOAD_PERM \ + NV_NAN_PAYLOAD_PERM_0_TO_7, 0xFF, 0xFF # elif LONG_DOUBLESIZE == 12 -# define NV_NAN_PAYLOAD_MASK \ - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1f, \ - 0x00, 0x00, 0x00, 0x00 -# define NV_NAN_PAYLOAD_PERM \ - NV_NAN_PAYLOAD_PERM_0_TO_7, 0xFF, 0xFF, 0xFF, 0xFF +# define NV_NAN_PAYLOAD_MASK \ + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1f, \ + 0x00, 0x00, 0x00, 0x00 +# define NV_NAN_PAYLOAD_PERM \ + NV_NAN_PAYLOAD_PERM_0_TO_7, 0xFF, 0xFF, 0xFF, 0xFF # elif LONG_DOUBLESIZE == 16 -# define NV_NAN_PAYLOAD_MASK \ - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1f, \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -# define NV_NAN_PAYLOAD_PERM \ - NV_NAN_PAYLOAD_PERM_0_TO_7, \ - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF +# define NV_NAN_PAYLOAD_MASK \ + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1f, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +# define NV_NAN_PAYLOAD_PERM \ + NV_NAN_PAYLOAD_PERM_0_TO_7, \ + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF # else # error "Unexpected x86 80-bit little-endian long double format" # endif # elif LONG_DOUBLEKIND == LONG_DOUBLE_IS_X86_80_BIT_BIG_ENDIAN # if LONG_DOUBLESIZE == 10 -# define NV_NAN_PAYLOAD_MASK \ - 0x00, 0x00, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xff, \ - 0xff, 0xff -# define NV_NAN_PAYLOAD_PERM \ - NV_NAN_PAYLOAD_PERM_7_TO_0, 0xFF, 0xFF +# define NV_NAN_PAYLOAD_MASK \ + 0x00, 0x00, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xff, \ + 0xff, 0xff +# define NV_NAN_PAYLOAD_PERM \ + NV_NAN_PAYLOAD_PERM_7_TO_0, 0xFF, 0xFF # elif LONG_DOUBLESIZE == 12 -# define NV_NAN_PAYLOAD_MASK \ - 0x00, 0x00, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xff, \ - 0xff, 0xff, 0x00, 0x00 -# define NV_NAN_PAYLOAD_PERM \ - NV_NAN_PAYLOAD_PERM_7_TO_0, 0xFF, 0xFF, 0xFF, 0xFF +# define NV_NAN_PAYLOAD_MASK \ + 0x00, 0x00, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xff, \ + 0xff, 0xff, 0x00, 0x00 +# define NV_NAN_PAYLOAD_PERM \ + NV_NAN_PAYLOAD_PERM_7_TO_0, 0xFF, 0xFF, 0xFF, 0xFF # elif LONG_DOUBLESIZE == 16 -# define NV_NAN_PAYLOAD_MASK \ - 0x00, 0x00, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xff, \ - 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -# define NV_NAN_PAYLOAD_PERM \ - NV_NAN_PAYLOAD_PERM_7_TO_0, \ - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF +# define NV_NAN_PAYLOAD_MASK \ + 0x00, 0x00, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xff, \ + 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +# define NV_NAN_PAYLOAD_PERM \ + NV_NAN_PAYLOAD_PERM_7_TO_0, \ + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF # else # error "Unexpected x86 80-bit big-endian long double format" # endif @@ -8961,24 +8961,24 @@ END_EXTERN_C /* For double-double we assume only the first double (in LE or BE terms) * is used for NaN. */ # define NV_NAN_PAYLOAD_MASK \ - NV_NAN_PAYLOAD_MASK_SKIP_EIGHT, NV_NAN_PAYLOAD_MASK_IEEE_754_64_LE + NV_NAN_PAYLOAD_MASK_SKIP_EIGHT, NV_NAN_PAYLOAD_MASK_IEEE_754_64_LE # define NV_NAN_PAYLOAD_PERM \ - NV_NAN_PAYLOAD_PERM_SKIP_EIGHT, NV_NAN_PAYLOAD_PERM_IEEE_754_64_LE + NV_NAN_PAYLOAD_PERM_SKIP_EIGHT, NV_NAN_PAYLOAD_PERM_IEEE_754_64_LE # elif LONG_DOUBLEKIND == LONG_DOUBLE_IS_DOUBLEDOUBLE_128_BIT_BE_BE # define NV_NAN_PAYLOAD_MASK \ - NV_NAN_PAYLOAD_MASK_IEEE_754_64_BE + NV_NAN_PAYLOAD_MASK_IEEE_754_64_BE # define NV_NAN_PAYLOAD_PERM \ - NV_NAN_PAYLOAD_PERM_IEEE_754_64_BE + NV_NAN_PAYLOAD_PERM_IEEE_754_64_BE # elif LONG_DOUBLEKIND == LONG_DOUBLE_IS_DOUBLEDOUBLE_128_BIT_LE_BE # define NV_NAN_PAYLOAD_MASK \ - NV_NAN_PAYLOAD_MASK_IEEE_754_64_LE + NV_NAN_PAYLOAD_MASK_IEEE_754_64_LE # define NV_NAN_PAYLOAD_PERM \ - NV_NAN_PAYLOAD_PERM_IEEE_754_64_LE + NV_NAN_PAYLOAD_PERM_IEEE_754_64_LE # elif LONG_DOUBLEKIND == LONG_DOUBLE_IS_DOUBLEDOUBLE_128_BIT_BE_LE # define NV_NAN_PAYLOAD_MASK \ - NV_NAN_PAYLOAD_MASK_SKIP_EIGHT, NV_NAN_PAYLOAD_MASK_IEEE_754_64_BE + NV_NAN_PAYLOAD_MASK_SKIP_EIGHT, NV_NAN_PAYLOAD_MASK_IEEE_754_64_BE # define NV_NAN_PAYLOAD_PERM \ - NV_NAN_PAYLOAD_PERM_SKIP_EIGHT, NV_NAN_PAYLOAD_PERM_IEEE_754_64_BE + NV_NAN_PAYLOAD_PERM_SKIP_EIGHT, NV_NAN_PAYLOAD_PERM_IEEE_754_64_BE # else # error "Unexpected long double format" # endif @@ -9030,25 +9030,25 @@ END_EXTERN_C */ #define PERL_SRAND_OVERRIDE_NEXT() PERL_XORSHIFT32_A(PL_srand_override_next); -#define PERL_SRAND_OVERRIDE_NEXT_INIT() \ - STMT_START {\ - PL_srand_override = PL_srand_override_next; \ - PERL_SRAND_OVERRIDE_NEXT(); \ -} STMT_END - -#define PERL_SRAND_OVERRIDE_GET(into) \ - STMT_START {\ - into= PL_srand_override; \ - PERL_SRAND_OVERRIDE_NEXT_INIT(); \ -} STMT_END - -#define PERL_SRAND_OVERRIDE_NEXT_CHILD() \ - STMT_START {\ - PERL_XORSHIFT32_B(PL_srand_override_next); \ - PERL_SRAND_OVERRIDE_NEXT_INIT(); \ -} STMT_END - -#define PERL_SRAND_OVERRIDE_NEXT_PARENT() \ +#define PERL_SRAND_OVERRIDE_NEXT_INIT() \ + STMT_START { \ + PL_srand_override = PL_srand_override_next; \ + PERL_SRAND_OVERRIDE_NEXT(); \ + } STMT_END + +#define PERL_SRAND_OVERRIDE_GET(into) \ + STMT_START { \ + into= PL_srand_override; \ + PERL_SRAND_OVERRIDE_NEXT_INIT(); \ + } STMT_END + +#define PERL_SRAND_OVERRIDE_NEXT_CHILD() \ + STMT_START { \ + PERL_XORSHIFT32_B(PL_srand_override_next); \ + PERL_SRAND_OVERRIDE_NEXT_INIT(); \ + } STMT_END + +#define PERL_SRAND_OVERRIDE_NEXT_PARENT() \ PERL_SRAND_OVERRIDE_NEXT() /* in something like diff --git a/perl_inc_macro.h b/perl_inc_macro.h index 83f17bb0776d..29da9ac68bec 100644 --- a/perl_inc_macro.h +++ b/perl_inc_macro.h @@ -23,31 +23,31 @@ #define DEFINE_INC_MACROS 1 #ifdef APPLLIB_EXP -# define INCPUSH_APPLLIB_EXP \ - S_incpush_use_sep(aTHX_ STR_WITH_LEN(APPLLIB_EXP),\ - INCPUSH_ADD_SUB_DIRS|INCPUSH_CAN_RELOCATE); +# define INCPUSH_APPLLIB_EXP \ + S_incpush_use_sep(aTHX_ STR_WITH_LEN(APPLLIB_EXP), \ + INCPUSH_ADD_SUB_DIRS|INCPUSH_CAN_RELOCATE); #endif #ifdef SITEARCH_EXP /* sitearch is always relative to sitelib on Windows for * DLL-based path intuition to work correctly */ # if !defined(WIN32) -# define INCPUSH_SITEARCH_EXP \ - S_incpush_use_sep(aTHX_ STR_WITH_LEN(SITEARCH_EXP),\ - INCPUSH_CAN_RELOCATE); +# define INCPUSH_SITEARCH_EXP \ + S_incpush_use_sep(aTHX_ STR_WITH_LEN(SITEARCH_EXP), \ + INCPUSH_CAN_RELOCATE); # endif #endif #ifdef SITELIB_EXP # if defined(WIN32) /* this picks up sitearch as well */ -# define INCPUSH_SITELIB_EXP \ - s = PerlEnv_sitelib_path(PERL_FS_VERSION, &len);\ - if (s) incpush_use_sep(s, len, INCPUSH_ADD_SUB_DIRS|INCPUSH_CAN_RELOCATE); +# define INCPUSH_SITELIB_EXP \ + s = PerlEnv_sitelib_path(PERL_FS_VERSION, &len); \ + if (s) incpush_use_sep(s, len, INCPUSH_ADD_SUB_DIRS|INCPUSH_CAN_RELOCATE); # else -# define INCPUSH_SITELIB_EXP \ - S_incpush_use_sep(aTHX_ STR_WITH_LEN(SITELIB_EXP),\ - INCPUSH_CAN_RELOCATE); +# define INCPUSH_SITELIB_EXP \ + S_incpush_use_sep(aTHX_ STR_WITH_LEN(SITELIB_EXP), \ + INCPUSH_CAN_RELOCATE); # endif #endif @@ -62,9 +62,9 @@ #ifdef PERL_VENDORLIB_EXP # if defined(WIN32) /* this picks up vendorarch as well */ -# define INCPUSH_PERL_VENDORLIB_EXP \ - s = PerlEnv_vendorlib_path(PERL_FS_VERSION, &len);\ - if (s) incpush_use_sep(s, len, INCPUSH_ADD_SUB_DIRS|INCPUSH_CAN_RELOCATE); +# define INCPUSH_PERL_VENDORLIB_EXP \ + s = PerlEnv_vendorlib_path(PERL_FS_VERSION, &len); \ + if (s) incpush_use_sep(s, len, INCPUSH_ADD_SUB_DIRS|INCPUSH_CAN_RELOCATE); # else # define INCPUSH_PERL_VENDORLIB_EXP S_incpush_use_sep(aTHX_ STR_WITH_LEN(PERL_VENDORLIB_EXP), INCPUSH_CAN_RELOCATE); # endif @@ -80,17 +80,17 @@ #endif #if defined(WIN32) -# define INCPUSH_PRIVLIB_EXP \ - s = PerlEnv_lib_path(PERL_FS_VERSION, &len);\ - if (s) incpush_use_sep(s, len, INCPUSH_ADD_SUB_DIRS|INCPUSH_CAN_RELOCATE); +# define INCPUSH_PRIVLIB_EXP \ + s = PerlEnv_lib_path(PERL_FS_VERSION, &len); \ + if (s) incpush_use_sep(s, len, INCPUSH_ADD_SUB_DIRS|INCPUSH_CAN_RELOCATE); #else # define INCPUSH_PRIVLIB_EXP S_incpush_use_sep(aTHX_ STR_WITH_LEN(PRIVLIB_EXP), INCPUSH_CAN_RELOCATE); #endif #ifdef PERL_OTHERLIBDIRS -# define INCPUSH_PERL_OTHERLIBDIRS \ - S_incpush_use_sep(aTHX_ STR_WITH_LEN(PERL_OTHERLIBDIRS),\ - INCPUSH_ADD_VERSIONED_SUB_DIRS|INCPUSH_NOT_BASEDIR|INCPUSH_CAN_RELOCATE); +# define INCPUSH_PERL_OTHERLIBDIRS \ + S_incpush_use_sep(aTHX_ STR_WITH_LEN(PERL_OTHERLIBDIRS), \ + INCPUSH_ADD_VERSIONED_SUB_DIRS|INCPUSH_NOT_BASEDIR|INCPUSH_CAN_RELOCATE); #endif @@ -106,14 +106,14 @@ * "natural" VMS idiom for a Unix path string. We allow each * element to be a set of |-separated directories for compatibility. */ -# define _INCPUSH_PERL5LIB_ADD \ - char buf[256];\ - int idx = 0; \ - if (vmstrnenv("PERL5LIB",buf,0,NULL,0)) \ - do { \ - incpush_use_sep(buf, 0, \ - INCPUSH_ADD_OLD_VERS|INCPUSH_NOT_BASEDIR); \ - } while (vmstrnenv("PERL5LIB",buf,++idx,NULL,0)); +# define _INCPUSH_PERL5LIB_ADD \ + char buf[256]; \ + int idx = 0; \ + if (vmstrnenv("PERL5LIB",buf,0,NULL,0)) \ + do { \ + incpush_use_sep(buf, 0, \ + INCPUSH_ADD_OLD_VERS|INCPUSH_NOT_BASEDIR); \ + } while (vmstrnenv("PERL5LIB",buf,++idx,NULL,0)); #endif /* this macro is special and use submacros from above */ @@ -123,30 +123,30 @@ SITELIB and VENDORLIB for older versions */ #ifdef APPLLIB_EXP -# define INCPUSH_APPLLIB_OLD_EXP \ - S_incpush_use_sep(aTHX_ STR_WITH_LEN(APPLLIB_EXP),\ - INCPUSH_ADD_OLD_VERS|INCPUSH_NOT_BASEDIR|INCPUSH_CAN_RELOCATE); +# define INCPUSH_APPLLIB_OLD_EXP \ + S_incpush_use_sep(aTHX_ STR_WITH_LEN(APPLLIB_EXP), \ + INCPUSH_ADD_OLD_VERS|INCPUSH_NOT_BASEDIR|INCPUSH_CAN_RELOCATE); #endif #if defined(SITELIB_STEM) && defined(PERL_INC_VERSION_LIST) /* Search for version-specific dirs below here */ -# define INCPUSH_SITELIB_STEM \ - S_incpush_use_sep(aTHX_ STR_WITH_LEN(SITELIB_STEM),\ - INCPUSH_ADD_OLD_VERS|INCPUSH_CAN_RELOCATE); +# define INCPUSH_SITELIB_STEM \ + S_incpush_use_sep(aTHX_ STR_WITH_LEN(SITELIB_STEM), \ + INCPUSH_ADD_OLD_VERS|INCPUSH_CAN_RELOCATE); #endif #if defined(PERL_VENDORLIB_STEM) && defined(PERL_INC_VERSION_LIST) /* Search for version-specific dirs below here */ -# define INCPUSH_PERL_VENDORLIB_STEM \ - S_incpush_use_sep(aTHX_ STR_WITH_LEN(PERL_VENDORLIB_STEM),\ - INCPUSH_ADD_OLD_VERS|INCPUSH_CAN_RELOCATE); +# define INCPUSH_PERL_VENDORLIB_STEM \ + S_incpush_use_sep(aTHX_ STR_WITH_LEN(PERL_VENDORLIB_STEM), \ + INCPUSH_ADD_OLD_VERS|INCPUSH_CAN_RELOCATE); #endif #ifdef PERL_OTHERLIBDIRS -# define INCPUSH_PERL_OTHERLIBDIRS_ARCHONLY \ - S_incpush_use_sep(aTHX_ STR_WITH_LEN(PERL_OTHERLIBDIRS),\ - INCPUSH_ADD_OLD_VERS|INCPUSH_ADD_ARCHONLY_SUB_DIRS|INCPUSH_CAN_RELOCATE); +# define INCPUSH_PERL_OTHERLIBDIRS_ARCHONLY \ + S_incpush_use_sep(aTHX_ STR_WITH_LEN(PERL_OTHERLIBDIRS), \ + INCPUSH_ADD_OLD_VERS|INCPUSH_ADD_ARCHONLY_SUB_DIRS|INCPUSH_CAN_RELOCATE); #endif diff --git a/perl_siphash.h b/perl_siphash.h index b9b6c9e6a10a..3ab42c5487bd 100644 --- a/perl_siphash.h +++ b/perl_siphash.h @@ -14,24 +14,24 @@ #ifdef CAN64BITHASH -#define SIPROUND \ - STMT_START { \ - v0 += v1; v1=ROTL64(v1,13); v1 ^= v0; v0=ROTL64(v0,32); \ - v2 += v3; v3=ROTL64(v3,16); v3 ^= v2; \ - v0 += v3; v3=ROTL64(v3,21); v3 ^= v0; \ - v2 += v1; v1=ROTL64(v1,17); v1 ^= v2; v2=ROTL64(v2,32); \ - } STMT_END +#define SIPROUND \ + STMT_START { \ + v0 += v1; v1=ROTL64(v1,13); v1 ^= v0; v0=ROTL64(v0,32); \ + v2 += v3; v3=ROTL64(v3,16); v3 ^= v2; \ + v0 += v3; v3=ROTL64(v3,21); v3 ^= v0; \ + v2 += v1; v1=ROTL64(v1,17); v1 ^= v2; v2=ROTL64(v2,32); \ + } STMT_END -#define SIPHASH_SEED_STATE(key,v0,v1,v2,v3) \ -do { \ - v0 = v2 = U8TO64_LE(key + 0); \ - v1 = v3 = U8TO64_LE(key + 8); \ - /* "somepseudorandomlygeneratedbytes" */ \ - v0 ^= UINT64_C(0x736f6d6570736575); \ - v1 ^= UINT64_C(0x646f72616e646f6d); \ - v2 ^= UINT64_C(0x6c7967656e657261); \ - v3 ^= UINT64_C(0x7465646279746573); \ -} while (0) +#define SIPHASH_SEED_STATE(key,v0,v1,v2,v3) \ + do { \ + v0 = v2 = U8TO64_LE(key + 0); \ + v1 = v3 = U8TO64_LE(key + 8); \ + /* "somepseudorandomlygeneratedbytes" */ \ + v0 ^= UINT64_C(0x736f6d6570736575); \ + v1 ^= UINT64_C(0x646f72616e646f6d); \ + v2 ^= UINT64_C(0x6c7967656e657261); \ + v3 ^= UINT64_C(0x7465646279746573); \ + } while (0) PERL_STATIC_INLINE void S_perl_siphash_seed_state(const unsigned char * const seed_buf, unsigned char * state_buf) { @@ -39,77 +39,77 @@ void S_perl_siphash_seed_state(const unsigned char * const seed_buf, unsigned ch SIPHASH_SEED_STATE(seed_buf, v[0],v[1],v[2],v[3]); } -#define PERL_SIPHASH_FNC(FNC,SIP_ROUNDS,SIP_FINAL_ROUNDS) \ -PERL_STATIC_INLINE U64 \ -FNC ## _with_state_64 \ - (const unsigned char * const state, const unsigned char *in, const STRLEN inlen) \ -{ \ - const int left = inlen & 7; \ - const U8 *end = in + inlen - left; \ - \ - U64 b = ( ( U64 )(inlen) ) << 56; \ - U64 m; \ - U64 v0 = U8TO64_LE(state); \ - U64 v1 = U8TO64_LE(state+8); \ - U64 v2 = U8TO64_LE(state+16); \ - U64 v3 = U8TO64_LE(state+24); \ - \ - for (; in != end; in += 8 ) \ - { \ - m = U8TO64_LE( in ); \ - v3 ^= m; \ - \ - SIP_ROUNDS; \ - \ - v0 ^= m; \ - } \ - \ - switch( left ) \ - { \ - case 7: b |= ( ( U64 )in[ 6] ) << 48; /*FALLTHROUGH*/ \ - case 6: b |= ( ( U64 )in[ 5] ) << 40; /*FALLTHROUGH*/ \ - case 5: b |= ( ( U64 )in[ 4] ) << 32; /*FALLTHROUGH*/ \ - case 4: b |= ( ( U64 )in[ 3] ) << 24; /*FALLTHROUGH*/ \ - case 3: b |= ( ( U64 )in[ 2] ) << 16; /*FALLTHROUGH*/ \ - case 2: b |= ( ( U64 )in[ 1] ) << 8; /*FALLTHROUGH*/ \ - case 1: b |= ( ( U64 )in[ 0] ); break; \ - case 0: break; \ - } \ - \ - v3 ^= b; \ - \ - SIP_ROUNDS; \ - \ - v0 ^= b; \ - \ - v2 ^= 0xff; \ - \ - SIP_FINAL_ROUNDS \ - \ - b = v0 ^ v1 ^ v2 ^ v3; \ - return b; \ -} \ - \ -PERL_STATIC_INLINE U32 \ -FNC ## _with_state \ - (const unsigned char * const state, const unsigned char *in, const STRLEN inlen) \ -{ \ - union { \ - U64 h64; \ - U32 h32[2]; \ - } h; \ - h.h64= FNC ## _with_state_64(state,in,inlen); \ - return h.h32[0] ^ h.h32[1]; \ -} \ - \ - \ -PERL_STATIC_INLINE U32 \ -FNC (const unsigned char * const seed, const unsigned char *in, const STRLEN inlen) \ -{ \ - U64 state[4]; \ - SIPHASH_SEED_STATE(seed,state[0],state[1],state[2],state[3]); \ - return FNC ## _with_state((U8*)state,in,inlen); \ -} +#define PERL_SIPHASH_FNC(FNC,SIP_ROUNDS,SIP_FINAL_ROUNDS) \ + PERL_STATIC_INLINE U64 \ + FNC ## _with_state_64 \ + (const unsigned char * const state, const unsigned char *in, const STRLEN inlen) \ + { \ + const int left = inlen & 7; \ + const U8 *end = in + inlen - left; \ + \ + U64 b = ( ( U64 )(inlen) ) << 56; \ + U64 m; \ + U64 v0 = U8TO64_LE(state); \ + U64 v1 = U8TO64_LE(state+8); \ + U64 v2 = U8TO64_LE(state+16); \ + U64 v3 = U8TO64_LE(state+24); \ + \ + for (; in != end; in += 8 ) \ + { \ + m = U8TO64_LE( in ); \ + v3 ^= m; \ + \ + SIP_ROUNDS; \ + \ + v0 ^= m; \ + } \ + \ + switch( left ) \ + { \ + case 7: b |= ( ( U64 )in[ 6] ) << 48; /*FALLTHROUGH*/ \ + case 6: b |= ( ( U64 )in[ 5] ) << 40; /*FALLTHROUGH*/ \ + case 5: b |= ( ( U64 )in[ 4] ) << 32; /*FALLTHROUGH*/ \ + case 4: b |= ( ( U64 )in[ 3] ) << 24; /*FALLTHROUGH*/ \ + case 3: b |= ( ( U64 )in[ 2] ) << 16; /*FALLTHROUGH*/ \ + case 2: b |= ( ( U64 )in[ 1] ) << 8; /*FALLTHROUGH*/ \ + case 1: b |= ( ( U64 )in[ 0] ); break; \ + case 0: break; \ + } \ + \ + v3 ^= b; \ + \ + SIP_ROUNDS; \ + \ + v0 ^= b; \ + \ + v2 ^= 0xff; \ + \ + SIP_FINAL_ROUNDS \ + \ + b = v0 ^ v1 ^ v2 ^ v3; \ + return b; \ + } \ + \ + PERL_STATIC_INLINE U32 \ + FNC ## _with_state \ + (const unsigned char * const state, const unsigned char *in, const STRLEN inlen) \ + { \ + union { \ + U64 h64; \ + U32 h32[2]; \ + } h; \ + h.h64= FNC ## _with_state_64(state,in,inlen); \ + return h.h32[0] ^ h.h32[1]; \ + } \ + \ + \ + PERL_STATIC_INLINE U32 \ + FNC (const unsigned char * const seed, const unsigned char *in, const STRLEN inlen) \ + { \ + U64 state[4]; \ + SIPHASH_SEED_STATE(seed,state[0],state[1],state[2],state[3]); \ + return FNC ## _with_state((U8*)state,in,inlen); \ + } PERL_SIPHASH_FNC( diff --git a/pp.h b/pp.h index edb0340d1420..2c4b89d2bc7a 100644 --- a/pp.h +++ b/pp.h @@ -65,27 +65,27 @@ value for the OP, but some use it for other purposes. */ #define TARG targ -#define PUSHMARK(p) \ - STMT_START { \ - I32 * mark_stack_entry; \ - if (UNLIKELY((mark_stack_entry = ++PL_markstack_ptr) \ - == PL_markstack_max)) \ - mark_stack_entry = markstack_grow(); \ - *mark_stack_entry = (I32)((p) - PL_stack_base); \ - DEBUG_s(DEBUG_v(PerlIO_printf(Perl_debug_log, \ - "MARK push %p %" IVdf "\n", \ - PL_markstack_ptr, (IV)*mark_stack_entry))); \ +#define PUSHMARK(p) \ + STMT_START { \ + I32 * mark_stack_entry; \ + if (UNLIKELY((mark_stack_entry = ++PL_markstack_ptr) \ + == PL_markstack_max)) \ + mark_stack_entry = markstack_grow(); \ + *mark_stack_entry = (I32)((p) - PL_stack_base); \ + DEBUG_s(DEBUG_v(PerlIO_printf(Perl_debug_log, \ + "MARK push %p %" IVdf "\n", \ + PL_markstack_ptr, (IV)*mark_stack_entry))); \ } STMT_END #define TOPMARK Perl_TOPMARK(aTHX) #define POPMARK Perl_POPMARK(aTHX) -#define INCMARK \ - STMT_START { \ - DEBUG_s(DEBUG_v(PerlIO_printf(Perl_debug_log, \ - "MARK inc %p %" IVdf "\n", \ - (PL_markstack_ptr+1), (IV)*(PL_markstack_ptr+1)))); \ - PL_markstack_ptr++; \ +#define INCMARK \ + STMT_START { \ + DEBUG_s(DEBUG_v(PerlIO_printf(Perl_debug_log, \ + "MARK inc %p %" IVdf "\n", \ + (PL_markstack_ptr+1), (IV)*(PL_markstack_ptr+1)))); \ + PL_markstack_ptr++; \ } STMT_END #define dSP SV **sp = PL_stack_sp @@ -332,12 +332,12 @@ Does not use C. See also C>, C> and C>. * requested to be extended (which is likely to be less than PL_stack_max) */ #if defined DEBUGGING && !defined DEBUGGING_RE_ONLY -# define EXTEND_HWM_SET(p, n) \ - STMT_START { \ - SSize_t extend_hwm_set_ix = (p) - PL_stack_base + (n); \ - if (extend_hwm_set_ix > PL_curstackinfo->si_stack_hwm) \ - PL_curstackinfo->si_stack_hwm = extend_hwm_set_ix; \ - } STMT_END +# define EXTEND_HWM_SET(p, n) \ + STMT_START { \ + SSize_t extend_hwm_set_ix = (p) - PL_stack_base + (n); \ + if (extend_hwm_set_ix > PL_curstackinfo->si_stack_hwm) \ + PL_curstackinfo->si_stack_hwm = extend_hwm_set_ix; \ + } STMT_END #else # define EXTEND_HWM_SET(p, n) NOOP #endif @@ -349,25 +349,25 @@ Does not use C. See also C>, C> and C>. * can't happen. */ -#define _EXTEND_SAFE_N(n) \ - (sizeof(n) > sizeof(SSize_t) && ((SSize_t)(n) != (n)) ? -1 : (n)) +#define _EXTEND_SAFE_N(n) \ + (sizeof(n) > sizeof(SSize_t) && ((SSize_t)(n) != (n)) ? -1 : (n)) #ifdef STRESS_REALLOC # define EXTEND_SKIP(p, n) EXTEND_HWM_SET(p, n) -# define EXTEND(p,n) \ - STMT_START {\ - sp = stack_grow(sp,p,_EXTEND_SAFE_N(n)); \ - PERL_UNUSED_VAR(sp); \ - } STMT_END +# define EXTEND(p,n) \ + STMT_START { \ + sp = stack_grow(sp,p,_EXTEND_SAFE_N(n)); \ + PERL_UNUSED_VAR(sp); \ + } STMT_END /* Same thing, but update mark register too. */ -# define MEXTEND(p,n) \ - STMT_START {\ - const SSize_t markoff = mark - PL_stack_base; \ - sp = stack_grow(sp,p,_EXTEND_SAFE_N(n)); \ - mark = PL_stack_base + markoff; \ - PERL_UNUSED_VAR(sp); \ - } STMT_END +# define MEXTEND(p,n) \ + STMT_START { \ + const SSize_t markoff = mark - PL_stack_base; \ + sp = stack_grow(sp,p,_EXTEND_SAFE_N(n)); \ + mark = PL_stack_base + markoff; \ + PERL_UNUSED_VAR(sp); \ + } STMT_END #else /* _EXTEND_NEEDS_GROW(p,n): private helper macro for EXTEND(). @@ -397,83 +397,83 @@ Does not use C. See also C>, C> and C>. * debugging mechanism which would otherwise whine */ -# define EXTEND_SKIP(p, n) \ - STMT_START {\ - EXTEND_HWM_SET(p, n); \ - assert(!_EXTEND_NEEDS_GROW(p,n)); \ - } STMT_END - - -# define EXTEND(p,n) \ - STMT_START {\ - EXTEND_HWM_SET(p, n); \ - if (UNLIKELY(_EXTEND_NEEDS_GROW(p,n))) { \ - sp = stack_grow(sp,p,_EXTEND_SAFE_N(n)); \ - PERL_UNUSED_VAR(sp); \ - } \ - } STMT_END +# define EXTEND_SKIP(p, n) \ + STMT_START { \ + EXTEND_HWM_SET(p, n); \ + assert(!_EXTEND_NEEDS_GROW(p,n)); \ + } STMT_END + + +# define EXTEND(p,n) \ + STMT_START { \ + EXTEND_HWM_SET(p, n); \ + if (UNLIKELY(_EXTEND_NEEDS_GROW(p,n))) { \ + sp = stack_grow(sp,p,_EXTEND_SAFE_N(n)); \ + PERL_UNUSED_VAR(sp); \ + } \ + } STMT_END /* Same thing, but update mark register too. */ -# define MEXTEND(p,n) \ - STMT_START {\ - EXTEND_HWM_SET(p, n); \ - if (UNLIKELY(_EXTEND_NEEDS_GROW(p,n))) { \ - const SSize_t markoff = mark - PL_stack_base;\ - sp = stack_grow(sp,p,_EXTEND_SAFE_N(n)); \ - mark = PL_stack_base + markoff; \ - PERL_UNUSED_VAR(sp); \ - } \ - } STMT_END +# define MEXTEND(p,n) \ + STMT_START { \ + EXTEND_HWM_SET(p, n); \ + if (UNLIKELY(_EXTEND_NEEDS_GROW(p,n))) { \ + const SSize_t markoff = mark - PL_stack_base; \ + sp = stack_grow(sp,p,_EXTEND_SAFE_N(n)); \ + mark = PL_stack_base + markoff; \ + PERL_UNUSED_VAR(sp); \ + } \ + } STMT_END #endif /* set TARG to the IV value i. If do_taint is false, * assume that PL_tainted can never be true */ -#define TARGi(i, do_taint) \ - STMT_START { \ - IV TARGi_iv = i; \ - if (LIKELY( \ - ((SvFLAGS(TARG) & (SVTYPEMASK|SVf_THINKFIRST|SVf_IVisUV)) == SVt_IV) \ - & (do_taint ? !TAINT_get : 1))) \ - { \ - /* Cheap SvIOK_only(). \ - * Assert that flags which SvIOK_only() would test or \ - * clear can't be set, because we're SVt_IV */ \ - assert(!(SvFLAGS(TARG) & \ - (SVf_OOK|SVf_UTF8|(SVf_OK & ~(SVf_IOK|SVp_IOK))))); \ - SvFLAGS(TARG) |= (SVf_IOK|SVp_IOK); \ - /* SvIV_set() where sv_any points to head */ \ - TARG->sv_u.svu_iv = TARGi_iv; \ - } \ - else \ - sv_setiv_mg(targ, TARGi_iv); \ +#define TARGi(i, do_taint) \ + STMT_START { \ + IV TARGi_iv = i; \ + if (LIKELY( \ + ((SvFLAGS(TARG) & (SVTYPEMASK|SVf_THINKFIRST|SVf_IVisUV)) == SVt_IV) \ + & (do_taint ? !TAINT_get : 1))) \ + { \ + /* Cheap SvIOK_only(). \ + * Assert that flags which SvIOK_only() would test or \ + * clear can't be set, because we're SVt_IV */ \ + assert(!(SvFLAGS(TARG) & \ + (SVf_OOK|SVf_UTF8|(SVf_OK & ~(SVf_IOK|SVp_IOK))))); \ + SvFLAGS(TARG) |= (SVf_IOK|SVp_IOK); \ + /* SvIV_set() where sv_any points to head */ \ + TARG->sv_u.svu_iv = TARGi_iv; \ + } \ + else \ + sv_setiv_mg(targ, TARGi_iv); \ } STMT_END /* set TARG to the UV value u. If do_taint is false, * assume that PL_tainted can never be true */ -#define TARGu(u, do_taint) \ - STMT_START { \ - UV TARGu_uv = u; \ - if (LIKELY( \ - ((SvFLAGS(TARG) & (SVTYPEMASK|SVf_THINKFIRST|SVf_IVisUV)) == SVt_IV) \ - & (do_taint ? !TAINT_get : 1) \ - & (TARGu_uv <= (UV)IV_MAX))) \ - { \ - /* Cheap SvIOK_only(). \ - * Assert that flags which SvIOK_only() would test or \ - * clear can't be set, because we're SVt_IV */ \ - assert(!(SvFLAGS(TARG) & \ - (SVf_OOK|SVf_UTF8|(SVf_OK & ~(SVf_IOK|SVp_IOK))))); \ - SvFLAGS(TARG) |= (SVf_IOK|SVp_IOK); \ - /* SvIV_set() where sv_any points to head */ \ - TARG->sv_u.svu_iv = TARGu_uv; \ - } \ - else \ - sv_setuv_mg(targ, TARGu_uv); \ +#define TARGu(u, do_taint) \ + STMT_START { \ + UV TARGu_uv = u; \ + if (LIKELY( \ + ((SvFLAGS(TARG) & (SVTYPEMASK|SVf_THINKFIRST|SVf_IVisUV)) == SVt_IV) \ + & (do_taint ? !TAINT_get : 1) \ + & (TARGu_uv <= (UV)IV_MAX))) \ + { \ + /* Cheap SvIOK_only(). \ + * Assert that flags which SvIOK_only() would test or \ + * clear can't be set, because we're SVt_IV */ \ + assert(!(SvFLAGS(TARG) & \ + (SVf_OOK|SVf_UTF8|(SVf_OK & ~(SVf_IOK|SVp_IOK))))); \ + SvFLAGS(TARG) |= (SVf_IOK|SVp_IOK); \ + /* SvIV_set() where sv_any points to head */ \ + TARG->sv_u.svu_iv = TARGu_uv; \ + } \ + else \ + sv_setuv_mg(targ, TARGu_uv); \ } STMT_END /* set TARG to the NV value n. If do_taint is false, * assume that PL_tainted can never be true */ -#define TARGn(n, do_taint) \ +#define TARGn(n, do_taint) \ STMT_START { \ NV TARGn_nv = n; \ if (LIKELY( \ @@ -546,11 +546,11 @@ Does not use C. See also C>, C> and C>. #define dPOPXnnrl(X) NV right = POPn; NV left = CAT2(X,n) #define dPOPXiirl(X) IV right = POPi; IV left = CAT2(X,i) -#define USE_LEFT(sv) \ - (SvOK(sv) || !(PL_op->op_flags & OPf_STACKED)) -#define dPOPXiirl_ul_nomg(X) \ - IV right = (sp--, SvIV_nomg(TOPp1s)); \ - SV *leftsv = CAT2(X,s); \ +#define USE_LEFT(sv) \ + (SvOK(sv) || !(PL_op->op_flags & OPf_STACKED)) +#define dPOPXiirl_ul_nomg(X) \ + IV right = (sp--, SvIV_nomg(TOPp1s)); \ + SV *leftsv = CAT2(X,s); \ IV left = USE_LEFT(leftsv) ? SvIV_nomg(leftsv) : 0 #define dPOPPOPssrl dPOPXssrl(POP) @@ -559,11 +559,11 @@ Does not use C. See also C>, C> and C>. #define dPOPTOPssrl dPOPXssrl(TOP) #define dPOPTOPnnrl dPOPXnnrl(TOP) -#define dPOPTOPnnrl_nomg \ +#define dPOPTOPnnrl_nomg \ NV right = SvNV_nomg(TOPs); NV left = (sp--, SvNV_nomg(TOPs)) #define dPOPTOPiirl dPOPXiirl(TOP) #define dPOPTOPiirl_ul_nomg dPOPXiirl_ul_nomg(TOP) -#define dPOPTOPiirl_nomg \ +#define dPOPTOPiirl_nomg \ IV right = SvIV_nomg(TOPs); IV left = (sp--, SvIV_nomg(TOPs)) #define RETPUSHYES RETURNX(PUSHs(&PL_sv_yes)) @@ -579,20 +579,20 @@ Does not use C. See also C>, C> and C>. #define MAXARG (PL_op->op_private & OPpARG4_MASK) -#define SWITCHSTACK(f,t) \ - STMT_START { \ - AvFILLp(f) = sp - PL_stack_base; \ - PL_stack_base = AvARRAY(t); \ - PL_stack_max = PL_stack_base + AvMAX(t); \ - sp = PL_stack_sp = PL_stack_base + AvFILLp(t); \ - PL_curstack = t; \ +#define SWITCHSTACK(f,t) \ + STMT_START { \ + AvFILLp(f) = sp - PL_stack_base; \ + PL_stack_base = AvARRAY(t); \ + PL_stack_max = PL_stack_base + AvMAX(t); \ + sp = PL_stack_sp = PL_stack_base + AvFILLp(t); \ + PL_curstack = t; \ } STMT_END -#define EXTEND_MORTAL(n) \ - STMT_START { \ - SSize_t eMiX = PL_tmps_ix + (n); \ - if (UNLIKELY(eMiX >= PL_tmps_max)) \ - (void)Perl_tmps_grow_p(aTHX_ eMiX); \ +#define EXTEND_MORTAL(n) \ + STMT_START { \ + SSize_t eMiX = PL_tmps_ix + (n); \ + if (UNLIKELY(eMiX >= PL_tmps_max)) \ + (void)Perl_tmps_grow_p(aTHX_ eMiX); \ } STMT_END #define AMGf_noright 1 @@ -607,20 +607,20 @@ Does not use C. See also C>, C> and C>. /* do SvGETMAGIC on the stack args before checking for overload */ -#define tryAMAGICun_MG(method, flags) \ - STMT_START {\ - if ( UNLIKELY((SvFLAGS(TOPs) & (SVf_ROK|SVs_GMG))) \ +#define tryAMAGICun_MG(method, flags) \ + STMT_START { \ + if ( UNLIKELY((SvFLAGS(TOPs) & (SVf_ROK|SVs_GMG))) \ && Perl_try_amagic_un(aTHX_ method, flags)) \ - return NORMAL; \ + return NORMAL; \ } STMT_END -#define tryAMAGICbin_MG(method, flags) \ - STMT_START {\ - if ( UNLIKELY(((SvFLAGS(TOPm1s)|SvFLAGS(TOPs)) & (SVf_ROK|SVs_GMG))) \ - && Perl_try_amagic_bin(aTHX_ method, flags)) \ - return NORMAL; \ +#define tryAMAGICbin_MG(method, flags) \ + STMT_START { \ + if ( UNLIKELY(((SvFLAGS(TOPm1s)|SvFLAGS(TOPs)) & (SVf_ROK|SVs_GMG))) \ + && Perl_try_amagic_bin(aTHX_ method, flags)) \ + return NORMAL; \ } STMT_END -#define AMG_CALLunary(sv,meth) \ +#define AMG_CALLunary(sv,meth) \ amagic_call(sv,&PL_sv_undef, meth, AMGf_noright | AMGf_unary) /* No longer used in core. Use AMG_CALLunary instead */ @@ -631,7 +631,7 @@ Does not use C. See also C>, C> and C>. dSP; \ SV *tmpsv; \ SV *arg= *sp; \ - U8 gimme = GIMME_V; \ + U8 gimme = GIMME_V; \ if (UNLIKELY(SvAMAGIC(arg) && \ (tmpsv = amagic_call(arg, &PL_sv_undef, meth, \ AMGf_want_list | AMGf_noright \ @@ -664,7 +664,7 @@ Does not use C. See also C>, C> and C>. while (jump_o->op_type == OP_NULL) \ jump_o = jump_o->op_next; \ assert(jump_o->op_type == OP_ENTERSUB); \ - (void)POPMARK; \ + (void)POPMARK; \ return jump_o->op_next; \ } \ return NORMAL; \ @@ -673,10 +673,10 @@ Does not use C. See also C>, C> and C>. /* This is no longer used anywhere in the core. You might wish to consider calling amagic_deref_call() directly, as it has a cleaner interface. */ -#define tryAMAGICunDEREF(meth) \ - STMT_START { \ - sv = amagic_deref_call(*sp, CAT2(meth,_amg)); \ - SPAGAIN; \ +#define tryAMAGICunDEREF(meth) \ + STMT_START { \ + sv = amagic_deref_call(*sp, CAT2(meth,_amg)); \ + SPAGAIN; \ } STMT_END @@ -690,14 +690,14 @@ True if this op will be the return value of an lvalue subroutine =cut */ #define LVRET ((PL_op->op_private & OPpMAYBE_LVSUB) && is_lvalue_sub()) -#define SvCANEXISTDELETE(sv) \ - (!SvRMAGICAL(sv) \ - || !(mg = mg_find((const SV *) sv, PERL_MAGIC_tied)) \ - || ( (stash = SvSTASH(SvRV(SvTIED_obj(MUTABLE_SV(sv), mg)))) \ - && gv_fetchmethod_autoload(stash, "EXISTS", TRUE) \ - && gv_fetchmethod_autoload(stash, "DELETE", TRUE) \ - ) \ - ) +#define SvCANEXISTDELETE(sv) \ + (!SvRMAGICAL(sv) \ + || !(mg = mg_find((const SV *) sv, PERL_MAGIC_tied)) \ + || ( (stash = SvSTASH(SvRV(SvTIED_obj(MUTABLE_SV(sv), mg)))) \ + && gv_fetchmethod_autoload(stash, "EXISTS", TRUE) \ + && gv_fetchmethod_autoload(stash, "DELETE", TRUE) \ + ) \ + ) #ifdef PERL_CORE @@ -709,16 +709,16 @@ True if this op will be the return value of an lvalue subroutine # define TIED_METHOD_SAY 0x10 /* Used in various places that need to dereference a glob or globref */ -# define MAYBE_DEREF_GV_flags(sv,phlags) \ - ( \ - (void)(((phlags) & SV_GMAGIC) && (SvGETMAGIC(sv),0)), \ - isGV_with_GP(sv) \ - ? (GV *)(sv) \ - : SvROK(sv) && SvTYPE(SvRV(sv)) <= SVt_PVLV && \ - (SvGETMAGIC(SvRV(sv)), isGV_with_GP(SvRV(sv))) \ - ? (GV *)SvRV(sv) \ - : NULL \ - ) +# define MAYBE_DEREF_GV_flags(sv,phlags) \ + ( \ + (void)(((phlags) & SV_GMAGIC) && (SvGETMAGIC(sv),0)), \ + isGV_with_GP(sv) \ + ? (GV *)(sv) \ + : SvROK(sv) && SvTYPE(SvRV(sv)) <= SVt_PVLV && \ + (SvGETMAGIC(SvRV(sv)), isGV_with_GP(SvRV(sv))) \ + ? (GV *)SvRV(sv) \ + : NULL \ + ) # define MAYBE_DEREF_GV(sv) MAYBE_DEREF_GV_flags(sv,SV_GMAGIC) # define MAYBE_DEREF_GV_nomg(sv) MAYBE_DEREF_GV_flags(sv,0) diff --git a/regcomp.h b/regcomp.h index ea2d1929da96..f07358b65faa 100644 --- a/regcomp.h +++ b/regcomp.h @@ -8,8 +8,8 @@ * */ -#if ! defined(PERL_REGCOMP_H_) && ( defined(PERL_CORE) \ - || defined(PERL_EXT_RE_BUILD)) +#if ! defined(PERL_REGCOMP_H_) && ( defined(PERL_CORE) \ + || defined(PERL_EXT_RE_BUILD)) #define PERL_REGCOMP_H_ @@ -109,7 +109,7 @@ typedef struct regexp_internal { #define PREGf_ANCH_GPOS 0x00001000 #define PREGf_RECURSE_SEEN 0x00002000 -#define PREGf_ANCH \ +#define PREGf_ANCH \ ( PREGf_ANCH_SBOL | PREGf_ANCH_GPOS | PREGf_ANCH_MBOL ) /* this is where the old regcomp.h started */ @@ -225,9 +225,9 @@ struct regnode_2 { U16 arg2; }; -#define REGNODE_BBM_BITMAP_LEN \ - /* 6 info bits requires 64 bits; 5 => 32 */ \ - ((1 << (UTF_CONTINUATION_BYTE_INFO_BITS)) / CHARBITS) +#define REGNODE_BBM_BITMAP_LEN \ + /* 6 info bits requires 64 bits; 5 => 32 */ \ + ((1 << (UTF_CONTINUATION_BYTE_INFO_BITS)) / CHARBITS) /* Used for matching any two-byte UTF-8 character whose start byte is known. * The array is a bitmap capable of representing any possible continuation @@ -377,15 +377,15 @@ struct regnode_ssc { #undef STRING #define OP(p) ((p)->type) -#define FLAGS(p) \ - ((p)->flags) /* Caution: Doesn't apply to all\ - regnode types. For some, it's the \ +#define FLAGS(p) \ + ((p)->flags) /* Caution: Doesn't apply to all \ + regnode types. For some, it's the \ character set of the regnode */ -#define STR_LENs(p) \ - (__ASSERT_(OP(p) != LEXACT && OP(p) != LEXACT_REQ8)\ +#define STR_LENs(p) \ + (__ASSERT_(OP(p) != LEXACT && OP(p) != LEXACT_REQ8) \ ((struct regnode_string *)p)->str_len) -#define STRINGs(p) \ - (__ASSERT_(OP(p) != LEXACT && OP(p) != LEXACT_REQ8)\ +#define STRINGs(p) \ + (__ASSERT_(OP(p) != LEXACT && OP(p) != LEXACT_REQ8) \ ((struct regnode_string *)p)->string) #define OPERANDs(p) STRINGs(p) @@ -401,19 +401,19 @@ struct regnode_ssc { * node to be an ARG2L, using the second 32 bit field for the length, and not * using the flags nor next_off fields at all. One could have an llstring node * and even an lllstring type. */ -#define STR_LENl(p) \ - (__ASSERT_(OP(p) == LEXACT || OP(p) == LEXACT_REQ8)\ +#define STR_LENl(p) \ + (__ASSERT_(OP(p) == LEXACT || OP(p) == LEXACT_REQ8) \ (((struct regnode_lstring *)p)->str_len)) -#define STRINGl(p) \ - (__ASSERT_(OP(p) == LEXACT || OP(p) == LEXACT_REQ8)\ +#define STRINGl(p) \ + (__ASSERT_(OP(p) == LEXACT || OP(p) == LEXACT_REQ8) \ (((struct regnode_lstring *)p)->string)) #define OPERANDl(p) STRINGl(p) -#define STR_LEN(p) \ - ((OP(p) == LEXACT || OP(p) == LEXACT_REQ8)\ +#define STR_LEN(p) \ + ((OP(p) == LEXACT || OP(p) == LEXACT_REQ8) \ ? STR_LENl(p) : STR_LENs(p)) -#define STRING(p) \ - ((OP(p) == LEXACT || OP(p) == LEXACT_REQ8)\ +#define STRING(p) \ + ((OP(p) == LEXACT || OP(p) == LEXACT_REQ8) \ ? STRINGl(p) : STRINGs(p)) #define OPERAND(p) STRING(p) @@ -421,12 +421,12 @@ struct regnode_ssc { * occupies - Used by the REGNODE_AFTER() macros and functions. */ #define STR_SZ(l) (((l) + sizeof(regnode) - 1) / sizeof(regnode)) -#define setSTR_LEN(p,v) \ - STMT_START{ \ - if (OP(p) == LEXACT || OP(p) == LEXACT_REQ8) \ - ((struct regnode_lstring *)(p))->str_len = (v); \ - else \ - ((struct regnode_string *)(p))->str_len = (v); \ +#define setSTR_LEN(p,v) \ + STMT_START{ \ + if (OP(p) == LEXACT || OP(p) == LEXACT_REQ8) \ + ((struct regnode_lstring *)(p))->str_len = (v); \ + else \ + ((struct regnode_string *)(p))->str_len = (v); \ } STMT_END #define ANYOFR_BASE_BITS 20 @@ -522,7 +522,7 @@ struct regnode_ssc { * don't have to implement different versions for DEBUGGING and not DEBUGGING, * and explains why all the macros use REGNODE_AFTER_PLUS_DEBUG() under the * hood. */ -#define REGNODE_AFTER_PLUS_DEBUG(p,extra) \ +#define REGNODE_AFTER_PLUS_DEBUG(p,extra) \ (assert_(check_regnode_after(p,extra)) REGNODE_AFTER_PLUS((p),(extra))) /* find the regnode after this p by using the opcode we previously extracted @@ -547,40 +547,40 @@ struct regnode_ssc { * things go wrong the opcode should be illegal or say the item should be larger * than it is, etc. */ #define REGNODE_BEFORE_BASE(p) ((p) - NODE_STEP_REGNODE) -#define REGNODE_BEFORE_BASE_DEBUG(p) \ +#define REGNODE_BEFORE_BASE_DEBUG(p) \ (assert_(check_regnode_after(REGNODE_BEFORE_BASE(p),0)) REGNODE_BEFORE_BASE(p)) #define REGNODE_BEFORE(p) REGNODE_BEFORE_BASE_DEBUG(p) -#define FILL_NODE(offset, op) \ - STMT_START { \ - OP(REGNODE_p(offset)) = op; \ - NEXT_OFF(REGNODE_p(offset)) = 0; \ +#define FILL_NODE(offset, op) \ + STMT_START { \ + OP(REGNODE_p(offset)) = op; \ + NEXT_OFF(REGNODE_p(offset)) = 0; \ } STMT_END -#define FILL_ADVANCE_NODE(offset, op) \ - STMT_START { \ - FILL_NODE(offset, op); \ - (offset)++; \ +#define FILL_ADVANCE_NODE(offset, op) \ + STMT_START { \ + FILL_NODE(offset, op); \ + (offset)++; \ } STMT_END -#define FILL_ADVANCE_NODE_ARG(offset, op, arg) \ - STMT_START { \ - ARG_SET(REGNODE_p(offset), arg); \ - FILL_ADVANCE_NODE(offset, op); \ - /* This is used generically for other operations \ - * that have a longer argument */ \ - (offset) += REGNODE_ARG_LEN(op); \ +#define FILL_ADVANCE_NODE_ARG(offset, op, arg) \ + STMT_START { \ + ARG_SET(REGNODE_p(offset), arg); \ + FILL_ADVANCE_NODE(offset, op); \ + /* This is used generically for other operations \ + * that have a longer argument */ \ + (offset) += REGNODE_ARG_LEN(op); \ } STMT_END -#define FILL_ADVANCE_NODE_ARGp(offset, op, arg) \ - STMT_START { \ - ARGp_SET(REGNODE_p(offset), arg); \ - FILL_ADVANCE_NODE(offset, op); \ - (offset) += REGNODE_ARG_LEN(op); \ +#define FILL_ADVANCE_NODE_ARGp(offset, op, arg) \ + STMT_START { \ + ARGp_SET(REGNODE_p(offset), arg); \ + FILL_ADVANCE_NODE(offset, op); \ + (offset) += REGNODE_ARG_LEN(op); \ } STMT_END -#define FILL_ADVANCE_NODE_2L_ARG(offset, op, arg1, arg2) \ - STMT_START { \ - ARG_SET(REGNODE_p(offset), arg1); \ - ARG2L_SET(REGNODE_p(offset), arg2); \ - FILL_ADVANCE_NODE(offset, op); \ - (offset) += 2; \ +#define FILL_ADVANCE_NODE_2L_ARG(offset, op, arg1, arg2) \ + STMT_START { \ + ARG_SET(REGNODE_p(offset), arg1); \ + ARG2L_SET(REGNODE_p(offset), arg2); \ + FILL_ADVANCE_NODE(offset, op); \ + (offset) += 2; \ } STMT_END /* define these after we define the normal macros, so we can use @@ -617,17 +617,17 @@ ARGp_SET_inline(struct regnode *node, SV *ptr) { * set to the following: */ #define ANYOF_MATCHES_ALL_OUTSIDE_BITMAP_VALUE U32_MAX -#define ANYOF_MATCHES_ALL_OUTSIDE_BITMAP(node) \ - (ARG(node) == ANYOF_MATCHES_ALL_OUTSIDE_BITMAP_VALUE) +#define ANYOF_MATCHES_ALL_OUTSIDE_BITMAP(node) \ + (ARG(node) == ANYOF_MATCHES_ALL_OUTSIDE_BITMAP_VALUE) -#define ANYOF_MATCHES_NONE_OUTSIDE_BITMAP_VALUE \ - /* Assumes ALL is odd */ (ANYOF_MATCHES_ALL_OUTSIDE_BITMAP_VALUE - 1) -#define ANYOF_MATCHES_NONE_OUTSIDE_BITMAP(node) \ - (ARG(node) == ANYOF_MATCHES_NONE_OUTSIDE_BITMAP_VALUE) +#define ANYOF_MATCHES_NONE_OUTSIDE_BITMAP_VALUE \ + /* Assumes ALL is odd */ (ANYOF_MATCHES_ALL_OUTSIDE_BITMAP_VALUE - 1) +#define ANYOF_MATCHES_NONE_OUTSIDE_BITMAP(node) \ + (ARG(node) == ANYOF_MATCHES_NONE_OUTSIDE_BITMAP_VALUE) #define ANYOF_ONLY_HAS_BITMAP_MASK ANYOF_MATCHES_NONE_OUTSIDE_BITMAP_VALUE -#define ANYOF_ONLY_HAS_BITMAP(node) \ - ((ARG(node) & ANYOF_ONLY_HAS_BITMAP_MASK) == ANYOF_ONLY_HAS_BITMAP_MASK) +#define ANYOF_ONLY_HAS_BITMAP(node) \ + ((ARG(node) & ANYOF_ONLY_HAS_BITMAP_MASK) == ANYOF_ONLY_HAS_BITMAP_MASK) #define ANYOF_HAS_AUX(node) (! ANYOF_ONLY_HAS_BITMAP(node)) @@ -806,8 +806,8 @@ ARGp_SET_inline(struct regnode *node, SV *ptr) { #define ANYOF_FLAGS_ALL ((U8) ~(0x10|0x20)) #define ANYOF_LOCALE_FLAGS \ - ( ANYOFL_FOLD\ - | ANYOF_MATCHES_POSIXL \ + ( ANYOFL_FOLD \ + | ANYOF_MATCHES_POSIXL \ | ANYOFL_UTF8_LOCALE_REQD) /* These are the flags that apply to both regular ANYOF nodes and synthetic @@ -912,32 +912,32 @@ ARGp_SET_inline(struct regnode *node, SV *ptr) { #define POSIXL_ZERO(field) STMT_START { (field) = 0; } STMT_END #define ANYOF_POSIXL_ZERO(ret) POSIXL_ZERO(ANYOF_POSIXL_BITMAP(ret)) -#define ANYOF_POSIXL_SET_TO_BITMAP(p, bits) \ - STMT_START { ANYOF_POSIXL_BITMAP(p) = (bits); } STMT_END +#define ANYOF_POSIXL_SET_TO_BITMAP(p, bits) \ + STMT_START { ANYOF_POSIXL_BITMAP(p) = (bits); } STMT_END /* Shifts a bit to get, eg. 0x4000_0000, then subtracts 1 to get 0x3FFF_FFFF */ -#define ANYOF_POSIXL_SETALL(ret) \ - STMT_START { \ - ANYOF_POSIXL_BITMAP(ret) = nBIT_MASK(ANYOF_POSIXL_MAX); \ - } STMT_END +#define ANYOF_POSIXL_SETALL(ret) \ + STMT_START { \ + ANYOF_POSIXL_BITMAP(ret) = nBIT_MASK(ANYOF_POSIXL_MAX); \ + } STMT_END #define ANYOF_CLASS_SETALL(ret) ANYOF_POSIXL_SETALL(ret) -#define ANYOF_POSIXL_TEST_ANY_SET(p) \ - ((ANYOF_FLAGS(p) & ANYOF_MATCHES_POSIXL) && ANYOF_POSIXL_BITMAP(p)) +#define ANYOF_POSIXL_TEST_ANY_SET(p) \ + ((ANYOF_FLAGS(p) & ANYOF_MATCHES_POSIXL) && ANYOF_POSIXL_BITMAP(p)) #define ANYOF_CLASS_TEST_ANY_SET(p) ANYOF_POSIXL_TEST_ANY_SET(p) /* Since an SSC always has this field, we don't have to test for that; nor do * we want to because the bit isn't set for SSC during its construction */ -#define ANYOF_POSIXL_SSC_TEST_ANY_SET(p) \ - cBOOL(((regnode_ssc*)(p))->classflags) -#define ANYOF_POSIXL_SSC_TEST_ALL_SET(p) \ - /* Are all bits set? */\ - (((regnode_ssc*) (p))->classflags \ +#define ANYOF_POSIXL_SSC_TEST_ANY_SET(p) \ + cBOOL(((regnode_ssc*)(p))->classflags) +#define ANYOF_POSIXL_SSC_TEST_ALL_SET(p) \ + /* Are all bits set? */ \ + (((regnode_ssc*) (p))->classflags \ == nBIT_MASK(ANYOF_POSIXL_MAX)) -#define ANYOF_POSIXL_TEST_ALL_SET(p) \ - ((ANYOF_FLAGS(p) & ANYOF_MATCHES_POSIXL) \ - && ANYOF_POSIXL_BITMAP(p) == nBIT_MASK(ANYOF_POSIXL_MAX)) +#define ANYOF_POSIXL_TEST_ALL_SET(p) \ + ((ANYOF_FLAGS(p) & ANYOF_MATCHES_POSIXL) \ + && ANYOF_POSIXL_BITMAP(p) == nBIT_MASK(ANYOF_POSIXL_MAX)) #define ANYOF_POSIXL_OR(source, dest) STMT_START { (dest)->classflags |= (source)->classflags; } STMT_END #define ANYOF_CLASS_OR(source, dest) ANYOF_POSIXL_OR((source), (dest)) @@ -951,10 +951,10 @@ ARGp_SET_inline(struct regnode *node, SV *ptr) { #define ANYOF_BITMAP_CLEAR(p,c) (ANYOF_BITMAP_BYTE(p, c) &= ~ANYOF_BIT(c)) #define ANYOF_BITMAP_TEST(p, c) cBOOL(ANYOF_BITMAP_BYTE(p, c) & ANYOF_BIT(c)) -#define ANYOF_BITMAP_SETALL(p) \ - memset (ANYOF_BITMAP(p), 255, ANYOF_BITMAP_SIZE) -#define ANYOF_BITMAP_CLEARALL(p) \ - Zero (ANYOF_BITMAP(p), ANYOF_BITMAP_SIZE) +#define ANYOF_BITMAP_SETALL(p) \ + memset (ANYOF_BITMAP(p), 255, ANYOF_BITMAP_SIZE) +#define ANYOF_BITMAP_CLEARALL(p) \ + Zero (ANYOF_BITMAP(p), ANYOF_BITMAP_SIZE) /* * Utility definitions. @@ -1259,89 +1259,89 @@ re.pm, especially to the documentation. #define RE_DEBUG_FLAG(x) (re_debug_flags & (x)) /* Compile */ #define DEBUG_COMPILE_r(x) \ - DEBUG_r(\ + DEBUG_r( \ if (DEBUG_v_TEST || RE_DEBUG_FLAG(RE_DEBUG_COMPILE_MASK)) x ) -#define DEBUG_PARSE_r(x) \ - DEBUG_r(\ +#define DEBUG_PARSE_r(x) \ + DEBUG_r( \ if (DEBUG_v_TEST || RE_DEBUG_FLAG(RE_DEBUG_COMPILE_PARSE)) x ) -#define DEBUG_OPTIMISE_r(x) \ - DEBUG_r(\ +#define DEBUG_OPTIMISE_r(x) \ + DEBUG_r( \ if (DEBUG_v_TEST || RE_DEBUG_FLAG(RE_DEBUG_COMPILE_OPTIMISE)) x ) -#define DEBUG_DUMP_r(x) \ - DEBUG_r(\ +#define DEBUG_DUMP_r(x) \ + DEBUG_r( \ if (DEBUG_v_TEST || RE_DEBUG_FLAG(RE_DEBUG_COMPILE_DUMP)) x ) -#define DEBUG_TRIE_COMPILE_r(x) \ - DEBUG_r(\ +#define DEBUG_TRIE_COMPILE_r(x) \ + DEBUG_r( \ if (DEBUG_v_TEST || RE_DEBUG_FLAG(RE_DEBUG_COMPILE_TRIE)) x ) -#define DEBUG_FLAGS_r(x) \ - DEBUG_r(\ +#define DEBUG_FLAGS_r(x) \ + DEBUG_r( \ if (DEBUG_v_TEST || RE_DEBUG_FLAG(RE_DEBUG_COMPILE_FLAGS)) x ) -#define DEBUG_TEST_r(x) \ - DEBUG_r(\ +#define DEBUG_TEST_r(x) \ + DEBUG_r( \ if (DEBUG_v_TEST || RE_DEBUG_FLAG(RE_DEBUG_COMPILE_TEST)) x ) /* Execute */ #define DEBUG_EXECUTE_r(x) \ - DEBUG_r(\ + DEBUG_r( \ if (DEBUG_v_TEST || RE_DEBUG_FLAG(RE_DEBUG_EXECUTE_MASK)) x ) -#define DEBUG_INTUIT_r(x) \ - DEBUG_r(\ +#define DEBUG_INTUIT_r(x) \ + DEBUG_r( \ if (DEBUG_v_TEST || RE_DEBUG_FLAG(RE_DEBUG_EXECUTE_INTUIT)) x ) -#define DEBUG_MATCH_r(x) \ - DEBUG_r(\ +#define DEBUG_MATCH_r(x) \ + DEBUG_r( \ if (DEBUG_v_TEST || RE_DEBUG_FLAG(RE_DEBUG_EXECUTE_MATCH)) x ) -#define DEBUG_TRIE_EXECUTE_r(x) \ - DEBUG_r(\ +#define DEBUG_TRIE_EXECUTE_r(x) \ + DEBUG_r( \ if (DEBUG_v_TEST || RE_DEBUG_FLAG(RE_DEBUG_EXECUTE_TRIE)) x ) /* Extra */ -#define DEBUG_EXTRA_r(x) \ - DEBUG_r(\ +#define DEBUG_EXTRA_r(x) \ + DEBUG_r( \ if (DEBUG_v_TEST || RE_DEBUG_FLAG(RE_DEBUG_EXTRA_MASK)) x ) -#define DEBUG_STATE_r(x) \ - DEBUG_r(\ +#define DEBUG_STATE_r(x) \ + DEBUG_r( \ if (DEBUG_v_TEST || RE_DEBUG_FLAG(RE_DEBUG_EXTRA_STATE)) x ) -#define DEBUG_STACK_r(x) \ - DEBUG_r(\ +#define DEBUG_STACK_r(x) \ + DEBUG_r( \ if (DEBUG_v_TEST || RE_DEBUG_FLAG(RE_DEBUG_EXTRA_STACK)) x ) #define DEBUG_BUFFERS_r(x) \ - DEBUG_r(\ + DEBUG_r( \ if (DEBUG_v_TEST || RE_DEBUG_FLAG(RE_DEBUG_EXTRA_BUFFERS)) x ) -#define DEBUG_OPTIMISE_MORE_r(x) \ - DEBUG_r(\ +#define DEBUG_OPTIMISE_MORE_r(x) \ + DEBUG_r( \ if (DEBUG_v_TEST || ((RE_DEBUG_EXTRA_OPTIMISE|RE_DEBUG_COMPILE_OPTIMISE) == \ RE_DEBUG_FLAG(RE_DEBUG_EXTRA_OPTIMISE|RE_DEBUG_COMPILE_OPTIMISE))) x ) -#define DEBUG_TRIE_COMPILE_MORE_r(x) \ - DEBUG_TRIE_COMPILE_r(\ +#define DEBUG_TRIE_COMPILE_MORE_r(x) \ + DEBUG_TRIE_COMPILE_r( \ if (DEBUG_v_TEST || RE_DEBUG_FLAG(RE_DEBUG_EXTRA_TRIE)) x ) -#define DEBUG_TRIE_EXECUTE_MORE_r(x) \ - DEBUG_TRIE_EXECUTE_r(\ +#define DEBUG_TRIE_EXECUTE_MORE_r(x) \ + DEBUG_TRIE_EXECUTE_r( \ if (DEBUG_v_TEST || RE_DEBUG_FLAG(RE_DEBUG_EXTRA_TRIE)) x ) -#define DEBUG_TRIE_r(x) \ - DEBUG_r(\ +#define DEBUG_TRIE_r(x) \ + DEBUG_r( \ if (DEBUG_v_TEST || RE_DEBUG_FLAG(RE_DEBUG_COMPILE_TRIE \ | RE_DEBUG_EXECUTE_TRIE )) x ) -#define DEBUG_GPOS_r(x) \ - DEBUG_r(\ +#define DEBUG_GPOS_r(x) \ + DEBUG_r( \ if (DEBUG_v_TEST || RE_DEBUG_FLAG(RE_DEBUG_EXTRA_GPOS)) x ) -#define DEBUG_DUMP_PRE_OPTIMIZE_r(x) \ - DEBUG_r(\ +#define DEBUG_DUMP_PRE_OPTIMIZE_r(x) \ + DEBUG_r( \ if (DEBUG_v_TEST || RE_DEBUG_FLAG(RE_DEBUG_EXTRA_DUMP_PRE_OPTIMIZE)) x ) /* initialization */ /* Get the debug flags for code not in regcomp.c nor regexec.c. This doesn't * initialize the variable if it isn't already there, instead it just assumes * the flags are 0 */ -#define DECLARE_AND_GET_RE_DEBUG_FLAGS_NON_REGEX \ - volatile IV re_debug_flags = 0; PERL_UNUSED_VAR(re_debug_flags); \ - STMT_START { \ - SV * re_debug_flags_sv = NULL; \ - /* get_sv() can return NULL during global destruction. */ \ - re_debug_flags_sv = PL_curcop ? get_sv(RE_DEBUG_FLAGS, GV_ADD) : NULL; \ - if (re_debug_flags_sv && SvIOK(re_debug_flags_sv)) \ - re_debug_flags=SvIV(re_debug_flags_sv); \ +#define DECLARE_AND_GET_RE_DEBUG_FLAGS_NON_REGEX \ + volatile IV re_debug_flags = 0; PERL_UNUSED_VAR(re_debug_flags); \ + STMT_START { \ + SV * re_debug_flags_sv = NULL; \ + /* get_sv() can return NULL during global destruction. */ \ + re_debug_flags_sv = PL_curcop ? get_sv(RE_DEBUG_FLAGS, GV_ADD) : NULL; \ + if (re_debug_flags_sv && SvIOK(re_debug_flags_sv)) \ + re_debug_flags=SvIV(re_debug_flags_sv); \ } STMT_END @@ -1349,28 +1349,28 @@ re.pm, especially to the documentation. /* For use in regcomp.c and regexec.c, Get the debug flags, and initialize to * the defaults if not done already */ -#define DECLARE_AND_GET_RE_DEBUG_FLAGS \ - volatile IV re_debug_flags = 0; PERL_UNUSED_VAR(re_debug_flags); \ - DEBUG_r({ \ - SV * re_debug_flags_sv = NULL; \ - /* get_sv() can return NULL during global destruction. */ \ - re_debug_flags_sv = PL_curcop ? get_sv(RE_DEBUG_FLAGS, GV_ADD) : NULL; \ - if (re_debug_flags_sv) { \ - if (!SvIOK(re_debug_flags_sv)) /* If doesnt exist set to default */\ - sv_setuv(re_debug_flags_sv, \ - /* These defaults should be kept in sync with re.pm */ \ - RE_DEBUG_COMPILE_DUMP | RE_DEBUG_EXECUTE_MASK ); \ - re_debug_flags=SvIV(re_debug_flags_sv); \ - } \ +#define DECLARE_AND_GET_RE_DEBUG_FLAGS \ + volatile IV re_debug_flags = 0; PERL_UNUSED_VAR(re_debug_flags); \ + DEBUG_r({ \ + SV * re_debug_flags_sv = NULL; \ + /* get_sv() can return NULL during global destruction. */ \ + re_debug_flags_sv = PL_curcop ? get_sv(RE_DEBUG_FLAGS, GV_ADD) : NULL; \ + if (re_debug_flags_sv) { \ + if (!SvIOK(re_debug_flags_sv)) /* If doesnt exist set to default */ \ + sv_setuv(re_debug_flags_sv, \ + /* These defaults should be kept in sync with re.pm */ \ + RE_DEBUG_COMPILE_DUMP | RE_DEBUG_EXECUTE_MASK ); \ + re_debug_flags=SvIV(re_debug_flags_sv); \ + } \ }) #define isDEBUG_WILDCARD (DEBUG_v_TEST || RE_DEBUG_FLAG(RE_DEBUG_EXTRA_WILDCARD)) -#define RE_PV_COLOR_DECL(rpv,rlen,isuni,dsv,pv,l,m,c1,c2) \ - const char * const rpv = \ - pv_pretty((dsv), (pv), (l), (m), \ - PL_colors[(c1)],PL_colors[(c2)], \ - PERL_PV_ESCAPE_RE|PERL_PV_ESCAPE_NONASCII |((isuni) ? PERL_PV_ESCAPE_UNI : 0) ); \ +#define RE_PV_COLOR_DECL(rpv,rlen,isuni,dsv,pv,l,m,c1,c2) \ + const char * const rpv = \ + pv_pretty((dsv), (pv), (l), (m), \ + PL_colors[(c1)],PL_colors[(c2)], \ + PERL_PV_ESCAPE_RE|PERL_PV_ESCAPE_NONASCII |((isuni) ? PERL_PV_ESCAPE_UNI : 0) ); \ const int rlen = SvCUR(dsv) /* This is currently unsed in the core */ @@ -1380,12 +1380,12 @@ re.pm, especially to the documentation. PL_colors[(c1)],PL_colors[(c2)], \ PERL_PV_ESCAPE_RE|PERL_PV_ESCAPE_NONASCII |((isuni) ? PERL_PV_ESCAPE_UNI : 0) ) -#define RE_PV_QUOTED_DECL(rpv,isuni,dsv,pv,l,m) \ - const char * const rpv = \ - pv_pretty((dsv), (pv), (l), (m), \ - PL_colors[0], PL_colors[1], \ - ( PERL_PV_PRETTY_QUOTE | PERL_PV_ESCAPE_RE | PERL_PV_ESCAPE_NONASCII | PERL_PV_PRETTY_ELLIPSES | \ - ((isuni) ? PERL_PV_ESCAPE_UNI : 0)) \ +#define RE_PV_QUOTED_DECL(rpv,isuni,dsv,pv,l,m) \ + const char * const rpv = \ + pv_pretty((dsv), (pv), (l), (m), \ + PL_colors[0], PL_colors[1], \ + ( PERL_PV_PRETTY_QUOTE | PERL_PV_ESCAPE_RE | PERL_PV_ESCAPE_NONASCII | PERL_PV_PRETTY_ELLIPSES | \ + ((isuni) ? PERL_PV_ESCAPE_UNI : 0)) \ ) #define RE_SV_DUMPLEN(ItEm) (SvCUR(ItEm) - (SvTAIL(ItEm)!=0)) @@ -1434,9 +1434,9 @@ typedef enum { # define MAX_ANYOF_HRx_BYTE 0xEF #endif #define LOWEST_ANYOF_HRx_BYTE(b) (((b) >> 2) + 0xC0) -#define HIGHEST_ANYOF_HRx_BYTE(b) \ - (LOWEST_ANYOF_HRx_BYTE(b) \ - + ((MAX_ANYOF_HRx_BYTE - LOWEST_ANYOF_HRx_BYTE(b)) >> ((b) & 3))) +#define HIGHEST_ANYOF_HRx_BYTE(b) \ + (LOWEST_ANYOF_HRx_BYTE(b) \ + + ((MAX_ANYOF_HRx_BYTE - LOWEST_ANYOF_HRx_BYTE(b)) >> ((b) & 3))) #if !defined(PERL_IN_XSUB_RE) || defined(PLUGGABLE_RE_EXTENSION) # define GET_REGCLASS_AUX_DATA(a,b,c,d,e,f) get_regclass_aux_data(a,b,c,d,e,f) diff --git a/regexp.h b/regexp.h index 3e7974b89c1a..2f18b4fbb800 100644 --- a/regexp.h +++ b/regexp.h @@ -304,24 +304,24 @@ and check for NULL. # define RXf_PMf_STD_PMMOD (RXf_PMf_MULTILINE|RXf_PMf_SINGLELINE|RXf_PMf_FOLD|RXf_PMf_EXTENDED|RXf_PMf_EXTENDED_MORE|RXf_PMf_NOCAPTURE) -# define CASE_STD_PMMOD_FLAGS_PARSE_SET(pmfl, x_count) \ - case IGNORE_PAT_MOD: *(pmfl) |= RXf_PMf_FOLD; break; \ - case MULTILINE_PAT_MOD: *(pmfl) |= RXf_PMf_MULTILINE; break; \ - case SINGLE_PAT_MOD: *(pmfl) |= RXf_PMf_SINGLELINE; break; \ - case XTENDED_PAT_MOD: if (x_count == 0) { \ - *(pmfl) |= RXf_PMf_EXTENDED; \ - *(pmfl) &= ~RXf_PMf_EXTENDED_MORE; \ - } \ - else { \ - *(pmfl) |= RXf_PMf_EXTENDED \ - |RXf_PMf_EXTENDED_MORE; \ - } \ - (x_count)++; break; \ - case NOCAPTURE_PAT_MOD: *(pmfl) |= RXf_PMf_NOCAPTURE; break; +# define CASE_STD_PMMOD_FLAGS_PARSE_SET(pmfl, x_count) \ + case IGNORE_PAT_MOD: *(pmfl) |= RXf_PMf_FOLD; break; \ + case MULTILINE_PAT_MOD: *(pmfl) |= RXf_PMf_MULTILINE; break; \ + case SINGLE_PAT_MOD: *(pmfl) |= RXf_PMf_SINGLELINE; break; \ + case XTENDED_PAT_MOD: if (x_count == 0) { \ + *(pmfl) |= RXf_PMf_EXTENDED; \ + *(pmfl) &= ~RXf_PMf_EXTENDED_MORE; \ + } \ + else { \ + *(pmfl) |= RXf_PMf_EXTENDED \ + |RXf_PMf_EXTENDED_MORE; \ + } \ + (x_count)++; break; \ + case NOCAPTURE_PAT_MOD: *(pmfl) |= RXf_PMf_NOCAPTURE; break; /* Note, includes charset ones, assumes 0 is the default for them */ -# define STD_PMMOD_FLAGS_CLEAR(pmfl) \ - *(pmfl) &= ~(RXf_PMf_FOLD|RXf_PMf_MULTILINE|RXf_PMf_SINGLELINE|RXf_PMf_EXTENDED|RXf_PMf_EXTENDED_MORE|RXf_PMf_CHARSET|RXf_PMf_NOCAPTURE) +# define STD_PMMOD_FLAGS_CLEAR(pmfl) \ + *(pmfl) &= ~(RXf_PMf_FOLD|RXf_PMf_MULTILINE|RXf_PMf_SINGLELINE|RXf_PMf_EXTENDED|RXf_PMf_EXTENDED_MORE|RXf_PMf_CHARSET|RXf_PMf_NOCAPTURE) /* chars and strings used as regex pattern modifiers * Singular is a 'c'har, plural is a "string" @@ -496,10 +496,10 @@ and check for NULL. # define RXp_HAS_CUTGROUP(prog) ((prog)->intflags & PREGf_CUTGROUP_SEEN) -# define RX_MATCH_TAINTED_set(rx_sv, t) \ - ((t)\ - ? RX_MATCH_TAINTED_on(rx_sv) \ - : RX_MATCH_TAINTED_off(rx_sv)) +# define RX_MATCH_TAINTED_set(rx_sv, t) \ + ((t) \ + ? RX_MATCH_TAINTED_on(rx_sv) \ + : RX_MATCH_TAINTED_off(rx_sv)) # define RXp_MATCH_COPIED(prog) (RXp_EXTFLAGS(prog) & RXf_COPY_DONE) # define RX_MATCH_COPIED(rx_sv) (RX_EXTFLAGS(rx_sv) & RXf_COPY_DONE) @@ -507,27 +507,27 @@ and check for NULL. # define RX_MATCH_COPIED_on(rx_sv) (RX_EXTFLAGS(rx_sv) |= RXf_COPY_DONE) # define RXp_MATCH_COPIED_off(prog) (RXp_EXTFLAGS(prog) &= ~RXf_COPY_DONE) # define RX_MATCH_COPIED_off(rx_sv) (RX_EXTFLAGS(rx_sv) &= ~RXf_COPY_DONE) -# define RX_MATCH_COPIED_set(rx_sv,t) \ - ((t)\ - ? RX_MATCH_COPIED_on(rx_sv) \ - : RX_MATCH_COPIED_off(rx_sv)) +# define RX_MATCH_COPIED_set(rx_sv,t) \ + ((t) \ + ? RX_MATCH_COPIED_on(rx_sv) \ + : RX_MATCH_COPIED_off(rx_sv)) # define RXp_EXTFLAGS(rx) ((rx)->extflags) # define RXp_COMPFLAGS(rx) ((rx)->compflags) /* For source compatibility. We used to store these explicitly. */ -# define RX_PRECOMP(rx_sv) \ - (RX_WRAPPED(rx_sv)\ - + ReANY(rx_sv)->pre_prefix) -# define RX_PRECOMP_const(rx_sv) \ - (RX_WRAPPED_const(rx_sv)\ - + ReANY(rx_sv)->pre_prefix) +# define RX_PRECOMP(rx_sv) \ + (RX_WRAPPED(rx_sv) \ + + ReANY(rx_sv)->pre_prefix) +# define RX_PRECOMP_const(rx_sv) \ + (RX_WRAPPED_const(rx_sv) \ + + ReANY(rx_sv)->pre_prefix) /* FIXME? Are we hardcoding too much here and constraining plugin extension writers? Specifically, the value 1 assumes that the wrapped version always has exactly one character at the end, a ')'. Will that always be true? */ -# define RX_PRELEN(rx_sv) \ - (RX_WRAPLEN(rx_sv)\ - - ReANY(rx_sv)->pre_prefix - 1) +# define RX_PRELEN(rx_sv) \ + (RX_WRAPLEN(rx_sv) \ + - ReANY(rx_sv)->pre_prefix - 1) # define RX_WRAPPED(rx_sv) SvPVX(rx_sv) # define RX_WRAPPED_const(rx_sv) SvPVX_const(rx_sv) @@ -559,9 +559,9 @@ and check for NULL. # define RXp_SAVED_COPY(prog) (prog->saved_copy) # define RX_SAVED_COPY(rx_sv) (RXp_SAVED_COPY(ReANY(rx_sv))) /* last match was zero-length */ -# define RXp_ZERO_LEN(prog) \ - (RXp_OFFS(prog)[0].start + (SSize_t)RXp_GOFS(prog) \ - == RXp_OFFS(prog)[0].end) +# define RXp_ZERO_LEN(prog) \ + (RXp_OFFS(prog)[0].start + (SSize_t)RXp_GOFS(prog) \ + == RXp_OFFS(prog)[0].end) # define RX_ZERO_LEN(rx_sv) (RXp_ZERO_LEN(ReANY(rx_sv))) #endif /* PLUGGABLE_RE_EXTENSION */ @@ -570,23 +570,23 @@ and check for NULL. #ifdef PERL_ANY_COW # define RXp_MATCH_COPY_FREE(prog) \ - STMT_START { \ - if (RXp_SAVED_COPY(prog)) { \ - SV_CHECK_THINKFIRST_COW_DROP(RXp_SAVED_COPY(prog)); \ - } \ - if (RXp_MATCH_COPIED(prog)) { \ - Safefree(RXp_SUBBEG(prog)); \ - RXp_MATCH_COPIED_off(prog); \ - } \ - } STMT_END + STMT_START { \ + if (RXp_SAVED_COPY(prog)) { \ + SV_CHECK_THINKFIRST_COW_DROP(RXp_SAVED_COPY(prog)); \ + } \ + if (RXp_MATCH_COPIED(prog)) { \ + Safefree(RXp_SUBBEG(prog)); \ + RXp_MATCH_COPIED_off(prog); \ + } \ + } STMT_END #else -# define RXp_MATCH_COPY_FREE(prog) \ - STMT_START { \ - if (RXp_MATCH_COPIED(prog)) { \ - Safefree(RXp_SUBBEG(prog)); \ - RXp_MATCH_COPIED_off(prog); \ - } \ - } STMT_END +# define RXp_MATCH_COPY_FREE(prog) \ + STMT_START { \ + if (RXp_MATCH_COPIED(prog)) { \ + Safefree(RXp_SUBBEG(prog)); \ + RXp_MATCH_COPIED_off(prog); \ + } \ + } STMT_END #endif #define RX_MATCH_COPY_FREE(rx_sv) RXp_MATCH_COPY_FREE(ReANY(rx_sv)) @@ -596,9 +596,9 @@ and check for NULL. #define RX_MATCH_UTF8_on(rx_sv) (RXp_MATCH_UTF8_on(ReANY(rx_sv))) #define RXp_MATCH_UTF8_off(prog) (RXp_EXTFLAGS(prog) &= ~RXf_MATCH_UTF8) #define RX_MATCH_UTF8_off(rx_sv) (RXp_MATCH_UTF8_off(ReANY(rx_sv)) -#define RXp_MATCH_UTF8_set(prog, t) \ - ((t)\ - ? RXp_MATCH_UTF8_on(prog) \ +#define RXp_MATCH_UTF8_set(prog, t) \ + ((t) \ + ? RXp_MATCH_UTF8_on(prog) \ : RXp_MATCH_UTF8_off(prog)) #define RX_MATCH_UTF8_set(rx_sv, t) (RXp_MATCH_UTF8_set(ReANY(rx_sv), t)) @@ -625,20 +625,20 @@ and check for NULL. on second iteration */ #if defined(PERL_USE_GCC_BRACE_GROUPS) -# define ReREFCNT_inc(re) \ - ({ \ - /* This is here to generate a casting warning if incorrect. */ \ - REGEXP *const _rerefcnt_inc = (re); \ - assert(SvTYPE(_rerefcnt_inc) == SVt_REGEXP); \ - SvREFCNT_inc(_rerefcnt_inc); \ - _rerefcnt_inc; \ - }) -# define ReREFCNT_dec(re) \ - ({ \ - /* This is here to generate a casting warning if incorrect. */ \ - REGEXP *const _rerefcnt_dec = (re); \ - SvREFCNT_dec(_rerefcnt_dec); \ - }) +# define ReREFCNT_inc(re) \ + ({ \ + /* This is here to generate a casting warning if incorrect. */ \ + REGEXP *const _rerefcnt_inc = (re); \ + assert(SvTYPE(_rerefcnt_inc) == SVt_REGEXP); \ + SvREFCNT_inc(_rerefcnt_inc); \ + _rerefcnt_inc; \ + }) +# define ReREFCNT_dec(re) \ + ({ \ + /* This is here to generate a casting warning if incorrect. */ \ + REGEXP *const _rerefcnt_dec = (re); \ + SvREFCNT_dec(_rerefcnt_dec); \ + }) #else # define ReREFCNT_dec(re) SvREFCNT_dec(re) # define ReREFCNT_inc(re) ((REGEXP *) SvREFCNT_inc(re)) @@ -938,7 +938,7 @@ typedef struct regmatch_state { * We do it in 4K blocks for efficiency. The "3" is 2 for the next/prev * pointers, plus 1 for any mythical malloc overhead. */ -#define PERL_REGMATCH_SLAB_SLOTS \ +#define PERL_REGMATCH_SLAB_SLOTS \ ((4096 - 3 * sizeof (void*)) / sizeof(regmatch_state)) typedef struct regmatch_slab { diff --git a/sbox32_hash.h b/sbox32_hash.h index 972805a00e7a..6b37b1d91d1d 100644 --- a/sbox32_hash.h +++ b/sbox32_hash.h @@ -82,32 +82,32 @@ #define SBOX32_STATE_BITS (SBOX32_STATE_BYTES * 8) #endif -#define SBOX32_MIX4(v0,v1,v2,v3,text) \ - STMT_START {\ - SBOX32_WARN5("v0=%08x v1=%08x v2=%08x v3=%08x - SBOX32_MIX4 %s\n", \ - (unsigned int)v0, (unsigned int)v1, \ - (unsigned int)v2, (unsigned int)v3, text); \ - v0 = ROTL32(v0,13) - v3; \ - v1 ^= v2; \ - v3 = ROTL32(v3, 9) + v1; \ - v2 ^= v0; \ - v0 = ROTL32(v0,14) ^ v3; \ - v1 = ROTL32(v1,25) - v2; \ - v3 ^= v1; \ - v2 = ROTL32(v2, 4) - v0; \ -} STMT_END +#define SBOX32_MIX4(v0,v1,v2,v3,text) \ + STMT_START { \ + SBOX32_WARN5("v0=%08x v1=%08x v2=%08x v3=%08x - SBOX32_MIX4 %s\n", \ + (unsigned int)v0, (unsigned int)v1, \ + (unsigned int)v2, (unsigned int)v3, text); \ + v0 = ROTL32(v0,13) - v3; \ + v1 ^= v2; \ + v3 = ROTL32(v3, 9) + v1; \ + v2 ^= v0; \ + v0 = ROTL32(v0,14) ^ v3; \ + v1 = ROTL32(v1,25) - v2; \ + v3 ^= v1; \ + v2 = ROTL32(v2, 4) - v0; \ + } STMT_END -#define SBOX32_MIX3(v0,v1,v2,text) \ - STMT_START {\ - SBOX32_WARN4("v0=%08x v1=%08x v2=%08x - SBOX32_MIX3 %s\n", \ - (unsigned int)v0,(unsigned int)v1,(unsigned int)v2, text ); \ - v0 = ROTL32(v0,16) - v2; \ - v1 = ROTR32(v1,13) ^ v2; \ - v2 = ROTL32(v2,17) + v1; \ - v0 = ROTR32(v0, 2) + v1; \ - v1 = ROTR32(v1,17) - v0; \ - v2 = ROTR32(v2, 7) ^ v0; \ -} STMT_END +#define SBOX32_MIX3(v0,v1,v2,text) \ + STMT_START { \ + SBOX32_WARN4("v0=%08x v1=%08x v2=%08x - SBOX32_MIX3 %s\n", \ + (unsigned int)v0,(unsigned int)v1,(unsigned int)v2, text ); \ + v0 = ROTL32(v0,16) - v2; \ + v1 = ROTR32(v1,13) ^ v2; \ + v2 = ROTL32(v2,17) + v1; \ + v0 = ROTR32(v0, 2) + v1; \ + v1 = ROTR32(v1,17) - v0; \ + v2 = ROTR32(v2, 7) ^ v0; \ + } STMT_END #if SBOX32_MAX_LEN > 256 #error "SBOX32_MAX_LEN is set too high!" @@ -1392,19 +1392,19 @@ #define case_1_SBOX32(hash,state,key) /**/ #endif -#define XORSHIFT128_set(r,x,y,z,w,t) \ - STMT_START {\ - t = ( x ^ ( x << 5 ) ); \ - x = y; y = z; z = w; \ - r = w = ( w ^ ( w >> 29 ) ) ^ ( t ^ ( t >> 12 ) ); \ -} STMT_END +#define XORSHIFT128_set(r,x,y,z,w,t) \ + STMT_START { \ + t = ( x ^ ( x << 5 ) ); \ + x = y; y = z; z = w; \ + r = w = ( w ^ ( w >> 29 ) ) ^ ( t ^ ( t >> 12 ) ); \ + } STMT_END #ifndef SBOX32_CHURN_ROUNDS #define SBOX32_CHURN_ROUNDS 128 #endif -#define _SBOX32_CASE(len,hash,state,key) \ - /* FALLTHROUGH */ \ +#define _SBOX32_CASE(len,hash,state,key) \ + /* FALLTHROUGH */ \ case len: hash ^= state[ 1 + ( 256 * ( len - 1 ) ) + key[ len - 1 ] ]; diff --git a/scope.h b/scope.h index 475d1fab7645..2fd0ace8e7c8 100644 --- a/scope.h +++ b/scope.h @@ -52,16 +52,16 @@ * * These are for internal core use only and are subject to change */ -#define dSS_ADD \ - I32 ix = PL_savestack_ix; \ +#define dSS_ADD \ + I32 ix = PL_savestack_ix; \ ANY *ssp = &PL_savestack[ix] -#define SS_ADD_END(need) \ - assert((need) <= SS_MAXPUSH); \ - ix += (need); \ - PL_savestack_ix = ix; \ - assert(ix <= PL_savestack_max + SS_MAXPUSH); \ - if (UNLIKELY(ix > PL_savestack_max)) savestack_grow(); \ +#define SS_ADD_END(need) \ + assert((need) <= SS_MAXPUSH); \ + ix += (need); \ + PL_savestack_ix = ix; \ + assert(ix <= PL_savestack_max + SS_MAXPUSH); \ + if (UNLIKELY(ix > PL_savestack_max)) savestack_grow(); \ assert(PL_savestack_ix <= PL_savestack_max); #define SS_ADD_INT(i) ((ssp++)->any_i32 = (I32)(i)) @@ -118,34 +118,34 @@ scope has the given name. C must be a literal string. #define FREETMPS if (PL_tmps_ix > PL_tmps_floor) free_tmps() #ifdef DEBUGGING -#define ENTER \ - STMT_START { \ - push_scope(); \ - DEBUG_SCOPE("ENTER") \ +#define ENTER \ + STMT_START { \ + push_scope(); \ + DEBUG_SCOPE("ENTER") \ } STMT_END -#define LEAVE \ - STMT_START { \ - DEBUG_SCOPE("LEAVE") \ - pop_scope(); \ +#define LEAVE \ + STMT_START { \ + DEBUG_SCOPE("LEAVE") \ + pop_scope(); \ } STMT_END -#define ENTER_with_name(name) \ - STMT_START { \ - push_scope(); \ - if (PL_scopestack_name) \ - PL_scopestack_name[PL_scopestack_ix-1] = ASSERT_IS_LITERAL(name);\ - DEBUG_SCOPE("ENTER \"" name "\"") \ +#define ENTER_with_name(name) \ + STMT_START { \ + push_scope(); \ + if (PL_scopestack_name) \ + PL_scopestack_name[PL_scopestack_ix-1] = ASSERT_IS_LITERAL(name); \ + DEBUG_SCOPE("ENTER \"" name "\"") \ } STMT_END -#define LEAVE_with_name(name) \ - STMT_START { \ - DEBUG_SCOPE("LEAVE \"" name "\"") \ - if (PL_scopestack_name) { \ - CLANG_DIAG_IGNORE_STMT(-Wstring-compare); \ - assert(((char*)PL_scopestack_name[PL_scopestack_ix-1] \ - == (char*)ASSERT_IS_LITERAL(name)) \ - || strEQ(PL_scopestack_name[PL_scopestack_ix-1], name)); \ - CLANG_DIAG_RESTORE_STMT; \ - } \ - pop_scope(); \ +#define LEAVE_with_name(name) \ + STMT_START { \ + DEBUG_SCOPE("LEAVE \"" name "\"") \ + if (PL_scopestack_name) { \ + CLANG_DIAG_IGNORE_STMT(-Wstring-compare); \ + assert(((char*)PL_scopestack_name[PL_scopestack_ix-1] \ + == (char*)ASSERT_IS_LITERAL(name)) \ + || strEQ(PL_scopestack_name[PL_scopestack_ix-1], name)); \ + CLANG_DIAG_RESTORE_STMT; \ + } \ + pop_scope(); \ } STMT_END #else #define ENTER push_scope() @@ -153,9 +153,9 @@ scope has the given name. C must be a literal string. #define ENTER_with_name(name) ENTER #define LEAVE_with_name(name) LEAVE #endif -#define LEAVE_SCOPE(old) \ - STMT_START {\ - if (PL_savestack_ix > old) leave_scope(old); \ +#define LEAVE_SCOPE(old) \ + STMT_START { \ + if (PL_savestack_ix > old) leave_scope(old); \ } STMT_END #define SAVEI8(i) save_I8((I8*)&(i)) @@ -183,24 +183,24 @@ scope has the given name. C must be a literal string. #define SAVESETSVFLAGS(sv,mask,val) save_set_svflags(sv,mask,val) #define SAVEFREECOPHH(h) save_pushptr((void *)(h), SAVEt_FREECOPHH) -#define SAVEDELETE(h,k,l) \ - save_delete(MUTABLE_HV(h), (char*)(k), (I32)(l)) -#define SAVEHDELETE(h,s) \ - save_hdelete(MUTABLE_HV(h), (s)) -#define SAVEADELETE(a,k) \ - save_adelete(MUTABLE_AV(a), (SSize_t)(k)) +#define SAVEDELETE(h,k,l) \ + save_delete(MUTABLE_HV(h), (char*)(k), (I32)(l)) +#define SAVEHDELETE(h,s) \ + save_hdelete(MUTABLE_HV(h), (s)) +#define SAVEADELETE(a,k) \ + save_adelete(MUTABLE_AV(a), (SSize_t)(k)) #define SAVEDESTRUCTOR(f,p) \ - save_destructor((DESTRUCTORFUNC_NOCONTEXT_t)(f), (void*)(p)) + save_destructor((DESTRUCTORFUNC_NOCONTEXT_t)(f), (void*)(p)) -#define SAVEDESTRUCTOR_X(f,p) \ - save_destructor_x((DESTRUCTORFUNC_t)(f), (void*)(p)) +#define SAVEDESTRUCTOR_X(f,p) \ + save_destructor_x((DESTRUCTORFUNC_t)(f), (void*)(p)) -#define SAVESTACK_POS() \ - STMT_START { \ - dSS_ADD; \ - SS_ADD_INT(PL_stack_sp - PL_stack_base); \ - SS_ADD_UV(SAVEt_STACK_POS); \ - SS_ADD_END(2); \ +#define SAVESTACK_POS() \ + STMT_START { \ + dSS_ADD; \ + SS_ADD_INT(PL_stack_sp - PL_stack_base); \ + SS_ADD_UV(SAVEt_STACK_POS); \ + SS_ADD_END(2); \ } STMT_END #define SAVEOP() save_op() @@ -209,11 +209,11 @@ scope has the given name. C must be a literal string. #define SAVECOMPPAD() save_pushptr(MUTABLE_SV(PL_comppad), SAVEt_COMPPAD) -#define SAVESWITCHSTACK(f,t) \ - STMT_START { \ - save_pushptrptr(MUTABLE_SV(f), MUTABLE_SV(t), SAVEt_SAVESWITCHSTACK); \ - SWITCHSTACK((f),(t)); \ - PL_curstackinfo->si_stack = (t); \ +#define SAVESWITCHSTACK(f,t) \ + STMT_START { \ + save_pushptrptr(MUTABLE_SV(f), MUTABLE_SV(t), SAVEt_SAVESWITCHSTACK); \ + SWITCHSTACK((f),(t)); \ + PL_curstackinfo->si_stack = (t); \ } STMT_END /* Note these are special, we can't just use a save_pushptrptr() on them @@ -227,17 +227,17 @@ scope has the given name. C must be a literal string. #ifdef USE_ITHREADS # define SAVECOPSTASH_FREE(c) SAVEIV((c)->cop_stashoff) # define SAVECOPFILE_x(c) SAVEPPTR((c)->cop_file) -# define SAVECOPFILE(c) \ - STMT_START { \ - SAVECOPFILE_x(c); \ - CopFILE_debug((c),"SAVECOPFILE",0); \ - } STMT_END +# define SAVECOPFILE(c) \ + STMT_START { \ + SAVECOPFILE_x(c); \ + CopFILE_debug((c),"SAVECOPFILE",0); \ + } STMT_END # define SAVECOPFILE_FREE_x(c) SAVERCPVFREE((c)->cop_file) -# define SAVECOPFILE_FREE(c) \ - STMT_START { \ - SAVECOPFILE_FREE_x(c); \ - CopFILE_debug((c),"SAVECOPFILE_FREE",0); \ - } STMT_END +# define SAVECOPFILE_FREE(c) \ + STMT_START { \ + SAVECOPFILE_FREE_x(c); \ + CopFILE_debug((c),"SAVECOPFILE_FREE",0); \ + } STMT_END #else # /* XXX not refcounted */ # define SAVECOPSTASH_FREE(c) SAVESPTR(CopSTASH(c)) @@ -280,8 +280,8 @@ casts it to a pointer of that C. #define SSNEW(size) Perl_save_alloc(aTHX_ (size), 0) #define SSNEWt(n,t) SSNEW((n)*sizeof(t)) -#define SSNEWa(size,align) \ - Perl_save_alloc(aTHX_ (size),\ +#define SSNEWa(size,align) \ + Perl_save_alloc(aTHX_ (size), \ (I32)(align - ((size_t)((caddr_t)&PL_savestack[PL_savestack_ix]) % align)) % align) #define SSNEWat(n,t,align) SSNEWa((n)*sizeof(t), align) @@ -291,13 +291,13 @@ casts it to a pointer of that C. #define save_freesv(op) save_pushptr((void *)(op), SAVEt_FREESV) #define save_mortalizesv(op) save_pushptr((void *)(op), SAVEt_MORTALIZESV) -# define save_freeop(op) \ -STMT_START { \ - OP * const _o = (OP *)(op); \ - assert(!_o->op_savefree); \ - _o->op_savefree = 1; \ - save_pushptr((void *)(_o), SAVEt_FREEOP); \ - } STMT_END +# define save_freeop(op) \ + STMT_START { \ + OP * const _o = (OP *)(op); \ + assert(!_o->op_savefree); \ + _o->op_savefree = 1; \ + save_pushptr((void *)(_o), SAVEt_FREEOP); \ + } STMT_END #define save_freepv(pv) save_pushptr((void *)(pv), SAVEt_FREEPV) /* diff --git a/sv.h b/sv.h index 1af7989b5f0b..823bf69d3ef4 100644 --- a/sv.h +++ b/sv.h @@ -196,8 +196,8 @@ typedef struct hek HEK; /* Using C's structural equivalence to help emulate C++ inheritance here... */ /* start with 2 sv-head building blocks */ -#define _SV_HEAD(ptrtype) \ - ptrtype sv_any; /* pointer to body */ \ +#define _SV_HEAD(ptrtype) \ + ptrtype sv_any; /* pointer to body */ \ U32 sv_refcnt; /* how many references to us */ \ U32 sv_flags /* what we are */ @@ -207,27 +207,27 @@ typedef struct hek HEK; # define _NV_BODYLESS_UNION #endif -#define _SV_HEAD_UNION \ - union { \ - char* svu_pv; /* pointer to malloced string */ \ - IV svu_iv; \ - UV svu_uv; \ - _NV_BODYLESS_UNION \ - SV* svu_rv; /* pointer to another SV */ \ - SV** svu_array; \ - HE** svu_hash; \ - GP* svu_gp; \ - PerlIO *svu_fp; \ - } sv_u \ +#define _SV_HEAD_UNION \ + union { \ + char* svu_pv; /* pointer to malloced string */ \ + IV svu_iv; \ + UV svu_uv; \ + _NV_BODYLESS_UNION \ + SV* svu_rv; /* pointer to another SV */ \ + SV** svu_array; \ + HE** svu_hash; \ + GP* svu_gp; \ + PerlIO *svu_fp; \ + } sv_u \ _SV_HEAD_DEBUG #ifdef DEBUG_LEAKING_SCALARS -#define _SV_HEAD_DEBUG;\ - PERL_BITFIELD32 sv_debug_optype:9; /* the type of OP that allocated us */ \ - PERL_BITFIELD32 sv_debug_inpad:1; /* was allocated in a pad for an OP */ \ - PERL_BITFIELD32 sv_debug_line:16; /* the line where we were allocated */ \ - UV sv_debug_serial; /* serial number of sv allocation */ \ - char * sv_debug_file; /* the file where we were allocated */ \ +#define _SV_HEAD_DEBUG; \ + PERL_BITFIELD32 sv_debug_optype:9; /* the type of OP that allocated us */ \ + PERL_BITFIELD32 sv_debug_inpad:1; /* was allocated in a pad for an OP */ \ + PERL_BITFIELD32 sv_debug_line:16; /* the line where we were allocated */ \ + UV sv_debug_serial; /* serial number of sv allocation */ \ + char * sv_debug_file; /* the file where we were allocated */ \ SV * sv_debug_parent /* what we were cloned from (ithreads)*/ #else #define _SV_HEAD_DEBUG @@ -349,12 +349,12 @@ perform the upgrade if necessary. See C>. #define SvREFCNT_inc_void(sv) Perl_SvREFCNT_inc_void(MUTABLE_SV(sv)) /* These guys don't need the curly blocks */ -#define SvREFCNT_inc_simple_void(sv) \ - STMT_START { \ - SV * sv_ = MUTABLE_SV(sv); \ - if (sv_) \ - SvREFCNT(sv_)++; \ - } STMT_END +#define SvREFCNT_inc_simple_void(sv) \ + STMT_START { \ + SV * sv_ = MUTABLE_SV(sv); \ + if (sv_) \ + SvREFCNT(sv_)++; \ + } STMT_END #define SvREFCNT_inc_simple_NN(sv) (++(SvREFCNT(sv)),MUTABLE_SV(sv)) #define SvREFCNT_inc_void_NN(sv) (void)(++SvREFCNT(MUTABLE_SV(sv))) @@ -373,7 +373,7 @@ perform the upgrade if necessary. See C>. /* this is defined in this peculiar way to avoid compiler warnings. * See the <20121213131428.GD1842@iabyn.com> thread in p5p */ -#define SvUPGRADE(sv, mt) \ +#define SvUPGRADE(sv, mt) \ ((void)(SvTYPE(sv) >= (mt) || (sv_upgrade(sv, mt),1))) #define SVf_IOK 0x00000100 /* has valid public integer value */ @@ -435,12 +435,12 @@ perform the upgrade if necessary. See C>. -#define SVf_THINKFIRST \ - (SVf_READONLY|SVf_PROTECT|SVf_ROK|SVf_FAKE\ +#define SVf_THINKFIRST \ + (SVf_READONLY|SVf_PROTECT|SVf_ROK|SVf_FAKE \ |SVs_RMG|SVf_IsCOW) -#define SVf_OK \ - (SVf_IOK|SVf_NOK|SVf_POK|SVf_ROK|\ +#define SVf_OK \ + (SVf_IOK|SVf_NOK|SVf_POK|SVf_ROK| \ SVp_IOK|SVp_NOK|SVp_POK|SVpgv_GP) #define PRIVSHIFT 4 /* (SVp_?OK >> PRIVSHIFT) == SVf_?OK */ @@ -591,30 +591,30 @@ struct xpvgv { typedef U32 cv_flags_t; -#define _XPVCV_COMMON \ - HV * xcv_stash; \ - union { \ - OP * xcv_start; \ - ANY xcv_xsubany; \ - } xcv_start_u; \ - union { \ - OP * xcv_root; \ - void (*xcv_xsub) (pTHX_ CV*); \ - } xcv_root_u; \ - union { \ - GV * xcv_gv; \ - HEK * xcv_hek; \ - } xcv_gv_u; \ - char * xcv_file; \ - union { \ - PADLIST * xcv_padlist; \ - void * xcv_hscxt; \ - } xcv_padlist_u; \ - CV * xcv_outside; \ - U32 xcv_outside_seq; /* the COP sequence (at the point of our \ - * compilation) in the lexically enclosing \ - * sub */ \ - cv_flags_t xcv_flags; \ +#define _XPVCV_COMMON \ + HV * xcv_stash; \ + union { \ + OP * xcv_start; \ + ANY xcv_xsubany; \ + } xcv_start_u; \ + union { \ + OP * xcv_root; \ + void (*xcv_xsub) (pTHX_ CV*); \ + } xcv_root_u; \ + union { \ + GV * xcv_gv; \ + HEK * xcv_hek; \ + } xcv_gv_u; \ + char * xcv_file; \ + union { \ + PADLIST * xcv_padlist; \ + void * xcv_hscxt; \ + } xcv_padlist_u; \ + CV * xcv_outside; \ + U32 xcv_outside_seq; /* the COP sequence (at the point of our \ + * compilation) in the lexically enclosing \ + * sub */ \ + cv_flags_t xcv_flags; \ I32 xcv_depth /* >= 2 indicates recursive call */ /* This structure must match XPVCV in cv.h */ @@ -929,73 +929,73 @@ Set the size of the string buffer for the SV. See C>. #define SvNIOK(sv) (SvFLAGS(sv) & (SVf_IOK|SVf_NOK)) #define SvNIOKp(sv) (SvFLAGS(sv) & (SVp_IOK|SVp_NOK)) -#define SvNIOK_off(sv) \ - (SvFLAGS(sv) &= ~(SVf_IOK|SVf_NOK|\ +#define SvNIOK_off(sv) \ + (SvFLAGS(sv) &= ~(SVf_IOK|SVf_NOK| \ SVp_IOK|SVp_NOK|SVf_IVisUV)) #define assert_not_ROK(sv) assert_(!SvROK(sv) || !SvRV(sv)) #define assert_not_glob(sv) assert_(!isGV_with_GP(sv)) #define SvOK(sv) (SvFLAGS(sv) & SVf_OK) -#define SvOK_off(sv) \ - (assert_not_ROK(sv) assert_not_glob(sv)\ +#define SvOK_off(sv) \ + (assert_not_ROK(sv) assert_not_glob(sv) \ SvFLAGS(sv) &= ~(SVf_OK| \ SVf_IVisUV|SVf_UTF8), \ SvOOK_off(sv)) -#define SvOK_off_exc_UV(sv) \ - (assert_not_ROK(sv)\ - SvFLAGS(sv) &= ~(SVf_OK| \ - SVf_UTF8), \ +#define SvOK_off_exc_UV(sv) \ + (assert_not_ROK(sv) \ + SvFLAGS(sv) &= ~(SVf_OK| \ + SVf_UTF8), \ SvOOK_off(sv)) #define SvOKp(sv) (SvFLAGS(sv) & (SVp_IOK|SVp_NOK|SVp_POK)) #define SvIOKp(sv) (SvFLAGS(sv) & SVp_IOK) -#define SvIOKp_on(sv) \ - (assert_not_glob(sv)\ +#define SvIOKp_on(sv) \ + (assert_not_glob(sv) \ SvFLAGS(sv) |= SVp_IOK) #define SvNOKp(sv) (SvFLAGS(sv) & SVp_NOK) #define SvNOKp_on(sv) (assert_not_glob(sv) SvFLAGS(sv) |= SVp_NOK) #define SvPOKp(sv) (SvFLAGS(sv) & SVp_POK) -#define SvPOKp_on(sv) \ - (assert_not_ROK(sv) assert_not_glob(sv)\ +#define SvPOKp_on(sv) \ + (assert_not_ROK(sv) assert_not_glob(sv) \ SvFLAGS(sv) |= SVp_POK) #define SvIOK(sv) (SvFLAGS(sv) & SVf_IOK) -#define SvIOK_on(sv) \ - (assert_not_glob(sv)\ +#define SvIOK_on(sv) \ + (assert_not_glob(sv) \ SvFLAGS(sv) |= (SVf_IOK|SVp_IOK)) #define SvIOK_off(sv) (SvFLAGS(sv) &= ~(SVf_IOK|SVp_IOK|SVf_IVisUV)) -#define SvIOK_only(sv) \ - (SvOK_off(sv),\ +#define SvIOK_only(sv) \ + (SvOK_off(sv), \ SvFLAGS(sv) |= (SVf_IOK|SVp_IOK)) -#define SvIOK_only_UV(sv) \ - (assert_not_glob(sv) SvOK_off_exc_UV(sv),\ +#define SvIOK_only_UV(sv) \ + (assert_not_glob(sv) SvOK_off_exc_UV(sv), \ SvFLAGS(sv) |= (SVf_IOK|SVp_IOK)) -#define SvIOK_UV(sv) \ - ((SvFLAGS(sv) & (SVf_IOK|SVf_IVisUV))\ +#define SvIOK_UV(sv) \ + ((SvFLAGS(sv) & (SVf_IOK|SVf_IVisUV)) \ == (SVf_IOK|SVf_IVisUV)) #define SvUOK(sv) SvIOK_UV(sv) -#define SvIOK_notUV(sv) \ - ((SvFLAGS(sv) & (SVf_IOK|SVf_IVisUV))\ +#define SvIOK_notUV(sv) \ + ((SvFLAGS(sv) & (SVf_IOK|SVf_IVisUV)) \ == SVf_IOK) #define SvIandPOK(sv) ((SvFLAGS(sv) & (SVf_IOK|SVf_POK)) == (SVf_IOK|SVf_POK)) -#define SvIandPOK_on(sv) \ - (assert_not_glob(sv)\ +#define SvIandPOK_on(sv) \ + (assert_not_glob(sv) \ (SvFLAGS(sv) |= (SVf_IOK|SVp_IOK|SVf_POK|SVp_POK))) #define SvIandPOK_off(sv) (SvFLAGS(sv) &= ~(SVf_IOK|SVp_IOK|SVf_IVisUV|SVf_POK|SVp_POK)) #define SvBoolFlagsOK(sv) SvIandPOK(sv) -#define BOOL_INTERNALS_sv_isbool(sv) \ - (SvIsCOW_static(sv) &&\ +#define BOOL_INTERNALS_sv_isbool(sv) \ + (SvIsCOW_static(sv) && \ (SvPVX_const(sv) == PL_Yes || SvPVX_const(sv) == PL_No)) -#define BOOL_INTERNALS_sv_isbool_true(sv) \ - (SvIsCOW_static(sv) &&\ +#define BOOL_INTERNALS_sv_isbool_true(sv) \ + (SvIsCOW_static(sv) && \ (SvPVX_const(sv) == PL_Yes)) -#define BOOL_INTERNALS_sv_isbool_false(sv) \ - (SvIsCOW_static(sv) &&\ +#define BOOL_INTERNALS_sv_isbool_false(sv) \ + (SvIsCOW_static(sv) && \ (SvPVX_const(sv) == PL_No)) #define SvIsUV(sv) (SvFLAGS(sv) & SVf_IVisUV) @@ -1003,12 +1003,12 @@ Set the size of the string buffer for the SV. See C>. #define SvIsUV_off(sv) (SvFLAGS(sv) &= ~SVf_IVisUV) #define SvNOK(sv) (SvFLAGS(sv) & SVf_NOK) -#define SvNOK_on(sv) \ - (assert_not_glob(sv)\ +#define SvNOK_on(sv) \ + (assert_not_glob(sv) \ SvFLAGS(sv) |= (SVf_NOK|SVp_NOK)) #define SvNOK_off(sv) (SvFLAGS(sv) &= ~(SVf_NOK|SVp_NOK)) -#define SvNOK_only(sv) \ - (SvOK_off(sv),\ +#define SvNOK_only(sv) \ + (SvOK_off(sv), \ SvFLAGS(sv) |= (SVf_NOK|SVp_NOK)) /* @@ -1043,23 +1043,23 @@ in gv.h: */ #define SvUTF8_off(sv) (SvFLAGS(sv) &= ~(SVf_UTF8)) #define SvPOK(sv) (SvFLAGS(sv) & SVf_POK) -#define SvPOK_on(sv) \ - (assert_not_ROK(sv) assert_not_glob(sv)\ +#define SvPOK_on(sv) \ + (assert_not_ROK(sv) assert_not_glob(sv) \ SvFLAGS(sv) |= (SVf_POK|SVp_POK)) #define SvPOK_off(sv) (SvFLAGS(sv) &= ~(SVf_POK|SVp_POK)) -#define SvPOK_only(sv) \ - (assert_not_ROK(sv) assert_not_glob(sv)\ +#define SvPOK_only(sv) \ + (assert_not_ROK(sv) assert_not_glob(sv) \ SvFLAGS(sv) &= ~(SVf_OK| \ SVf_IVisUV|SVf_UTF8), \ SvFLAGS(sv) |= (SVf_POK|SVp_POK)) -#define SvPOK_only_UTF8(sv) \ - (assert_not_ROK(sv) assert_not_glob(sv)\ +#define SvPOK_only_UTF8(sv) \ + (assert_not_ROK(sv) assert_not_glob(sv) \ SvFLAGS(sv) &= ~(SVf_OK| \ SVf_IVisUV), \ SvFLAGS(sv) |= (SVf_POK|SVp_POK)) -#define SvVOK(sv) \ - (SvMAGICAL(sv)\ +#define SvVOK(sv) \ + (SvMAGICAL(sv) \ && mg_find(sv,PERL_MAGIC_vstring)) /* =for apidoc Am|MAGIC*|SvVSTRING_mg|SV * sv @@ -1068,8 +1068,8 @@ Returns the vstring magic, or NULL if none =cut */ -#define SvVSTRING_mg(sv) \ - (SvMAGICAL(sv)\ +#define SvVSTRING_mg(sv) \ + (SvMAGICAL(sv) \ ? mg_find(sv,PERL_MAGIC_vstring) : NULL) #define SvOOK(sv) (SvFLAGS(sv) & SVf_OOK) @@ -1119,8 +1119,8 @@ not. =cut */ -#define SvAMAGIC(sv) \ - (SvROK(sv) && SvOBJECT(SvRV(sv)) &&\ +#define SvAMAGIC(sv) \ + (SvROK(sv) && SvOBJECT(SvRV(sv)) && \ HvAMAGIC(SvSTASH(SvRV(sv)))) /* To be used on the stashes themselves: */ @@ -1150,9 +1150,9 @@ not. #define SvPOK_pure_nogthink(sv) \ ((SvFLAGS(sv) & (SVf_POK|SVf_IOK|SVf_NOK|SVf_ROK|SVpgv_GP|SVf_THINKFIRST|SVs_GMG)) == SVf_POK) -#define SvPOK_utf8_pure_nogthink(sv) \ +#define SvPOK_utf8_pure_nogthink(sv) \ ((SvFLAGS(sv) & (SVf_POK|SVf_UTF8|SVf_IOK|SVf_NOK|SVf_ROK|SVpgv_GP|SVf_THINKFIRST|SVs_GMG)) == (SVf_POK|SVf_UTF8)) -#define SvPOK_byte_pure_nogthink(sv) \ +#define SvPOK_byte_pure_nogthink(sv) \ ((SvFLAGS(sv) & (SVf_POK|SVf_UTF8|SVf_IOK|SVf_NOK|SVf_ROK|SVpgv_GP|SVf_THINKFIRST|SVs_GMG)) == SVf_POK) /* @@ -1182,19 +1182,19 @@ the scalar's value cannot change unless written to. #define SvGAMAGIC(sv) (SvGMAGICAL(sv) || SvAMAGIC(sv)) -#define Gv_AMG(stash) \ - (HvNAME(stash) && Gv_AMupdate(stash,FALSE) \ - ? 1 \ - : (HvAMAGIC_off(stash), 0)) +#define Gv_AMG(stash) \ + (HvNAME(stash) && Gv_AMupdate(stash,FALSE) \ + ? 1 \ + : (HvAMAGIC_off(stash), 0)) -#define SvWEAKREF(sv) \ - ((SvFLAGS(sv) & (SVf_ROK|SVprv_WEAKREF))\ +#define SvWEAKREF(sv) \ + ((SvFLAGS(sv) & (SVf_ROK|SVprv_WEAKREF)) \ == (SVf_ROK|SVprv_WEAKREF)) #define SvWEAKREF_on(sv) (SvFLAGS(sv) |= (SVf_ROK|SVprv_WEAKREF)) #define SvWEAKREF_off(sv) (SvFLAGS(sv) &= ~(SVf_ROK|SVprv_WEAKREF)) -#define SvPCS_IMPORTED(sv) \ - ((SvFLAGS(sv) & (SVf_ROK|SVprv_PCS_IMPORTED))\ +#define SvPCS_IMPORTED(sv) \ + ((SvFLAGS(sv) & (SVf_ROK|SVprv_PCS_IMPORTED)) \ == (SVf_ROK|SVprv_PCS_IMPORTED)) #define SvPCS_IMPORTED_on(sv) (SvFLAGS(sv) |= (SVf_ROK|SVprv_PCS_IMPORTED)) #define SvPCS_IMPORTED_off(sv) (SvFLAGS(sv) &= ~(SVf_ROK|SVprv_PCS_IMPORTED)) @@ -1284,27 +1284,27 @@ object type. Exposed to perl code via Internals::SvREADONLY(). #if defined (DEBUGGING) && defined(PERL_USE_GCC_BRACE_GROUPS) -# define SvTAIL(sv) \ - ({ const SV *const _svtail = (const SV *)(sv);\ - assert(SvTYPE(_svtail) != SVt_PVAV); \ - assert(SvTYPE(_svtail) != SVt_PVHV); \ - assert(!(SvFLAGS(_svtail) & (SVf_NOK|SVp_NOK))); \ - assert(SvVALID(_svtail)); \ - ((XPVNV*)SvANY(_svtail))->xnv_u.xnv_bm_tail; \ - }) +# define SvTAIL(sv) \ + ({ const SV *const _svtail = (const SV *)(sv); \ + assert(SvTYPE(_svtail) != SVt_PVAV); \ + assert(SvTYPE(_svtail) != SVt_PVHV); \ + assert(!(SvFLAGS(_svtail) & (SVf_NOK|SVp_NOK))); \ + assert(SvVALID(_svtail)); \ + ((XPVNV*)SvANY(_svtail))->xnv_u.xnv_bm_tail; \ + }) #else # define SvTAIL(_svtail) (((XPVNV*)SvANY(_svtail))->xnv_u.xnv_bm_tail) #endif /* Does the SV have a Boyer-Moore table attached as magic? * 'VALID' is a poor name, but is kept for historical reasons. */ -#define SvVALID(_svvalid) \ - (\ - SvPOKp(_svvalid) \ - && SvSMAGICAL(_svvalid) \ - && SvMAGIC(_svvalid) \ - && (SvMAGIC(_svvalid)->mg_type == PERL_MAGIC_bm \ - || mg_find(_svvalid, PERL_MAGIC_bm)) \ +#define SvVALID(_svvalid) \ + ( \ + SvPOKp(_svvalid) \ + && SvSMAGICAL(_svvalid) \ + && SvMAGIC(_svvalid) \ + && (SvMAGIC(_svvalid)->mg_type == PERL_MAGIC_bm \ + || mg_find(_svvalid, PERL_MAGIC_bm)) \ ) #define SvRVx(sv) SvRV(sv) @@ -1339,77 +1339,77 @@ object type. Exposed to perl code via Internals::SvREADONLY(). # if defined (DEBUGGING) && defined(PERL_USE_GCC_BRACE_GROUPS) /* These get expanded inside other macros that already use a variable _sv */ -# define SvPVX(sv) \ - (*({ SV *const _svpvx = MUTABLE_SV(sv); \ - assert(PL_valid_types_PVX[SvTYPE(_svpvx) & SVt_MASK]); \ - assert(!isGV_with_GP(_svpvx)); \ - assert(!(SvTYPE(_svpvx) == SVt_PVIO \ - && !(IoFLAGS(_svpvx) & IOf_FAKE_DIRP))); \ - &((_svpvx)->sv_u.svu_pv); \ - })) +# define SvPVX(sv) \ + (*({ SV *const _svpvx = MUTABLE_SV(sv); \ + assert(PL_valid_types_PVX[SvTYPE(_svpvx) & SVt_MASK]); \ + assert(!isGV_with_GP(_svpvx)); \ + assert(!(SvTYPE(_svpvx) == SVt_PVIO \ + && !(IoFLAGS(_svpvx) & IOf_FAKE_DIRP))); \ + &((_svpvx)->sv_u.svu_pv); \ + })) # ifdef PERL_CORE -# define SvCUR(sv) \ - ({ const SV *const _svcur = (const SV *)(sv); \ - assert(PL_valid_types_PVX[SvTYPE(_svcur) & SVt_MASK]); \ - assert(!isGV_with_GP(_svcur)); \ - assert(!(SvTYPE(_svcur) == SVt_PVIO \ - && !(IoFLAGS(_svcur) & IOf_FAKE_DIRP))); \ - (((XPV*) MUTABLE_PTR(SvANY(_svcur)))->xpv_cur); \ - }) +# define SvCUR(sv) \ + ({ const SV *const _svcur = (const SV *)(sv); \ + assert(PL_valid_types_PVX[SvTYPE(_svcur) & SVt_MASK]); \ + assert(!isGV_with_GP(_svcur)); \ + assert(!(SvTYPE(_svcur) == SVt_PVIO \ + && !(IoFLAGS(_svcur) & IOf_FAKE_DIRP))); \ + (((XPV*) MUTABLE_PTR(SvANY(_svcur)))->xpv_cur); \ + }) # else -# define SvCUR(sv) \ - (*({ const SV *const _svcur = (const SV *)(sv); \ - assert(PL_valid_types_PVX[SvTYPE(_svcur) & SVt_MASK]); \ - assert(!isGV_with_GP(_svcur)); \ - assert(!(SvTYPE(_svcur) == SVt_PVIO \ - && !(IoFLAGS(_svcur) & IOf_FAKE_DIRP))); \ - &(((XPV*) MUTABLE_PTR(SvANY(_svcur)))->xpv_cur); \ - })) +# define SvCUR(sv) \ + (*({ const SV *const _svcur = (const SV *)(sv); \ + assert(PL_valid_types_PVX[SvTYPE(_svcur) & SVt_MASK]); \ + assert(!isGV_with_GP(_svcur)); \ + assert(!(SvTYPE(_svcur) == SVt_PVIO \ + && !(IoFLAGS(_svcur) & IOf_FAKE_DIRP))); \ + &(((XPV*) MUTABLE_PTR(SvANY(_svcur)))->xpv_cur); \ + })) # endif -# define SvIVX(sv) \ - (*({ const SV *const _svivx = (const SV *)(sv); \ - assert(PL_valid_types_IVX[SvTYPE(_svivx) & SVt_MASK]); \ - assert(!isGV_with_GP(_svivx)); \ - &(((XPVIV*) MUTABLE_PTR(SvANY(_svivx)))->xiv_iv); \ - })) -# define SvUVX(sv) \ - (*({ const SV *const _svuvx = (const SV *)(sv); \ - assert(PL_valid_types_IVX[SvTYPE(_svuvx) & SVt_MASK]); \ - assert(!isGV_with_GP(_svuvx)); \ - &(((XPVUV*) MUTABLE_PTR(SvANY(_svuvx)))->xuv_uv); \ - })) +# define SvIVX(sv) \ + (*({ const SV *const _svivx = (const SV *)(sv); \ + assert(PL_valid_types_IVX[SvTYPE(_svivx) & SVt_MASK]); \ + assert(!isGV_with_GP(_svivx)); \ + &(((XPVIV*) MUTABLE_PTR(SvANY(_svivx)))->xiv_iv); \ + })) +# define SvUVX(sv) \ + (*({ const SV *const _svuvx = (const SV *)(sv); \ + assert(PL_valid_types_IVX[SvTYPE(_svuvx) & SVt_MASK]); \ + assert(!isGV_with_GP(_svuvx)); \ + &(((XPVUV*) MUTABLE_PTR(SvANY(_svuvx)))->xuv_uv); \ + })) # define SvNVX(sv) \ - (*({ const SV *const _svnvx = (const SV *)(sv); \ - assert(PL_valid_types_NVX[SvTYPE(_svnvx) & SVt_MASK]); \ - assert(!isGV_with_GP(_svnvx)); \ - &(((XPVNV*) MUTABLE_PTR(SvANY(_svnvx)))->xnv_u.xnv_nv); \ - })) -# define SvRV(sv) \ - (*({ SV *const _svrv = MUTABLE_SV(sv); \ - assert(PL_valid_types_RV[SvTYPE(_svrv) & SVt_MASK]); \ - assert(!isGV_with_GP(_svrv)); \ - assert(!(SvTYPE(_svrv) == SVt_PVIO \ - && !(IoFLAGS(_svrv) & IOf_FAKE_DIRP))); \ - &((_svrv)->sv_u.svu_rv); \ - })) -# define SvRV_const(sv) \ - ({ const SV *const _svrv = (const SV *)(sv); \ - assert(PL_valid_types_RV[SvTYPE(_svrv) & SVt_MASK]); \ - assert(!isGV_with_GP(_svrv)); \ - assert(!(SvTYPE(_svrv) == SVt_PVIO \ - && !(IoFLAGS(_svrv) & IOf_FAKE_DIRP))); \ - (_svrv)->sv_u.svu_rv; \ - }) -# define SvMAGIC(sv) \ - (*({ const SV *const _svmagic = (const SV *)(sv); \ - assert(SvTYPE(_svmagic) >= SVt_PVMG); \ - &(((XPVMG*) MUTABLE_PTR(SvANY(_svmagic)))->xmg_u.xmg_magic); \ + (*({ const SV *const _svnvx = (const SV *)(sv); \ + assert(PL_valid_types_NVX[SvTYPE(_svnvx) & SVt_MASK]); \ + assert(!isGV_with_GP(_svnvx)); \ + &(((XPVNV*) MUTABLE_PTR(SvANY(_svnvx)))->xnv_u.xnv_nv); \ })) -# define SvSTASH(sv) \ - (*({ const SV *const _svstash = (const SV *)(sv); \ - assert(SvTYPE(_svstash) >= SVt_PVMG); \ - &(((XPVMG*) MUTABLE_PTR(SvANY(_svstash)))->xmg_stash); \ +# define SvRV(sv) \ + (*({ SV *const _svrv = MUTABLE_SV(sv); \ + assert(PL_valid_types_RV[SvTYPE(_svrv) & SVt_MASK]); \ + assert(!isGV_with_GP(_svrv)); \ + assert(!(SvTYPE(_svrv) == SVt_PVIO \ + && !(IoFLAGS(_svrv) & IOf_FAKE_DIRP))); \ + &((_svrv)->sv_u.svu_rv); \ })) +# define SvRV_const(sv) \ + ({ const SV *const _svrv = (const SV *)(sv); \ + assert(PL_valid_types_RV[SvTYPE(_svrv) & SVt_MASK]); \ + assert(!isGV_with_GP(_svrv)); \ + assert(!(SvTYPE(_svrv) == SVt_PVIO \ + && !(IoFLAGS(_svrv) & IOf_FAKE_DIRP))); \ + (_svrv)->sv_u.svu_rv; \ + }) +# define SvMAGIC(sv) \ + (*({ const SV *const _svmagic = (const SV *)(sv); \ + assert(SvTYPE(_svmagic) >= SVt_PVMG); \ + &(((XPVMG*) MUTABLE_PTR(SvANY(_svmagic)))->xmg_u.xmg_magic); \ + })) +# define SvSTASH(sv) \ + (*({ const SV *const _svstash = (const SV *)(sv); \ + assert(SvTYPE(_svstash) >= SVt_PVMG); \ + &(((XPVMG*) MUTABLE_PTR(SvANY(_svstash)))->xmg_stash); \ + })) # else /* Below is not DEBUGGING or can't use brace groups */ # define SvPVX(sv) ((sv)->sv_u.svu_pv) # define SvCUR(sv) ((XPV*) SvANY(sv))->xpv_cur @@ -1446,83 +1446,83 @@ object type. Exposed to perl code via Internals::SvREADONLY(). /* Ask a scalar nicely to try to become an IV, if possible. Not guaranteed to stay returning void */ /* Macro won't actually call sv_2iv if already IOK */ -#define SvIV_please(sv) \ - STMT_START { \ - SV * sv_ = MUTABLE_SV(sv); \ - if (!SvIOKp(sv_) && (SvFLAGS(sv_) & (SVf_NOK|SVf_POK))) \ - (void) SvIV(sv_); \ - } STMT_END -#define SvIV_please_nomg(sv) \ - (!(SvFLAGS(sv) & (SVf_IOK|SVp_IOK)) && (SvFLAGS(sv) & (SVf_NOK|SVf_POK)) \ - ? (sv_2iv_flags(sv, 0), SvIOK(sv)) \ - : SvIOK(sv)) - -#define SvIV_set(sv, val) \ - STMT_START { \ - SV * sv_ = MUTABLE_SV(sv); \ - assert(PL_valid_types_IV_set[SvTYPE(sv_) & SVt_MASK]); \ - assert(!isGV_with_GP(sv_)); \ - (((XPVIV*) SvANY(sv_))->xiv_iv = (val)); \ - } STMT_END - -#define SvNV_set(sv, val) \ - STMT_START { \ - SV * sv_ = MUTABLE_SV(sv); \ - assert(PL_valid_types_NV_set[SvTYPE(sv_) & SVt_MASK]); \ - assert(!isGV_with_GP(sv_)); \ - (((XPVNV*)SvANY(sv_))->xnv_u.xnv_nv = (val)); \ - } STMT_END - -#define SvPV_set(sv, val) \ - STMT_START { \ - SV * sv_ = MUTABLE_SV(sv); \ - assert(PL_valid_types_PVX[SvTYPE(sv_) & SVt_MASK]); \ - assert(!isGV_with_GP(sv_)); \ - assert(!(SvTYPE(sv_) == SVt_PVIO \ - && !(IoFLAGS(sv_) & IOf_FAKE_DIRP))); \ - ((sv_)->sv_u.svu_pv = (val)); \ - } STMT_END - -#define SvUV_set(sv, val) \ - STMT_START { \ - SV * sv_ = MUTABLE_SV(sv); \ - assert(PL_valid_types_IV_set[SvTYPE(sv_) & SVt_MASK]); \ - assert(!isGV_with_GP(sv_)); \ - (((XPVUV*)SvANY(sv_))->xuv_uv = (val)); \ - } STMT_END - -#define SvRV_set(sv, val) \ - STMT_START { \ - SV * sv_ = MUTABLE_SV(sv); \ - assert(PL_valid_types_RV[SvTYPE(sv_) & SVt_MASK]); \ - assert(!isGV_with_GP(sv_)); \ - assert(!(SvTYPE(sv_) == SVt_PVIO \ - && !(IoFLAGS(sv_) & IOf_FAKE_DIRP))); \ - ((sv_)->sv_u.svu_rv = (val)); \ - } STMT_END -#define SvMAGIC_set(sv, val) \ - STMT_START { assert(SvTYPE(sv) >= SVt_PVMG); \ - (((XPVMG*)SvANY(sv))->xmg_u.xmg_magic = (val)); } STMT_END -#define SvSTASH_set(sv, val) \ - STMT_START { assert(SvTYPE(sv) >= SVt_PVMG); \ - (((XPVMG*) SvANY(sv))->xmg_stash = (val)); } STMT_END -#define SvCUR_set(sv, val) \ - STMT_START { \ - assert(PL_valid_types_PVX[SvTYPE(sv) & SVt_MASK]); \ - assert(!isGV_with_GP(sv)); \ - assert(!(SvTYPE(sv) == SVt_PVIO \ - && !(IoFLAGS(sv) & IOf_FAKE_DIRP))); \ - (((XPV*) SvANY(sv))->xpv_cur = (val)); } STMT_END -#define SvLEN_set(sv, val) \ - STMT_START { \ - assert(PL_valid_types_PVX[SvTYPE(sv) & SVt_MASK]); \ - assert(!isGV_with_GP(sv)); \ - assert(!(SvTYPE(sv) == SVt_PVIO \ - && !(IoFLAGS(sv) & IOf_FAKE_DIRP))); \ - (((XPV*) SvANY(sv))->xpv_len = (val)); } STMT_END -#define SvEND_set(sv, val) \ - STMT_START { assert(SvTYPE(sv) >= SVt_PV); \ - SvCUR_set(sv, (val) - SvPVX(sv)); } STMT_END +#define SvIV_please(sv) \ + STMT_START { \ + SV * sv_ = MUTABLE_SV(sv); \ + if (!SvIOKp(sv_) && (SvFLAGS(sv_) & (SVf_NOK|SVf_POK))) \ + (void) SvIV(sv_); \ + } STMT_END +#define SvIV_please_nomg(sv) \ + (!(SvFLAGS(sv) & (SVf_IOK|SVp_IOK)) && (SvFLAGS(sv) & (SVf_NOK|SVf_POK)) \ + ? (sv_2iv_flags(sv, 0), SvIOK(sv)) \ + : SvIOK(sv)) + +#define SvIV_set(sv, val) \ + STMT_START { \ + SV * sv_ = MUTABLE_SV(sv); \ + assert(PL_valid_types_IV_set[SvTYPE(sv_) & SVt_MASK]); \ + assert(!isGV_with_GP(sv_)); \ + (((XPVIV*) SvANY(sv_))->xiv_iv = (val)); \ + } STMT_END + +#define SvNV_set(sv, val) \ + STMT_START { \ + SV * sv_ = MUTABLE_SV(sv); \ + assert(PL_valid_types_NV_set[SvTYPE(sv_) & SVt_MASK]); \ + assert(!isGV_with_GP(sv_)); \ + (((XPVNV*)SvANY(sv_))->xnv_u.xnv_nv = (val)); \ + } STMT_END + +#define SvPV_set(sv, val) \ + STMT_START { \ + SV * sv_ = MUTABLE_SV(sv); \ + assert(PL_valid_types_PVX[SvTYPE(sv_) & SVt_MASK]); \ + assert(!isGV_with_GP(sv_)); \ + assert(!(SvTYPE(sv_) == SVt_PVIO \ + && !(IoFLAGS(sv_) & IOf_FAKE_DIRP))); \ + ((sv_)->sv_u.svu_pv = (val)); \ + } STMT_END + +#define SvUV_set(sv, val) \ + STMT_START { \ + SV * sv_ = MUTABLE_SV(sv); \ + assert(PL_valid_types_IV_set[SvTYPE(sv_) & SVt_MASK]); \ + assert(!isGV_with_GP(sv_)); \ + (((XPVUV*)SvANY(sv_))->xuv_uv = (val)); \ + } STMT_END + +#define SvRV_set(sv, val) \ + STMT_START { \ + SV * sv_ = MUTABLE_SV(sv); \ + assert(PL_valid_types_RV[SvTYPE(sv_) & SVt_MASK]); \ + assert(!isGV_with_GP(sv_)); \ + assert(!(SvTYPE(sv_) == SVt_PVIO \ + && !(IoFLAGS(sv_) & IOf_FAKE_DIRP))); \ + ((sv_)->sv_u.svu_rv = (val)); \ + } STMT_END +#define SvMAGIC_set(sv, val) \ + STMT_START { assert(SvTYPE(sv) >= SVt_PVMG); \ + (((XPVMG*)SvANY(sv))->xmg_u.xmg_magic = (val)); } STMT_END +#define SvSTASH_set(sv, val) \ + STMT_START { assert(SvTYPE(sv) >= SVt_PVMG); \ + (((XPVMG*) SvANY(sv))->xmg_stash = (val)); } STMT_END +#define SvCUR_set(sv, val) \ + STMT_START { \ + assert(PL_valid_types_PVX[SvTYPE(sv) & SVt_MASK]); \ + assert(!isGV_with_GP(sv)); \ + assert(!(SvTYPE(sv) == SVt_PVIO \ + && !(IoFLAGS(sv) & IOf_FAKE_DIRP))); \ + (((XPV*) SvANY(sv))->xpv_cur = (val)); } STMT_END +#define SvLEN_set(sv, val) \ + STMT_START { \ + assert(PL_valid_types_PVX[SvTYPE(sv) & SVt_MASK]); \ + assert(!isGV_with_GP(sv)); \ + assert(!(SvTYPE(sv) == SVt_PVIO \ + && !(IoFLAGS(sv) & IOf_FAKE_DIRP))); \ + (((XPV*) SvANY(sv))->xpv_len = (val)); } STMT_END +#define SvEND_set(sv, val) \ + STMT_START { assert(SvTYPE(sv) >= SVt_PV); \ + SvCUR_set(sv, (val) - SvPVX(sv)); } STMT_END /* =for apidoc Am|void|SvPV_renew|SV* sv|STRLEN len @@ -1535,12 +1535,12 @@ why not just use C if you're not sure about the provenance? =cut */ -#define SvPV_renew(sv,n) \ - STMT_START { SvLEN_set(sv, n); \ - SvPV_set((sv), (MEM_WRAP_CHECK_(n,char) \ - (char*)saferealloc((Malloc_t)SvPVX(sv), \ - (MEM_SIZE)((n))))); \ - } STMT_END +#define SvPV_renew(sv,n) \ + STMT_START { SvLEN_set(sv, n); \ + SvPV_set((sv), (MEM_WRAP_CHECK_(n,char) \ + (char*)saferealloc((Malloc_t)SvPVX(sv), \ + (MEM_SIZE)((n))))); \ + } STMT_END /* =for apidoc Am|void|SvPV_shrink_to_cur|SV* sv @@ -1555,11 +1555,11 @@ L> before calling this. =cut */ -#define SvPV_shrink_to_cur(sv) \ - STMT_START {\ - const STRLEN _lEnGtH = SvCUR(sv) + 1; \ - SvPV_renew(sv, _lEnGtH); \ - } STMT_END +#define SvPV_shrink_to_cur(sv) \ + STMT_START { \ + const STRLEN _lEnGtH = SvCUR(sv) + 1; \ + SvPV_renew(sv, _lEnGtH); \ + } STMT_END /* =for apidoc Am|void|SvPV_free|SV * sv @@ -1569,34 +1569,34 @@ only be used as part of a larger operation =cut */ -#define SvPV_free(sv) \ - STMT_START { \ - assert(SvTYPE(sv) >= SVt_PV); \ - if (SvLEN(sv)) { \ - assert(!SvROK(sv)); \ - if(UNLIKELY(SvOOK(sv))) { \ - STRLEN zok; \ - SvOOK_offset(sv, zok); \ - SvPV_set(sv, SvPVX_mutable(sv) - zok); \ - SvFLAGS(sv) &= ~SVf_OOK; \ - } \ - Safefree(SvPVX(sv)); \ - } \ - } STMT_END +#define SvPV_free(sv) \ + STMT_START { \ + assert(SvTYPE(sv) >= SVt_PV); \ + if (SvLEN(sv)) { \ + assert(!SvROK(sv)); \ + if(UNLIKELY(SvOOK(sv))) { \ + STRLEN zok; \ + SvOOK_offset(sv, zok); \ + SvPV_set(sv, SvPVX_mutable(sv) - zok); \ + SvFLAGS(sv) &= ~SVf_OOK; \ + } \ + Safefree(SvPVX(sv)); \ + } \ + } STMT_END #ifdef PERL_CORE /* Code that crops up in three places to take a scalar and ready it to hold a reference */ -# define prepare_SV_for_RV(sv) \ - STMT_START { \ - if (SvTYPE(sv) < SVt_PV && SvTYPE(sv) != SVt_IV) \ - sv_upgrade(sv, SVt_IV); \ - else if (SvTYPE(sv) >= SVt_PV) { \ - SvPV_free(sv); \ - SvLEN_set(sv, 0); \ - SvCUR_set(sv, 0); \ - } \ - } STMT_END +# define prepare_SV_for_RV(sv) \ + STMT_START { \ + if (SvTYPE(sv) < SVt_PV && SvTYPE(sv) != SVt_IV) \ + sv_upgrade(sv, SVt_IV); \ + else if (SvTYPE(sv) >= SVt_PV) { \ + SvPV_free(sv); \ + SvLEN_set(sv, 0); \ + SvCUR_set(sv, 0); \ + } \ + } STMT_END #endif #ifndef PERL_CORE @@ -1604,13 +1604,13 @@ only be used as part of a larger operation #endif #if defined (DEBUGGING) && defined(PERL_USE_GCC_BRACE_GROUPS) -# define BmUSEFUL(sv) \ - (*({ SV *const _bmuseful = MUTABLE_SV(sv); \ - assert(SvTYPE(_bmuseful) >= SVt_PVIV); \ - assert(SvVALID(_bmuseful)); \ - assert(!SvIOK(_bmuseful)); \ - &(((XPVIV*) SvANY(_bmuseful))->xiv_u.xivu_iv); \ - })) +# define BmUSEFUL(sv) \ + (*({ SV *const _bmuseful = MUTABLE_SV(sv); \ + assert(SvTYPE(_bmuseful) >= SVt_PVIV); \ + assert(SvVALID(_bmuseful)); \ + assert(!SvIOK(_bmuseful)); \ + &(((XPVIV*) SvANY(_bmuseful))->xiv_u.xivu_iv); \ + })) #else # define BmUSEFUL(sv) ((XPVIV*) SvANY(sv))->xiv_u.xivu_iv @@ -1700,11 +1700,11 @@ attention to precisely which outputs are influenced by which inputs. #define SvTAINTED_on(sv) STMT_START{ if(UNLIKELY(TAINTING_get)){sv_taint(sv);} }STMT_END #define SvTAINTED_off(sv) STMT_START{ if(UNLIKELY(TAINTING_get)){sv_untaint(sv);} }STMT_END -#define SvTAINT(sv) \ - STMT_START { \ +#define SvTAINT(sv) \ + STMT_START { \ assert(TAINTING_get || !TAINT_get); \ - if (UNLIKELY(TAINT_get)) \ - SvTAINTED_on(sv); \ + if (UNLIKELY(TAINT_get)) \ + SvTAINTED_on(sv); \ } STMT_END /* @@ -1927,26 +1927,26 @@ END_EXTERN_C * For the latter case, we don't set SVf_POK so that we can distinguish whether * the value originated as a string or as an integer, before we cached the * second representation. */ -#define SvPOK_or_cached_IV(sv) \ +#define SvPOK_or_cached_IV(sv) \ (((SvFLAGS(sv) & (SVf_POK|SVs_GMG)) == SVf_POK) || ((SvFLAGS(sv) & (SVf_IOK|SVp_POK|SVs_GMG)) == (SVf_IOK|SVp_POK))) -#define SvPV_flags(sv, len, flags) \ - Perl_SvPV_helper(aTHX_ sv, &len, flags, SvPVnormal_type_, \ - Perl_sv_2pv_flags, FALSE, 0) -#define SvPV_flags_const(sv, len, flags) \ - ((const char*) Perl_SvPV_helper(aTHX_ sv, &len, flags, SvPVnormal_type_, \ - Perl_sv_2pv_flags, FALSE, \ - SV_CONST_RETURN)) -#define SvPV_flags_const_nolen(sv, flags) \ - ((const char*) Perl_SvPV_helper(aTHX_ sv, NULL, flags, SvPVnormal_type_, \ - Perl_sv_2pv_flags, FALSE, \ - SV_CONST_RETURN)) -#define SvPV_flags_mutable(sv, len, flags) \ - Perl_SvPV_helper(aTHX_ sv, &len, flags, SvPVnormal_type_, \ +#define SvPV_flags(sv, len, flags) \ + Perl_SvPV_helper(aTHX_ sv, &len, flags, SvPVnormal_type_, \ + Perl_sv_2pv_flags, FALSE, 0) +#define SvPV_flags_const(sv, len, flags) \ + ((const char*) Perl_SvPV_helper(aTHX_ sv, &len, flags, SvPVnormal_type_, \ + Perl_sv_2pv_flags, FALSE, \ + SV_CONST_RETURN)) +#define SvPV_flags_const_nolen(sv, flags) \ + ((const char*) Perl_SvPV_helper(aTHX_ sv, NULL, flags, SvPVnormal_type_, \ + Perl_sv_2pv_flags, FALSE, \ + SV_CONST_RETURN)) +#define SvPV_flags_mutable(sv, len, flags) \ + Perl_SvPV_helper(aTHX_ sv, &len, flags, SvPVnormal_type_, \ Perl_sv_2pv_flags, FALSE, SV_MUTABLE_RETURN) -#define SvPV_nolen(sv) \ - Perl_SvPV_helper(aTHX_ sv, NULL, SV_GMAGIC, SvPVnormal_type_, \ +#define SvPV_nolen(sv) \ + Perl_SvPV_helper(aTHX_ sv, NULL, SV_GMAGIC, SvPVnormal_type_, \ Perl_sv_2pv_flags, FALSE, 0) #define SvPV_nolen_const(sv) SvPV_flags_const_nolen(sv, SV_GMAGIC) @@ -1962,14 +1962,14 @@ END_EXTERN_C #define SvPV_nomg_const(sv, len) SvPV_flags_const(sv, len, 0) #define SvPV_nomg_const_nolen(sv) SvPV_flags_const_nolen(sv, 0) -#define SvPV_force_flags(sv, len, flags) \ - Perl_SvPV_helper(aTHX_ sv, &len, flags, SvPVforce_type_, \ +#define SvPV_force_flags(sv, len, flags) \ + Perl_SvPV_helper(aTHX_ sv, &len, flags, SvPVforce_type_, \ Perl_sv_pvn_force_flags, FALSE, 0) -#define SvPV_force_flags_nolen(sv, flags) \ - Perl_SvPV_helper(aTHX_ sv, NULL, flags, SvPVforce_type_, \ +#define SvPV_force_flags_nolen(sv, flags) \ + Perl_SvPV_helper(aTHX_ sv, NULL, flags, SvPVforce_type_, \ Perl_sv_pvn_force_flags, FALSE, 0) -#define SvPV_force_flags_mutable(sv, len, flags) \ - Perl_SvPV_helper(aTHX_ sv, &len, flags, SvPVforce_type_, \ +#define SvPV_force_flags_mutable(sv, len, flags) \ + Perl_SvPV_helper(aTHX_ sv, &len, flags, SvPVforce_type_, \ Perl_sv_pvn_force_flags, FALSE, SV_MUTABLE_RETURN) #define SvPV_force(sv, len) SvPV_force_flags(sv, len, SV_GMAGIC) @@ -1980,44 +1980,44 @@ END_EXTERN_C #define SvPV_force_nomg(sv, len) SvPV_force_flags(sv, len, 0) #define SvPV_force_nomg_nolen(sv) SvPV_force_flags_nolen(sv, 0) -#define SvPVutf8(sv, len) \ - Perl_SvPV_helper(aTHX_ sv, &len, SV_GMAGIC, SvPVutf8_type_, \ +#define SvPVutf8(sv, len) \ + Perl_SvPV_helper(aTHX_ sv, &len, SV_GMAGIC, SvPVutf8_type_, \ Perl_sv_2pvutf8_flags, FALSE, 0) -#define SvPVutf8_nomg(sv, len) \ - Perl_SvPV_helper(aTHX_ sv, NULL, 0, SvPVutf8_type_, \ +#define SvPVutf8_nomg(sv, len) \ + Perl_SvPV_helper(aTHX_ sv, NULL, 0, SvPVutf8_type_, \ Perl_sv_2pvutf8_flags, FALSE, 0) -#define SvPVutf8_nolen(sv) \ - Perl_SvPV_helper(aTHX_ sv, NULL, SV_GMAGIC, SvPVutf8_type_, \ +#define SvPVutf8_nolen(sv) \ + Perl_SvPV_helper(aTHX_ sv, NULL, SV_GMAGIC, SvPVutf8_type_, \ Perl_sv_2pvutf8_flags, FALSE, 0) -#define SvPVutf8_or_null(sv, len) \ - Perl_SvPV_helper(aTHX_ sv, &len, SV_GMAGIC, SvPVutf8_type_, \ +#define SvPVutf8_or_null(sv, len) \ + Perl_SvPV_helper(aTHX_ sv, &len, SV_GMAGIC, SvPVutf8_type_, \ Perl_sv_2pvutf8_flags, TRUE, 0) -#define SvPVutf8_or_null_nomg(sv, len) \ - Perl_SvPV_helper(aTHX_ sv, &len, 0, SvPVutf8_type_, \ +#define SvPVutf8_or_null_nomg(sv, len) \ + Perl_SvPV_helper(aTHX_ sv, &len, 0, SvPVutf8_type_, \ Perl_sv_2pvutf8_flags, TRUE, 0) -#define SvPVbyte(sv, len) \ - Perl_SvPV_helper(aTHX_ sv, &len, SV_GMAGIC, SvPVbyte_type_, \ +#define SvPVbyte(sv, len) \ + Perl_SvPV_helper(aTHX_ sv, &len, SV_GMAGIC, SvPVbyte_type_, \ Perl_sv_2pvbyte_flags, FALSE, 0) -#define SvPVbyte_nomg(sv, len) \ - Perl_SvPV_helper(aTHX_ sv, &len, 0, SvPVbyte_type_, \ +#define SvPVbyte_nomg(sv, len) \ + Perl_SvPV_helper(aTHX_ sv, &len, 0, SvPVbyte_type_, \ Perl_sv_2pvbyte_flags, FALSE, 0) -#define SvPVbyte_nolen(sv) \ - Perl_SvPV_helper(aTHX_ sv, NULL, SV_GMAGIC, SvPVbyte_type_, \ +#define SvPVbyte_nolen(sv) \ + Perl_SvPV_helper(aTHX_ sv, NULL, SV_GMAGIC, SvPVbyte_type_, \ Perl_sv_2pvbyte_flags, FALSE, 0) -#define SvPVbyte_or_null(sv, len) \ - Perl_SvPV_helper(aTHX_ sv, &len, SV_GMAGIC, SvPVbyte_type_, \ +#define SvPVbyte_or_null(sv, len) \ + Perl_SvPV_helper(aTHX_ sv, &len, SV_GMAGIC, SvPVbyte_type_, \ Perl_sv_2pvbyte_flags, TRUE, 0) -#define SvPVbyte_or_null_nomg(sv, len) \ - Perl_SvPV_helper(aTHX_ sv, &len, 0, SvPVbyte_type_, \ +#define SvPVbyte_or_null_nomg(sv, len) \ + Perl_SvPV_helper(aTHX_ sv, &len, 0, SvPVbyte_type_, \ Perl_sv_2pvbyte_flags, TRUE, 0) -#define SvPVutf8_force(sv, len) \ - Perl_SvPV_helper(aTHX_ sv, &len, 0, SvPVutf8_pure_type_, \ +#define SvPVutf8_force(sv, len) \ + Perl_SvPV_helper(aTHX_ sv, &len, 0, SvPVutf8_pure_type_, \ Perl_sv_pvutf8n_force_wrapper, FALSE, 0) -#define SvPVbyte_force(sv, len) \ - Perl_SvPV_helper(aTHX_ sv, &len, 0, SvPVbyte_pure_type_, \ +#define SvPVbyte_force(sv, len) \ + Perl_SvPV_helper(aTHX_ sv, &len, 0, SvPVbyte_pure_type_, \ Perl_sv_pvbyten_force_wrapper, FALSE, 0) /* define FOOx(): Before FOO(x) was inlined, these were idempotent versions of @@ -2065,8 +2065,8 @@ END_EXTERN_C #define SvIsCOW_shared_hash(sv) ((SvFLAGS(sv) & (SVf_IsCOW|SVppv_STATIC)) == (SVf_IsCOW) && SvLEN(sv) == 0) #define SvIsCOW_static(sv) ((SvFLAGS(sv) & (SVf_IsCOW|SVppv_STATIC)) == (SVf_IsCOW|SVppv_STATIC)) -#define SvSHARED_HEK_FROM_PV(pvx) \ - ((struct hek*)(pvx - STRUCT_OFFSET(struct hek, hek_key))) +#define SvSHARED_HEK_FROM_PV(pvx) \ + ((struct hek*)(pvx - STRUCT_OFFSET(struct hek, hek_key))) /* =for apidoc Am|struct hek*|SvSHARED_HASH|SV * sv Returns the hash for C created by C>. @@ -2141,22 +2141,22 @@ other encumbrances that would be problematic when changing C. =cut */ -#define SV_CHECK_THINKFIRST_COW_DROP(sv) \ - if (SvTHINKFIRST(sv))\ +#define SV_CHECK_THINKFIRST_COW_DROP(sv) \ + if (SvTHINKFIRST(sv)) \ sv_force_normal_flags(sv, SV_COW_DROP_PV) #ifdef PERL_COPY_ON_WRITE -# define SvCANCOW(sv) \ - (SvIsCOW(sv) \ - ? SvLEN(sv) ? CowREFCNT(sv) != SV_COW_REFCNT_MAX : 1 \ - : (SvFLAGS(sv) & CAN_COW_MASK) == CAN_COW_FLAGS \ +# define SvCANCOW(sv) \ + (SvIsCOW(sv) \ + ? SvLEN(sv) ? CowREFCNT(sv) != SV_COW_REFCNT_MAX : 1 \ + : (SvFLAGS(sv) & CAN_COW_MASK) == CAN_COW_FLAGS \ && SvCUR(sv)+1 < SvLEN(sv)) /* Note: To allow 256 COW "copies", a refcnt of 0 means 1. */ # define CowREFCNT(sv) (*(U8 *)(SvPVX(sv)+SvLEN(sv)-1)) # define SV_COW_REFCNT_MAX nBIT_UMAX(sizeof(U8) * CHARBITS) -# define CAN_COW_MASK \ - (SVf_POK|SVf_ROK|SVp_POK|SVf_FAKE|\ - SVf_OOK|SVf_BREAK|SVf_READONLY|SVf_PROTECT) +# define CAN_COW_MASK \ + (SVf_POK|SVf_ROK|SVp_POK|SVf_FAKE| \ + SVf_OOK|SVf_BREAK|SVf_READONLY|SVf_PROTECT) #endif #define CAN_COW_FLAGS (SVp_POK|SVf_POK) @@ -2174,8 +2174,8 @@ immediately written again. =cut */ -#define SV_CHECK_THINKFIRST(sv) \ - if (SvTHINKFIRST(sv))\ +#define SV_CHECK_THINKFIRST(sv) \ + if (SvTHINKFIRST(sv)) \ sv_force_normal_flags(sv, 0) @@ -2192,8 +2192,8 @@ immediately written again. #define sv_utf8_downgrade_nomg(sv, fail_ok) sv_utf8_downgrade_flags(sv, fail_ok, 0) #define sv_catpvn_nomg(dsv, sstr, slen) sv_catpvn_flags(dsv, sstr, slen, 0) #define sv_catpv_nomg(dsv, sstr) sv_catpv_flags(dsv, sstr, 0) -#define sv_setsv(dsv, ssv) \ - sv_setsv_flags(dsv, ssv, SV_GMAGIC|SV_DO_COW_SVSETSV) +#define sv_setsv(dsv, ssv) \ + sv_setsv_flags(dsv, ssv, SV_GMAGIC|SV_DO_COW_SVSETSV) #define sv_setsv_nomg(dsv, ssv) sv_setsv_flags(dsv, ssv, SV_DO_COW_SVSETSV) #define sv_catsv(dsv, ssv) sv_catsv_flags(dsv, ssv, SV_GMAGIC) #define sv_catsv_nomg(dsv, ssv) sv_catsv_flags(dsv, ssv, 0) @@ -2222,37 +2222,37 @@ immediately written again. #define sv_collxfrm(sv, nxp) sv_collxfrm_flags(sv, nxp, SV_GMAGIC) #define sv_2bool(sv) sv_2bool_flags(sv, SV_GMAGIC) #define sv_2bool_nomg(sv) sv_2bool_flags(sv, 0) -#define sv_insert(bigstr, offset, len, little, littlelen) \ - Perl_sv_insert_flags(aTHX_ (bigstr),(offset), (len), (little), \ - (littlelen), SV_GMAGIC) -#define sv_mortalcopy(sv) \ - Perl_sv_mortalcopy_flags(aTHX_ sv, SV_GMAGIC|SV_DO_COW_SVSETSV) +#define sv_insert(bigstr, offset, len, little, littlelen) \ + Perl_sv_insert_flags(aTHX_ (bigstr),(offset), (len), (little), \ + (littlelen), SV_GMAGIC) +#define sv_mortalcopy(sv) \ + Perl_sv_mortalcopy_flags(aTHX_ sv, SV_GMAGIC|SV_DO_COW_SVSETSV) #define sv_cathek(sv,hek) \ - STMT_START { \ - HEK * const bmxk = hek; \ - sv_catpvn_flags(sv, HEK_KEY(bmxk), HEK_LEN(bmxk), \ - HEK_UTF8(bmxk) ? SV_CATUTF8 : SV_CATBYTES); \ - } STMT_END + STMT_START { \ + HEK * const bmxk = hek; \ + sv_catpvn_flags(sv, HEK_KEY(bmxk), HEK_LEN(bmxk), \ + HEK_UTF8(bmxk) ? SV_CATUTF8 : SV_CATBYTES); \ + } STMT_END /* Should be named SvCatPVN_utf8_upgrade? */ -#define sv_catpvn_nomg_utf8_upgrade(dsv, sstr, slen, nsv) \ - STMT_START { \ - if (!(nsv)) \ - nsv = newSVpvn_flags(sstr, slen, SVs_TEMP); \ - else \ - sv_setpvn(nsv, sstr, slen); \ - SvUTF8_off(nsv); \ - sv_utf8_upgrade(nsv); \ - sv_catsv_nomg(dsv, nsv); \ - } STMT_END -#define sv_catpvn_nomg_maybeutf8(dsv, sstr, len, is_utf8) \ - sv_catpvn_flags(dsv, sstr, len, (is_utf8)?SV_CATUTF8:SV_CATBYTES) +#define sv_catpvn_nomg_utf8_upgrade(dsv, sstr, slen, nsv) \ + STMT_START { \ + if (!(nsv)) \ + nsv = newSVpvn_flags(sstr, slen, SVs_TEMP); \ + else \ + sv_setpvn(nsv, sstr, slen); \ + SvUTF8_off(nsv); \ + sv_utf8_upgrade(nsv); \ + sv_catsv_nomg(dsv, nsv); \ + } STMT_END +#define sv_catpvn_nomg_maybeutf8(dsv, sstr, len, is_utf8) \ + sv_catpvn_flags(dsv, sstr, len, (is_utf8)?SV_CATUTF8:SV_CATBYTES) #if defined(PERL_CORE) || defined(PERL_EXT) -# define sv_or_pv_len_utf8(sv, pv, bytelen) \ - (SvGAMAGIC(sv) \ - ? utf8_length((U8 *)(pv), (U8 *)(pv)+(bytelen)) \ - : sv_len_utf8(sv)) +# define sv_or_pv_len_utf8(sv, pv, bytelen) \ + (SvGAMAGIC(sv) \ + ? utf8_length((U8 *)(pv), (U8 *)(pv)+(bytelen)) \ + : sv_len_utf8(sv)) #endif /* @@ -2341,38 +2341,38 @@ that already have a PV buffer allocated, but no SvTHINKFIRST. #define SvSETMAGIC(x) STMT_START { if (UNLIKELY(SvSMAGICAL(x))) mg_set(x); } STMT_END -#define SvSetSV_and(dst,src,finally) \ - STMT_START { \ - SV * src_ = src; \ - SV * dst_ = dst; \ - if (LIKELY((dst_) != (src_))) { \ - sv_setsv(dst_, src_); \ - finally; \ - } \ - } STMT_END - -#define SvSetSV_nosteal_and(dst,src,finally) \ - STMT_START { \ - SV * src_ = src; \ - SV * dst_ = dst; \ - if (LIKELY((dst_) != (src_))) { \ - sv_setsv_flags(dst_, src_, \ - SV_GMAGIC \ - | SV_NOSTEAL \ - | SV_DO_COW_SVSETSV); \ - finally; \ - } \ - } STMT_END +#define SvSetSV_and(dst,src,finally) \ + STMT_START { \ + SV * src_ = src; \ + SV * dst_ = dst; \ + if (LIKELY((dst_) != (src_))) { \ + sv_setsv(dst_, src_); \ + finally; \ + } \ + } STMT_END + +#define SvSetSV_nosteal_and(dst,src,finally) \ + STMT_START { \ + SV * src_ = src; \ + SV * dst_ = dst; \ + if (LIKELY((dst_) != (src_))) { \ + sv_setsv_flags(dst_, src_, \ + SV_GMAGIC \ + | SV_NOSTEAL \ + | SV_DO_COW_SVSETSV); \ + finally; \ + } \ + } STMT_END -#define SvSetSV(dst,src) \ - SvSetSV_and(dst,src,/*nothing*/;) -#define SvSetSV_nosteal(dst,src) \ - SvSetSV_nosteal_and(dst,src,/*nothing*/;) +#define SvSetSV(dst,src) \ + SvSetSV_and(dst,src,/*nothing*/;) +#define SvSetSV_nosteal(dst,src) \ + SvSetSV_nosteal_and(dst,src,/*nothing*/;) -#define SvSetMagicSV(dst,src) \ - SvSetSV_and(dst,src,SvSETMAGIC(dst)) -#define SvSetMagicSV_nosteal(dst,src) \ - SvSetSV_nosteal_and(dst,src,SvSETMAGIC(dst)) +#define SvSetMagicSV(dst,src) \ + SvSetSV_and(dst,src,SvSETMAGIC(dst)) +#define SvSetMagicSV_nosteal(dst,src) \ + SvSetSV_nosteal_and(dst,src,SvSETMAGIC(dst)) #if !defined(SKIP_DEBUGGING) @@ -2392,9 +2392,9 @@ that already have a PV buffer allocated, but no SvTHINKFIRST. #define SvIMMORTAL_TRUE(sv) ((sv) == &PL_sv_yes) /* the SvREADONLY() test is to quickly reject most SVs */ -#define SvIMMORTAL(sv) \ - ( SvREADONLY(sv) \ - && (SvIMMORTAL_INTERP(sv) || (sv) == &PL_sv_placeholder)) +#define SvIMMORTAL(sv) \ + ( SvREADONLY(sv) \ + && (SvIMMORTAL_INTERP(sv) || (sv) == &PL_sv_placeholder)) #ifdef DEBUGGING /* exercise the immortal resurrection code in sv_free2() */ @@ -2440,45 +2440,45 @@ Returns a boolean as to whether or not C is a GV with a pointer to a GP =cut */ -#define isGV_with_GP(pwadak) \ - (((SvFLAGS(pwadak) & (SVp_POK|SVpgv_GP)) == SVpgv_GP) \ - && (SvTYPE(pwadak) == SVt_PVGV || SvTYPE(pwadak) == SVt_PVLV)) - -#define isGV_with_GP_on(sv) \ - STMT_START { \ - SV * sv_ = MUTABLE_SV(sv); \ - assert (SvTYPE(sv_) == SVt_PVGV || SvTYPE(sv_) == SVt_PVLV); \ - assert (!SvPOKp(sv_)); \ - assert (!SvIOKp(sv_)); \ - (SvFLAGS(sv_) |= SVpgv_GP); \ +#define isGV_with_GP(pwadak) \ + (((SvFLAGS(pwadak) & (SVp_POK|SVpgv_GP)) == SVpgv_GP) \ + && (SvTYPE(pwadak) == SVt_PVGV || SvTYPE(pwadak) == SVt_PVLV)) + +#define isGV_with_GP_on(sv) \ + STMT_START { \ + SV * sv_ = MUTABLE_SV(sv); \ + assert (SvTYPE(sv_) == SVt_PVGV || SvTYPE(sv_) == SVt_PVLV); \ + assert (!SvPOKp(sv_)); \ + assert (!SvIOKp(sv_)); \ + (SvFLAGS(sv_) |= SVpgv_GP); \ } STMT_END -#define isGV_with_GP_off(sv) \ - STMT_START { \ - SV * sv_ = MUTABLE_SV(sv); \ - assert (SvTYPE(sv_) == SVt_PVGV || SvTYPE(sv_) == SVt_PVLV); \ - assert (!SvPOKp(sv_)); \ - assert (!SvIOKp(sv_)); \ - (SvFLAGS(sv_) &= ~SVpgv_GP); \ +#define isGV_with_GP_off(sv) \ + STMT_START { \ + SV * sv_ = MUTABLE_SV(sv); \ + assert (SvTYPE(sv_) == SVt_PVGV || SvTYPE(sv_) == SVt_PVLV); \ + assert (!SvPOKp(sv_)); \ + assert (!SvIOKp(sv_)); \ + (SvFLAGS(sv_) &= ~SVpgv_GP); \ } STMT_END #ifdef PERL_CORE -# define isGV_or_RVCV(kadawp) \ - (isGV(kadawp) || (SvROK(kadawp) && SvTYPE(SvRV(kadawp)) == SVt_PVCV)) +# define isGV_or_RVCV(kadawp) \ + (isGV(kadawp) || (SvROK(kadawp) && SvTYPE(SvRV(kadawp)) == SVt_PVCV)) #endif -#define isREGEXP(sv) \ - (SvTYPE(sv) == SVt_REGEXP \ - || (SvFLAGS(sv) & (SVTYPEMASK|SVpgv_GP|SVf_FAKE)) \ +#define isREGEXP(sv) \ + (SvTYPE(sv) == SVt_REGEXP \ + || (SvFLAGS(sv) & (SVTYPEMASK|SVpgv_GP|SVf_FAKE)) \ == (SVt_PVLV|SVf_FAKE)) #ifdef PERL_ANY_COW # define SvGROW(sv,len) \ - (SvIsCOW(sv) || SvLEN(sv) < (len) ? sv_grow(sv,len) : SvPVX(sv)) + (SvIsCOW(sv) || SvLEN(sv) < (len) ? sv_grow(sv,len) : SvPVX(sv)) #else # define SvGROW(sv,len) (SvLEN(sv) < (len) ? sv_grow(sv,len) : SvPVX(sv)) #endif -#define SvGROW_mutable(sv,len) \ +#define SvGROW_mutable(sv,len) \ (SvLEN(sv) < (len) ? sv_grow(sv,len) : SvPVX_mutable(sv)) #define Sv_Grow sv_grow @@ -2539,44 +2539,44 @@ Evaluates C more than once. Sets C to 0 if C is false. 10:28 <@Nicholas> metabatman 10:28 <+meta> Nicholas: crash */ -# define SvOOK_offset(sv, offset) \ - STMT_START {\ - STATIC_ASSERT_STMT(sizeof(offset) == sizeof(STRLEN)); \ - if (SvOOK(sv)) { \ - const U8 *_crash = (U8*)SvPVX_const(sv); \ - (offset) = *--_crash; \ - if (!(offset)) { \ - _crash -= sizeof(STRLEN); \ - Copy(_crash, (U8 *)&(offset), sizeof(STRLEN), U8); \ - } \ - { \ - /* Validate the preceding buffer's sentinels to \ - verify that no-one is using it. */ \ - const U8 *const _bonk = (U8*)SvPVX_const(sv) - (offset);\ - while (_crash > _bonk) { \ - --_crash; \ - assert (*_crash == (U8)PTR2UV(_crash)); \ - } \ - } \ - } else { \ - (offset) = 0; \ - } \ - } STMT_END +# define SvOOK_offset(sv, offset) \ + STMT_START { \ + STATIC_ASSERT_STMT(sizeof(offset) == sizeof(STRLEN)); \ + if (SvOOK(sv)) { \ + const U8 *_crash = (U8*)SvPVX_const(sv); \ + (offset) = *--_crash; \ + if (!(offset)) { \ + _crash -= sizeof(STRLEN); \ + Copy(_crash, (U8 *)&(offset), sizeof(STRLEN), U8); \ + } \ + { \ + /* Validate the preceding buffer's sentinels to \ + verify that no-one is using it. */ \ + const U8 *const _bonk = (U8*)SvPVX_const(sv) - (offset); \ + while (_crash > _bonk) { \ + --_crash; \ + assert (*_crash == (U8)PTR2UV(_crash)); \ + } \ + } \ + } else { \ + (offset) = 0; \ + } \ + } STMT_END #else /* This is the same code, but avoids using any temporary variables: */ -# define SvOOK_offset(sv, offset) \ - STMT_START {\ - STATIC_ASSERT_STMT(sizeof(offset) == sizeof(STRLEN)); \ - if (SvOOK(sv)) { \ - (offset) = ((U8*)SvPVX_const(sv))[-1]; \ - if (!(offset)) { \ - Copy(SvPVX_const(sv) - 1 - sizeof(STRLEN), \ - (U8*)&(offset), sizeof(STRLEN), U8); \ - } \ - } else { \ - (offset) = 0; \ - } \ - } STMT_END +# define SvOOK_offset(sv, offset) \ + STMT_START { \ + STATIC_ASSERT_STMT(sizeof(offset) == sizeof(STRLEN)); \ + if (SvOOK(sv)) { \ + (offset) = ((U8*)SvPVX_const(sv))[-1]; \ + if (!(offset)) { \ + Copy(SvPVX_const(sv) - 1 - sizeof(STRLEN), \ + (U8*)&(offset), sizeof(STRLEN), U8); \ + } \ + } else { \ + (offset) = 0; \ + } \ + } STMT_END #endif /* @@ -2591,10 +2591,10 @@ Create a new IO, setting the reference count to 1. #if defined(PERL_CORE) || defined(PERL_EXT) -# define SV_CONST(name) \ - PL_sv_consts[SV_CONST_##name] \ - ? PL_sv_consts[SV_CONST_##name] \ - : (PL_sv_consts[SV_CONST_##name] = newSVpv_share(#name, 0)) +# define SV_CONST(name) \ + PL_sv_consts[SV_CONST_##name] \ + ? PL_sv_consts[SV_CONST_##name] \ + : (PL_sv_consts[SV_CONST_##name] = newSVpv_share(#name, 0)) # define SV_CONST_TIESCALAR 0 # define SV_CONST_TIEARRAY 1 @@ -2664,19 +2664,19 @@ Create a new IO, setting the reference count to 1. /* The following two macros compute the necessary offsets for the above * trick and store them in SvANY for SvIV() (and friends) to use. */ -# define SET_SVANY_FOR_BODYLESS_IV(sv) \ - STMT_START { \ - SV * sv_ = MUTABLE_SV(sv); \ - SvANY(sv_) = (XPVIV*)((char*)&(sv_->sv_u.svu_iv) \ - - STRUCT_OFFSET(XPVIV, xiv_iv)); \ - } STMT_END - -# define SET_SVANY_FOR_BODYLESS_NV(sv) \ - STMT_START { \ - SV * sv_ = MUTABLE_SV(sv); \ - SvANY(sv_) = (XPVNV*)((char*)&(sv_->sv_u.svu_nv) \ - - STRUCT_OFFSET(XPVNV, xnv_u.xnv_nv)); \ - } STMT_END +# define SET_SVANY_FOR_BODYLESS_IV(sv) \ + STMT_START { \ + SV * sv_ = MUTABLE_SV(sv); \ + SvANY(sv_) = (XPVIV*)((char*)&(sv_->sv_u.svu_iv) \ + - STRUCT_OFFSET(XPVIV, xiv_iv)); \ + } STMT_END + +# define SET_SVANY_FOR_BODYLESS_NV(sv) \ + STMT_START { \ + SV * sv_ = MUTABLE_SV(sv); \ + SvANY(sv_) = (XPVNV*)((char*)&(sv_->sv_u.svu_nv) \ + - STRUCT_OFFSET(XPVNV, xnv_u.xnv_nv)); \ + } STMT_END /* * ex: set ts=8 sts=4 sw=4 et: diff --git a/sv_inline.h b/sv_inline.h index 1f6eecdfa0f5..ec05c3f15222 100644 --- a/sv_inline.h +++ b/sv_inline.h @@ -38,9 +38,9 @@ unreferenced scalars # define POISON_SV_HEAD(sv) PoisonNew(sv, 1, struct STRUCT_SV) */ -# define POISON_SV_HEAD(sv) \ - PoisonNew(&SvANY(sv), 1, void *),\ - PoisonNew(&SvREFCNT(sv), 1, U32) +# define POISON_SV_HEAD(sv) \ + PoisonNew(&SvANY(sv), 1, void *), \ + PoisonNew(&SvREFCNT(sv), 1, U32) #else # define SvARENA_CHAIN(sv) SvANY(sv) # define SvARENA_CHAIN_SET(sv,val) SvANY(sv) = (void *)(val) @@ -49,19 +49,19 @@ #ifdef PERL_MEM_LOG # define MEM_LOG_NEW_SV(sv, file, line, func) \ - Perl_mem_log_new_sv(sv, file, line, func) + Perl_mem_log_new_sv(sv, file, line, func) # define MEM_LOG_DEL_SV(sv, file, line, func) \ - Perl_mem_log_del_sv(sv, file, line, func) + Perl_mem_log_del_sv(sv, file, line, func) #else # define MEM_LOG_NEW_SV(sv, file, line, func) NOOP # define MEM_LOG_DEL_SV(sv, file, line, func) NOOP #endif -#define uproot_SV(p) \ - STMT_START { \ - (p) = PL_sv_root; \ - PL_sv_root = MUTABLE_SV(SvARENA_CHAIN(p)); \ - ++PL_sv_count; \ +#define uproot_SV(p) \ + STMT_START { \ + (p) = PL_sv_root; \ + PL_sv_root = MUTABLE_SV(SvARENA_CHAIN(p)); \ + ++PL_sv_count; \ } STMT_END /* Perl_more_sv lives in sv.c, we don't want to inline it. @@ -106,17 +106,17 @@ S_new_SV(pTHX_ const char *file, int line, const char *func) # define new_SV(p) (p)=S_new_SV(aTHX_ __FILE__, __LINE__, FUNCTION__) #else -# define new_SV(p) \ - STMT_START { \ - if (PL_sv_root) \ - uproot_SV(p); \ - else \ - (p) = Perl_more_sv(aTHX); \ - SvANY(p) = 0; \ - SvREFCNT(p) = 1; \ - SvFLAGS(p) = 0; \ - MEM_LOG_NEW_SV(p, __FILE__, __LINE__, FUNCTION__); \ - } STMT_END +# define new_SV(p) \ + STMT_START { \ + if (PL_sv_root) \ + uproot_SV(p); \ + else \ + (p) = Perl_more_sv(aTHX); \ + SvANY(p) = 0; \ + SvREFCNT(p) = 1; \ + SvFLAGS(p) = 0; \ + MEM_LOG_NEW_SV(p, __FILE__, __LINE__, FUNCTION__); \ + } STMT_END #endif @@ -134,11 +134,11 @@ struct body_details { }; #define ALIGNED_TYPE_NAME(name) name##_aligned -#define ALIGNED_TYPE(name) \ - typedef union { \ - name align_me; \ - NV nv; \ - IV iv; \ +#define ALIGNED_TYPE(name) \ + typedef union { \ + name align_me; \ + NV nv; \ + IV iv; \ } ALIGNED_TYPE_NAME(name) ALIGNED_TYPE(regexp); @@ -172,24 +172,24 @@ ALIGNED_TYPE(XPVIO); limited by PERL_ARENA_SIZE, so we can safely oversize the declarations. */ -#define FIT_ARENA0(body_size) \ +#define FIT_ARENA0(body_size) \ ((size_t)(PERL_ARENA_SIZE / body_size) * body_size) -#define FIT_ARENAn(count,body_size) \ - ( count * body_size <= PERL_ARENA_SIZE) \ - ? count * body_size \ +#define FIT_ARENAn(count,body_size) \ + ( count * body_size <= PERL_ARENA_SIZE) \ + ? count * body_size \ : FIT_ARENA0 (body_size) -#define FIT_ARENA(count,body_size) \ - (U32)(count \ - ? FIT_ARENAn (count, body_size) \ - : FIT_ARENA0 (body_size)) +#define FIT_ARENA(count,body_size) \ + (U32)(count \ + ? FIT_ARENAn (count, body_size) \ + : FIT_ARENA0 (body_size)) /* Calculate the length to copy. Specifically work out the length less any final padding the compiler needed to add. See the comment in sv_upgrade for why copying the padding proved to be a bug. */ -#define copy_length(type, last_member) \ - STRUCT_OFFSET(type, last_member) \ - + sizeof (((type*)SvANY((const SV *)0))->last_member) +#define copy_length(type, last_member) \ + STRUCT_OFFSET(type, last_member) \ + + sizeof (((type*)SvANY((const SV *)0))->last_member) static const struct body_details bodies_by_type[] = { /* HEs use this offset for their arena. */ @@ -283,8 +283,8 @@ static const struct body_details bodies_by_type[] = { FIT_ARENA(24, sizeof(ALIGNED_TYPE_NAME(XPVIO))) }, }; -#define new_body_allocated(sv_type) \ - (void *)((char *)S_new_body(aTHX_ sv_type) \ +#define new_body_allocated(sv_type) \ + (void *)((char *)S_new_body(aTHX_ sv_type) \ - bodies_by_type[sv_type].offset) #ifdef PURIFY @@ -304,30 +304,30 @@ static const struct body_details bodies_by_type[] = { #define new_XPVNV() new_body_allocated(SVt_PVNV) #define new_XPVMG() new_body_allocated(SVt_PVMG) -#define del_body_by_type(p, type) \ - del_body(p + bodies_by_type[(type)].offset, \ +#define del_body_by_type(p, type) \ + del_body(p + bodies_by_type[(type)].offset, \ &PL_body_roots[(type)]) #endif /* PURIFY */ /* no arena for you! */ -#define new_NOARENA(details) \ - safemalloc((details)->body_size + (details)->offset) -#define new_NOARENAZ(details) \ - safecalloc((details)->body_size + (details)->offset, 1) +#define new_NOARENA(details) \ + safemalloc((details)->body_size + (details)->offset) +#define new_NOARENAZ(details) \ + safecalloc((details)->body_size + (details)->offset, 1) #ifndef PURIFY /* grab a new thing from the arena's free list, allocating more if necessary. */ -#define new_body_from_arena(xpv, root_index, type_meta) \ - STMT_START { \ - void ** const r3wt = &PL_body_roots[root_index]; \ - xpv = (PTR_TBL_ENT_t*) (*((void **)(r3wt)) \ - ? *((void **)(r3wt)) : Perl_more_bodies(aTHX_ root_index, \ - type_meta.body_size,\ - type_meta.arena_size)); \ - *(r3wt) = *(void**)(xpv); \ +#define new_body_from_arena(xpv, root_index, type_meta) \ + STMT_START { \ + void ** const r3wt = &PL_body_roots[root_index]; \ + xpv = (PTR_TBL_ENT_t*) (*((void **)(r3wt)) \ + ? *((void **)(r3wt)) : Perl_more_bodies(aTHX_ root_index, \ + type_meta.body_size, \ + type_meta.arena_size)); \ + *(r3wt) = *(void**)(xpv); \ } STMT_END PERL_STATIC_INLINE void * diff --git a/thread.h b/thread.h index 7614f96ebf89..e6817d9a44f6 100644 --- a/thread.h +++ b/thread.h @@ -18,15 +18,15 @@ # include #else # ifdef OLD_PTHREADS_API /* Here be dragons. */ -# define DETACH(t) \ - STMT_START { \ - int _eC_; \ - if ((_eC_ = pthread_detach(&(t)->self))) { \ - MUTEX_UNLOCK(&(t)->mutex); \ - Perl_croak_nocontext("panic: DETACH (%d) [%s:%d]", \ - _eC_, __FILE__, __LINE__); \ - } \ - } STMT_END +# define DETACH(t) \ + STMT_START { \ + int _eC_; \ + if ((_eC_ = pthread_detach(&(t)->self))) { \ + MUTEX_UNLOCK(&(t)->mutex); \ + Perl_croak_nocontext("panic: DETACH (%d) [%s:%d]", \ + _eC_, __FILE__, __LINE__); \ + } \ + } STMT_END # define PERL_GET_CONTEXT Perl_get_context() # define PERL_SET_CONTEXT(t) Perl_set_context((void*)t) @@ -97,7 +97,7 @@ /* #include is in perl.h #ifdef I_MACH_CTHREADS */ -#define MUTEX_INIT(m) \ +#define MUTEX_INIT(m) \ STMT_START { \ *m = mutex_alloc(); \ if (*m) { \ @@ -110,13 +110,13 @@ #define MUTEX_LOCK(m) mutex_lock(*m) #define MUTEX_UNLOCK(m) mutex_unlock(*m) -#define MUTEX_DESTROY(m) \ - STMT_START { \ - mutex_free(*m); \ - *m = 0; \ +#define MUTEX_DESTROY(m) \ + STMT_START { \ + mutex_free(*m); \ + *m = 0; \ } STMT_END -#define COND_INIT(c) \ +#define COND_INIT(c) \ STMT_START { \ *c = condition_alloc(); \ if (*c) { \ @@ -131,10 +131,10 @@ #define COND_SIGNAL(c) condition_signal(*c) #define COND_BROADCAST(c) condition_broadcast(*c) #define COND_WAIT(c, m) condition_wait(*c, *m) -#define COND_DESTROY(c) \ - STMT_START { \ - condition_free(*c); \ - *c = 0; \ +#define COND_DESTROY(c) \ + STMT_START { \ + condition_free(*c); \ + *c = 0; \ } STMT_END #define THREAD_RET_TYPE any_t @@ -173,22 +173,22 @@ # ifdef MUTEX_INIT_NEEDS_MUTEX_ZEROED /* Temporary workaround, true bug is deeper. --jhi 1999-02-25 */ -# define MUTEX_INIT(m) \ - STMT_START { \ - int _eC_; \ - Zero((m), 1, perl_mutex); \ - if ((_eC_ = pthread_mutex_init((m), pthread_mutexattr_default)))\ - Perl_croak_nocontext("panic: MUTEX_INIT (%d) [%s:%d]", \ - _eC_, __FILE__, __LINE__); \ - } STMT_END +# define MUTEX_INIT(m) \ + STMT_START { \ + int _eC_; \ + Zero((m), 1, perl_mutex); \ + if ((_eC_ = pthread_mutex_init((m), pthread_mutexattr_default))) \ + Perl_croak_nocontext("panic: MUTEX_INIT (%d) [%s:%d]", \ + _eC_, __FILE__, __LINE__); \ + } STMT_END # else -# define MUTEX_INIT(m) \ - STMT_START { \ - int _eC_; \ - if ((_eC_ = pthread_mutex_init((m), pthread_mutexattr_default))) \ - Perl_croak_nocontext("panic: MUTEX_INIT (%d) [%s:%d]", \ - _eC_, __FILE__, __LINE__); \ - } STMT_END +# define MUTEX_INIT(m) \ + STMT_START { \ + int _eC_; \ + if ((_eC_ = pthread_mutex_init((m), pthread_mutexattr_default))) \ + Perl_croak_nocontext("panic: MUTEX_INIT (%d) [%s:%d]", \ + _eC_, __FILE__, __LINE__); \ + } STMT_END # endif # ifdef PERL_TSA_ACTIVE @@ -199,82 +199,82 @@ # define perl_pthread_mutex_unlock(m) pthread_mutex_unlock(m) # endif -# define MUTEX_LOCK(m) \ - STMT_START { \ - dSAVE_ERRNO; \ - int _eC_; \ - if ((_eC_ = perl_pthread_mutex_lock((m)))) \ - Perl_croak_nocontext("panic: MUTEX_LOCK (%d) [%s:%d]",\ - _eC_, __FILE__, __LINE__); \ - RESTORE_ERRNO; \ - } STMT_END - -# define MUTEX_UNLOCK(m) \ - STMT_START { \ - dSAVE_ERRNO; /* Shouldn't be necessary as panics if fails */\ - int _eC_; \ - if ((_eC_ = perl_pthread_mutex_unlock((m)))) { \ - Perl_croak_nocontext( \ - "panic: MUTEX_UNLOCK (%d) [%s:%d]", \ - _eC_, __FILE__, __LINE__); \ - } \ - RESTORE_ERRNO; \ - } STMT_END - -# define MUTEX_DESTROY(m) \ - STMT_START { \ - int _eC_; \ - if ((_eC_ = pthread_mutex_destroy((m)))) { \ - Perl_croak_nocontext("panic: MUTEX_DESTROY (%d) [%s:%d]", \ - _eC_, __FILE__, __LINE__); \ - } \ - } STMT_END +# define MUTEX_LOCK(m) \ + STMT_START { \ + dSAVE_ERRNO; \ + int _eC_; \ + if ((_eC_ = perl_pthread_mutex_lock((m)))) \ + Perl_croak_nocontext("panic: MUTEX_LOCK (%d) [%s:%d]", \ + _eC_, __FILE__, __LINE__); \ + RESTORE_ERRNO; \ + } STMT_END + +# define MUTEX_UNLOCK(m) \ + STMT_START { \ + dSAVE_ERRNO; /* Shouldn't be necessary as panics if fails */ \ + int _eC_; \ + if ((_eC_ = perl_pthread_mutex_unlock((m)))) { \ + Perl_croak_nocontext( \ + "panic: MUTEX_UNLOCK (%d) [%s:%d]", \ + _eC_, __FILE__, __LINE__); \ + } \ + RESTORE_ERRNO; \ + } STMT_END + +# define MUTEX_DESTROY(m) \ + STMT_START { \ + int _eC_; \ + if ((_eC_ = pthread_mutex_destroy((m)))) { \ + Perl_croak_nocontext("panic: MUTEX_DESTROY (%d) [%s:%d]", \ + _eC_, __FILE__, __LINE__); \ + } \ + } STMT_END #endif /* MUTEX_INIT */ #ifndef COND_INIT -# define COND_INIT(c) \ - STMT_START { \ - int _eC_; \ - if ((_eC_ = pthread_cond_init((c), pthread_condattr_default))) \ - Perl_croak_nocontext("panic: COND_INIT (%d) [%s:%d]", \ - _eC_, __FILE__, __LINE__); \ - } STMT_END - -# define COND_SIGNAL(c) \ - STMT_START { \ - int _eC_; \ - if ((_eC_ = pthread_cond_signal((c)))) \ - Perl_croak_nocontext("panic: COND_SIGNAL (%d) [%s:%d]", \ - _eC_, __FILE__, __LINE__); \ - } STMT_END - -# define COND_BROADCAST(c) \ - STMT_START { \ - int _eC_; \ - if ((_eC_ = pthread_cond_broadcast((c)))) \ - Perl_croak_nocontext("panic: COND_BROADCAST (%d) [%s:%d]", \ - _eC_, __FILE__, __LINE__); \ - } STMT_END - -# define COND_WAIT(c, m) \ - STMT_START { \ - int _eC_; \ - if ((_eC_ = pthread_cond_wait((c), (m)))) \ - Perl_croak_nocontext("panic: COND_WAIT (%d) [%s:%d]", \ - _eC_, __FILE__, __LINE__); \ - } STMT_END - -# define COND_DESTROY(c) \ - STMT_START { \ - int _eC_; \ - if ((_eC_ = pthread_cond_destroy((c)))) \ - Perl_croak_nocontext("panic: COND_DESTROY (%d) [%s:%d]", \ - _eC_, __FILE__, __LINE__); \ - } STMT_END +# define COND_INIT(c) \ + STMT_START { \ + int _eC_; \ + if ((_eC_ = pthread_cond_init((c), pthread_condattr_default))) \ + Perl_croak_nocontext("panic: COND_INIT (%d) [%s:%d]", \ + _eC_, __FILE__, __LINE__); \ + } STMT_END + +# define COND_SIGNAL(c) \ + STMT_START { \ + int _eC_; \ + if ((_eC_ = pthread_cond_signal((c)))) \ + Perl_croak_nocontext("panic: COND_SIGNAL (%d) [%s:%d]", \ + _eC_, __FILE__, __LINE__); \ + } STMT_END + +# define COND_BROADCAST(c) \ + STMT_START { \ + int _eC_; \ + if ((_eC_ = pthread_cond_broadcast((c)))) \ + Perl_croak_nocontext("panic: COND_BROADCAST (%d) [%s:%d]", \ + _eC_, __FILE__, __LINE__); \ + } STMT_END + +# define COND_WAIT(c, m) \ + STMT_START { \ + int _eC_; \ + if ((_eC_ = pthread_cond_wait((c), (m)))) \ + Perl_croak_nocontext("panic: COND_WAIT (%d) [%s:%d]", \ + _eC_, __FILE__, __LINE__); \ + } STMT_END + +# define COND_DESTROY(c) \ + STMT_START { \ + int _eC_; \ + if ((_eC_ = pthread_cond_destroy((c)))) \ + Perl_croak_nocontext("panic: COND_DESTROY (%d) [%s:%d]", \ + _eC_, __FILE__, __LINE__); \ + } STMT_END #endif /* COND_INIT */ -#if defined(MUTEX_LOCK) && defined(MUTEX_UNLOCK) \ - && defined(COND_SIGNAL) && defined(COND_WAIT) +#if defined(MUTEX_LOCK) && defined(MUTEX_UNLOCK) \ + && defined(COND_SIGNAL) && defined(COND_WAIT) /* These emulate native many-reader/1-writer locks. * Basically a locking reader just locks the semaphore long enough to increment @@ -286,89 +286,89 @@ * the count to become 0 signals any waiting writers, and the system guarantees * that only one gets control at a time */ -# define PERL_READ_LOCK(mutex) \ - STMT_START { \ - MUTEX_LOCK(&(mutex)->lock); \ - (mutex)->readers_count++; \ - MUTEX_UNLOCK(&(mutex)->lock); \ - } STMT_END - -# define PERL_READ_UNLOCK(mutex) \ - STMT_START { \ - MUTEX_LOCK(&(mutex)->lock); \ - (mutex)->readers_count--; \ - if ((mutex)->readers_count <= 0) { \ - assert((mutex)->readers_count == 0); \ - COND_SIGNAL(&(mutex)->wakeup); \ - (mutex)->readers_count = 0; \ - } \ - MUTEX_UNLOCK(&(mutex)->lock); \ - } STMT_END - -# define PERL_WRITE_LOCK(mutex) \ - STMT_START { \ - MUTEX_LOCK(&(mutex)->lock); \ - do { \ - if ((mutex)->readers_count <= 0) { \ - assert((mutex)->readers_count == 0); \ - (mutex)->readers_count = 0; \ - break; \ - } \ - COND_WAIT(&(mutex)->wakeup, &(mutex)->lock); \ - } \ - while (1); \ - \ - /* Here, the mutex is locked, with no readers */ \ - } STMT_END - -# define PERL_WRITE_UNLOCK(mutex) \ - STMT_START { \ - COND_SIGNAL(&(mutex)->wakeup); \ - MUTEX_UNLOCK(&(mutex)->lock); \ - } STMT_END - -# define PERL_RW_MUTEX_INIT(mutex) \ - STMT_START { \ - MUTEX_INIT(&(mutex)->lock); \ - COND_INIT(&(mutex)->wakeup); \ - (mutex)->readers_count = 0; \ - } STMT_END - -# define PERL_RW_MUTEX_DESTROY(mutex) \ - STMT_START { \ - COND_DESTROY(&(mutex)->wakeup); \ - MUTEX_DESTROY(&(mutex)->lock); \ - } STMT_END +# define PERL_READ_LOCK(mutex) \ + STMT_START { \ + MUTEX_LOCK(&(mutex)->lock); \ + (mutex)->readers_count++; \ + MUTEX_UNLOCK(&(mutex)->lock); \ + } STMT_END + +# define PERL_READ_UNLOCK(mutex) \ + STMT_START { \ + MUTEX_LOCK(&(mutex)->lock); \ + (mutex)->readers_count--; \ + if ((mutex)->readers_count <= 0) { \ + assert((mutex)->readers_count == 0); \ + COND_SIGNAL(&(mutex)->wakeup); \ + (mutex)->readers_count = 0; \ + } \ + MUTEX_UNLOCK(&(mutex)->lock); \ + } STMT_END + +# define PERL_WRITE_LOCK(mutex) \ + STMT_START { \ + MUTEX_LOCK(&(mutex)->lock); \ + do { \ + if ((mutex)->readers_count <= 0) { \ + assert((mutex)->readers_count == 0); \ + (mutex)->readers_count = 0; \ + break; \ + } \ + COND_WAIT(&(mutex)->wakeup, &(mutex)->lock); \ + } \ + while (1); \ + \ + /* Here, the mutex is locked, with no readers */ \ + } STMT_END + +# define PERL_WRITE_UNLOCK(mutex) \ + STMT_START { \ + COND_SIGNAL(&(mutex)->wakeup); \ + MUTEX_UNLOCK(&(mutex)->lock); \ + } STMT_END + +# define PERL_RW_MUTEX_INIT(mutex) \ + STMT_START { \ + MUTEX_INIT(&(mutex)->lock); \ + COND_INIT(&(mutex)->wakeup); \ + (mutex)->readers_count = 0; \ + } STMT_END + +# define PERL_RW_MUTEX_DESTROY(mutex) \ + STMT_START { \ + COND_DESTROY(&(mutex)->wakeup); \ + MUTEX_DESTROY(&(mutex)->lock); \ + } STMT_END #endif /* DETACH(t) must only be called while holding t->mutex */ #ifndef DETACH -# define DETACH(t) \ - STMT_START { \ - int _eC_; \ - if ((_eC_ = pthread_detach((t)->self))) { \ - MUTEX_UNLOCK(&(t)->mutex); \ - Perl_croak_nocontext("panic: DETACH (%d) [%s:%d]", \ - _eC_, __FILE__, __LINE__); \ - } \ - } STMT_END +# define DETACH(t) \ + STMT_START { \ + int _eC_; \ + if ((_eC_ = pthread_detach((t)->self))) { \ + MUTEX_UNLOCK(&(t)->mutex); \ + Perl_croak_nocontext("panic: DETACH (%d) [%s:%d]", \ + _eC_, __FILE__, __LINE__); \ + } \ + } STMT_END #endif /* DETACH */ #ifndef JOIN -# define JOIN(t, avp) \ - STMT_START { \ - int _eC_; \ - if ((_eC_ = pthread_join((t)->self, (void**)(avp)))) \ - Perl_croak_nocontext("panic: pthread_join (%d) [%s:%d]", \ - _eC_, __FILE__, __LINE__); \ - } STMT_END +# define JOIN(t, avp) \ + STMT_START { \ + int _eC_; \ + if ((_eC_ = pthread_join((t)->self, (void**)(avp)))) \ + Perl_croak_nocontext("panic: pthread_join (%d) [%s:%d]", \ + _eC_, __FILE__, __LINE__); \ + } STMT_END #endif /* JOIN */ /* Use an unchecked fetch of thread-specific data instead of a checked one. * It would fail if the key were bogus, but if the key were bogus then * Really Bad Things would be happening anyway. --dan */ -#if (defined(__ALPHA) && (__VMS_VER >= 70000000)) || \ +#if (defined(__ALPHA) && (__VMS_VER >= 70000000)) || \ (defined(__alpha) && defined(__osf__) && !defined(__GNUC__)) /* Available only on >= 4.0 */ # define HAS_PTHREAD_UNCHECKED_GETSPECIFIC_NP /* Configure test needed */ #endif @@ -397,15 +397,15 @@ extern PERL_THREAD_LOCAL void *PL_current_context; /* We must also call pthread_setspecific() always, as C++ code has to read it * with pthreads (the #else side just below) */ -# define PERL_SET_CONTEXT(t) \ - STMT_START { \ - int _eC_; \ - if ((_eC_ = pthread_setspecific(PL_thr_key, \ - PL_current_context = (void *)(t)))) \ - Perl_croak_nocontext("panic: pthread_setspecific (%d) [%s:%d]", \ - _eC_, __FILE__, __LINE__); \ - PERL_SET_NON_tTHX_CONTEXT(t); \ - } STMT_END +# define PERL_SET_CONTEXT(t) \ + STMT_START { \ + int _eC_; \ + if ((_eC_ = pthread_setspecific(PL_thr_key, \ + PL_current_context = (void *)(t)))) \ + Perl_croak_nocontext("panic: pthread_setspecific (%d) [%s:%d]", \ + _eC_, __FILE__, __LINE__); \ + PERL_SET_NON_tTHX_CONTEXT(t); \ + } STMT_END #else /* else fall back to pthreads */ @@ -432,29 +432,29 @@ extern PERL_THREAD_LOCAL void *PL_current_context; #endif #ifndef ALLOC_THREAD_KEY -# define ALLOC_THREAD_KEY \ - STMT_START { \ - if (pthread_key_create(&PL_thr_key, 0)) { \ - PERL_UNUSED_RESULT(write(2, STR_WITH_LEN("panic: pthread_key_create failed\n"))); \ - exit(1); \ - } \ - } STMT_END +# define ALLOC_THREAD_KEY \ + STMT_START { \ + if (pthread_key_create(&PL_thr_key, 0)) { \ + PERL_UNUSED_RESULT(write(2, STR_WITH_LEN("panic: pthread_key_create failed\n"))); \ + exit(1); \ + } \ + } STMT_END #endif #ifndef FREE_THREAD_KEY -# define FREE_THREAD_KEY \ - STMT_START { \ - pthread_key_delete(PL_thr_key); \ - } STMT_END +# define FREE_THREAD_KEY \ + STMT_START { \ + pthread_key_delete(PL_thr_key); \ + } STMT_END #endif #ifndef PTHREAD_ATFORK # ifdef HAS_PTHREAD_ATFORK -# define PTHREAD_ATFORK(prepare,parent,child) \ - pthread_atfork(prepare,parent,child) +# define PTHREAD_ATFORK(prepare,parent,child) \ + pthread_atfork(prepare,parent,child) # else -# define PTHREAD_ATFORK(prepare,parent,child) \ - NOOP +# define PTHREAD_ATFORK(prepare,parent,child) \ + NOOP # endif #endif diff --git a/unixish.h b/unixish.h index 0c9064b60e6c..6555e4c3a001 100644 --- a/unixish.h +++ b/unixish.h @@ -137,20 +137,20 @@ int afstat(int fd, struct stat *statb); #if defined(__amigaos4__) # define PLATFORM_SYS_TERM_ amigaos4_dispose_fork_array() -# define PLATFORM_SYS_INIT_ \ - STMT_START {\ - amigaos4_init_fork_array(); \ - amigaos4_init_environ_sema(); \ - } STMT_END +# define PLATFORM_SYS_INIT_ \ + STMT_START { \ + amigaos4_init_fork_array(); \ + amigaos4_init_environ_sema(); \ + } STMT_END #else # define PLATFORM_SYS_TERM_ NOOP # define PLATFORM_SYS_INIT_ NOOP #endif #ifndef PERL_SYS_INIT_BODY -#define PERL_SYS_INIT_BODY(c,v) \ - MALLOC_CHECK_TAINT2(*c,*v) PERL_FPU_INIT; PERLIO_INIT; \ - MALLOC_INIT; PLATFORM_SYS_INIT_; +#define PERL_SYS_INIT_BODY(c,v) \ + MALLOC_CHECK_TAINT2(*c,*v) PERL_FPU_INIT; PERLIO_INIT; \ + MALLOC_INIT; PLATFORM_SYS_INIT_; #endif /* Generally add things last-in first-terminated. IO and memory terminations @@ -159,12 +159,12 @@ int afstat(int fd, struct stat *statb); * BEWARE that using PerlIO in these will be using freed memory, so may appear * to work, but must NOT be retained in production code. */ #ifndef PERL_SYS_TERM_BODY -# define PERL_SYS_TERM_BODY() \ - ENV_TERM; USER_PROP_MUTEX_TERM; LOCALE_TERM; \ - HINTS_REFCNT_TERM; KEYWORD_PLUGIN_MUTEX_TERM; \ - OP_CHECK_MUTEX_TERM; OP_REFCNT_TERM; \ - PERLIO_TERM; MALLOC_TERM; \ - PLATFORM_SYS_TERM_; +# define PERL_SYS_TERM_BODY() \ + ENV_TERM; USER_PROP_MUTEX_TERM; LOCALE_TERM; \ + HINTS_REFCNT_TERM; KEYWORD_PLUGIN_MUTEX_TERM; \ + OP_CHECK_MUTEX_TERM; OP_REFCNT_TERM; \ + PERLIO_TERM; MALLOC_TERM; \ + PLATFORM_SYS_TERM_; #endif #define BIT_BUCKET "/dev/null" diff --git a/utf8.h b/utf8.h index fd8dd309318a..bca5e924f0de 100644 --- a/utf8.h +++ b/utf8.h @@ -145,33 +145,33 @@ the string is invariant. #define is_ascii_string(s, len) is_utf8_invariant_string(s, len) #define is_invariant_string(s, len) is_utf8_invariant_string(s, len) -#define uvoffuni_to_utf8_flags(d,uv,flags) \ - uvoffuni_to_utf8_flags_msgs(d, uv, flags, 0) +#define uvoffuni_to_utf8_flags(d,uv,flags) \ + uvoffuni_to_utf8_flags_msgs(d, uv, flags, 0) #define uvchr_to_utf8(a,b) uvchr_to_utf8_flags(a,b,0) -#define uvchr_to_utf8_flags(d,uv,flags) \ - uvchr_to_utf8_flags_msgs(d,uv,flags, 0) -#define uvchr_to_utf8_flags_msgs(d,uv,flags,msgs) \ - uvoffuni_to_utf8_flags_msgs(d,NATIVE_TO_UNI(uv),flags, msgs) -#define utf8_to_uvchr_buf(s, e, lenp) \ - utf8_to_uvchr_buf_helper((const U8 *) (s), (const U8 *) e, lenp) -#define utf8n_to_uvchr(s, len, lenp, flags) \ - utf8n_to_uvchr_error(s, len, lenp, flags, 0) -#define utf8n_to_uvchr_error(s, len, lenp, flags, errors) \ - utf8n_to_uvchr_msgs(s, len, lenp, flags, errors, 0) - -#define utf16_to_utf8(p, d, bytelen, newlen) \ - utf16_to_utf8_base(p, d, bytelen, newlen, 0, 1) -#define utf16_to_utf8_reversed(p, d, bytelen, newlen) \ - utf16_to_utf8_base(p, d, bytelen, newlen, 1, 0) -#define utf8_to_utf16(p, d, bytelen, newlen) \ - utf8_to_utf16_base(p, d, bytelen, newlen, 0, 1) -#define utf8_to_utf16_reversed(p, d, bytelen, newlen) \ - utf8_to_utf16_base(p, d, bytelen, newlen, 1, 0) +#define uvchr_to_utf8_flags(d,uv,flags) \ + uvchr_to_utf8_flags_msgs(d,uv,flags, 0) +#define uvchr_to_utf8_flags_msgs(d,uv,flags,msgs) \ + uvoffuni_to_utf8_flags_msgs(d,NATIVE_TO_UNI(uv),flags, msgs) +#define utf8_to_uvchr_buf(s, e, lenp) \ + utf8_to_uvchr_buf_helper((const U8 *) (s), (const U8 *) e, lenp) +#define utf8n_to_uvchr(s, len, lenp, flags) \ + utf8n_to_uvchr_error(s, len, lenp, flags, 0) +#define utf8n_to_uvchr_error(s, len, lenp, flags, errors) \ + utf8n_to_uvchr_msgs(s, len, lenp, flags, errors, 0) + +#define utf16_to_utf8(p, d, bytelen, newlen) \ + utf16_to_utf8_base(p, d, bytelen, newlen, 0, 1) +#define utf16_to_utf8_reversed(p, d, bytelen, newlen) \ + utf16_to_utf8_base(p, d, bytelen, newlen, 1, 0) +#define utf8_to_utf16(p, d, bytelen, newlen) \ + utf8_to_utf16_base(p, d, bytelen, newlen, 0, 1) +#define utf8_to_utf16_reversed(p, d, bytelen, newlen) \ + utf8_to_utf16_base(p, d, bytelen, newlen, 1, 0) #define to_uni_fold(c, p, lenp) _to_uni_fold_flags(c, p, lenp, FOLD_FLAGS_FULL) -#define foldEQ_utf8(s1, pe1, l1, u1, s2, pe2, l2, u2) \ - foldEQ_utf8_flags(s1, pe1, l1, u1, s2, pe2, l2, u2, 0) +#define foldEQ_utf8(s1, pe1, l1, u1, s2, pe2, l2, u2) \ + foldEQ_utf8_flags(s1, pe1, l1, u1, s2, pe2, l2, u2, 0) #define FOLDEQ_UTF8_NOMIX_ASCII (1 << 0) #define FOLDEQ_LOCALE (1 << 1) #define FOLDEQ_S1_ALREADY_FOLDED (1 << 2) @@ -358,8 +358,8 @@ are in the character. */ /* It turns out that in a number of cases, that handling ASCII vs EBCDIC is a * matter of being off-by-one. So this is a convenience macro, used to avoid * some #ifdefs. */ -#define ONE_IF_EBCDIC_ZERO_IF_NOT \ - (UTF_CONTINUATION_BYTE_INFO_BITS == UTF_EBCDIC_CONTINUATION_BYTE_INFO_BITS) +#define ONE_IF_EBCDIC_ZERO_IF_NOT \ + (UTF_CONTINUATION_BYTE_INFO_BITS == UTF_EBCDIC_CONTINUATION_BYTE_INFO_BITS) /* Since the significant bits in a continuation byte are stored in the * least-significant positions, we often find ourselves shifting by that @@ -369,8 +369,8 @@ are in the character. */ /* 2**info_bits - 1. This masks out all but the bits that carry real * information in a continuation byte. This turns out to be 0x3F in UTF-8, * 0x1F in UTF-EBCDIC. */ -#define UTF_CONTINUATION_MASK \ - ((U8) nBIT_MASK(UTF_CONTINUATION_BYTE_INFO_BITS)) +#define UTF_CONTINUATION_MASK \ + ((U8) nBIT_MASK(UTF_CONTINUATION_BYTE_INFO_BITS)) /* For use in UTF8_IS_CONTINUATION(). This turns out to be 0xC0 in UTF-8, * E0 in UTF-EBCDIC */ @@ -388,16 +388,16 @@ are in the character. */ /* Is the byte 'c' part of a multi-byte UTF8-8 encoded sequence, and not the * first byte thereof? */ -#define UTF8_IS_CONTINUATION(c) \ - (__ASSERT_(FITS_IN_8_BITS(c))\ - (((NATIVE_UTF8_TO_I8(c) & UTF_IS_CONTINUATION_MASK) \ +#define UTF8_IS_CONTINUATION(c) \ + (__ASSERT_(FITS_IN_8_BITS(c)) \ + (((NATIVE_UTF8_TO_I8(c) & UTF_IS_CONTINUATION_MASK) \ == UTF_CONTINUATION_MARK))) /* Is the representation of the Unicode code point 'cp' the same regardless of * being encoded in UTF-8 or not? This is a fundamental property of * UTF-8,EBCDIC */ -#define OFFUNI_IS_INVARIANT(c) \ - (((WIDEST_UTYPE)(c)) < UTF_MIN_CONTINUATION_BYTE) +#define OFFUNI_IS_INVARIANT(c) \ + (((WIDEST_UTYPE)(c)) < UTF_MIN_CONTINUATION_BYTE) /* =for apidoc Am|bool|UVCHR_IS_INVARIANT|UV cp @@ -491,8 +491,8 @@ The disadvantages of this method are: WARNING: This number must be in sync with the value in regen/charset_translations.pl. */ -#define UTF8_MAXBYTES \ - (ASCII_PLATFORM_UTF8_MAXBYTES + ONE_IF_EBCDIC_ZERO_IF_NOT) +#define UTF8_MAXBYTES \ + (ASCII_PLATFORM_UTF8_MAXBYTES + ONE_IF_EBCDIC_ZERO_IF_NOT) /* Calculate how many bytes are necessary to represent a value whose most * significant 1 bit is in bit position 'pos' of the word. For 0x1, 'pos would @@ -516,10 +516,10 @@ regen/charset_translations.pl. */ * bits), as it breaks down at the lower edge. At the high end, if it returns * 8 or more, Perl instead anomalously uses MAX_BYTES, so this would be wrong. * */ -#define UNISKIP_BY_MSB_(pos) \ - ( ( -ONE_IF_EBCDIC_ZERO_IF_NOT /* platform break pos's are off-by-one */ \ - + (pos) + ((UTF_CONTINUATION_BYTE_INFO_BITS - 1) - 1)) /* Step fcn */ \ - / (UTF_CONTINUATION_BYTE_INFO_BITS - 1)) /* take floor of */ +#define UNISKIP_BY_MSB_(pos) \ + ( ( -ONE_IF_EBCDIC_ZERO_IF_NOT /* platform break pos's are off-by-one */ \ + + (pos) + ((UTF_CONTINUATION_BYTE_INFO_BITS - 1) - 1)) /* Step fcn */ \ + / (UTF_CONTINUATION_BYTE_INFO_BITS - 1)) /* take floor of */ /* Compute the number of UTF-8 bytes required for representing the input uv, * which must be a Unicode, not native value. @@ -529,9 +529,9 @@ regen/charset_translations.pl. */ * around that, and use a helper for high code points to accommodate the fact * that above 7 btyes, the value is anomalous. The helper is empty on * platforms that don't go that high */ -#define OFFUNISKIP(uv) \ - ((OFFUNI_IS_INVARIANT(uv)) \ - ? 1 \ +#define OFFUNISKIP(uv) \ + ((OFFUNI_IS_INVARIANT(uv)) \ + ? 1 \ : (OFFUNISKIP_helper_(uv) UNISKIP_BY_MSB_(msbit_pos(uv)))) /* We need to go to MAX_BYTES when we can't represent 'uv' by the number of @@ -541,9 +541,9 @@ regen/charset_translations.pl. */ * will always be false */ #if UVSIZE * CHARBITS > (6 * UTF_CONTINUATION_BYTE_INFO_BITS) # define HAS_EXTRA_LONG_UTF8 -# define OFFUNISKIP_helper_(uv) \ - UNLIKELY(uv > nBIT_UMAX(6 * UTF_CONTINUATION_BYTE_INFO_BITS)) \ - ? UTF8_MAXBYTES : +# define OFFUNISKIP_helper_(uv) \ + UNLIKELY(uv > nBIT_UMAX(6 * UTF_CONTINUATION_BYTE_INFO_BITS)) \ + ? UTF8_MAXBYTES : #else # define OFFUNISKIP_helper_(uv) #endif @@ -582,12 +582,12 @@ encoded as UTF-8. C is a native (ASCII or EBCDIC) code point if less than * bits form the lower part which is OR'd with the mark * * Note that on EBCDIC platforms, this is actually the I8 */ -#define UTF_START_BYTE(uv, bits) \ - (__ASSERT_((uv) >> ((bits) - 1)) /* At least 'bits' */ \ - __ASSERT_(((uv) & ~nBIT_MASK(bits)) == 0) /* No extra bits */ \ - UTF_START_MARK(UNISKIP_BY_MSB_((bits) - 1)) \ - | ((uv) >> (((bits) / UTF_CONTINUATION_BYTE_INFO_BITS) \ - * UTF_CONTINUATION_BYTE_INFO_BITS))) +#define UTF_START_BYTE(uv, bits) \ + (__ASSERT_((uv) >> ((bits) - 1)) /* At least 'bits' */ \ + __ASSERT_(((uv) & ~nBIT_MASK(bits)) == 0) /* No extra bits */ \ + UTF_START_MARK(UNISKIP_BY_MSB_((bits) - 1)) \ + | ((uv) >> (((bits) / UTF_CONTINUATION_BYTE_INFO_BITS) \ + * UTF_CONTINUATION_BYTE_INFO_BITS))) /* Compute the first continuation byte for a given code point. This is mostly * for compile-time, so how many bits it occupies is also passed in). @@ -598,13 +598,13 @@ encoded as UTF-8. C is a native (ASCII or EBCDIC) code point if less than * byte. * * Note that on EBCDIC platforms, this is actually the I8 */ -#define UTF_FIRST_CONT_BYTE(uv, bits) \ - (__ASSERT_((uv) >> ((bits) - 1)) /* At least 'bits' */ \ - __ASSERT_(((uv) & ~nBIT_MASK(bits)) == 0) /* No extra bits */ \ - UTF_CONTINUATION_MARK \ - | ( UTF_CONTINUATION_MASK \ - & ((uv) >> ((((bits) / UTF_CONTINUATION_BYTE_INFO_BITS) - 1) \ - * UTF_CONTINUATION_BYTE_INFO_BITS)))) +#define UTF_FIRST_CONT_BYTE(uv, bits) \ + (__ASSERT_((uv) >> ((bits) - 1)) /* At least 'bits' */ \ + __ASSERT_(((uv) & ~nBIT_MASK(bits)) == 0) /* No extra bits */ \ + UTF_CONTINUATION_MARK \ + | ( UTF_CONTINUATION_MASK \ + & ((uv) >> ((((bits) / UTF_CONTINUATION_BYTE_INFO_BITS) - 1) \ + * UTF_CONTINUATION_BYTE_INFO_BITS)))) #define UTF_MIN_START_BYTE UTF_START_BYTE(UTF_MIN_CONTINUATION_BYTE, 8) @@ -614,12 +614,12 @@ encoded as UTF-8. C is a native (ASCII or EBCDIC) code point if less than * C0-C4 I8 start bytes on EBCDIC ones. On EBCDIC E0 can't start a * non-overlong sequence, so we define a base macro and for those platforms, * extend it to also exclude E0 */ -#define UTF8_IS_START_base(c) \ - (__ASSERT_(FITS_IN_8_BITS(c))\ +#define UTF8_IS_START_base(c) \ + (__ASSERT_(FITS_IN_8_BITS(c)) \ (NATIVE_UTF8_TO_I8(c) >= UTF_MIN_START_BYTE)) #ifdef EBCDIC -# define UTF8_IS_START(c) \ - (UTF8_IS_START_base(c) && (c) != I8_TO_NATIVE_UTF8(0xE0)) +# define UTF8_IS_START(c) \ + (UTF8_IS_START_base(c) && (c) != I8_TO_NATIVE_UTF8(0xE0)) #else # define UTF8_IS_START(c) UTF8_IS_START_base(c) #endif @@ -628,16 +628,16 @@ encoded as UTF-8. C is a native (ASCII or EBCDIC) code point if less than /* Is the UTF8-encoded byte 'c' the first byte of a sequence of bytes that * represent a code point > 255? */ -#define UTF8_IS_ABOVE_LATIN1(c) \ - (__ASSERT_(FITS_IN_8_BITS(c))\ +#define UTF8_IS_ABOVE_LATIN1(c) \ + (__ASSERT_(FITS_IN_8_BITS(c)) \ (NATIVE_UTF8_TO_I8(c) >= UTF_MIN_ABOVE_LATIN1_BYTE)) /* Is the UTF8-encoded byte 'c' the first byte of a two byte sequence? Use * UTF8_IS_NEXT_CHAR_DOWNGRADEABLE() instead if the input isn't known to * be well-formed. */ -#define UTF8_IS_DOWNGRADEABLE_START(c) \ - (__ASSERT_(FITS_IN_8_BITS(c))\ - inRANGE_helper_(U8, NATIVE_UTF8_TO_I8(c), \ +#define UTF8_IS_DOWNGRADEABLE_START(c) \ + (__ASSERT_(FITS_IN_8_BITS(c)) \ + inRANGE_helper_(U8, NATIVE_UTF8_TO_I8(c), \ UTF_MIN_START_BYTE, UTF_MIN_ABOVE_LATIN1_BYTE - 1)) /* The largest code point representable by two UTF-8 bytes on this platform. @@ -655,9 +655,9 @@ encoded as UTF-8. C is a native (ASCII or EBCDIC) code point if less than /* The largest code point representable by two UTF-8 bytes on any platform that * Perl runs on. */ -#define MAX_PORTABLE_UTF8_TWO_BYTE \ - nBIT_UMAX(5 + MIN( UTF_CONTINUATION_BYTE_INFO_BITS, \ - UTF_EBCDIC_CONTINUATION_BYTE_INFO_BITS)) +#define MAX_PORTABLE_UTF8_TWO_BYTE \ + nBIT_UMAX(5 + MIN( UTF_CONTINUATION_BYTE_INFO_BITS, \ + UTF_EBCDIC_CONTINUATION_BYTE_INFO_BITS)) /* @@ -677,8 +677,8 @@ uppercase/lowercase/titlecase/fold into. * =cut */ -#define UTF8_MAXBYTES_CASE \ - MAX(UTF8_MAXBYTES, UTF8_MAX_FOLD_CHAR_EXPAND * UNISKIP_BY_MSB_(20)) +#define UTF8_MAXBYTES_CASE \ + MAX(UTF8_MAXBYTES, UTF8_MAX_FOLD_CHAR_EXPAND * UNISKIP_BY_MSB_(20)) /* Rest of these are attributes of Unicode and perl's internals rather than the * encoding, or happen to be the same in both ASCII and EBCDIC (at least at @@ -703,17 +703,17 @@ uppercase/lowercase/titlecase/fold into. * that this is asymmetric on EBCDIC platforms, in that the 'new' parameter is * the UTF-EBCDIC byte, whereas the 'old' parameter is a Unicode (not EBCDIC) * code point in process of being generated */ -#define UTF8_ACCUMULATE(old, new) \ - (__ASSERT_(FITS_IN_8_BITS(new))\ - ((old) << UTF_ACCUMULATION_SHIFT) \ - | ((NATIVE_UTF8_TO_I8(new)) \ +#define UTF8_ACCUMULATE(old, new) \ + (__ASSERT_(FITS_IN_8_BITS(new)) \ + ((old) << UTF_ACCUMULATION_SHIFT) \ + | ((NATIVE_UTF8_TO_I8(new)) \ & UTF_CONTINUATION_MASK)) /* This works in the face of malformed UTF-8. */ -#define UTF8_IS_NEXT_CHAR_DOWNGRADEABLE(s, e) \ - ( ( (e) - (s) > 1) \ - && UTF8_IS_DOWNGRADEABLE_START(*(s)) \ - && UTF8_IS_CONTINUATION(*((s)+1))) +#define UTF8_IS_NEXT_CHAR_DOWNGRADEABLE(s, e) \ + ( ( (e) - (s) > 1) \ + && UTF8_IS_DOWNGRADEABLE_START(*(s)) \ + && UTF8_IS_CONTINUATION(*((s)+1))) /* Longer, but more accurate name */ #define UTF8_IS_ABOVE_LATIN1_START(c) UTF8_IS_ABOVE_LATIN1(c) @@ -727,10 +727,10 @@ uppercase/lowercase/titlecase/fold into. * HI: a downgradable start byte; * LO: continuation. * */ -#define EIGHT_BIT_UTF8_TO_NATIVE(HI, LO) \ - ( __ASSERT_(UTF8_IS_DOWNGRADEABLE_START(HI)) \ - __ASSERT_(UTF8_IS_CONTINUATION(LO)) \ - LATIN1_TO_NATIVE(UTF8_ACCUMULATE(( \ +#define EIGHT_BIT_UTF8_TO_NATIVE(HI, LO) \ + ( __ASSERT_(UTF8_IS_DOWNGRADEABLE_START(HI)) \ + __ASSERT_(UTF8_IS_CONTINUATION(LO)) \ + LATIN1_TO_NATIVE(UTF8_ACCUMULATE(( \ NATIVE_UTF8_TO_I8(HI) & UTF_START_MASK(2)), (LO)))) /* Convert a two (not one) byte utf8 character to a native code point value. @@ -738,10 +738,10 @@ uppercase/lowercase/titlecase/fold into. * known that the two bytes are legal: 1) two-byte start, and 2) continuation. * Note that the result can be larger than 255 if the input character is not * downgradable */ -#define TWO_BYTE_UTF8_TO_NATIVE(HI, LO) \ +#define TWO_BYTE_UTF8_TO_NATIVE(HI, LO) \ (__ASSERT_(FITS_IN_8_BITS(HI)) \ __ASSERT_(FITS_IN_8_BITS(LO)) \ - __ASSERT_(PL_utf8skip[(U8) HI] == 2) \ + __ASSERT_(PL_utf8skip[(U8) HI] == 2) \ __ASSERT_(UTF8_IS_CONTINUATION(LO)) \ UNI_TO_NATIVE(UTF8_ACCUMULATE((NATIVE_UTF8_TO_I8(HI) & UTF_START_MASK(2)), \ (LO)))) @@ -804,9 +804,9 @@ C>, for example when interfacing with a C library. =cut */ -#define UTF8_CHK_SKIP(s) \ - (UNLIKELY(s[0] == '\0') ? 1 : MIN(UTF8SKIP(s), \ - my_strnlen((char *) (s), UTF8SKIP(s)))) +#define UTF8_CHK_SKIP(s) \ + (UNLIKELY(s[0] == '\0') ? 1 : MIN(UTF8SKIP(s), \ + my_strnlen((char *) (s), UTF8SKIP(s)))) /* =for apidoc Am|STRLEN|UTF8_SAFE_SKIP|char* s|char* e @@ -816,10 +816,10 @@ returns beyond C. On DEBUGGING builds, it asserts that S= e>>. =cut */ -#define UTF8_SAFE_SKIP(s, e) \ - (__ASSERT_((e) >= (s))\ - UNLIKELY(((e) - (s)) <= 0) \ - ? 0 \ +#define UTF8_SAFE_SKIP(s, e) \ + (__ASSERT_((e) >= (s)) \ + UNLIKELY(((e) - (s)) <= 0) \ + ? 0 \ : MIN(((e) - (s)), UTF8_SKIP(s))) /* Most code that says 'UNI_' really means the native value for code points up @@ -853,8 +853,8 @@ implementation of the latter. */ /* Misleadingly named: is the UTF8-encoded byte 'c' part of a variant sequence * in UTF-8? This is the inverse of UTF8_IS_INVARIANT. */ -#define UTF8_IS_CONTINUED(c) \ - (__ASSERT_(FITS_IN_8_BITS(c))\ +#define UTF8_IS_CONTINUED(c) \ + (__ASSERT_(FITS_IN_8_BITS(c)) \ (! UTF8_IS_INVARIANT(c))) /* The macros in the next 4 sets are used to generate the two utf8 or utfebcdic @@ -865,14 +865,14 @@ implementation of the latter. */ * directly anywhere else. 'translate_function' is either NATIVE_TO_LATIN1 * (which works for code points up through 0xFF) or NATIVE_TO_UNI which works * for any code point */ -#define __BASE_TWO_BYTE_HI(c, translate_function) \ - (__ASSERT_(! UVCHR_IS_INVARIANT(c)) \ - I8_TO_NATIVE_UTF8((translate_function(c) >> UTF_ACCUMULATION_SHIFT) \ - | UTF_START_MARK(2))) -#define __BASE_TWO_BYTE_LO(c, translate_function) \ - (__ASSERT_(! UVCHR_IS_INVARIANT(c)) \ - I8_TO_NATIVE_UTF8((translate_function(c) & UTF_CONTINUATION_MASK) \ - | UTF_CONTINUATION_MARK)) +#define __BASE_TWO_BYTE_HI(c, translate_function) \ + (__ASSERT_(! UVCHR_IS_INVARIANT(c)) \ + I8_TO_NATIVE_UTF8((translate_function(c) >> UTF_ACCUMULATION_SHIFT) \ + | UTF_START_MARK(2))) +#define __BASE_TWO_BYTE_LO(c, translate_function) \ + (__ASSERT_(! UVCHR_IS_INVARIANT(c)) \ + I8_TO_NATIVE_UTF8((translate_function(c) & UTF_CONTINUATION_MASK) \ + | UTF_CONTINUATION_MARK)) /* The next two macros should not be used. They were designed to be usable as * the case label of a switch statement, but this doesn't work for EBCDIC. Use @@ -882,11 +882,11 @@ implementation of the latter. */ /* The next two macros are used when the source should be a single byte * character; checked for under DEBUGGING */ -#define UTF8_EIGHT_BIT_HI(c) \ - (__ASSERT_(FITS_IN_8_BITS(c))\ +#define UTF8_EIGHT_BIT_HI(c) \ + (__ASSERT_(FITS_IN_8_BITS(c)) \ ( __BASE_TWO_BYTE_HI(c, NATIVE_TO_LATIN1))) -#define UTF8_EIGHT_BIT_LO(c) \ - (__ASSERT_(FITS_IN_8_BITS(c))\ +#define UTF8_EIGHT_BIT_LO(c) \ + (__ASSERT_(FITS_IN_8_BITS(c)) \ (__BASE_TWO_BYTE_LO(c, NATIVE_TO_LATIN1))) /* These final two macros in the series are used when the source can be any @@ -895,14 +895,14 @@ implementation of the latter. */ * operator instead of "<=" to avoid getting compiler warnings. * MAX_UTF8_TWO_BYTE should be exactly all one bits in the lower few * places, so the ~ works */ -#define UTF8_TWO_BYTE_HI(c) \ - (__ASSERT_((sizeof(c) == 1) \ - || !(((WIDEST_UTYPE)(c)) & ~MAX_UTF8_TWO_BYTE)) \ - (__BASE_TWO_BYTE_HI(c, NATIVE_TO_UNI))) -#define UTF8_TWO_BYTE_LO(c) \ - (__ASSERT_((sizeof(c) == 1) \ - || !(((WIDEST_UTYPE)(c)) & ~MAX_UTF8_TWO_BYTE)) \ - (__BASE_TWO_BYTE_LO(c, NATIVE_TO_UNI))) +#define UTF8_TWO_BYTE_HI(c) \ + (__ASSERT_((sizeof(c) == 1) \ + || !(((WIDEST_UTYPE)(c)) & ~MAX_UTF8_TWO_BYTE)) \ + (__BASE_TWO_BYTE_HI(c, NATIVE_TO_UNI))) +#define UTF8_TWO_BYTE_LO(c) \ + (__ASSERT_((sizeof(c) == 1) \ + || !(((WIDEST_UTYPE)(c)) & ~MAX_UTF8_TWO_BYTE)) \ + (__BASE_TWO_BYTE_LO(c, NATIVE_TO_UNI))) /* This is illegal in any well-formed UTF-8 in both EBCDIC and ASCII * as it is only in overlongs. */ @@ -915,14 +915,14 @@ implementation of the latter. */ * beginning of a utf8 character. Now that foo_utf8() determines that itself, * no need to do it again here */ -#define isIDFIRST_lazy_if_safe(p, e, UTF) \ - ((IN_BYTES || !UTF) \ - ? isIDFIRST(*(p)) \ - : isIDFIRST_utf8_safe(p, e)) -#define isWORDCHAR_lazy_if_safe(p, e, UTF) \ - ((IN_BYTES || !UTF) \ - ? isWORDCHAR(*(p)) \ - : isWORDCHAR_utf8_safe((U8 *) p, (U8 *) e)) +#define isIDFIRST_lazy_if_safe(p, e, UTF) \ + ((IN_BYTES || !UTF) \ + ? isIDFIRST(*(p)) \ + : isIDFIRST_utf8_safe(p, e)) +#define isWORDCHAR_lazy_if_safe(p, e, UTF) \ + ((IN_BYTES || !UTF) \ + ? isWORDCHAR(*(p)) \ + : isWORDCHAR_utf8_safe((U8 *) p, (U8 *) e)) #define isALNUM_lazy_if_safe(p, e, UTF) isWORDCHAR_lazy_if_safe(p, e, UTF) #define UTF8_MAXLEN UTF8_MAXBYTES @@ -949,12 +949,12 @@ case any call to string overloading updates the internal UTF-8 encoding flag. * Is so within 'feature unicode_strings' or 'locale :not_characters', and not * within 'use bytes'. UTF-8 locales are not tested for here, but perhaps * could be */ -#define IN_UNI_8_BIT \ - (( ( (CopHINTS_get(PL_curcop) & HINT_UNI_8_BIT)) \ - || ( CopHINTS_get(PL_curcop) & HINT_LOCALE_PARTIAL \ - /* -1 below is for :not_characters */ \ - && _is_in_locale_category(FALSE, -1))) \ - && (! IN_BYTES)) +#define IN_UNI_8_BIT \ + (( ( (CopHINTS_get(PL_curcop) & HINT_UNI_8_BIT)) \ + || ( CopHINTS_get(PL_curcop) & HINT_LOCALE_PARTIAL \ + /* -1 below is for :not_characters */ \ + && _is_in_locale_category(FALSE, -1))) \ + && (! IN_BYTES)) #define UNICODE_SURROGATE_FIRST 0xD800 #define UNICODE_SURROGATE_LAST 0xDFFF @@ -976,8 +976,8 @@ point's representation. =cut */ -#define UNICODE_IS_SURROGATE(uv) \ - UNLIKELY(inRANGE(uv, UNICODE_SURROGATE_FIRST,\ +#define UNICODE_IS_SURROGATE(uv) \ + UNLIKELY(inRANGE(uv, UNICODE_SURROGATE_FIRST, \ UNICODE_SURROGATE_LAST)) #define UTF8_IS_SURROGATE(s, e) is_SURROGATE_utf8_safe(s, e) @@ -1004,10 +1004,10 @@ representation. */ #define UNICODE_REPLACEMENT 0xFFFD #define UNICODE_IS_REPLACEMENT(uv) UNLIKELY((UV) (uv) == UNICODE_REPLACEMENT) -#define UTF8_IS_REPLACEMENT(s, send) \ - UNLIKELY( \ - ((send) - (s)) >= ((SSize_t)(sizeof(REPLACEMENT_CHARACTER_UTF8) - 1))\ - && memEQ((s), REPLACEMENT_CHARACTER_UTF8, \ +#define UTF8_IS_REPLACEMENT(s, send) \ + UNLIKELY( \ + ((send) - (s)) >= ((SSize_t)(sizeof(REPLACEMENT_CHARACTER_UTF8) - 1)) \ + && memEQ((s), REPLACEMENT_CHARACTER_UTF8, \ sizeof(REPLACEMENT_CHARACTER_UTF8) - 1)) /* Max legal code point according to Unicode */ @@ -1053,8 +1053,8 @@ this macro matches * U+110001: \xF4\x90\x80\x81 \xF9\xA2\xA0\xA0\xA1 */ #define UTF_START_BYTE_110000_ UTF_START_BYTE(PERL_UNICODE_MAX + 1, 21) -#define UTF_FIRST_CONT_BYTE_110000_ \ - UTF_FIRST_CONT_BYTE(PERL_UNICODE_MAX + 1, 21) +#define UTF_FIRST_CONT_BYTE_110000_ \ + UTF_FIRST_CONT_BYTE(PERL_UNICODE_MAX + 1, 21) #define UTF8_IS_SUPER(s, e) \ ( ((e) - (s)) >= UNISKIP_BY_MSB_(20) \ && ( NATIVE_UTF8_TO_I8(s[0]) >= UTF_START_BYTE_110000_ \ @@ -1073,18 +1073,18 @@ non-character code points */ /* Is 'uv' one of the 32 contiguous-range noncharacters? */ -#define UNICODE_IS_32_CONTIGUOUS_NONCHARS(uv) \ - UNLIKELY(inRANGE(uv, 0xFDD0, 0xFDEF)) +#define UNICODE_IS_32_CONTIGUOUS_NONCHARS(uv) \ + UNLIKELY(inRANGE(uv, 0xFDD0, 0xFDEF)) /* Is 'uv' one of the 34 plane-ending noncharacters 0xFFFE, 0xFFFF, 0x1FFFE, * 0x1FFFF, ... 0x10FFFE, 0x10FFFF, given that we know that 'uv' is not above * the Unicode legal max */ -#define UNICODE_IS_END_PLANE_NONCHAR_GIVEN_NOT_SUPER(uv) \ - UNLIKELY(((UV) (uv) & 0xFFFE) == 0xFFFE) +#define UNICODE_IS_END_PLANE_NONCHAR_GIVEN_NOT_SUPER(uv) \ + UNLIKELY(((UV) (uv) & 0xFFFE) == 0xFFFE) -#define UNICODE_IS_NONCHAR(uv) \ - ( UNLIKELY(UNICODE_IS_32_CONTIGUOUS_NONCHARS(uv)) \ - || ( UNLIKELY(UNICODE_IS_END_PLANE_NONCHAR_GIVEN_NOT_SUPER(uv)) \ +#define UNICODE_IS_NONCHAR(uv) \ + ( UNLIKELY(UNICODE_IS_32_CONTIGUOUS_NONCHARS(uv)) \ + || ( UNLIKELY(UNICODE_IS_END_PLANE_NONCHAR_GIVEN_NOT_SUPER(uv)) \ && LIKELY(! UNICODE_IS_SUPER(uv)))) /* @@ -1102,8 +1102,8 @@ point's representation. /* This is now machine generated, and the 'given' clause is no longer * applicable */ -#define UTF8_IS_NONCHAR_GIVEN_THAT_NON_SUPER_AND_GE_PROBLEMATIC(s, e) \ - UTF8_IS_NONCHAR(s, e) +#define UTF8_IS_NONCHAR_GIVEN_THAT_NON_SUPER_AND_GE_PROBLEMATIC(s, e) \ + UTF8_IS_NONCHAR(s, e) /* Surrogates, non-character code points and above-Unicode code points are * problematic in some contexts. These macros allow code that needs to check @@ -1113,7 +1113,7 @@ point's representation. * The lowest such code point is the smallest surrogate, U+D800. We calculate * the start byte of that. 0xD800 occupies 16 bits. */ #define isUNICODE_POSSIBLY_PROBLEMATIC(uv) ((uv) >= UNICODE_SURROGATE_FIRST) -#define isUTF8_POSSIBLY_PROBLEMATIC(c) \ +#define isUTF8_POSSIBLY_PROBLEMATIC(c) \ (NATIVE_UTF8_TO_I8(c) >= UTF_START_BYTE(UNICODE_SURROGATE_FIRST, 16)) /* Perl extends Unicode so that it is possible to encode (as extended UTF-8 or @@ -1132,10 +1132,10 @@ point's representation. * and the start byte FF on EBCDIC ones. That translates into that it is a * Perl extension to represent anything occupying more than 31 bits on ASCII * platforms; 30 bits on EBCDIC. */ -#define UNICODE_IS_PERL_EXTENDED(uv) \ - UNLIKELY((UV) (uv) > nBIT_UMAX(31 - ONE_IF_EBCDIC_ZERO_IF_NOT)) -#define UTF8_IS_PERL_EXTENDED(s) \ - (UTF8SKIP(s) > 6 + ONE_IF_EBCDIC_ZERO_IF_NOT) +#define UNICODE_IS_PERL_EXTENDED(uv) \ + UNLIKELY((UV) (uv) > nBIT_UMAX(31 - ONE_IF_EBCDIC_ZERO_IF_NOT)) +#define UTF8_IS_PERL_EXTENDED(s) \ + (UTF8SKIP(s) > 6 + ONE_IF_EBCDIC_ZERO_IF_NOT) /* Largest code point we accept from external sources */ #define MAX_LEGAL_CP ((UV)IV_MAX) @@ -1211,24 +1211,24 @@ point's representation. #define UTF8_ALLOW_SURROGATE 0 /* C9 refers to Unicode Corrigendum #9: allows but discourages non-chars */ -#define UTF8_DISALLOW_ILLEGAL_C9_INTERCHANGE \ - (UTF8_DISALLOW_SUPER|UTF8_DISALLOW_SURROGATE) +#define UTF8_DISALLOW_ILLEGAL_C9_INTERCHANGE \ + (UTF8_DISALLOW_SUPER|UTF8_DISALLOW_SURROGATE) #define UTF8_WARN_ILLEGAL_C9_INTERCHANGE (UTF8_WARN_SUPER|UTF8_WARN_SURROGATE) -#define UTF8_DISALLOW_ILLEGAL_INTERCHANGE \ - (UTF8_DISALLOW_ILLEGAL_C9_INTERCHANGE|UTF8_DISALLOW_NONCHAR) -#define UTF8_WARN_ILLEGAL_INTERCHANGE \ - (UTF8_WARN_ILLEGAL_C9_INTERCHANGE|UTF8_WARN_NONCHAR) +#define UTF8_DISALLOW_ILLEGAL_INTERCHANGE \ + (UTF8_DISALLOW_ILLEGAL_C9_INTERCHANGE|UTF8_DISALLOW_NONCHAR) +#define UTF8_WARN_ILLEGAL_INTERCHANGE \ + (UTF8_WARN_ILLEGAL_C9_INTERCHANGE|UTF8_WARN_NONCHAR) /* This is typically used for code that processes UTF-8 input and doesn't want * to have to deal with any malformations that might be present. All such will * be safely replaced by the REPLACEMENT CHARACTER, unless other flags * overriding this are also present. */ -#define UTF8_ALLOW_ANY \ - ( UTF8_ALLOW_CONTINUATION\ - |UTF8_ALLOW_NON_CONTINUATION \ - |UTF8_ALLOW_SHORT \ - |UTF8_ALLOW_LONG \ +#define UTF8_ALLOW_ANY \ + ( UTF8_ALLOW_CONTINUATION \ + |UTF8_ALLOW_NON_CONTINUATION \ + |UTF8_ALLOW_SHORT \ + |UTF8_ALLOW_LONG \ |UTF8_ALLOW_OVERFLOW) /* Accept any Perl-extended UTF-8 that evaluates to any UV on the platform, but @@ -1256,14 +1256,14 @@ point's representation. #define UNICODE_GOT_SUPER UNICODE_DISALLOW_SUPER #define UNICODE_GOT_PERL_EXTENDED UNICODE_DISALLOW_PERL_EXTENDED -#define UNICODE_WARN_ILLEGAL_C9_INTERCHANGE \ - (UNICODE_WARN_SURROGATE|UNICODE_WARN_SUPER) -#define UNICODE_WARN_ILLEGAL_INTERCHANGE \ - (UNICODE_WARN_ILLEGAL_C9_INTERCHANGE|UNICODE_WARN_NONCHAR) -#define UNICODE_DISALLOW_ILLEGAL_C9_INTERCHANGE \ - (UNICODE_DISALLOW_SURROGATE|UNICODE_DISALLOW_SUPER) -#define UNICODE_DISALLOW_ILLEGAL_INTERCHANGE \ - (UNICODE_DISALLOW_ILLEGAL_C9_INTERCHANGE|UNICODE_DISALLOW_NONCHAR) +#define UNICODE_WARN_ILLEGAL_C9_INTERCHANGE \ + (UNICODE_WARN_SURROGATE|UNICODE_WARN_SUPER) +#define UNICODE_WARN_ILLEGAL_INTERCHANGE \ + (UNICODE_WARN_ILLEGAL_C9_INTERCHANGE|UNICODE_WARN_NONCHAR) +#define UNICODE_DISALLOW_ILLEGAL_C9_INTERCHANGE \ + (UNICODE_DISALLOW_SURROGATE|UNICODE_DISALLOW_SUPER) +#define UNICODE_DISALLOW_ILLEGAL_INTERCHANGE \ + (UNICODE_DISALLOW_ILLEGAL_C9_INTERCHANGE|UNICODE_DISALLOW_NONCHAR) /* For backward source compatibility, as are now the default */ #define UNICODE_ALLOW_SURROGATE 0 @@ -1271,18 +1271,18 @@ point's representation. #define UNICODE_ALLOW_ANY 0 #define UNICODE_BYTE_ORDER_MARK 0xFEFF -#define UNICODE_IS_BYTE_ORDER_MARK(uv) \ - UNLIKELY((UV) (uv)\ +#define UNICODE_IS_BYTE_ORDER_MARK(uv) \ + UNLIKELY((UV) (uv) \ == UNICODE_BYTE_ORDER_MARK) #define LATIN_SMALL_LETTER_SHARP_S LATIN_SMALL_LETTER_SHARP_S_NATIVE -#define LATIN_SMALL_LETTER_Y_WITH_DIAERESIS \ - LATIN_SMALL_LETTER_Y_WITH_DIAERESIS_NATIVE +#define LATIN_SMALL_LETTER_Y_WITH_DIAERESIS \ + LATIN_SMALL_LETTER_Y_WITH_DIAERESIS_NATIVE #define MICRO_SIGN MICRO_SIGN_NATIVE -#define LATIN_CAPITAL_LETTER_A_WITH_RING_ABOVE \ - LATIN_CAPITAL_LETTER_A_WITH_RING_ABOVE_NATIVE -#define LATIN_SMALL_LETTER_A_WITH_RING_ABOVE \ - LATIN_SMALL_LETTER_A_WITH_RING_ABOVE_NATIVE +#define LATIN_CAPITAL_LETTER_A_WITH_RING_ABOVE \ + LATIN_CAPITAL_LETTER_A_WITH_RING_ABOVE_NATIVE +#define LATIN_SMALL_LETTER_A_WITH_RING_ABOVE \ + LATIN_SMALL_LETTER_A_WITH_RING_ABOVE_NATIVE #define UNICODE_GREEK_CAPITAL_LETTER_SIGMA 0x03A3 #define UNICODE_GREEK_SMALL_LETTER_FINAL_SIGMA 0x03C2 #define UNICODE_GREEK_SMALL_LETTER_SIGMA 0x03C3 @@ -1305,9 +1305,9 @@ point's representation. #define UNI_DISPLAY_BACKSLASH 0x0002 #define UNI_DISPLAY_BACKSPACE 0x0004 /* Allow \b when also UNI_DISPLAY_BACKSLASH */ -#define UNI_DISPLAY_QQ \ - (UNI_DISPLAY_ISPRINT\ - |UNI_DISPLAY_BACKSLASH \ +#define UNI_DISPLAY_QQ \ + (UNI_DISPLAY_ISPRINT \ + |UNI_DISPLAY_BACKSLASH \ |UNI_DISPLAY_BACKSPACE) /* Character classes could also allow \b, but not patterns in general */ @@ -1317,8 +1317,8 @@ point's representation. #define SHARP_S_SKIP 2 #define is_utf8_char_buf(buf, buf_end) isUTF8_CHAR(buf, buf_end) -#define bytes_from_utf8(s, lenp, is_utf8p) \ - bytes_from_utf8_loc(s, lenp, is_utf8p, 0) +#define bytes_from_utf8(s, lenp, is_utf8p) \ + bytes_from_utf8_loc(s, lenp, is_utf8p, 0) /* Do not use; should be deprecated. Use isUTF8_CHAR() instead; this is * retained solely for backwards compatibility */ diff --git a/utfebcdic.h b/utfebcdic.h index dbf76c61e942..1e5fc777f9ab 100644 --- a/utfebcdic.h +++ b/utfebcdic.h @@ -141,10 +141,10 @@ END_EXTERN_C #define I8_TO_NATIVE_UTF8(b) (__ASSERT_(FITS_IN_8_BITS(b)) PL_utf2e[(U8)(b)]) /* Transforms in wide UV chars */ -#define NATIVE_TO_UNI(ch) \ - (FITS_IN_8_BITS(ch) ? NATIVE_TO_LATIN1(ch) : (UV) (ch)) -#define UNI_TO_NATIVE(ch) \ - (FITS_IN_8_BITS(ch) ? LATIN1_TO_NATIVE(ch) : (UV) (ch)) +#define NATIVE_TO_UNI(ch) \ + (FITS_IN_8_BITS(ch) ? NATIVE_TO_LATIN1(ch) : (UV) (ch)) +#define UNI_TO_NATIVE(ch) \ + (FITS_IN_8_BITS(ch) ? LATIN1_TO_NATIVE(ch) : (UV) (ch)) /* The following table is adapted from tr16, it shows the I8 encoding of Unicode code points. diff --git a/util.h b/util.h index 15cd5823dc76..20653e77cc3a 100644 --- a/util.h +++ b/util.h @@ -13,20 +13,20 @@ #ifdef VMS -# define PERL_FILE_IS_ABSOLUTE(f) \ - (*(f) == '/' \ - || (strchr(f,':') \ - || ((*(f) == '[' || *(f) == '<') \ - && (isWORDCHAR((f)[1]) || memCHRs("$-_]>",(f)[1]))))) +# define PERL_FILE_IS_ABSOLUTE(f) \ + (*(f) == '/' \ + || (strchr(f,':') \ + || ((*(f) == '[' || *(f) == '<') \ + && (isWORDCHAR((f)[1]) || memCHRs("$-_]>",(f)[1]))))) #elif defined(WIN32) || defined(__CYGWIN__) -# define PERL_FILE_IS_ABSOLUTE(f) \ - (*(f) == '/' || *(f) == '\\' /* UNC/rooted path */ \ - || ((f)[0] && (f)[1] == ':')) /* drive name */ +# define PERL_FILE_IS_ABSOLUTE(f) \ + (*(f) == '/' || *(f) == '\\' /* UNC/rooted path */ \ + || ((f)[0] && (f)[1] == ':')) /* drive name */ #elif defined(DOSISH) -# define PERL_FILE_IS_ABSOLUTE(f) \ - (*(f) == '/' \ - || ((f)[0] && (f)[1] == ':')) /* drive name */ +# define PERL_FILE_IS_ABSOLUTE(f) \ + (*(f) == '/' \ + || ((f)[0] && (f)[1] == ':')) /* drive name */ #else /* NOT DOSISH */ # define PERL_FILE_IS_ABSOLUTE(f) (*(f) == '/') #endif @@ -50,8 +50,8 @@ This is a synonym for S> */ #define ibcmp(s1, s2, len) cBOOL(! foldEQ(s1, s2, len)) #define ibcmp_locale(s1, s2, len) cBOOL(! foldEQ_locale(s1, s2, len)) -#define ibcmp_utf8(s1, pe1, l1, u1, s2, pe2, l2, u2) \ - cBOOL(! foldEQ_utf8(s1, pe1, l1, u1, s2, pe2, l2, u2)) +#define ibcmp_utf8(s1, pe1, l1, u1, s2, pe2, l2, u2) \ + cBOOL(! foldEQ_utf8(s1, pe1, l1, u1, s2, pe2, l2, u2)) /* outside the core, perl.h undefs HAS_QUAD if IV isn't 64-bit We can't swap this to HAS_QUAD, because the logic here affects the type of @@ -204,15 +204,15 @@ means arg not present, 1 is empty string/null byte */ /* internal to util.h macro to create a packed handshake key, all args must be constants */ /* U32 return = (U16 interpsize, bool cxt, bool setxsubfn, bool popmark, U5 (FIVE!) apiverlen, U8 xsverlen) */ -#define HS_KEYp(interpsize, cxt, setxsubfn, popmark, apiverlen, xsverlen) \ - (((interpsize) << 16) \ - | ((xsverlen) > HS_XSVERLEN_MAX \ - ? (Perl_croak_nocontext("panic: handshake overflow"), HS_XSVERLEN_MAX) \ - : (xsverlen) << 8) \ - | (cBOOL(setxsubfn) ? HSf_SETXSUBFN : 0) \ - | (cBOOL(cxt) ? HSf_IMP_CXT : 0) \ - | (cBOOL(popmark) ? HSf_POPMARK : 0) \ - | ((apiverlen) > HS_APIVERLEN_MAX \ +#define HS_KEYp(interpsize, cxt, setxsubfn, popmark, apiverlen, xsverlen) \ + (((interpsize) << 16) \ + | ((xsverlen) > HS_XSVERLEN_MAX \ + ? (Perl_croak_nocontext("panic: handshake overflow"), HS_XSVERLEN_MAX) \ + : (xsverlen) << 8) \ + | (cBOOL(setxsubfn) ? HSf_SETXSUBFN : 0) \ + | (cBOOL(cxt) ? HSf_IMP_CXT : 0) \ + | (cBOOL(popmark) ? HSf_POPMARK : 0) \ + | ((apiverlen) > HS_APIVERLEN_MAX \ ? (Perl_croak_nocontext("panic: handshake overflow"), HS_APIVERLEN_MAX) \ : (apiverlen))) /* overflows above will optimize away unless they will execute */ @@ -222,14 +222,14 @@ means arg not present, 1 is empty string/null byte */ /* U32 return = (bool setxsubfn, bool popmark, "litteral_string_api_ver", "litteral_string_xs_ver") */ #ifdef MULTIPLICITY -# define HS_KEY(setxsubfn, popmark, apiver, xsver) \ - HS_KEYp(sizeof(PerlInterpreter), TRUE, setxsubfn, popmark, \ - sizeof("" apiver "")-1, sizeof("" xsver "")-1) +# define HS_KEY(setxsubfn, popmark, apiver, xsver) \ + HS_KEYp(sizeof(PerlInterpreter), TRUE, setxsubfn, popmark, \ + sizeof("" apiver "")-1, sizeof("" xsver "")-1) # define HS_CXT aTHX #else -# define HS_KEY(setxsubfn, popmark, apiver, xsver) \ - HS_KEYp(sizeof(struct PerlHandShakeInterpreter), FALSE, setxsubfn, popmark, \ - sizeof("" apiver "")-1, sizeof("" xsver "")-1) +# define HS_KEY(setxsubfn, popmark, apiver, xsver) \ + HS_KEYp(sizeof(struct PerlHandShakeInterpreter), FALSE, setxsubfn, popmark, \ + sizeof("" apiver "")-1, sizeof("" xsver "")-1) # define HS_CXT cv #endif @@ -246,11 +246,11 @@ returning NULL if not found. The terminating NUL bytes are not compared. #define instr(haystack, needle) strstr((char *) haystack, (char *) needle) #ifdef HAS_MEMMEM -# define ninstr(big, bigend, little, lend) \ - (__ASSERT_(bigend >= big) \ - __ASSERT_(lend >= little) \ - (char *) memmem((big), (bigend) - (big), \ - (little), (lend) - (little))) +# define ninstr(big, bigend, little, lend) \ + (__ASSERT_(bigend >= big) \ + __ASSERT_(lend >= little) \ + (char *) memmem((big), (bigend) - (big), \ + (little), (lend) - (little))) #else # define ninstr(a,b,c,d) Perl_ninstr(a,b,c,d) #endif diff --git a/vutil.h b/vutil.h index e4e5a1f16338..49b600506068 100644 --- a/vutil.h +++ b/vutil.h @@ -41,11 +41,11 @@ static const char * Perl_prescan_version2(pTHX_ const char *s, bool strict, cons # define VCMP(a,b) Perl_vcmp2(aTHX_ a,b) # define PRESCAN_VERSION(a,b,c,d,e,f,g) Perl_prescan_version2(aTHX_ a,b,c,d,e,f,g) # undef is_LAX_VERSION -# define is_LAX_VERSION(a,b) \ - (a != Perl_prescan_version2(aTHX_ a, FALSE, b, NULL, NULL, NULL, NULL)) +# define is_LAX_VERSION(a,b) \ + (a != Perl_prescan_version2(aTHX_ a, FALSE, b, NULL, NULL, NULL, NULL)) # undef is_STRICT_VERSION -# define is_STRICT_VERSION(a,b) \ - (a != Perl_prescan_version2(aTHX_ a, TRUE, b, NULL, NULL, NULL, NULL)) +# define is_STRICT_VERSION(a,b) \ + (a != Perl_prescan_version2(aTHX_ a, TRUE, b, NULL, NULL, NULL, NULL)) #else @@ -71,44 +71,44 @@ const char * Perl_prescan_version(pTHX_ const char *s, bool strict, const char** # define PRESCAN_VERSION(a,b,c,d,e,f,g) Perl_prescan_version(aTHX_ a,b,c,d,e,f,g) # ifndef is_LAX_VERSION # define is_LAX_VERSION(a,b) \ - (a != Perl_prescan_version(aTHX_ a, FALSE, b, NULL, NULL, NULL, NULL)) + (a != Perl_prescan_version(aTHX_ a, FALSE, b, NULL, NULL, NULL, NULL)) # endif # ifndef is_STRICT_VERSION -# define is_STRICT_VERSION(a,b) \ - (a != Perl_prescan_version(aTHX_ a, TRUE, b, NULL, NULL, NULL, NULL)) +# define is_STRICT_VERSION(a,b) \ + (a != Perl_prescan_version(aTHX_ a, TRUE, b, NULL, NULL, NULL, NULL)) # endif #endif #if PERL_VERSION_LT(5,11,4) # define BADVERSION(a,b,c) \ - if (b) { \ - *b = c; \ - } \ - return a; + if (b) { \ + *b = c; \ + } \ + return a; -# define PERL_ARGS_ASSERT_PRESCAN_VERSION \ - assert(s); assert(sqv); assert(ssaw_decimal);\ - assert(swidth); assert(salpha); +# define PERL_ARGS_ASSERT_PRESCAN_VERSION \ + assert(s); assert(sqv); assert(ssaw_decimal); \ + assert(swidth); assert(salpha); # define PERL_ARGS_ASSERT_SCAN_VERSION \ - assert(s); assert(rv) + assert(s); assert(rv) # define PERL_ARGS_ASSERT_NEW_VERSION \ - assert(ver) + assert(ver) # define PERL_ARGS_ASSERT_UPG_VERSION \ - assert(ver) -# define PERL_ARGS_ASSERT_VVERIFY \ - assert(vs) -# define PERL_ARGS_ASSERT_VNUMIFY \ - assert(vs) -# define PERL_ARGS_ASSERT_VNORMAL \ - assert(vs) + assert(ver) +# define PERL_ARGS_ASSERT_VVERIFY \ + assert(vs) +# define PERL_ARGS_ASSERT_VNUMIFY \ + assert(vs) +# define PERL_ARGS_ASSERT_VNORMAL \ + assert(vs) # define PERL_ARGS_ASSERT_VSTRINGIFY \ - assert(vs) + assert(vs) # define PERL_ARGS_ASSERT_VCMP \ - assert(lhv); assert(rhv) -# define PERL_ARGS_ASSERT_CK_WARNER \ - assert(pat) + assert(lhv); assert(rhv) +# define PERL_ARGS_ASSERT_CK_WARNER \ + assert(pat) #endif /* ex: set ro: */ diff --git a/zaphod32_hash.h b/zaphod32_hash.h index 44a5965175ed..138fcf663ca4 100644 --- a/zaphod32_hash.h +++ b/zaphod32_hash.h @@ -77,55 +77,55 @@ /* This is two marsaglia xor-shift permutes, with a prime-multiple * sandwiched inside. The end result of doing this twice with different * primes is a completely avalanched v. */ -#define ZAPHOD32_SCRAMBLE32(v,prime) \ - STMT_START {\ - v ^= (v>>9); \ - v ^= (v<<21); \ - v ^= (v>>16); \ - v *= prime; \ - v ^= (v>>17); \ - v ^= (v<<15); \ - v ^= (v>>23); \ -} STMT_END +#define ZAPHOD32_SCRAMBLE32(v,prime) \ + STMT_START { \ + v ^= (v>>9); \ + v ^= (v<<21); \ + v ^= (v>>16); \ + v *= prime; \ + v ^= (v>>17); \ + v ^= (v<<15); \ + v ^= (v>>23); \ + } STMT_END -#define ZAPHOD32_FINALIZE(v0,v1,v2) \ - STMT_START {\ - ZAPHOD32_WARN3("v0=%08x v1=%08x v2=%08x - ZAPHOD32 FINALIZE\n", \ - (unsigned int)v0, (unsigned int)v1, (unsigned int)v2); \ - v2 += v0; \ - v1 -= v2; \ - v1 = ROTL32(v1, 6); \ - v2 ^= v1; \ - v2 = ROTL32(v2, 28); \ - v1 ^= v2; \ - v0 += v1; \ - v1 = ROTL32(v1, 24); \ - v2 += v1; \ - v2 = ROTL32(v2, 18) + v1; \ - v0 ^= v2; \ - v0 = ROTL32(v0, 20); \ - v2 += v0; \ - v1 ^= v2; \ - v0 += v1; \ - v0 = ROTL32(v0, 5); \ - v2 += v0; \ - v2 = ROTL32(v2, 22); \ - v0 -= v1; \ - v1 -= v2; \ - v1 = ROTL32(v1, 17); \ -} STMT_END +#define ZAPHOD32_FINALIZE(v0,v1,v2) \ + STMT_START { \ + ZAPHOD32_WARN3("v0=%08x v1=%08x v2=%08x - ZAPHOD32 FINALIZE\n", \ + (unsigned int)v0, (unsigned int)v1, (unsigned int)v2); \ + v2 += v0; \ + v1 -= v2; \ + v1 = ROTL32(v1, 6); \ + v2 ^= v1; \ + v2 = ROTL32(v2, 28); \ + v1 ^= v2; \ + v0 += v1; \ + v1 = ROTL32(v1, 24); \ + v2 += v1; \ + v2 = ROTL32(v2, 18) + v1; \ + v0 ^= v2; \ + v0 = ROTL32(v0, 20); \ + v2 += v0; \ + v1 ^= v2; \ + v0 += v1; \ + v0 = ROTL32(v0, 5); \ + v2 += v0; \ + v2 = ROTL32(v2, 22); \ + v0 -= v1; \ + v1 -= v2; \ + v1 = ROTL32(v1, 17); \ + } STMT_END -#define ZAPHOD32_MIX(v0,v1,v2,text) \ - STMT_START {\ - ZAPHOD32_WARN4("v0=%08x v1=%08x v2=%08x - ZAPHOD32 %s MIX\n", \ - (unsigned int)v0,(unsigned int)v1,(unsigned int)v2, text ); \ - v0 = ROTL32(v0,16) - v2; \ - v1 = ROTR32(v1,13) ^ v2; \ - v2 = ROTL32(v2,17) + v1; \ - v0 = ROTR32(v0, 2) + v1; \ - v1 = ROTR32(v1,17) - v0; \ - v2 = ROTR32(v2, 7) ^ v0; \ -} STMT_END +#define ZAPHOD32_MIX(v0,v1,v2,text) \ + STMT_START { \ + ZAPHOD32_WARN4("v0=%08x v1=%08x v2=%08x - ZAPHOD32 %s MIX\n", \ + (unsigned int)v0,(unsigned int)v1,(unsigned int)v2, text ); \ + v0 = ROTL32(v0,16) - v2; \ + v1 = ROTR32(v1,13) ^ v2; \ + v2 = ROTL32(v2,17) + v1; \ + v0 = ROTR32(v0, 2) + v1; \ + v1 = ROTR32(v1,17) - v0; \ + v2 = ROTR32(v2, 7) ^ v0; \ + } STMT_END ZAPHOD32_STATIC_INLINE