-
Notifications
You must be signed in to change notification settings - Fork 587
Allow automatic long name macro generation #23434
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: blead
Are you sure you want to change the base?
Changes from all commits
4d463e3
ef6d695
9344ebb
4189498
f408e64
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -51,10 +51,10 @@ ($$) | |
|
||
if ($flags =~ /[ps]/) { | ||
|
||
# An all uppercase macro name gets an uppercase prefix. | ||
return ($flags =~ /m/ && $flags =~ /p/ && $func !~ /[[:lower:]]/) | ||
? "PERL_$func" | ||
: "Perl_$func"; | ||
# An all uppercase macro name gets an uppercase prefix. | ||
return ($flags =~ /m/ && $flags =~ /p/ && $func !~ /[[:lower:]]/) | ||
? "PERL_$func" | ||
: "Perl_$func"; | ||
} | ||
|
||
return "S_$func" if $flags =~ /[SIi]/; | ||
|
@@ -144,14 +144,14 @@ sub generate_proto_h { | |
|
||
die_at_end "$plain_func: S and p flags are mutually exclusive" | ||
if $flags =~ /S/ && $flags =~ /p/; | ||
if ($has_mflag) { | ||
if ($flags =~ /S/) { | ||
die_at_end "$plain_func: m and S flags are mutually exclusive"; | ||
} | ||
} | ||
else { | ||
die_at_end "$plain_func: u flag only usable with m" if $flags =~ /u/; | ||
} | ||
if ($has_mflag) { | ||
if ($flags =~ /S/) { | ||
die_at_end "$plain_func: m and S flags are mutually exclusive"; | ||
} | ||
} | ||
else { | ||
die_at_end "$plain_func: u flag only usable with m" if $flags =~ /u/; | ||
} | ||
|
||
my ($static_flag, @extra_static_flags)= $flags =~/([SsIi])/g; | ||
|
||
|
@@ -244,7 +244,7 @@ sub generate_proto_h { | |
|
||
$arg = "const char * const $name"; | ||
die_at_end 'm flag required for "literal" argument' | ||
unless $has_mflag; | ||
unless $has_mflag; | ||
} | ||
elsif ( $args_assert_line | ||
&& $arg =~ /\*/ | ||
|
@@ -510,7 +510,46 @@ sub embed_h { | |
my $ind= $level ? " " : ""; | ||
$ind .= " " x ($level-1) if $level>1; | ||
my $inner_ind= $ind ? " " : " "; | ||
if ($flags !~ /[omM]/ or ($flags =~ /m/ && $flags =~ /p/)) { | ||
|
||
if ($flags =~ /m/ && $flags =~ /p/) { | ||
my $full_name = full_name($func, $flags); | ||
next if $full_name eq $func; # Don't output a no-op. | ||
|
||
# Yields | ||
# #define Perl_func func | ||
# which works when there is no thread context. | ||
$ret = indent_define($full_name, $func, $ind); | ||
|
||
if ($flags !~ /[T]/) { | ||
|
||
# But when there is the possibility of a thread context | ||
# parameter, $ret works only on non-threaded builds | ||
my $no_thread_full_define = $ret; | ||
|
||
# And we have to do more when there are threads. First, | ||
# convert the input argument list to 'a', 'b' .... This keeps | ||
# us from having to worry about all the extra stuff in the | ||
# input list; stuff like the type declarations, things like | ||
# NULLOK, and pointers '*'. | ||
my $argname = 'a'; | ||
my @stripped_args; | ||
push @stripped_args, $argname++ for $args->@*; | ||
my $arglist = join ",", @stripped_args; | ||
|
||
# In the threaded case, the Perl_ form is expecting an aTHX | ||
# first argument. Use mTHX to match that, which isn't passed | ||
# on to the short form name, as that is expecting an implicit | ||
# aTHX. The non-threaded case just uses what we generated | ||
# above for the /T/ flag case. | ||
$ret = "#${ind}ifdef USE_THREADS\n" | ||
. "#${ind} define $full_name(mTHX,$arglist)" | ||
. " $func($arglist)\n" | ||
. "#${ind}else\n" | ||
. "$ind $no_thread_full_define" # No \n because no chomp | ||
. "#${ind}endif\n"; | ||
} | ||
} | ||
elsif ($flags !~ /[omM]/) { | ||
my $argc = scalar @$args; | ||
if ($flags =~ /[T]/) { | ||
my $full_name = full_name($func, $flags); | ||
|
@@ -535,7 +574,7 @@ sub embed_h { | |
$use_va_list ? ("__VA_ARGS__") : ()); | ||
$ret = "#${ind}define $func($paramlist) "; | ||
add_indent($ret,full_name($func, $flags) . "(aTHX"); | ||
if ($replacelist) { | ||
if ($replacelist) { | ||
$ret .= ($flags =~ /m/) ? "," : "_ "; | ||
$ret .= $replacelist; | ||
} | ||
|
@@ -720,4 +759,4 @@ sub update_headers { | |
|
||
update_headers() unless caller; | ||
|
||
# ex: set ts=8 sts=4 sw=4 noet: | ||
# ex: set ts=8 sts=4 sw=4 et: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Umm ... ??? Why was this sent thru astyle or clangformat? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't understand this comment. It was not sent through those things. The commit message for the commit that changes it explains why it was done |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this a white space only chunk? or a code change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The first commit in this p.r. separates out all the white space changes from code changes.