Skip to content

Commit 840c303

Browse files
committed
regen/embed.pl: Refactor ARGS_ASSERT generation
This is in preparation for future enhancements. Instead of placing things on two holding arrays and later going through them later, place them in the final array as we go along. This simplifies things. The order of some assertions in the generated proto.h are changed, and, importantly, there are new assertions added, showing that the previous scheme missed things. That means that some ARGS_ASSERT macros needed to be inserted in the functions where assertions were found. This led to finding that the assertions didn't work in a few of them, so that NOCHECK needed to be added to the embed.fnc entries.
1 parent 4f308dc commit 840c303

File tree

9 files changed

+152
-114
lines changed

9 files changed

+152
-114
lines changed

dump.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2933,12 +2933,14 @@ Perl_sv_dump_depth(pTHX_ SV *sv, I32 depth)
29332933
void
29342934
Perl_av_dump(pTHX_ AV *av)
29352935
{
2936+
PERL_ARGS_ASSERT_AV_DUMP;
29362937
sv_dump_depth((SV*)av, 3);
29372938
}
29382939

29392940
void
29402941
Perl_hv_dump(pTHX_ HV *hv)
29412942
{
2943+
PERL_ARGS_ASSERT_HV_DUMP;
29422944
sv_dump_depth((SV*)hv, 3);
29432945
}
29442946

embed.fnc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1467,7 +1467,7 @@ ARdpx |SV * |hv_bucket_ratio|NN HV *hv
14671467
Adp |void |hv_clear |NULLOK HV *hv
14681468
Adp |void |hv_clear_placeholders \
14691469
|NN HV *hv
1470-
Cp |void * |hv_common |NULLOK HV *hv \
1470+
Cp |void * |hv_common |NULLOK NOCHECK HV *hv \
14711471
|NULLOK SV *keysv \
14721472
|NULLOK const char *key \
14731473
|STRLEN klen \
@@ -3386,7 +3386,7 @@ Adp |void |sv_reset |NN const char *s \
33863386
|NULLOK HV * const stash
33873387
p |void |sv_resetpvn |NULLOK const char *s \
33883388
|STRLEN len \
3389-
|NULLOK HV * const stash
3389+
|NULLOK NOCHECK HV * const stash
33903390
Adp |SV * |sv_rvunweaken |NN SV * const sv
33913391
Adp |SV * |sv_rvweaken |NN SV * const sv
33923392
Adp |void |sv_set_bool |NN SV *sv \
@@ -6075,7 +6075,7 @@ S |I32 |utf16_textfilter \
60756075
# endif
60766076
#endif /* defined(PERL_IN_TOKE_C) */
60776077
#if defined(PERL_IN_UNIVERSAL_C)
6078-
GS |bool |isa_lookup |NULLOK HV *stash \
6078+
GS |bool |isa_lookup |NN HV *stash \
60796079
|NULLOK SV *namesv \
60806080
|NULLOK const char *name \
60816081
|STRLEN len \

gv.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3340,6 +3340,8 @@ Implements C<StashHANDLER>, which you should use instead
33403340
CV*
33413341
Perl_gv_handler(pTHX_ HV *stash, I32 id)
33423342
{
3343+
PERL_ARGS_ASSERT_GV_HANDLER;
3344+
33433345
MAGIC *mg;
33443346
AMT *amtp;
33453347
U32 newgen;

hv.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1836,6 +1836,8 @@ returned.
18361836
HV *
18371837
Perl_newHVhv(pTHX_ HV *ohv)
18381838
{
1839+
PERL_ARGS_ASSERT_NEWHVHV;
1840+
18391841
HV * const hv = newHV();
18401842
STRLEN hv_max;
18411843

@@ -1944,6 +1946,8 @@ added to it. A pointer to the new hash is returned.
19441946
HV *
19451947
Perl_hv_copy_hints_hv(pTHX_ HV *const ohv)
19461948
{
1949+
PERL_ARGS_ASSERT_HV_COPY_HINTS_HV;
1950+
19471951
HV * const hv = newHV();
19481952

19491953
if (ohv) {
@@ -2009,6 +2013,7 @@ S_hv_free_ent_ret(pTHX_ HE *entry)
20092013
void
20102014
Perl_hv_free_ent(pTHX_ HV *notused, HE *entry)
20112015
{
2016+
PERL_ARGS_ASSERT_HV_FREE_ENT;
20122017
PERL_UNUSED_ARG(notused);
20132018

20142019
if (!entry)
@@ -2022,6 +2027,7 @@ Perl_hv_free_ent(pTHX_ HV *notused, HE *entry)
20222027
void
20232028
Perl_hv_delayfree_ent(pTHX_ HV *notused, HE *entry)
20242029
{
2030+
PERL_ARGS_ASSERT_HV_DELAYFREE_ENT;
20252031
PERL_UNUSED_ARG(notused);
20262032

20272033
if (!entry)
@@ -2049,6 +2055,8 @@ return.
20492055
void
20502056
Perl_hv_clear(pTHX_ HV *hv)
20512057
{
2058+
PERL_ARGS_ASSERT_HV_CLEAR;
2059+
20522060
SSize_t orig_ix;
20532061

20542062
if (!hv)
@@ -2279,6 +2287,8 @@ return.
22792287
void
22802288
Perl_hv_undef_flags(pTHX_ HV *hv, U32 flags)
22812289
{
2290+
PERL_ARGS_ASSERT_HV_UNDEF_FLAGS;
2291+
22822292
bool save;
22832293
SSize_t orig_ix = PL_tmps_ix; /* silence compiler warning about uninitialized vars */
22842294

op.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11784,6 +11784,7 @@ S_process_special_blocks(pTHX_ I32 floor, const char *const fullname,
1178411784
CV *
1178511785
Perl_newCONSTSUB(pTHX_ HV *stash, const char *name, SV *sv)
1178611786
{
11787+
PERL_ARGS_ASSERT_NEWCONSTSUB;
1178711788
return newCONSTSUB_flags(stash, name, name ? strlen(name) : 0, 0, sv);
1178811789
}
1178911790

@@ -11868,6 +11869,8 @@ CV *
1186811869
Perl_newCONSTSUB_flags(pTHX_ HV *stash, const char *name, STRLEN len,
1186911870
U32 flags, SV *sv)
1187011871
{
11872+
PERL_ARGS_ASSERT_NEWCONSTSUB_FLAGS;
11873+
1187111874
CV* cv;
1187211875
const char *const file = CopFILE(PL_curcop);
1187311876

pad.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -507,6 +507,8 @@ finished its job, so it can forget the slab.
507507
void
508508
Perl_cv_forget_slab(pTHX_ CV *cv)
509509
{
510+
PERL_ARGS_ASSERT_CV_FORGET_SLAB;
511+
510512
bool slabbed;
511513
OPSLAB *slab = NULL;
512514

0 commit comments

Comments
 (0)