From: Daniel Dragan Date: Sun, 15 Jun 2014 21:49:32 +0000 (-0400) Subject: PERL_UNUSED_CONTEXT -> remove interp context where possible X-Git-Tag: v5.21.2~144 X-Git-Url: https://perl5.git.perl.org/perl5.git/commitdiff_plain/ddeaf6457db7d0d56f0cc5a6452effef1d1a0f2f PERL_UNUSED_CONTEXT -> remove interp context where possible Removing context params will save machine code in the callers of these functions, and 1 ptr of stack space. Some of these funcs are heavily used as mg_find*. The contexts can always be readded in the future the same way they were removed. This patch inspired by commit dc3bf40570. Also remove PERL_UNUSED_CONTEXT when its not needed. See removal candidate rejection rational in [perl #122106]. -Perl_hv_backreferences_p uses context in S_hv_auxinit commit 96a5add60f was wrong -Perl_whichsig_sv and Perl_whichsig_pv wrongly used PERL_UNUSED_CONTEXT from inception in commit 84c7b88cca -in authors opinion cast_* shouldn't be public API, no CPAN grep usage, can't be static and/or inline optimized since it is exported -Perl_my_unexec move to block where it is needed, make Win32 block, context free, for inlining likelyhood, private api and only 2 callers in core -Perl_my_dirfd make all blocks context free, then change proto -Perl_bytes_cmp_utf8 wrongly used PERL_UNUSED_CONTEXT from inception in commit fed3ba5d6b --- diff --git a/dquote_static.c b/dquote_static.c index 2fcb0fa..802d83b 100644 --- a/dquote_static.c +++ b/dquote_static.c @@ -15,9 +15,8 @@ Pulled from regcomp.c. */ PERL_STATIC_INLINE I32 -S_regcurly(pTHX_ const char *s) +S_regcurly(const char *s) { - PERL_UNUSED_CONTEXT; PERL_ARGS_ASSERT_REGCURLY; if (*s++ != '{') diff --git a/embed.fnc b/embed.fnc index 45b4838..be4f9b7 100644 --- a/embed.fnc +++ b/embed.fnc @@ -253,10 +253,10 @@ Apd |const PERL_CONTEXT * |caller_cx|I32 level \ |NULLOK const PERL_CONTEXT **dbcxp : Used in several source files pR |bool |cando |Mode_t mode|bool effective|NN const Stat_t* statbufp -ApR |U32 |cast_ulong |NV f -ApR |I32 |cast_i32 |NV f -ApR |IV |cast_iv |NV f -ApR |UV |cast_uv |NV f +ApRn |U32 |cast_ulong |NV f +ApRn |I32 |cast_i32 |NV f +ApRn |IV |cast_iv |NV f +ApRn |UV |cast_uv |NV f #if !defined(HAS_TRUNCATE) && !defined(HAS_CHSIZE) && defined(F_FREESP) ApR |I32 |my_chsize |int fd|Off_t length #endif @@ -312,8 +312,8 @@ EMXp |void |cv_ckproto_len_flags |NN const CV* cv|NULLOK const GV* gv\ |const U32 flags : Used in pp.c and pp_sys.c ApdR |SV* |gv_const_sv |NN GV* gv -ApdR |SV* |cv_const_sv |NULLOK const CV *const cv -pR |SV* |cv_const_sv_or_av|NULLOK const CV *const cv +ApdRn |SV* |cv_const_sv |NULLOK const CV *const cv +pRn |SV* |cv_const_sv_or_av|NULLOK const CV *const cv : Used in pad.c pR |SV* |op_const_sv |NULLOK const OP* o|NULLOK CV* cv Apd |void |cv_undef |NN CV* cv @@ -881,18 +881,18 @@ Apd |int |mg_copy |NN SV *sv|NN SV *nsv|NULLOK const char *key \ |I32 klen : Defined in mg.c, used only in scope.c pd |void |mg_localize |NN SV* sv|NN SV* nsv|bool setmagic -ApdR |MAGIC* |mg_find |NULLOK const SV* sv|int type -ApdR |MAGIC* |mg_findext |NULLOK const SV* sv|int type|NULLOK const MGVTBL *vtbl +ApdRn |MAGIC* |mg_find |NULLOK const SV* sv|int type +ApdRn |MAGIC* |mg_findext |NULLOK const SV* sv|int type|NULLOK const MGVTBL *vtbl : exported for re.pm EXpR |MAGIC* |mg_find_mglob |NN SV* sv Apd |int |mg_free |NN SV* sv Apd |void |mg_free_type |NN SV* sv|int how Apd |int |mg_get |NN SV* sv ApdD |U32 |mg_length |NN SV* sv -Apd |void |mg_magical |NN SV* sv +Apdn |void |mg_magical |NN SV* sv Apd |int |mg_set |NN SV* sv Ap |I32 |mg_size |NN SV* sv -Ap |void |mini_mktime |NN struct tm *ptm +Apn |void |mini_mktime |NN struct tm *ptm AMmd |OP* |op_lvalue |NULLOK OP* o|I32 type poX |OP* |op_lvalue_flags|NULLOK OP* o|I32 type|U32 flags p |void |finalize_optree |NN OP* o @@ -1162,7 +1162,7 @@ Ap |char* |re_intuit_start|NN REGEXP * const rx \ |NULLOK re_scream_pos_data *data Ap |SV* |re_intuit_string|NN REGEXP *const r #if defined(PERL_IN_REGCOMP_C) || defined(PERL_IN_TOKE_C) -EiPR |I32 |regcurly |NN const char *s +EiPRn |I32 |regcurly |NN const char *s #endif Ap |I32 |regexec_flags |NN REGEXP *const rx|NN char *stringarg \ |NN char *strend|NN char *strbeg \ @@ -1349,7 +1349,7 @@ Apd |I32 |sv_true |NULLOK SV *const sv sd |void |sv_add_arena |NN char *const ptr|const U32 size \ |const U32 flags #endif -Apd |int |sv_backoff |NN SV *const sv +Apdn |int |sv_backoff |NN SV *const sv Apd |SV* |sv_bless |NN SV *const sv|NN HV *const stash #if defined(PERL_DEBUG_READONLY_COW) p |void |sv_buf_to_ro |NN SV *sv @@ -1568,7 +1568,7 @@ Abmd |UV |to_utf8_fold |NN const U8 *p|NN U8* ustrp|NULLOK STRLEN *lenp AMp |UV |_to_utf8_fold_flags|NN const U8 *p|NN U8* ustrp \ |NULLOK STRLEN *lenp|U8 flags #if defined(PERL_IN_MG_C) || defined(PERL_IN_PP_C) -p |bool |translate_substr_offsets|STRLEN curlen|IV pos1_iv \ +pn |bool |translate_substr_offsets|STRLEN curlen|IV pos1_iv \ |bool pos1_is_uv|IV len_iv \ |bool len_is_uv|NN STRLEN *posp \ |NN STRLEN *lenp @@ -1590,7 +1590,7 @@ Ap |U8* |utf16_to_utf8 |NN U8* p|NN U8 *d|I32 bytelen|NN I32 *newlen Ap |U8* |utf16_to_utf8_reversed|NN U8* p|NN U8 *d|I32 bytelen|NN I32 *newlen AdpPR |STRLEN |utf8_length |NN const U8* s|NN const U8 *e ApdPR |IV |utf8_distance |NN const U8 *a|NN const U8 *b -ApdPR |U8* |utf8_hop |NN const U8 *s|I32 off +ApdPRn |U8* |utf8_hop |NN const U8 *s|I32 off ApMd |U8* |utf8_to_bytes |NN U8 *s|NN STRLEN *len Apd |int |bytes_cmp_utf8 |NN const U8 *b|STRLEN blen|NN const U8 *u \ |STRLEN ulen @@ -2434,7 +2434,7 @@ Apmd |void |sv_copypv_nomg |NN SV *const dsv|NN SV *const ssv Apd |void |sv_copypv_flags |NN SV *const dsv|NN SV *const ssv|const I32 flags Ap |char* |my_atof2 |NN const char *s|NN NV* value Apn |int |my_socketpair |int family|int type|int protocol|int fd[2] -Ap |int |my_dirfd |NULLOK DIR* dir +Apn |int |my_dirfd |NULLOK DIR* dir #ifdef PERL_ANY_COW : Used in pp_hot.c and regexec.c pMXE |SV* |sv_setsv_cow |NULLOK SV* dstr|NN SV* sstr diff --git a/embed.h b/embed.h index b2863c0..263d7cd 100644 --- a/embed.h +++ b/embed.h @@ -77,10 +77,10 @@ #define call_pv(a,b) Perl_call_pv(aTHX_ a,b) #define call_sv(a,b) Perl_call_sv(aTHX_ a,b) #define caller_cx(a,b) Perl_caller_cx(aTHX_ a,b) -#define cast_i32(a) Perl_cast_i32(aTHX_ a) -#define cast_iv(a) Perl_cast_iv(aTHX_ a) -#define cast_ulong(a) Perl_cast_ulong(aTHX_ a) -#define cast_uv(a) Perl_cast_uv(aTHX_ a) +#define cast_i32 Perl_cast_i32 +#define cast_iv Perl_cast_iv +#define cast_ulong Perl_cast_ulong +#define cast_uv Perl_cast_uv #define ck_entersub_args_list(a) Perl_ck_entersub_args_list(aTHX_ a) #define ck_entersub_args_proto(a,b,c) Perl_ck_entersub_args_proto(aTHX_ a,b,c) #define ck_entersub_args_proto_or_list(a,b,c) Perl_ck_entersub_args_proto_or_list(aTHX_ a,b,c) @@ -98,7 +98,7 @@ #define custom_op_desc(a) Perl_custom_op_desc(aTHX_ a) #define custom_op_name(a) Perl_custom_op_name(aTHX_ a) #define cv_clone(a) Perl_cv_clone(aTHX_ a) -#define cv_const_sv(a) Perl_cv_const_sv(aTHX_ a) +#define cv_const_sv Perl_cv_const_sv #define cv_get_call_checker(a,b,c) Perl_cv_get_call_checker(aTHX_ a,b,c) #define cv_set_call_checker(a,b,c) Perl_cv_set_call_checker(aTHX_ a,b,c) #define cv_undef(a) Perl_cv_undef(aTHX_ a) @@ -317,22 +317,22 @@ #define mess_sv(a,b) Perl_mess_sv(aTHX_ a,b) #define mg_clear(a) Perl_mg_clear(aTHX_ a) #define mg_copy(a,b,c,d) Perl_mg_copy(aTHX_ a,b,c,d) -#define mg_find(a,b) Perl_mg_find(aTHX_ a,b) -#define mg_findext(a,b,c) Perl_mg_findext(aTHX_ a,b,c) +#define mg_find Perl_mg_find +#define mg_findext Perl_mg_findext #define mg_free(a) Perl_mg_free(aTHX_ a) #define mg_free_type(a,b) Perl_mg_free_type(aTHX_ a,b) #define mg_get(a) Perl_mg_get(aTHX_ a) #define mg_length(a) Perl_mg_length(aTHX_ a) -#define mg_magical(a) Perl_mg_magical(aTHX_ a) +#define mg_magical Perl_mg_magical #define mg_set(a) Perl_mg_set(aTHX_ a) #define mg_size(a) Perl_mg_size(aTHX_ a) -#define mini_mktime(a) Perl_mini_mktime(aTHX_ a) +#define mini_mktime Perl_mini_mktime #define moreswitches(a) Perl_moreswitches(aTHX_ a) #define mro_get_linear_isa(a) Perl_mro_get_linear_isa(aTHX_ a) #define mro_method_changed_in(a) Perl_mro_method_changed_in(aTHX_ a) #define my_atof(a) Perl_my_atof(aTHX_ a) #define my_atof2(a,b) Perl_my_atof2(aTHX_ a,b) -#define my_dirfd(a) Perl_my_dirfd(aTHX_ a) +#define my_dirfd Perl_my_dirfd #define my_exit(a) Perl_my_exit(aTHX_ a) #define my_failure_exit() Perl_my_failure_exit(aTHX) #define my_fflush_all() Perl_my_fflush_all(aTHX) @@ -563,7 +563,7 @@ #define sv_2pvbyte(a,b) Perl_sv_2pvbyte(aTHX_ a,b) #define sv_2pvutf8(a,b) Perl_sv_2pvutf8(aTHX_ a,b) #define sv_2uv_flags(a,b) Perl_sv_2uv_flags(aTHX_ a,b) -#define sv_backoff(a) Perl_sv_backoff(aTHX_ a) +#define sv_backoff Perl_sv_backoff #define sv_bless(a,b) Perl_sv_bless(aTHX_ a,b) #define sv_cat_decode(a,b,c,d,e,f) Perl_sv_cat_decode(aTHX_ a,b,c,d,e,f) #define sv_catpv(a,b) Perl_sv_catpv(aTHX_ a,b) @@ -692,7 +692,7 @@ #define utf16_to_utf8(a,b,c,d) Perl_utf16_to_utf8(aTHX_ a,b,c,d) #define utf16_to_utf8_reversed(a,b,c,d) Perl_utf16_to_utf8_reversed(aTHX_ a,b,c,d) #define utf8_distance(a,b) Perl_utf8_distance(aTHX_ a,b) -#define utf8_hop(a,b) Perl_utf8_hop(aTHX_ a,b) +#define utf8_hop Perl_utf8_hop #define utf8_length(a,b) Perl_utf8_length(aTHX_ a,b) #define utf8_to_bytes(a,b) Perl_utf8_to_bytes(aTHX_ a,b) #define utf8_to_uvchr(a,b) Perl_utf8_to_uvchr(aTHX_ a,b) @@ -1015,7 +1015,7 @@ #define grok_bslash_c(a,b) S_grok_bslash_c(aTHX_ a,b) #define grok_bslash_o(a,b,c,d,e,f,g) S_grok_bslash_o(aTHX_ a,b,c,d,e,f,g) #define grok_bslash_x(a,b,c,d,e,f,g) S_grok_bslash_x(aTHX_ a,b,c,d,e,f,g) -#define regcurly(a) S_regcurly(aTHX_ a) +#define regcurly S_regcurly # endif # if defined(PERL_IN_REGCOMP_C) || defined(PERL_IN_UTF8_C) #define _add_range_to_invlist(a,b,c) Perl__add_range_to_invlist(aTHX_ a,b,c) @@ -1115,7 +1115,7 @@ #define croak_popstack Perl_croak_popstack #define custom_op_get_field(a,b) Perl_custom_op_get_field(aTHX_ a,b) #define cv_clone_into(a,b) Perl_cv_clone_into(aTHX_ a,b) -#define cv_const_sv_or_av(a) Perl_cv_const_sv_or_av(aTHX_ a) +#define cv_const_sv_or_av Perl_cv_const_sv_or_av #define cv_forget_slab(a) Perl_cv_forget_slab(aTHX_ a) #define cvgv_set(a,b) Perl_cvgv_set(aTHX_ a,b) #define cvstash_set(a,b) Perl_cvstash_set(aTHX_ a,b) @@ -1465,7 +1465,7 @@ #define unwind_handler_stack(a) S_unwind_handler_stack(aTHX_ a) # endif # if defined(PERL_IN_MG_C) || defined(PERL_IN_PP_C) -#define translate_substr_offsets(a,b,c,d,e,f,g) Perl_translate_substr_offsets(aTHX_ a,b,c,d,e,f,g) +#define translate_substr_offsets Perl_translate_substr_offsets # endif # if defined(PERL_IN_MRO_C) #define mro_clean_isarev(a,b,c,d,e,f) S_mro_clean_isarev(aTHX_ a,b,c,d,e,f) diff --git a/hv.c b/hv.c index 5a975ed..db3ce63 100644 --- a/hv.c +++ b/hv.c @@ -2390,7 +2390,6 @@ Perl_hv_backreferences_p(pTHX_ HV *hv) { struct xpvhv_aux * const iter = SvOOK(hv) ? HvAUX(hv) : hv_auxinit(hv); PERL_ARGS_ASSERT_HV_BACKREFERENCES_P; - PERL_UNUSED_CONTEXT; return &(iter->xhv_backreferences); } diff --git a/mg.c b/mg.c index 3a0f18b..96d7f77 100644 --- a/mg.c +++ b/mg.c @@ -136,11 +136,10 @@ Turns on the magical status of an SV. See C. */ void -Perl_mg_magical(pTHX_ SV *sv) +Perl_mg_magical(SV *sv) { const MAGIC* mg; PERL_ARGS_ASSERT_MG_MAGICAL; - PERL_UNUSED_CONTEXT; SvMAGICAL_off(sv); if ((mg = SvMAGIC(sv))) { @@ -387,10 +386,8 @@ Perl_mg_clear(pTHX_ SV *sv) } static MAGIC* -S_mg_findext_flags(pTHX_ const SV *sv, int type, const MGVTBL *vtbl, U32 flags) +S_mg_findext_flags(const SV *sv, int type, const MGVTBL *vtbl, U32 flags) { - PERL_UNUSED_CONTEXT; - assert(flags <= 1); if (sv) { @@ -417,9 +414,9 @@ Finds the magic pointer for type matching the SV. See C. */ MAGIC* -Perl_mg_find(pTHX_ const SV *sv, int type) +Perl_mg_find(const SV *sv, int type) { - return S_mg_findext_flags(aTHX_ sv, type, NULL, 0); + return S_mg_findext_flags(sv, type, NULL, 0); } /* @@ -432,9 +429,9 @@ C. */ MAGIC* -Perl_mg_findext(pTHX_ const SV *sv, int type, const MGVTBL *vtbl) +Perl_mg_findext(const SV *sv, int type, const MGVTBL *vtbl) { - return S_mg_findext_flags(aTHX_ sv, type, vtbl, 1); + return S_mg_findext_flags(sv, type, vtbl, 1); } MAGIC * @@ -448,7 +445,7 @@ Perl_mg_find_mglob(pTHX_ SV *sv) sv = LvTARG(sv); } if (SvTYPE(sv) >= SVt_PVMG && SvMAGIC(sv)) - return S_mg_findext_flags(aTHX_ sv, PERL_MAGIC_regex_global, 0, 0); + return S_mg_findext_flags(sv, PERL_MAGIC_regex_global, 0, 0); return NULL; } @@ -3086,7 +3083,6 @@ Perl_whichsig_sv(pTHX_ SV *sigsv) const char *sigpv; STRLEN siglen; PERL_ARGS_ASSERT_WHICHSIG_SV; - PERL_UNUSED_CONTEXT; sigpv = SvPV_const(sigsv, siglen); return whichsig_pvn(sigpv, siglen); } @@ -3095,7 +3091,6 @@ I32 Perl_whichsig_pv(pTHX_ const char *sig) { PERL_ARGS_ASSERT_WHICHSIG_PV; - PERL_UNUSED_CONTEXT; return whichsig_pvn(sig, strlen(sig)); } diff --git a/numeric.c b/numeric.c index e0ffafa..e70992a 100644 --- a/numeric.c +++ b/numeric.c @@ -30,9 +30,8 @@ values, including such things as replacements for the OS's atof() function #include "perl.h" U32 -Perl_cast_ulong(pTHX_ NV f) +Perl_cast_ulong(NV f) { - PERL_UNUSED_CONTEXT; if (f < 0.0) return f < I32_MIN ? (U32) I32_MIN : (U32)(I32) f; if (f < U32_MAX_P1) { @@ -49,9 +48,8 @@ Perl_cast_ulong(pTHX_ NV f) } I32 -Perl_cast_i32(pTHX_ NV f) +Perl_cast_i32(NV f) { - PERL_UNUSED_CONTEXT; if (f < I32_MAX_P1) return f < I32_MIN ? I32_MIN : (I32) f; if (f < U32_MAX_P1) { @@ -68,9 +66,8 @@ Perl_cast_i32(pTHX_ NV f) } IV -Perl_cast_iv(pTHX_ NV f) +Perl_cast_iv(NV f) { - PERL_UNUSED_CONTEXT; if (f < IV_MAX_P1) return f < IV_MIN ? IV_MIN : (IV) f; if (f < UV_MAX_P1) { @@ -88,9 +85,8 @@ Perl_cast_iv(pTHX_ NV f) } UV -Perl_cast_uv(pTHX_ NV f) +Perl_cast_uv(NV f) { - PERL_UNUSED_CONTEXT; if (f < 0.0) return f < IV_MIN ? (UV) IV_MIN : (UV)(IV) f; if (f < UV_MAX_P1) { diff --git a/op.c b/op.c index 2bd0fa9..d7a99ad 100644 --- a/op.c +++ b/op.c @@ -6829,10 +6829,9 @@ L. =cut */ SV * -Perl_cv_const_sv(pTHX_ const CV *const cv) +Perl_cv_const_sv(const CV *const cv) { SV *sv; - PERL_UNUSED_CONTEXT; if (!cv) return NULL; if (!(SvTYPE(cv) == SVt_PVCV || SvTYPE(cv) == SVt_PVFM)) @@ -6843,9 +6842,8 @@ Perl_cv_const_sv(pTHX_ const CV *const cv) } SV * -Perl_cv_const_sv_or_av(pTHX_ const CV * const cv) +Perl_cv_const_sv_or_av(const CV * const cv) { - PERL_UNUSED_CONTEXT; if (!cv) return NULL; assert (SvTYPE(cv) == SVt_PVCV || SvTYPE(cv) == SVt_PVFM); diff --git a/perl.c b/perl.c index 9e0d2b5..d9a7d1c 100644 --- a/perl.c +++ b/perl.c @@ -3531,7 +3531,6 @@ Internet, point your browser at http://www.perl.org/, the Perl Home Page.\n\n"); void Perl_my_unexec(pTHX) { - PERL_UNUSED_CONTEXT; #ifdef UNEXEC SV * prog = newSVpv(BIN_EXP, 0); SV * file = newSVpv(PL_origfilename, 0); @@ -3545,10 +3544,11 @@ Perl_my_unexec(pTHX) /* unexec prints msg to stderr in case of failure */ PerlProc_exit(status); #else + PERL_UNUSED_CONTEXT; # ifdef VMS lib$signal(SS$_DEBUG); /* ssdef.h #included from vmsish.h */ # elif defined(WIN32) || defined(__CYGWIN__) - Perl_croak(aTHX_ "dump is not supported"); + Perl_croak_nocontext("dump is not supported"); # else ABORT(); /* for use with undump */ # endif diff --git a/pod/perldelta.pod b/pod/perldelta.pod index aa6b199..20023bc 100644 --- a/pod/perldelta.pod +++ b/pod/perldelta.pod @@ -327,7 +327,12 @@ well. =item * -XXX +The following private API functions had their context parameter removed, +C, C, C, C, +C, C, C, C, +C, C, C, C. + +Users of the public API prefix-less calls remain unaffected. =back diff --git a/pp.c b/pp.c index 4e2d26a..2b1f73f 100644 --- a/pp.c +++ b/pp.c @@ -2972,16 +2972,15 @@ PP(pp_length) always be true for an explicit 0. */ bool -Perl_translate_substr_offsets(pTHX_ STRLEN curlen, IV pos1_iv, - bool pos1_is_uv, IV len_iv, - bool len_is_uv, STRLEN *posp, - STRLEN *lenp) +Perl_translate_substr_offsets( STRLEN curlen, IV pos1_iv, + bool pos1_is_uv, IV len_iv, + bool len_is_uv, STRLEN *posp, + STRLEN *lenp) { IV pos2_iv; int pos2_is_uv; PERL_ARGS_ASSERT_TRANSLATE_SUBSTR_OFFSETS; - PERL_UNUSED_CONTEXT; if (!pos1_is_uv && pos1_iv < 0 && curlen) { pos1_is_uv = curlen-1 > ~(UV)pos1_iv; diff --git a/proto.h b/proto.h index 3c8888e..7d3e9e7 100644 --- a/proto.h +++ b/proto.h @@ -374,16 +374,16 @@ PERL_CALLCONV bool Perl_cando(pTHX_ Mode_t mode, bool effective, const Stat_t* s #define PERL_ARGS_ASSERT_CANDO \ assert(statbufp) -PERL_CALLCONV I32 Perl_cast_i32(pTHX_ NV f) +PERL_CALLCONV I32 Perl_cast_i32(NV f) __attribute__warn_unused_result__; -PERL_CALLCONV IV Perl_cast_iv(pTHX_ NV f) +PERL_CALLCONV IV Perl_cast_iv(NV f) __attribute__warn_unused_result__; -PERL_CALLCONV U32 Perl_cast_ulong(pTHX_ NV f) +PERL_CALLCONV U32 Perl_cast_ulong(NV f) __attribute__warn_unused_result__; -PERL_CALLCONV UV Perl_cast_uv(pTHX_ NV f) +PERL_CALLCONV UV Perl_cast_uv(NV f) __attribute__warn_unused_result__; PERL_CALLCONV bool Perl_check_utf8_print(pTHX_ const U8 *s, const STRLEN len) @@ -793,10 +793,10 @@ PERL_CALLCONV CV* Perl_cv_clone_into(pTHX_ CV* proto, CV *target) #define PERL_ARGS_ASSERT_CV_CLONE_INTO \ assert(proto); assert(target) -PERL_CALLCONV SV* Perl_cv_const_sv(pTHX_ const CV *const cv) +PERL_CALLCONV SV* Perl_cv_const_sv(const CV *const cv) __attribute__warn_unused_result__; -PERL_CALLCONV SV* Perl_cv_const_sv_or_av(pTHX_ const CV *const cv) +PERL_CALLCONV SV* Perl_cv_const_sv_or_av(const CV *const cv) __attribute__warn_unused_result__; PERL_CALLCONV void Perl_cv_forget_slab(pTHX_ CV *cv) @@ -2551,7 +2551,7 @@ PERL_CALLCONV int Perl_mg_copy(pTHX_ SV *sv, SV *nsv, const char *key, I32 klen) #define PERL_ARGS_ASSERT_MG_COPY \ assert(sv); assert(nsv) -PERL_CALLCONV MAGIC* Perl_mg_find(pTHX_ const SV* sv, int type) +PERL_CALLCONV MAGIC* Perl_mg_find(const SV* sv, int type) __attribute__warn_unused_result__; PERL_CALLCONV MAGIC* Perl_mg_find_mglob(pTHX_ SV* sv) @@ -2560,7 +2560,7 @@ PERL_CALLCONV MAGIC* Perl_mg_find_mglob(pTHX_ SV* sv) #define PERL_ARGS_ASSERT_MG_FIND_MGLOB \ assert(sv) -PERL_CALLCONV MAGIC* Perl_mg_findext(pTHX_ const SV* sv, int type, const MGVTBL *vtbl) +PERL_CALLCONV MAGIC* Perl_mg_findext(const SV* sv, int type, const MGVTBL *vtbl) __attribute__warn_unused_result__; PERL_CALLCONV int Perl_mg_free(pTHX_ SV* sv) @@ -2590,8 +2590,8 @@ PERL_CALLCONV void Perl_mg_localize(pTHX_ SV* sv, SV* nsv, bool setmagic) #define PERL_ARGS_ASSERT_MG_LOCALIZE \ assert(sv); assert(nsv) -PERL_CALLCONV void Perl_mg_magical(pTHX_ SV* sv) - __attribute__nonnull__(pTHX_1); +PERL_CALLCONV void Perl_mg_magical(SV* sv) + __attribute__nonnull__(1); #define PERL_ARGS_ASSERT_MG_MAGICAL \ assert(sv) @@ -2605,8 +2605,8 @@ PERL_CALLCONV I32 Perl_mg_size(pTHX_ SV* sv) #define PERL_ARGS_ASSERT_MG_SIZE \ assert(sv) -PERL_CALLCONV void Perl_mini_mktime(pTHX_ struct tm *ptm) - __attribute__nonnull__(pTHX_1); +PERL_CALLCONV void Perl_mini_mktime(struct tm *ptm) + __attribute__nonnull__(1); #define PERL_ARGS_ASSERT_MINI_MKTIME \ assert(ptm) @@ -2688,7 +2688,7 @@ PERL_CALLCONV OP * Perl_my_attrs(pTHX_ OP *o, OP *attrs) assert(o) PERL_CALLCONV void Perl_my_clearenv(pTHX); -PERL_CALLCONV int Perl_my_dirfd(pTHX_ DIR* dir); +PERL_CALLCONV int Perl_my_dirfd(DIR* dir); PERL_CALLCONV_NO_RET void Perl_my_exit(pTHX_ U32 status) __attribute__noreturn__; @@ -3995,8 +3995,8 @@ PERL_CALLCONV UV Perl_sv_2uv_flags(pTHX_ SV *const sv, const I32 flags) #define PERL_ARGS_ASSERT_SV_2UV_FLAGS \ assert(sv) -PERL_CALLCONV int Perl_sv_backoff(pTHX_ SV *const sv) - __attribute__nonnull__(pTHX_1); +PERL_CALLCONV int Perl_sv_backoff(SV *const sv) + __attribute__nonnull__(1); #define PERL_ARGS_ASSERT_SV_BACKOFF \ assert(sv) @@ -4815,10 +4815,10 @@ PERL_CALLCONV IV Perl_utf8_distance(pTHX_ const U8 *a, const U8 *b) #define PERL_ARGS_ASSERT_UTF8_DISTANCE \ assert(a); assert(b) -PERL_CALLCONV U8* Perl_utf8_hop(pTHX_ const U8 *s, I32 off) +PERL_CALLCONV U8* Perl_utf8_hop(const U8 *s, I32 off) __attribute__warn_unused_result__ __attribute__pure__ - __attribute__nonnull__(pTHX_1); + __attribute__nonnull__(1); #define PERL_ARGS_ASSERT_UTF8_HOP \ assert(s) @@ -6034,9 +6034,9 @@ STATIC void S_save_magic_flags(pTHX_ I32 mgs_ix, SV *sv, U32 flags) STATIC void S_unwind_handler_stack(pTHX_ const void *p); #endif #if defined(PERL_IN_MG_C) || defined(PERL_IN_PP_C) -PERL_CALLCONV bool Perl_translate_substr_offsets(pTHX_ STRLEN curlen, IV pos1_iv, bool pos1_is_uv, IV len_iv, bool len_is_uv, STRLEN *posp, STRLEN *lenp) - __attribute__nonnull__(pTHX_6) - __attribute__nonnull__(pTHX_7); +PERL_CALLCONV bool Perl_translate_substr_offsets(STRLEN curlen, IV pos1_iv, bool pos1_is_uv, IV len_iv, bool len_is_uv, STRLEN *posp, STRLEN *lenp) + __attribute__nonnull__(6) + __attribute__nonnull__(7); #define PERL_ARGS_ASSERT_TRANSLATE_SUBSTR_OFFSETS \ assert(posp); assert(lenp) @@ -7139,10 +7139,10 @@ PERL_STATIC_INLINE bool S_grok_bslash_x(pTHX_ char** s, UV* uv, const char** err #define PERL_ARGS_ASSERT_GROK_BSLASH_X \ assert(s); assert(uv); assert(error_msg) -PERL_STATIC_INLINE I32 S_regcurly(pTHX_ const char *s) +PERL_STATIC_INLINE I32 S_regcurly(const char *s) __attribute__warn_unused_result__ __attribute__pure__ - __attribute__nonnull__(pTHX_1); + __attribute__nonnull__(1); #define PERL_ARGS_ASSERT_REGCURLY \ assert(s) diff --git a/sv.c b/sv.c index 3c58a07..73745e4 100644 --- a/sv.c +++ b/sv.c @@ -1509,13 +1509,12 @@ wrapper instead. */ int -Perl_sv_backoff(pTHX_ SV *const sv) +Perl_sv_backoff(SV *const sv) { STRLEN delta; const char * const s = SvPVX_const(sv); PERL_ARGS_ASSERT_SV_BACKOFF; - PERL_UNUSED_CONTEXT; assert(SvOOK(sv)); assert(SvTYPE(sv) != SVt_PVHV); diff --git a/toke.c b/toke.c index 44293de..01578e0 100644 --- a/toke.c +++ b/toke.c @@ -4586,7 +4586,7 @@ Perl_yylex(pTHX) : Perl_form(aTHX_ "\\x%02X", (unsigned char)*s); len = UTF ? Perl_utf8_length(aTHX_ (U8 *) PL_linestart, (U8 *) s) : (STRLEN) (s - PL_linestart); if (len > UNRECOGNIZED_PRECEDE_COUNT) { - d = UTF ? (char *) Perl_utf8_hop(aTHX_ (U8 *) s, -UNRECOGNIZED_PRECEDE_COUNT) : s - UNRECOGNIZED_PRECEDE_COUNT; + d = UTF ? (char *) utf8_hop((U8 *) s, -UNRECOGNIZED_PRECEDE_COUNT) : s - UNRECOGNIZED_PRECEDE_COUNT; } else { d = PL_linestart; } diff --git a/utf8.c b/utf8.c index 1e8f3f9..d8033b8 100644 --- a/utf8.c +++ b/utf8.c @@ -1010,11 +1010,10 @@ on the first byte of character or just after the last byte of a character. */ U8 * -Perl_utf8_hop(pTHX_ const U8 *s, I32 off) +Perl_utf8_hop(const U8 *s, I32 off) { PERL_ARGS_ASSERT_UTF8_HOP; - PERL_UNUSED_CONTEXT; /* Note: cannot use UTF8_IS_...() too eagerly here since e.g * the bitops (especially ~) can create illegal UTF-8. * In other words: in Perl UTF-8 is not just for Unicode. */ @@ -1057,7 +1056,6 @@ Perl_bytes_cmp_utf8(pTHX_ const U8 *b, STRLEN blen, const U8 *u, STRLEN ulen) const U8 *const uend = u + ulen; PERL_ARGS_ASSERT_BYTES_CMP_UTF8; - PERL_UNUSED_CONTEXT; while (b < bend && u < uend) { U8 c = *u++; diff --git a/util.c b/util.c index d81635d..f2e537b 100644 --- a/util.c +++ b/util.c @@ -3617,13 +3617,12 @@ Perl_init_tm(pTHX_ struct tm *ptm) /* see mktime, strftime and asctime */ * semantics (and overhead) of mktime(). */ void -Perl_mini_mktime(pTHX_ struct tm *ptm) +Perl_mini_mktime(struct tm *ptm) { int yearday; int secs; int month, mday, year, jday; int odd_cent, odd_year; - PERL_UNUSED_CONTEXT; PERL_ARGS_ASSERT_MINI_MKTIME; @@ -5390,19 +5389,17 @@ Perl_get_db_sub(pTHX_ SV **svp, CV *cv) } int -Perl_my_dirfd(pTHX_ DIR * dir) { +Perl_my_dirfd(DIR * dir) { /* Most dirfd implementations have problems when passed NULL. */ if(!dir) return -1; #ifdef HAS_DIRFD - PERL_UNUSED_CONTEXT; return dirfd(dir); #elif defined(HAS_DIR_DD_FD) - PERL_UNUSED_CONTEXT; return dir->dd_fd; #else - Perl_die(aTHX_ PL_no_func, "dirfd"); + Perl_croak_nocontext(PL_no_func, "dirfd"); assert(0); /* NOT REACHED */ return 0; #endif