Skip to content

Commit 51d43fe

Browse files
committed
regen/embed.pl: Certain flags are mutually exclusive
It makes no sense to specify more than one of A C X, nor more than one of A C E. This commit enforces that, showing one entry in embed.fnc that needed to be changed.
1 parent b22b7f9 commit 51d43fe

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

embed.fnc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2069,7 +2069,7 @@ Cp |const char *|moreswitches \
20692069
Adp |void |mortal_destructor_sv \
20702070
|NN SV *coderef \
20712071
|NULLOK SV *args
2072-
CRTXip |char * |mortal_getenv |NN const char *str
2072+
CRTip |char * |mortal_getenv |NN const char *str
20732073
Cdp |void |mortal_svfunc_x|SVFUNC_t f \
20742074
|NULLOK SV *p
20752075
Adop |const struct mro_alg *|mro_get_from_name \

regen/embed.pl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,14 @@ sub generate_proto_h {
142142
warn "It is nonsensical to require the return value of a void function ($plain_func) to be checked";
143143
}
144144

145+
my $count = 0;
146+
$count++ while $flags =~ /[ACX]/g;
147+
die_at_end "$plain_func: A, C, and X flags are mutually exclusive"
148+
if $count > 1;
149+
$count = 0;
150+
$count++ while $flags =~ /[ACE]/g;
151+
die_at_end "$plain_func: A, C, and E flags are mutually exclusive"
152+
if $count > 1;
145153
die_at_end "$plain_func: S and p flags are mutually exclusive"
146154
if $flags =~ /S/ && $flags =~ /p/;
147155
if ($has_mflag) {

0 commit comments

Comments
 (0)