Skip to content

Commit 09a9ab7

Browse files
committed
smoke
1 parent 0bf91cc commit 09a9ab7

File tree

2 files changed

+64
-37
lines changed

2 files changed

+64
-37
lines changed

perl.h

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2283,6 +2283,35 @@ typedef UVTYPE UV;
22832283
#define PERL_PRESERVE_IVUV /* We like our integers to stay integers. */
22842284
#endif
22852285

2286+
#if U32SIZE == UVSIZE
2287+
# define U32uf UVuf
2288+
# define U32of UVof
2289+
# define U32xf UVxf
2290+
# define U32Xf UVXf
2291+
#elif U32SIZE == INTSIZE
2292+
# define U32uf "u"
2293+
# define U32of "o"
2294+
# define U32xf "x"
2295+
# define U32Xf "X"
2296+
#elif U32SIZE == LONGSIZE
2297+
# define U32uf "lu"
2298+
# define U32of "lo"
2299+
# define U32xf "lx"
2300+
# define U32Xf "lX"
2301+
#else
2302+
# error Cant figure out formatting strings for U32SIZE
2303+
#endif
2304+
2305+
#if I32SIZE == IVSIZE
2306+
# define I32df IVdf
2307+
#elif I32SIZE == INTSIZE
2308+
# define I32df "d"
2309+
#elif I32SIZE == LONGSIZE
2310+
# define I32df "ld"
2311+
#else
2312+
# error Cant figure out formatting string for I32SIZE
2313+
#endif
2314+
22862315
/*
22872316
* The macros INT2PTR and NUM2PTR are (despite their names)
22882317
* bi-directional: they will convert int/float to or from pointers.

regcomp.c

Lines changed: 35 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/* regcomp.c
2+
* also ceate formats for int, long, [IU]32
23
*/
34

45
/*
@@ -936,10 +937,10 @@ static const scan_data_t zero_scan_data = {
936937
? eI - sI /* Length before the <--HERE */ \
937938
: ((xI_offset(xC) >= 0) \
938939
? xI_offset(xC) \
939-
: (Perl_croak(aTHX_ "panic: %s: %d: negative offset: %" \
940-
IVdf " trying to output message for " \
940+
: (Perl_croak(aTHX_ "panic: %s: %d: negative offset:" \
941+
" %td trying to output message for " \
941942
" pattern %.*s", \
942-
__FILE__, __LINE__, (IV) xI_offset(xC), \
943+
__FILE__, __LINE__, xI_offset(xC), \
943944
((int) (eC - sC)), sC), 0)), \
944945
sI), /* The input pattern printed up to the <--HERE */ \
945946
UTF8fARG(UTF, \
@@ -1352,13 +1353,13 @@ S_debug_studydata(pTHX_ const char *where, scan_data_t *data,
13521353
DEBUG_OPTIMISE_MORE_r({
13531354
if (!data)
13541355
return;
1355-
Perl_re_indentf(aTHX_ "%s: M/S/D: %" IVdf "/%" IVdf "/%" IVdf " Pos:%" IVdf "/%" IVdf " Flags: 0x%" UVXf,
1356+
Perl_re_indentf(aTHX_ "%s: M/S/D: %zd/%zd/%zd Pos:%zd/%zd Flags: 0x%" U32uf,
13561357
depth,
13571358
where,
13581359
min, stopmin, delta,
1359-
(IV)data->pos_min,
1360-
(IV)data->pos_delta,
1361-
(UV)data->flags
1360+
data->pos_min,
1361+
data->pos_delta,
1362+
data->flags
13621363
);
13631364

13641365
S_debug_show_study_flags(aTHX_ data->flags," [","]");
@@ -2417,15 +2418,15 @@ S_dump_trie(pTHX_ const struct _reg_trie_data *trie, HV *widecharmap,
24172418
for( state = 1 ; state < trie->statecount ; state++ ) {
24182419
const U32 base = trie->states[ state ].trans.base;
24192420

2420-
Perl_re_indentf( aTHX_ "#%4" UVXf "|", depth+1, (UV)state);
2421+
Perl_re_indentf( aTHX_ "#%4" U32Xf "|", depth+1, state);
24212422

24222423
if ( trie->states[ state ].wordnum ) {
24232424
Perl_re_printf( aTHX_ " W%4X", trie->states[ state ].wordnum );
24242425
} else {
24252426
Perl_re_printf( aTHX_ "%6s", "" );
24262427
}
24272428

2428-
Perl_re_printf( aTHX_ " @%4" UVXf " ", (UV)base );
2429+
Perl_re_printf( aTHX_ " @%4" U32Xf " ", base );
24292430

24302431
if ( base ) {
24312432
U32 ofs = 0;
@@ -2436,7 +2437,7 @@ S_dump_trie(pTHX_ const struct _reg_trie_data *trie, HV *widecharmap,
24362437
!= state))
24372438
ofs++;
24382439

2439-
Perl_re_printf( aTHX_ "+%2" UVXf "[ ", (UV)ofs);
2440+
Perl_re_printf( aTHX_ "+%2" U32Xf "[ ", ofs);
24402441

24412442
for ( ofs = 0 ; ofs < trie->uniquecharcount ; ofs++ ) {
24422443
if ( ( base + ofs >= trie->uniquecharcount )
@@ -5013,7 +5014,7 @@ S_study_chunk(pTHX_
50135014
Perl_re_indentf( aTHX_ "%s %" UVuf ":%s\n",
50145015
depth+1,
50155016
"Looking for TRIE'able sequences. Tail node is ",
5016-
(UV) REGNODE_OFFSET(tail),
5017+
REGNODE_OFFSET(tail),
50175018
SvPV_nolen_const( RExC_mysv )
50185019
);
50195020
});
@@ -8409,13 +8410,11 @@ Perl_re_op_compile(pTHX_ SV ** const patternp, int pat_count,
84098410
/* search for "restudy" in this file for a detailed explanation */
84108411
DEBUG_PARSE_r(
84118412
if (!restudied)
8412-
Perl_re_printf( aTHX_ "first at %" IVdf "\n",
8413-
(IV)(first - scan + 1))
8413+
Perl_re_printf( aTHX_ "first at %td\n", first - scan + 1)
84148414
);
84158415
#else
84168416
DEBUG_PARSE_r(
8417-
Perl_re_printf( aTHX_ "first at %" IVdf "\n",
8418-
(IV)(first - scan + 1))
8417+
Perl_re_printf( aTHX_ "first at %td\n", first - scan + 1)
84198418
);
84208419
#endif
84218420

@@ -10790,12 +10789,12 @@ Perl__invlist_dump(pTHX_ PerlIO *file, I32 level,
1079010789
}
1079110790
else if (end != start) {
1079210791
Perl_dump_indent(aTHX_ level, file,
10793-
"%s[%" UVuf "] 0x%04" UVXf " .. 0x%04" UVXf "\n",
10794-
indent, (UV)count, start, end);
10792+
"%s[%zu] 0x%04" UVXf " .. 0x%04" UVXf "\n",
10793+
indent, count, start, end);
1079510794
}
1079610795
else {
10797-
Perl_dump_indent(aTHX_ level, file, "%s[%" UVuf "] 0x%04" UVXf "\n",
10798-
indent, (UV)count, start);
10796+
Perl_dump_indent(aTHX_ level, file, "%s[%zu] 0x%04" UVXf "\n",
10797+
indent, count, start);
1079910798
}
1080010799
count += 2;
1080110800
}
@@ -12746,12 +12745,12 @@ S_reg(pTHX_ RExC_state_t *pRExC_state, I32 paren, I32 *flagp, U32 depth)
1274612745
DEBUG_PARSE_MSG("lsbr");
1274712746
regprop(RExC_rx, RExC_mysv1, REGNODE_p(lastbr), NULL, pRExC_state);
1274812747
regprop(RExC_rx, RExC_mysv2, REGNODE_p(ender), NULL, pRExC_state);
12749-
Perl_re_printf( aTHX_ "~ tying lastbr %s (%" IVdf ") to ender %s (%" IVdf ") offset %" IVdf "\n",
12748+
Perl_re_printf( aTHX_ "~ tying lastbr %s (%" IVdf ") to ender %s (%" IVdf ") offset %td\n",
1275012749
SvPV_nolen_const(RExC_mysv1),
1275112750
(IV)lastbr,
1275212751
SvPV_nolen_const(RExC_mysv2),
1275312752
(IV)ender,
12754-
(IV)(ender - lastbr)
12753+
(ender - lastbr)
1275512754
);
1275612755
});
1275712756
if (! REGTAIL(pRExC_state, lastbr, ender)) {
@@ -12800,12 +12799,12 @@ S_reg(pTHX_ RExC_state_t *pRExC_state, I32 paren, I32 *flagp, U32 depth)
1280012799
NULL, pRExC_state);
1280112800
regprop(RExC_rx, RExC_mysv2, REGNODE_p(ender),
1280212801
NULL, pRExC_state);
12803-
Perl_re_printf( aTHX_ "~ converting ret %s (%" IVdf ") to ender %s (%" IVdf ") offset %" IVdf "\n",
12802+
Perl_re_printf( aTHX_ "~ converting ret %s (%" IVdf ") to ender %s (%" IVdf ") offset %td\n",
1280412803
SvPV_nolen_const(RExC_mysv1),
1280512804
(IV)REG_NODE_NUM(ret_as_regnode),
1280612805
SvPV_nolen_const(RExC_mysv2),
1280712806
(IV)ender,
12808-
(IV)(ender - ret)
12807+
(ender - ret)
1280912808
);
1281012809
});
1281112810
OP(br)= NOTHING;
@@ -15741,8 +15740,8 @@ S_regatom(pTHX_ RExC_state_t *pRExC_state, I32 *flagp, U32 depth)
1574115740
if (need_to_fold_loc) {
1574215741
upper_fill = loc_correspondence[s - s_start];
1574315742
if (upper_fill == 0) {
15744-
FAIL2("panic: loc_correspondence[%d] is 0",
15745-
(int) (s - s_start));
15743+
FAIL2("panic: loc_correspondence[%td] is 0",
15744+
(s - s_start));
1574615745
}
1574715746
Safefree(locfold_buf);
1574815747
Safefree(loc_correspondence);
@@ -21310,7 +21309,7 @@ S_regtail_study(pTHX_ RExC_state_t *pRExC_state, regnode_offset p,
2131021309
DEBUG_PARSE_MSG("");
2131121310
regprop(RExC_rx, RExC_mysv, REGNODE_p(val), NULL, pRExC_state);
2131221311
Perl_re_printf( aTHX_
21313-
"~ attach to %s (%" IVdf ") offset to %" IVdf "\n",
21312+
"~ attach to %s (%zd) offset to %td\n",
2131421313
SvPV_nolen_const(RExC_mysv),
2131521314
(IV)val,
2131621315
(IV)(val - scan)
@@ -21673,7 +21672,7 @@ Perl_regprop(pTHX_ const regexp *prog, SV *sv, const regnode *o, const regmatch_
2167321672
U32 lo = ARG1(o), hi = ARG2(o);
2167421673
if (OP(o) == CURLYM || OP(o) == CURLYN || OP(o) == CURLYX)
2167521674
Perl_sv_catpvf(aTHX_ sv, "[%d]", o->flags); /* Parenth number */
21676-
Perl_sv_catpvf(aTHX_ sv, "{%u,", (unsigned) lo);
21675+
Perl_sv_catpvf(aTHX_ sv, "{%" U32uf ",", lo);
2167721676
if (hi == REG_INFTY)
2167821677
sv_catpvs(sv, "INFTY");
2167921678
else
@@ -21687,7 +21686,7 @@ Perl_regprop(pTHX_ const regexp *prog, SV *sv, const regnode *o, const regmatch_
2168721686
{
2168821687
AV *name_list= NULL;
2168921688
U32 parno= OP(o) == ACCEPT ? (U32)ARG2L(o) : ARG(o);
21690-
Perl_sv_catpvf(aTHX_ sv, "%" UVuf, (UV)parno); /* Parenth number */
21689+
Perl_sv_catpvf(aTHX_ sv, "%" U32uf, parno); /* Parenth number */
2169121690
if ( RXp_PAREN_NAMES(prog) ) {
2169221691
name_list= MUTABLE_AV(progi->data->data[progi->name_list_idx]);
2169321692
} else if ( pRExC_state ) {
@@ -22635,7 +22634,7 @@ Perl_regnext(pTHX_ regnode *p)
2263522634

2263622635
if (OP(p) > REGNODE_MAX) { /* regnode.type is unsigned */
2263722636
Perl_croak(aTHX_ "Corrupted regexp opcode %d > %d",
22638-
(int)OP(p), (int)REGNODE_MAX);
22637+
(int)OP(p), REGNODE_MAX);
2263922638
}
2264022639

2264122640
offset = (reg_off_by_arg[OP(p)] ? ARG(p) : NEXT_OFF(p));
@@ -22702,7 +22701,7 @@ Perl_save_re_context(pTHX)
2270222701
for (i = 1; i <= nparens; i++) {
2270322702
char digits[TYPE_CHARS(long)];
2270422703
const STRLEN len = my_snprintf(digits, sizeof(digits),
22705-
"%lu", (long)i);
22704+
"%" I32df, i);
2270622705
GV *const *const gvp
2270722706
= (GV**)hv_fetch(PL_defstash, digits, len, 0);
2270822707

@@ -23320,7 +23319,7 @@ S_put_charclass_bitmap_innards(pTHX_ SV *sv,
2332023319
#define CLEAR_OPTSTART \
2332123320
if (optstart) STMT_START { \
2332223321
DEBUG_OPTIMISE_r(Perl_re_printf( aTHX_ \
23323-
" (%" IVdf " nodes)\n", (IV)(node - optstart))); \
23322+
" (%td nodes)\n", (node - optstart))); \
2332423323
optstart=NULL; \
2332523324
} STMT_END
2332623325

@@ -23343,7 +23342,7 @@ S_dumpuntil(pTHX_ const regexp *r, const regnode *start, const regnode *node,
2334323342
PERL_ARGS_ASSERT_DUMPUNTIL;
2334423343

2334523344
#ifdef DEBUG_DUMPUNTIL
23346-
Perl_re_printf( aTHX_ "--- %d : %d - %d - %d\n", indent, node-start,
23345+
Perl_re_printf( aTHX_ "--- %" U32df " : %td - %td - %td\n", indent, node-start,
2334723346
last ? last-start : 0, plast ? plast-start : 0);
2334823347
#endif
2334923348

@@ -23369,7 +23368,7 @@ S_dumpuntil(pTHX_ const regexp *r, const regnode *start, const regnode *node,
2336923368
CLEAR_OPTSTART;
2337023369

2337123370
regprop(r, sv, node, NULL, NULL);
23372-
Perl_re_printf( aTHX_ "%4" IVdf ":%*s%s", (IV)(node - start),
23371+
Perl_re_printf( aTHX_ "%4td:%*s%s", (node - start),
2337323372
(int)(2*indent + 1), "", SvPVX_const(sv));
2337423373

2337523374
if (OP(node) != OPTIMIZED) {
@@ -23379,7 +23378,7 @@ S_dumpuntil(pTHX_ const regexp *r, const regnode *start, const regnode *node,
2337923378
&& PL_regkind[OP(next)] != BRANCH )
2338023379
Perl_re_printf( aTHX_ " (FAIL)");
2338123380
else
23382-
Perl_re_printf( aTHX_ " (%" IVdf ")", (IV)(next - start));
23381+
Perl_re_printf( aTHX_ " (%td)", (next - start));
2338323382
Perl_re_printf( aTHX_ "\n");
2338423383
}
2338523384

@@ -25874,7 +25873,7 @@ S_handle_names_wildcard(pTHX_ const char * wname, /* wildcard name to match */
2587425873
* were returned to us in the array 'algorithmic_names' from data in
2587525874
* lib/unicore/Name.pm. 'code_point' in the name is expressed in hex. */
2587625875
for (i = 0; i <= av_top_index((AV *) algorithmic_names); i++) {
25877-
IV j;
25876+
SSize_t j;
2587825877

2587925878
/* Each element of the array is a hash, giving the details for the
2588025879
* series of names it covers. There is the base name of the characters
@@ -25905,8 +25904,7 @@ S_handle_names_wildcard(pTHX_ const char * wname, /* wildcard name to match */
2590525904
for (j = low; j <= high; j++) { /* For each code point in the series */
2590625905

2590725906
/* Get its name, and see if it matches the subpattern */
25908-
Perl_sv_setpvf(aTHX_ algo_name, "%s-%X", SvPVX(prefix),
25909-
(unsigned) j);
25907+
Perl_sv_setpvf(aTHX_ algo_name, "%s-%zX", SvPVX(prefix), j);
2591025908

2591125909
if (execute_wildcard(subpattern_re,
2591225910
SvPVX(algo_name),

0 commit comments

Comments
 (0)