This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
regcomp.c: Add assertion
[perl5.git] / proto.h
diff --git a/proto.h b/proto.h
index 0115eab..06a31e3 100644 (file)
--- a/proto.h
+++ b/proto.h
@@ -934,6 +934,12 @@ PERL_CALLCONV void Perl_do_op_dump(pTHX_ I32 level, PerlIO *file, const OP *o)
 #define PERL_ARGS_ASSERT_DO_OPEN       \
        assert(gv); assert(name)
 
+PERL_CALLCONV bool     Perl_do_open6(pTHX_ GV *gv, const char *oname, STRLEN len, PerlIO *supplied_fp, SV **svp, U32 num)
+                       __attribute__nonnull__(pTHX_1)
+                       __attribute__nonnull__(pTHX_2);
+#define PERL_ARGS_ASSERT_DO_OPEN6      \
+       assert(gv); assert(oname)
+
 PERL_CALLCONV bool     Perl_do_open9(pTHX_ GV *gv, const char *name, I32 len, int as_raw, int rawmode, int rawperm, PerlIO *supplied_fp, SV *svs, I32 num)
                        __attribute__nonnull__(pTHX_1)
                        __attribute__nonnull__(pTHX_2)
@@ -941,6 +947,12 @@ PERL_CALLCONV bool Perl_do_open9(pTHX_ GV *gv, const char *name, I32 len, int as
 #define PERL_ARGS_ASSERT_DO_OPEN9      \
        assert(gv); assert(name); assert(svs)
 
+PERL_CALLCONV bool     Perl_do_open_raw(pTHX_ GV *gv, const char *oname, STRLEN len, int rawmode, int rawperm)
+                       __attribute__nonnull__(pTHX_1)
+                       __attribute__nonnull__(pTHX_2);
+#define PERL_ARGS_ASSERT_DO_OPEN_RAW   \
+       assert(gv); assert(oname)
+
 PERL_CALLCONV bool     Perl_do_openn(pTHX_ GV *gv, const char *oname, I32 len, int as_raw, int rawmode, int rawperm, PerlIO *supplied_fp, SV **svp, I32 num)
                        __attribute__nonnull__(pTHX_1)
                        __attribute__nonnull__(pTHX_2);
@@ -3052,7 +3064,7 @@ PERL_CALLCONV void        Perl_op_clear(pTHX_ OP* o)
 #define PERL_ARGS_ASSERT_OP_CLEAR      \
        assert(o)
 
-PERL_CALLCONV SV*      Perl_op_const_sv(pTHX_ const OP* o)
+PERL_CALLCONV SV*      Perl_op_const_sv(pTHX_ const OP* o, CV* cv)
                        __attribute__warn_unused_result__;
 
 PERL_CALLCONV OP*      Perl_op_contextualize(pTHX_ OP* o, I32 context)
@@ -3479,7 +3491,7 @@ PERL_CALLCONV void        Perl_reginitcolors(pTHX);
 PERL_CALLCONV regnode* Perl_regnext(pTHX_ regnode* p)
                        __attribute__warn_unused_result__;
 
-PERL_CALLCONV void     Perl_regprop(pTHX_ const regexp *prog, SV* sv, const regnode* o)
+PERL_CALLCONV void     Perl_regprop(pTHX_ const regexp *prog, SV* sv, const regnode* o, const regmatch_info *reginfo)
                        __attribute__nonnull__(pTHX_2)
                        __attribute__nonnull__(pTHX_3);
 #define PERL_ARGS_ASSERT_REGPROP       \
@@ -5082,6 +5094,11 @@ PERL_CALLCONV void       Perl_utilize(pTHX_ int aver, I32 floor, OP* version, OP* idop
        assert(idop)
 
 #endif
+#if !(defined(WIN32))
+/* PERL_CALLCONV char* my_setlocale(pTHX_ int category, const char* locale)
+                       __attribute__pure__; */
+
+#endif
 #if !(defined(_MSC_VER))
 PERL_CALLCONV_NO_RET int       Perl_magic_regdatum_set(pTHX_ SV* sv, MAGIC* mg)
                        __attribute__noreturn__
@@ -5478,6 +5495,12 @@ PERL_CALLCONV void       Perl_parser_free_nexttoke_ops(pTHX_ yy_parser *parser, OPSLAB
 #define PERL_ARGS_ASSERT_PARSER_FREE_NEXTTOKE_OPS      \
        assert(parser); assert(slab)
 
+PERL_STATIC_INLINE bool        S_should_warn_nl(const char *pv)
+                       __attribute__warn_unused_result__
+                       __attribute__nonnull__(1);
+#define PERL_ARGS_ASSERT_SHOULD_WARN_NL        \
+       assert(pv)
+
 #  if defined(PERL_DEBUG_READONLY_OPS)
 PERL_CALLCONV void     Perl_Slab_to_ro(pTHX_ OPSLAB *slab)
                        __attribute__nonnull__(pTHX_1);
@@ -5707,6 +5730,24 @@ STATIC void      S_exec_failed(pTHX_ const char *cmd, int fd, int do_report)
 STATIC bool    S_ingroup(pTHX_ Gid_t testgid, bool effective)
                        __attribute__warn_unused_result__;
 
+STATIC bool    S_openn_cleanup(pTHX_ GV *gv, IO *io, PerlIO *fp, char *mode, const char *oname, PerlIO *saveifp, PerlIO *saveofp, int savefd, char savetype, int writing, bool was_fdopen, const char *type)
+                       __attribute__nonnull__(pTHX_1)
+                       __attribute__nonnull__(pTHX_2)
+                       __attribute__nonnull__(pTHX_4)
+                       __attribute__nonnull__(pTHX_5);
+#define PERL_ARGS_ASSERT_OPENN_CLEANUP \
+       assert(gv); assert(io); assert(mode); assert(oname)
+
+STATIC IO *    S_openn_setup(pTHX_ GV *gv, char *mode, PerlIO **saveifp, PerlIO **saveofp, int *savefd, char *savetype)
+                       __attribute__nonnull__(pTHX_1)
+                       __attribute__nonnull__(pTHX_2)
+                       __attribute__nonnull__(pTHX_3)
+                       __attribute__nonnull__(pTHX_4)
+                       __attribute__nonnull__(pTHX_5)
+                       __attribute__nonnull__(pTHX_6);
+#define PERL_ARGS_ASSERT_OPENN_SETUP   \
+       assert(gv); assert(mode); assert(saveifp); assert(saveofp); assert(savefd); assert(savetype)
+
 #endif
 #if defined(PERL_IN_DOOP_C)
 STATIC I32     S_do_trans_complex(pTHX_ SV * const sv)
@@ -5858,6 +5899,11 @@ STATIC struct xpvhv_aux* S_hv_auxinit(pTHX_ HV *hv)
 #define PERL_ARGS_ASSERT_HV_AUXINIT    \
        assert(hv)
 
+STATIC struct xpvhv_aux*       S_hv_auxinit_internal(struct xpvhv_aux *iter)
+                       __attribute__nonnull__(1);
+#define PERL_ARGS_ASSERT_HV_AUXINIT_INTERNAL   \
+       assert(iter)
+
 STATIC SV*     S_hv_delete_common(pTHX_ HV *hv, SV *keysv, const char *key, STRLEN klen, int k_flags, I32 d_flags, U32 hash);
 STATIC SV*     S_hv_free_ent_ret(pTHX_ HV *hv, HE *entry)
                        __attribute__nonnull__(pTHX_1)
@@ -6118,6 +6164,11 @@ STATIC OP*       S_no_fh_allowed(pTHX_ OP *o)
 #define PERL_ARGS_ASSERT_NO_FH_ALLOWED \
        assert(o)
 
+STATIC void    S_null_listop_in_list_context(pTHX_ OP* o)
+                       __attribute__nonnull__(pTHX_1);
+#define PERL_ARGS_ASSERT_NULL_LISTOP_IN_LIST_CONTEXT   \
+       assert(o)
+
 PERL_STATIC_INLINE OP* S_op_integerize(pTHX_ OP *o)
                        __attribute__nonnull__(pTHX_1);
 #define PERL_ARGS_ASSERT_OP_INTEGERIZE \
@@ -6569,10 +6620,9 @@ STATIC I32       S_sv_ncmp(pTHX_ SV *const a, SV *const b)
 #if defined(PERL_IN_PP_SYS_C)
 STATIC OP*     S_doform(pTHX_ CV *cv, GV *gv, OP *retop)
                        __attribute__nonnull__(pTHX_1)
-                       __attribute__nonnull__(pTHX_2)
-                       __attribute__nonnull__(pTHX_3);
+                       __attribute__nonnull__(pTHX_2);
 #define PERL_ARGS_ASSERT_DOFORM        \
-       assert(cv); assert(gv); assert(retop)
+       assert(cv); assert(gv)
 
 STATIC SV *    S_space_join_names_mortal(pTHX_ char *const *array)
                        __attribute__nonnull__(pTHX_1);
@@ -6592,6 +6642,12 @@ PERL_STATIC_INLINE UV*   S__invlist_array_init(pTHX_ SV* const invlist, const bool
 #define PERL_ARGS_ASSERT__INVLIST_ARRAY_INIT   \
        assert(invlist)
 
+STATIC void    S_add_above_Latin1_folds(pTHX_ RExC_state_t *pRExC_state, const U8 cp, SV** invlist)
+                       __attribute__nonnull__(pTHX_1)
+                       __attribute__nonnull__(pTHX_3);
+#define PERL_ARGS_ASSERT_ADD_ABOVE_LATIN1_FOLDS        \
+       assert(pRExC_state); assert(invlist)
+
 PERL_STATIC_INLINE SV* S_add_cp_to_invlist(pTHX_ SV* invlist, const UV cp)
                        __attribute__warn_unused_result__;
 
@@ -6602,7 +6658,7 @@ STATIC U32        S_add_data(RExC_state_t* const pRExC_state, const char* const s, cons
 #define PERL_ARGS_ASSERT_ADD_DATA      \
        assert(pRExC_state); assert(s)
 
-PERL_STATIC_INLINE void        S_alloc_maybe_populate_EXACT(pTHX_ RExC_state_t *pRExC_state, regnode *node, I32 *flagp, STRLEN len, UV code_point)
+PERL_STATIC_INLINE void        S_alloc_maybe_populate_EXACT(pTHX_ RExC_state_t *pRExC_state, regnode *node, I32 *flagp, STRLEN len, UV code_point, bool downgradable)
                        __attribute__nonnull__(pTHX_1)
                        __attribute__nonnull__(pTHX_2)
                        __attribute__nonnull__(pTHX_3);
@@ -6619,7 +6675,7 @@ STATIC bool       S_could_it_be_a_POSIX_class(pTHX_ RExC_state_t *pRExC_state)
 #define PERL_ARGS_ASSERT_COULD_IT_BE_A_POSIX_CLASS     \
        assert(pRExC_state)
 
-STATIC SV*     S_get_ANYOF_cp_list_for_ssc(pTHX_ const RExC_state_t *pRExC_state, const regnode_charclass_posixl_fold* const node)
+STATIC SV*     S_get_ANYOF_cp_list_for_ssc(pTHX_ const RExC_state_t *pRExC_state, const regnode_charclass* const node)
                        __attribute__nonnull__(pTHX_1)
                        __attribute__nonnull__(pTHX_2);
 #define PERL_ARGS_ASSERT_GET_ANYOF_CP_LIST_FOR_SSC     \
@@ -6792,10 +6848,11 @@ STATIC SV *     S_reg_scan_name(pTHX_ RExC_state_t *pRExC_state, U32 flags)
 #define PERL_ARGS_ASSERT_REG_SCAN_NAME \
        assert(pRExC_state)
 
-STATIC bool    S_reg_skipcomment(pTHX_ RExC_state_t *pRExC_state)
-                       __attribute__nonnull__(pTHX_1);
+PERL_STATIC_INLINE char *      S_reg_skipcomment(pTHX_ RExC_state_t *pRExC_state, char * p)
+                       __attribute__nonnull__(pTHX_1)
+                       __attribute__nonnull__(pTHX_2);
 #define PERL_ARGS_ASSERT_REG_SKIPCOMMENT       \
-       assert(pRExC_state)
+       assert(pRExC_state); assert(p)
 
 STATIC regnode*        S_reganode(pTHX_ RExC_state_t *pRExC_state, U8 op, U32 arg)
                        __attribute__nonnull__(pTHX_1);
@@ -6826,10 +6883,10 @@ STATIC void     S_reginsert(pTHX_ RExC_state_t *pRExC_state, U8 op, regnode *opnd, U
 #define PERL_ARGS_ASSERT_REGINSERT     \
        assert(pRExC_state); assert(opnd)
 
-STATIC char *  S_regpatws(RExC_state_t *pRExC_state, char *p, const bool recognize_comment)
+STATIC char *  S_regpatws(pTHX_ RExC_state_t *pRExC_state, char *p, const bool recognize_comment)
                        __attribute__warn_unused_result__
-                       __attribute__nonnull__(1)
-                       __attribute__nonnull__(2);
+                       __attribute__nonnull__(pTHX_1)
+                       __attribute__nonnull__(pTHX_2);
 #define PERL_ARGS_ASSERT_REGPATWS      \
        assert(pRExC_state); assert(p)
 
@@ -6857,13 +6914,6 @@ PERL_STATIC_INLINE STRLEN        S_reguni(pTHX_ const RExC_state_t *pRExC_state, UV uv,
 #define PERL_ARGS_ASSERT_REGUNI        \
        assert(pRExC_state); assert(s)
 
-STATIC char *  S_regwhite(RExC_state_t *pRExC_state, char *p)
-                       __attribute__warn_unused_result__
-                       __attribute__nonnull__(1)
-                       __attribute__nonnull__(2);
-#define PERL_ARGS_ASSERT_REGWHITE      \
-       assert(pRExC_state); assert(p)
-
 STATIC void    S_scan_commit(pTHX_ const RExC_state_t *pRExC_state, struct scan_data_t *data, SSize_t *minlenp, int is_inf)
                        __attribute__nonnull__(pTHX_1)
                        __attribute__nonnull__(pTHX_2)
@@ -6871,7 +6921,7 @@ STATIC void       S_scan_commit(pTHX_ const RExC_state_t *pRExC_state, struct scan_dat
 #define PERL_ARGS_ASSERT_SCAN_COMMIT   \
        assert(pRExC_state); assert(data); assert(minlenp)
 
-STATIC void    S_set_ANYOF_arg(pTHX_ RExC_state_t* const pRExC_state, regnode* const node, SV* const cp_list, SV* const runtime_defns, SV* const swash, const bool has_user_defined_property)
+STATIC void    S_set_ANYOF_arg(pTHX_ RExC_state_t* const pRExC_state, regnode* const node, SV* const cp_list, SV* const runtime_defns, SV* const only_utf8_locale_list, SV* const swash, const bool has_user_defined_property)
                        __attribute__nonnull__(pTHX_1)
                        __attribute__nonnull__(pTHX_2);
 #define PERL_ARGS_ASSERT_SET_ANYOF_ARG \
@@ -6882,7 +6932,7 @@ PERL_STATIC_INLINE void   S_ssc_add_range(pTHX_ regnode_ssc *ssc, UV const start,
 #define PERL_ARGS_ASSERT_SSC_ADD_RANGE \
        assert(ssc)
 
-STATIC void    S_ssc_and(pTHX_ const RExC_state_t *pRExC_state, regnode_ssc *ssc, const regnode_ssc *and_with)
+STATIC void    S_ssc_and(pTHX_ const RExC_state_t *pRExC_state, regnode_ssc *ssc, const regnode_charclass *and_with)
                        __attribute__nonnull__(pTHX_1)
                        __attribute__nonnull__(pTHX_2)
                        __attribute__nonnull__(pTHX_3);
@@ -6910,11 +6960,6 @@ STATIC void      S_ssc_finalize(pTHX_ RExC_state_t *pRExC_state, regnode_ssc *ssc)
 #define PERL_ARGS_ASSERT_SSC_FINALIZE  \
        assert(pRExC_state); assert(ssc)
 
-STATIC void    S_ssc_flags_and(regnode_ssc *ssc, const U8 and_with)
-                       __attribute__nonnull__(1);
-#define PERL_ARGS_ASSERT_SSC_FLAGS_AND \
-       assert(ssc)
-
 STATIC void    S_ssc_init(pTHX_ const RExC_state_t *pRExC_state, regnode_ssc *ssc)
                        __attribute__nonnull__(pTHX_1)
                        __attribute__nonnull__(pTHX_2);
@@ -6940,7 +6985,7 @@ STATIC int        S_ssc_is_cp_posixl_init(pTHX_ const RExC_state_t *pRExC_state, const
 #define PERL_ARGS_ASSERT_SSC_IS_CP_POSIXL_INIT \
        assert(pRExC_state); assert(ssc)
 
-STATIC void    S_ssc_or(pTHX_ const RExC_state_t *pRExC_state, regnode_ssc *ssc, const regnode_ssc *or_with)
+STATIC void    S_ssc_or(pTHX_ const RExC_state_t *pRExC_state, regnode_ssc *ssc, const regnode_charclass *or_with)
                        __attribute__nonnull__(pTHX_1)
                        __attribute__nonnull__(pTHX_2)
                        __attribute__nonnull__(pTHX_3);
@@ -6980,6 +7025,14 @@ PERL_CALLCONV SV*        Perl__new_invlist_C_array(pTHX_ const UV* const list)
        assert(list)
 
 #endif
+#if defined(PERL_IN_REGCOMP_C) || defined(PERL_IN_REGEXEC_C)
+PERL_CALLCONV SV*      Perl__get_regclass_nonbitmap_data(pTHX_ const regexp *prog, const struct regnode *node, bool doinit, SV **listsvp, SV **lonly_utf8_locale)
+                       __attribute__nonnull__(pTHX_2);
+#define PERL_ARGS_ASSERT__GET_REGCLASS_NONBITMAP_DATA  \
+       assert(node)
+
+PERL_CALLCONV void     Perl__load_PL_utf8_foldclosures(pTHX);
+#endif
 #if defined(PERL_IN_REGCOMP_C) || defined(PERL_IN_REGEXEC_C) || defined(PERL_IN_UTF8_C)
 PERL_CALLCONV SV*      Perl__get_swash_invlist(pTHX_ SV* const swash)
                        __attribute__warn_unused_result__
@@ -7126,12 +7179,6 @@ PERL_CALLCONV SV*        Perl__swash_to_invlist(pTHX_ SV* const swash)
 
 #endif
 #if defined(PERL_IN_REGEXEC_C)
-STATIC SV*     S_core_regclass_swash(pTHX_ const regexp *prog, const struct regnode *node, bool doinit, SV **listsvp)
-                       __attribute__warn_unused_result__
-                       __attribute__nonnull__(pTHX_2);
-#define PERL_ARGS_ASSERT_CORE_REGCLASS_SWASH   \
-       assert(node)
-
 STATIC char*   S_find_byclass(pTHX_ regexp * prog, const regnode *c, char *s, const char *strend, regmatch_info *reginfo)
                        __attribute__warn_unused_result__
                        __attribute__nonnull__(pTHX_1)
@@ -7175,6 +7222,14 @@ STATIC U8*       S_reghop3(U8 *s, SSize_t off, const U8 *lim)
 #define PERL_ARGS_ASSERT_REGHOP3       \
        assert(s); assert(lim)
 
+STATIC U8*     S_reghop4(U8 *s, SSize_t off, const U8 *llim, const U8 *rlim)
+                       __attribute__warn_unused_result__
+                       __attribute__nonnull__(1)
+                       __attribute__nonnull__(3)
+                       __attribute__nonnull__(4);
+#define PERL_ARGS_ASSERT_REGHOP4       \
+       assert(s); assert(llim); assert(rlim)
+
 STATIC U8*     S_reghopmaybe3(U8 *s, SSize_t off, const U8 *lim)
                        __attribute__warn_unused_result__
                        __attribute__nonnull__(1)
@@ -7224,16 +7279,6 @@ STATIC void      S_to_utf8_substr(pTHX_ regexp * prog)
 #define PERL_ARGS_ASSERT_TO_UTF8_SUBSTR        \
        assert(prog)
 
-#  if defined(XXX_dmq)
-STATIC U8*     S_reghop4(U8 *s, SSize_t off, const U8 *llim, const U8 *rlim)
-                       __attribute__warn_unused_result__
-                       __attribute__nonnull__(1)
-                       __attribute__nonnull__(3)
-                       __attribute__nonnull__(4);
-#define PERL_ARGS_ASSERT_REGHOP4       \
-       assert(s); assert(llim); assert(rlim)
-
-#  endif
 #endif
 #if defined(PERL_IN_SCOPE_C)
 STATIC void    S_save_pushptri32ptr(pTHX_ void *const ptr1, const I32 i, void *const ptr2, const int type);
@@ -7307,11 +7352,6 @@ STATIC void      S_not_a_number(pTHX_ SV *const sv)
 #define PERL_ARGS_ASSERT_NOT_A_NUMBER  \
        assert(sv)
 
-STATIC void    S_not_incrementable(pTHX_ SV *const sv)
-                       __attribute__nonnull__(pTHX_1);
-#define PERL_ARGS_ASSERT_NOT_INCREMENTABLE     \
-       assert(sv)
-
 STATIC PTR_TBL_ENT_t * S_ptr_table_find(PTR_TBL_t *const tbl, const void *const sv)
                        __attribute__warn_unused_result__
                        __attribute__nonnull__(1);
@@ -7328,12 +7368,6 @@ STATIC void      S_sv_add_arena(pTHX_ char *const ptr, const U32 size, const U32 flag
 #define PERL_ARGS_ASSERT_SV_ADD_ARENA  \
        assert(ptr)
 
-STATIC const char *    S_sv_display(pTHX_ SV *const sv, char *tmpbuf, STRLEN tmpbuf_size)
-                       __attribute__nonnull__(pTHX_1)
-                       __attribute__nonnull__(pTHX_2);
-#define PERL_ARGS_ASSERT_SV_DISPLAY    \
-       assert(sv); assert(tmpbuf)
-
 STATIC STRLEN  S_sv_pos_b2u_midway(pTHX_ const U8 *const s, const U8 *const target, const U8 *end, STRLEN endu)
                        __attribute__nonnull__(pTHX_1)
                        __attribute__nonnull__(pTHX_2)
@@ -7672,6 +7706,17 @@ PERL_STATIC_INLINE bool  S_is_utf8_common(pTHX_ const U8 *const p, SV **swash, co
 #define PERL_ARGS_ASSERT_IS_UTF8_COMMON        \
        assert(p); assert(swash); assert(swashname)
 
+STATIC U8*     S_swash_scan_list_line(pTHX_ U8* l, U8* const lend, UV* min, UV* max, UV* val, const bool wants_value, const U8* const typestr)
+                       __attribute__warn_unused_result__
+                       __attribute__nonnull__(pTHX_1)
+                       __attribute__nonnull__(pTHX_2)
+                       __attribute__nonnull__(pTHX_3)
+                       __attribute__nonnull__(pTHX_4)
+                       __attribute__nonnull__(pTHX_5)
+                       __attribute__nonnull__(pTHX_7);
+#define PERL_ARGS_ASSERT_SWASH_SCAN_LIST_LINE  \
+       assert(l); assert(lend); assert(min); assert(max); assert(val); assert(typestr)
+
 STATIC SV*     S_swatch_get(pTHX_ SV* swash, UV start, UV span)
                        __attribute__warn_unused_result__
                        __attribute__nonnull__(pTHX_1);
@@ -8063,6 +8108,9 @@ PERL_CALLCONV SSize_t     Perl_PerlIO_write(pTHX_ PerlIO *f, const void *vbuf, Size_
 
 #endif
 #if defined(WIN32)
+PERL_CALLCONV char*    Perl_my_setlocale(pTHX_ int category, const char* locale)
+                       __attribute__pure__;
+
 PERL_CALLCONV_NO_RET void      win32_croak_not_implemented(const char * fname)
                        __attribute__noreturn__
                        __attribute__nonnull__(1);