diff --git a/doop.c b/doop.c index 62101b258a22..000e9d8adeff 100644 --- a/doop.c +++ b/doop.c @@ -373,7 +373,7 @@ S_do_trans_count_invmap(pTHX_ SV * const sv, AV * const invmap) else { from = utf8_to_uvchr_buf(s, send, &s_len); if (from == 0 && *s != '\0') { - _force_out_malformed_utf8_message(s, send, 0, MALFORMED_UTF8_DIE); + force_out_malformed_utf8_message_(s, send, 0, MALFORMED_UTF8_DIE); } } @@ -492,7 +492,7 @@ S_do_trans_invmap(pTHX_ SV * const sv, AV * const invmap) else { from = utf8_to_uvchr_buf(s, send, &s_len); if (from == 0 && *s != '\0') { - _force_out_malformed_utf8_message(s, send, 0, MALFORMED_UTF8_DIE); + force_out_malformed_utf8_message_(s, send, 0, MALFORMED_UTF8_DIE); } } diff --git a/embed.fnc b/embed.fnc index 5998567d33f4..7792a28e7a3c 100644 --- a/embed.fnc +++ b/embed.fnc @@ -1238,7 +1238,7 @@ Adpx |void |forbid_outofblock_ops \ |NN OP *o \ |NN const char *blockname p |void |force_locale_unlock -Cp |void |_force_out_malformed_utf8_message \ +Cp |void |force_out_malformed_utf8_message_ \ |NN const U8 * const p \ |NN const U8 * const e \ |const U32 flags \ diff --git a/embed.h b/embed.h index cf765e3cf44f..dfcc4f4881e6 100644 --- a/embed.h +++ b/embed.h @@ -113,7 +113,6 @@ # define SvTRUE_nomg(a) Perl_SvTRUE_nomg(aTHX_ a) # define SvUV(a) Perl_SvUV(aTHX_ a) # define SvUV_nomg(a) Perl_SvUV_nomg(aTHX_ a) -# define _force_out_malformed_utf8_message(a,b,c,d) Perl__force_out_malformed_utf8_message(aTHX_ a,b,c,d) # define _is_uni_FOO(a,b) Perl__is_uni_FOO(aTHX_ a,b) # define _is_uni_perl_idcont(a) Perl__is_uni_perl_idcont(aTHX_ a) # define _is_uni_perl_idstart(a) Perl__is_uni_perl_idstart(aTHX_ a) @@ -236,6 +235,7 @@ # define foldEQ_locale(a,b,c) Perl_foldEQ_locale(aTHX_ a,b,c) # define foldEQ_utf8_flags(a,b,c,d,e,f,g,h,i) Perl_foldEQ_utf8_flags(aTHX_ a,b,c,d,e,f,g,h,i) # define forbid_outofblock_ops(a,b) Perl_forbid_outofblock_ops(aTHX_ a,b) +# define force_out_malformed_utf8_message_(a,b,c,d) Perl_force_out_malformed_utf8_message_(aTHX_ a,b,c,d) # define free_tmps() Perl_free_tmps(aTHX) # define get_av(a,b) Perl_get_av(aTHX_ a,b) # define get_cv(a,b) Perl_get_cv(aTHX_ a,b) diff --git a/handy.h b/handy.h index 2146dbe54181..ebb17f9cb28d 100644 --- a/handy.h +++ b/handy.h @@ -2272,14 +2272,14 @@ END_EXTERN_C #define generic_utf8_safe_(classnum, p, e, above_latin1) \ ((! _utf8_safe_assert(p, e)) \ - ? (_force_out_malformed_utf8_message((U8 *) (p), (U8 *) (e), 0, MALFORMED_UTF8_DIE), 0)\ + ? (force_out_malformed_utf8_message_((U8 *) (p), (U8 *) (e), 0, MALFORMED_UTF8_DIE), 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( \ + : (force_out_malformed_utf8_message_( \ (U8 *) (p), (U8 *) (e), 0, MALFORMED_UTF8_DIE), 0)) \ : above_latin1)) /* Like the above, but calls 'above_latin1(p)' to get the utf8 value. @@ -2289,7 +2289,7 @@ END_EXTERN_C #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( \ + ? (force_out_malformed_utf8_message_( \ (U8 *) (p), (U8 *) (e), 0, MALFORMED_UTF8_DIE), 0) \ : above_latin1(p))) /* Like the above, but passes classnum to _isFOO_utf8(), instead of having an @@ -2379,7 +2379,7 @@ END_EXTERN_C #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( \ + ? (force_out_malformed_utf8_message_( \ (U8 *) (p), (U8 *) (e), 0, MALFORMED_UTF8_DIE), 0) \ : is_XDIGIT_high(p))) @@ -2428,7 +2428,7 @@ END_EXTERN_C : (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( \ + : (force_out_malformed_utf8_message_( \ (U8 *) (p), (U8 *) (e), 0, MALFORMED_UTF8_DIE), 0)) \ : above_latin1)) @@ -2442,7 +2442,7 @@ END_EXTERN_C #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( \ + ? (force_out_malformed_utf8_message_( \ (U8 *) (p), (U8 *) (e), 0, MALFORMED_UTF8_DIE), 0) \ : above_latin1(p))) diff --git a/pp_pack.c b/pp_pack.c index 0e8dd9d5f4f3..502353119aa6 100644 --- a/pp_pack.c +++ b/pp_pack.c @@ -3152,7 +3152,7 @@ PP_wrapped(pp_pack, 0, 1) const U8 * error_pos; if (! is_utf8_string_loc((U8 *) result, result_len, &error_pos)) { - _force_out_malformed_utf8_message(error_pos, + force_out_malformed_utf8_message_(error_pos, (U8 *) result + result_len, 0, /* no flags */ MALFORMED_UTF8_DIE diff --git a/proto.h b/proto.h index 6eacaeebe440..32e8d48f4fa7 100644 --- a/proto.h +++ b/proto.h @@ -91,11 +91,6 @@ PERL_CALLCONV const char * Perl__byte_dump_string(pTHX_ const U8 * const start, const STRLEN len, const bool format); #define PERL_ARGS_ASSERT__BYTE_DUMP_STRING -PERL_CALLCONV void -Perl__force_out_malformed_utf8_message(pTHX_ const U8 * const p, const U8 * const e, const U32 flags, const bool die_here); -#define PERL_ARGS_ASSERT__FORCE_OUT_MALFORMED_UTF8_MESSAGE \ - assert(p); assert(e) - PERL_CALLCONV Size_t Perl__inverse_folds(pTHX_ const UV cp, U32 *first_folds_to, const U32 **remaining_folds_to) __attribute__warn_unused_result__; @@ -1191,6 +1186,11 @@ Perl_force_locale_unlock(pTHX) __attribute__visibility__("hidden"); #define PERL_ARGS_ASSERT_FORCE_LOCALE_UNLOCK +PERL_CALLCONV void +Perl_force_out_malformed_utf8_message_(pTHX_ const U8 * const p, const U8 * const e, const U32 flags, const bool die_here); +#define PERL_ARGS_ASSERT_FORCE_OUT_MALFORMED_UTF8_MESSAGE_ \ + assert(p); assert(e) + PERL_CALLCONV char * Perl_form(pTHX_ const char *pat, ...) __attribute__format__(__printf__,pTHX_1,pTHX_2); diff --git a/regexec.c b/regexec.c index 47073dc72041..364713893d2b 100644 --- a/regexec.c +++ b/regexec.c @@ -10917,7 +10917,7 @@ S_reginclass(pTHX_ regexp * const prog, const regnode * const n, const U8* const const U32 utf8n_flags = UTF8_ALLOW_DEFAULT; c = utf8n_to_uvchr(p, p_end - p, &c_len, utf8n_flags | UTF8_CHECK_ONLY); if (c_len == (STRLEN)-1) { - _force_out_malformed_utf8_message(p, p_end, + force_out_malformed_utf8_message_(p, p_end, utf8n_flags, MALFORMED_UTF8_DIE); NOT_REACHED; /* NOTREACHED */ diff --git a/toke.c b/toke.c index c60d301ebf71..80d3bd17682f 100644 --- a/toke.c +++ b/toke.c @@ -929,7 +929,7 @@ Perl_lex_start(pTHX_ SV *line, PerlIO *rsfp, U32 flags) SvCUR(line), &first_bad_char_loc))) { - _force_out_malformed_utf8_message(first_bad_char_loc, + force_out_malformed_utf8_message_(first_bad_char_loc, (U8 *) s + SvCUR(line), 0, MALFORMED_UTF8_DIE); @@ -1546,7 +1546,7 @@ Perl_lex_next_chunk(pTHX_ U32 flags) PL_parser->bufend - PL_parser->bufptr, &first_bad_char_loc))) { - _force_out_malformed_utf8_message(first_bad_char_loc, + force_out_malformed_utf8_message_(first_bad_char_loc, (U8 *) PL_parser->bufend, 0, MALFORMED_UTF8_DIE); @@ -1636,7 +1636,7 @@ Perl_lex_peek_unichar(pTHX_ U32 flags) } unichar = utf8n_to_uvchr((U8*)s, bufend-s, &retlen, UTF8_CHECK_ONLY); if (retlen == (STRLEN)-1) { - _force_out_malformed_utf8_message((U8 *) s, + force_out_malformed_utf8_message_((U8 *) s, (U8 *) bufend, 0, MALFORMED_UTF8_DIE); @@ -3023,7 +3023,7 @@ Perl_get_and_check_backslash_N_name(pTHX_ const char* s, if (UNLIKELY(! is_utf8_string_loc((U8 *) str, len, &first_bad_char_loc))) { - _force_out_malformed_utf8_message(first_bad_char_loc, + force_out_malformed_utf8_message_(first_bad_char_loc, (U8 *) PL_parser->bufend, 0, MALFORMED_UTF8_WARN); @@ -9618,7 +9618,7 @@ Perl_yylex(pTHX) PL_bufend - PL_bufptr, &first_bad_char_loc))) { - _force_out_malformed_utf8_message(first_bad_char_loc, + force_out_malformed_utf8_message_(first_bad_char_loc, (U8 *) PL_bufend, 0, MALFORMED_UTF8_DIE); diff --git a/utf8.c b/utf8.c index aff54a3171d2..1da50e1bc39d 100644 --- a/utf8.c +++ b/utf8.c @@ -47,7 +47,7 @@ within non-zero characters. */ void -Perl__force_out_malformed_utf8_message(pTHX_ +Perl_force_out_malformed_utf8_message_(pTHX_ const U8 *const p, /* First byte in UTF-8 sequence */ const U8 * const e, /* Final byte in sequence (may include multiple chars */ @@ -55,6 +55,8 @@ Perl__force_out_malformed_utf8_message(pTHX_ usually 0, or some DISALLOW flags */ const bool die_here) /* If TRUE, this function does not return */ { + PERL_ARGS_ASSERT_FORCE_OUT_MALFORMED_UTF8_MESSAGE_; + /* This core-only function is to be called when a malformed UTF-8 character * is found, in order to output the detailed information about the * malformation before dieing. The reason it exists is for the occasions @@ -69,8 +71,6 @@ Perl__force_out_malformed_utf8_message(pTHX_ * die themselves */ U32 errors; - PERL_ARGS_ASSERT__FORCE_OUT_MALFORMED_UTF8_MESSAGE; - ENTER; SAVEI8(PL_dowarn); SAVESPTR(PL_curcop); @@ -86,7 +86,7 @@ Perl__force_out_malformed_utf8_message(pTHX_ LEAVE; if (! errors) { - Perl_croak(aTHX_ "panic: _force_out_malformed_utf8_message should" + Perl_croak(aTHX_ "panic: force_out_malformed_utf8_message_ should" " be called only when there are errors found"); } @@ -3734,7 +3734,7 @@ S_is_utf8_common(pTHX_ const U8 *const p, const U8 * const e, PERL_ARGS_ASSERT_IS_UTF8_COMMON; if (cp == 0 && (p >= e || *p != '\0')) { - _force_out_malformed_utf8_message(p, e, 0, MALFORMED_UTF8_DIE); + force_out_malformed_utf8_message_(p, e, 0, MALFORMED_UTF8_DIE); NOT_REACHED; /* NOTREACHED */ } @@ -4279,7 +4279,7 @@ S_turkic_uc(pTHX_ const U8 * const p, const U8 * const e, STRLEN len_result; \ result = utf8n_to_uvchr(p, e - p, &len_result, UTF8_CHECK_ONLY); \ if (len_result == (STRLEN) -1) { \ - _force_out_malformed_utf8_message(p, e, 0, MALFORMED_UTF8_DIE ); \ + force_out_malformed_utf8_message_(p, e, 0, MALFORMED_UTF8_DIE ); \ } #define CASE_CHANGE_BODY_END(locale_flags, change_macro) \