Skip to content

Commit a967a9c

Browse files
committed
embed.fnc: Add MPTR constraints
This is the first use of the new MPTR constraint that is used to generate an assertion that a pointer is somewhere in the middle of a string. I removed now redundant asserts that were in the functions, and now are included in the ARGS_ASSERT macros
1 parent 541d899 commit a967a9c

File tree

3 files changed

+88
-74
lines changed

3 files changed

+88
-74
lines changed

embed.fnc

Lines changed: 51 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -2708,9 +2708,9 @@ Fop |void |populate_isa |NN const char *name \
27082708
Adhp |REGEXP *|pregcomp |NN SV * const pattern \
27092709
|const U32 flags
27102710
Adhp |I32 |pregexec |NN REGEXP * const prog \
2711-
|NN char *stringarg \
2712-
|NN char *strend \
2713-
|NN char *strbeg \
2711+
|MPTR char *stringarg \
2712+
|EPTR char *strend \
2713+
|SPTR char *strbeg \
27142714
|SSize_t minend \
27152715
|NN SV *screamer \
27162716
|U32 nosave
@@ -2821,9 +2821,9 @@ Xdp |struct refcounted_he *|refcounted_he_new_sv \
28212821
|U32 flags
28222822
Cp |void |regdump |NN const regexp *r
28232823
Cp |I32 |regexec_flags |NN REGEXP * const rx \
2824-
|NN char *stringarg \
2824+
|MPTR char *stringarg \
28252825
|NN char *strend \
2826-
|NN char *strbeg \
2826+
|SPTR char *strbeg \
28272827
|SSize_t minend \
28282828
|NN SV *sv \
28292829
|NULLOK void *data \
@@ -2889,8 +2889,8 @@ EXp |REGEXP *|reg_temp_copy |NULLOK REGEXP *dsv \
28892889
|NN REGEXP *ssv
28902890
Cp |char * |re_intuit_start|NN REGEXP * const rx \
28912891
|NULLOK SV *sv \
2892-
|NN const char * const strbeg \
2893-
|NN char *strpos \
2892+
|SPTR const char * const strbeg \
2893+
|MPTR char *strpos \
28942894
|NN char *strend \
28952895
|const U32 flags \
28962896
|NULLOK re_scream_pos_data *data
@@ -3808,13 +3808,13 @@ ARdip |IV |utf8_distance |NN const U8 *a \
38083808
|NN const U8 *b
38093809
ARTdip |U8 * |utf8_hop |NN const U8 *s \
38103810
|SSize_t off
3811-
ARTdmp |U8 * |utf8_hop_back |NN const U8 *s \
3811+
ARTdmp |U8 * |utf8_hop_back |MPTR const U8 *s \
38123812
|SSize_t off \
3813-
|NN const U8 * const start
3813+
|SPTR const U8 * const start
38143814
ARTdip |U8 * |utf8_hop_back_overshoot \
3815-
|NN const U8 *s \
3815+
|MPTR const U8 *s \
38163816
|SSize_t off \
3817-
|NN const U8 * const start \
3817+
|SPTR const U8 * const start \
38183818
|NULLOK SSize_t *remaining
38193819
ARTdmp |U8 * |utf8_hop_forward \
38203820
|NN const U8 *s \
@@ -3826,14 +3826,14 @@ ARTdip |U8 * |utf8_hop_forward_overshoot \
38263826
|NN const U8 * const end \
38273827
|NULLOK SSize_t *remaining
38283828
ARTdip |U8 * |utf8_hop_overshoot \
3829-
|NN const U8 *s \
3829+
|MPTR const U8 *s \
38303830
|SSize_t off \
3831-
|NN const U8 * const start \
3831+
|SPTR const U8 * const start \
38323832
|NN const U8 * const end \
38333833
|NULLOK SSize_t *remaining
3834-
ARTdmp |U8 * |utf8_hop_safe |NN const U8 *s \
3834+
ARTdmp |U8 * |utf8_hop_safe |MPTR const U8 *s \
38353835
|SSize_t off \
3836-
|NN const U8 * const start \
3836+
|SPTR const U8 * const start \
38373837
|NN const U8 * const end
38383838
ARdp |STRLEN |utf8_length |NN const U8 *s0 \
38393839
|NN const U8 *e
@@ -4617,9 +4617,9 @@ S |void |maybe_multimagic_gv \
46174617
S |bool |parse_gv_stash_name \
46184618
|NN HV **stash \
46194619
|NN GV **gv \
4620-
|NN const char **name \
4620+
|MPTR const char **name \
46214621
|NN STRLEN *len \
4622-
|NN const char *nambeg \
4622+
|SPTR const char *nambeg \
46234623
|STRLEN full_len \
46244624
|const U32 is_utf8 \
46254625
|const I32 add
@@ -5321,8 +5321,8 @@ S |SV ** |pack_rec |NN SV *cat \
53215321
RS |char * |sv_exp_grow |NN SV *sv \
53225322
|STRLEN needed
53235323
S |SSize_t|unpack_rec |NN struct tempsym *symptr \
5324-
|NN const char *s \
5325-
|NN const char *strbeg \
5324+
|MPTR const char *s \
5325+
|SPTR const char *strbeg \
53265326
|NN const char *strend \
53275327
|NULLOK const char **new_s
53285328
#endif /* defined(PERL_IN_PP_PACK_C) */
@@ -5494,9 +5494,9 @@ ERST |int |edit_distance |NN const UV *src \
54945494
|const SSize_t maxDistance
54955495
ES |I32 |execute_wildcard \
54965496
|NN REGEXP * const prog \
5497-
|NN char *stringarg \
5497+
|MPTR char *stringarg \
54985498
|NN char *strend \
5499-
|NN char *strbeg \
5499+
|SPTR char *strbeg \
55005500
|SSize_t minend \
55015501
|NN SV *screamer \
55025502
|U32 nosave
@@ -5681,9 +5681,9 @@ Ep |void |populate_invlist_from_bitmap \
56815681
#endif
56825682
#if defined(PERL_IN_REGCOMP_C) || defined(PERL_IN_REGEXEC_C) || \
56835683
defined(PERL_IN_TOKE_C)
5684-
ERp |bool |is_grapheme |NN const U8 *strbeg \
5685-
|NN const U8 *s \
5686-
|NN const U8 *strend \
5684+
ERp |bool |is_grapheme |SPTR const U8 *strbeg \
5685+
|MPTR const U8 *s \
5686+
|EPTR const U8 *strend \
56875687
|const UV cp
56885688
#endif
56895689
#if defined(PERL_IN_REGCOMP_C) || defined(PERL_IN_REGEXEC_C) || \
@@ -5793,30 +5793,30 @@ ES |void |unwind_scan_frames \
57935793
|NN void *p
57945794
#endif /* defined(PERL_IN_REGCOMP_STUDY_C) */
57955795
#if defined(PERL_IN_REGEXEC_C)
5796-
ERS |LB_enum|advance_one_LB |NN U8 **curpos \
5797-
|NN const U8 * const strend \
5796+
ERS |LB_enum|advance_one_LB |MPTR U8 **curpos \
5797+
|EPTR const U8 * const strend \
57985798
|const bool utf8_target
5799-
ERS |SB_enum|advance_one_SB |NN U8 **curpos \
5800-
|NN const U8 * const strend \
5799+
ERS |SB_enum|advance_one_SB |MPTR U8 **curpos \
5800+
|EPTR const U8 * const strend \
58015801
|const bool utf8_target
5802-
ERS |WB_enum|advance_one_WB_|NN U8 **curpos \
5803-
|NN const U8 * const strend \
5802+
ERS |WB_enum|advance_one_WB_|MPTR U8 **curpos \
5803+
|EPTR const U8 * const strend \
58045804
|const bool utf8_target \
58055805
|const bool skip_Extend_Format
5806-
ERS |GCB_enum|backup_one_GCB|NN const U8 * const strbeg \
5807-
|NN U8 **curpos \
5806+
ERS |GCB_enum|backup_one_GCB|SPTR const U8 * const strbeg \
5807+
|MPTR U8 **curpos \
58085808
|const bool utf8_target
5809-
ERS |LB_enum|backup_one_LB_ |NN const U8 * const strbeg \
5810-
|NN U8 **curpos \
5809+
ERS |LB_enum|backup_one_LB_ |SPTR const U8 * const strbeg \
5810+
|MPTR U8 **curpos \
58115811
|const bool utf8_target \
58125812
|bool skip_CM_ZWJ
5813-
ERS |SB_enum|backup_one_SB |NN const U8 * const strbeg \
5814-
|NN U8 **curpos \
5813+
ERS |SB_enum|backup_one_SB |SPTR const U8 * const strbeg \
5814+
|MPTR U8 **curpos \
58155815
|const bool utf8_target
58165816
ERS |WB_enum|backup_one_WB_but_over_Extend_FO \
58175817
|NN WB_enum *previous \
5818-
|NN const U8 * const strbeg \
5819-
|NN U8 **curpos \
5818+
|SPTR const U8 * const strbeg \
5819+
|MPTR U8 **curpos \
58205820
|const bool utf8_target
58215821
EWi |void |capture_clear |NN regexp *rex \
58225822
|U16 from_ix \
@@ -5851,27 +5851,27 @@ ERS |bool |isFOO_utf8_lc |const U8 classnum \
58515851
|EPTR const U8 *e
58525852
ERS |bool |isGCB |const GCB_enum before \
58535853
|const GCB_enum after \
5854-
|NN const U8 * const strbeg \
5855-
|NN const U8 * const curpos \
5854+
|SPTR const U8 * const strbeg \
5855+
|MPTR const U8 * const curpos \
58565856
|const bool utf8_target
58575857
ERS |bool |isLB |LB_enum before \
58585858
|LB_enum after \
5859-
|NN const U8 * const strbeg \
5860-
|NN const U8 * const curpos \
5861-
|NN const U8 * const strend \
5859+
|SPTR const U8 * const strbeg \
5860+
|MPTR const U8 * const curpos \
5861+
|EPTR const U8 * const strend \
58625862
|const bool utf8_target
58635863
ERS |bool |isSB |SB_enum before \
58645864
|SB_enum after \
5865-
|NN const U8 * const strbeg \
5866-
|NN const U8 * const curpos \
5867-
|NN const U8 * const strend \
5865+
|SPTR const U8 * const strbeg \
5866+
|MPTR const U8 * const curpos \
5867+
|EPTR const U8 * const strend \
58685868
|const bool utf8_target
58695869
ERS |bool |isWB |WB_enum previous \
58705870
|WB_enum before \
58715871
|WB_enum after \
5872-
|NN const U8 * const strbeg \
5873-
|NN const U8 * const curpos \
5874-
|NN const U8 * const strend \
5872+
|SPTR const U8 * const strbeg \
5873+
|MPTR const U8 * const curpos \
5874+
|EPTR const U8 * const strend \
58755875
|const bool utf8_target
58765876
ERST |I32 |reg_check_named_buff_matched \
58775877
|NN const regexp *rex \
@@ -6050,8 +6050,8 @@ S |const char *|sv_display|NN SV * const sv \
60506050
|STRLEN tmpbuf_size
60516051
S |bool |sv_2iuv_common |NN SV * const sv
60526052
S |STRLEN |sv_pos_b2u_midway \
6053-
|NN const U8 * const s \
6054-
|NN const U8 * const target \
6053+
|SPTR const U8 * const s \
6054+
|MPTR const U8 * const target \
60556055
|NN const U8 *end \
60566056
|STRLEN endu
60576057
S |STRLEN |sv_pos_u2b_cached \

inline.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2963,7 +2963,6 @@ Perl_utf8_hop_back_overshoot(const U8 *s, SSize_t off,
29632963
const U8 * const start, SSize_t *remaining)
29642964
{
29652965
PERL_ARGS_ASSERT_UTF8_HOP_BACK_OVERSHOOT;
2966-
assert(start <= s);
29672966
assert(off <= 0);
29682967

29692968
/* Note: if we know that the input is well-formed, we can do per-word
@@ -3031,7 +3030,7 @@ Perl_utf8_hop_overshoot(const U8 *s, SSize_t off,
30313030
{
30323031
PERL_ARGS_ASSERT_UTF8_HOP_OVERSHOOT;
30333032

3034-
assert(start <= s && s <= end);
3033+
assert(s <= end);
30353034

30363035
if (off >= 0) {
30373036
return utf8_hop_forward_overshoot(s, off, end, remaining);

proto.h

Lines changed: 36 additions & 21 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)