Skip to content

ParseXS: fix handling of empty C_ARGS etc #23408

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

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS/Node.pm
Original file line number Diff line number Diff line change
Expand Up @@ -3648,7 +3648,7 @@ sub parse {
$self->SUPER::parse($pxs); # set file/line_no, read lines

my @lines = @{$self->{lines}};
shift @lines while $lines[0] !~ /\S/;
shift @lines while @lines && $lines[0] !~ /\S/;
# XXX ParseXS originally didn't include a trailing \n,
# so we carry on doing the same.
$self->{text} = join "\n", @lines;
Expand Down
10 changes: 10 additions & 0 deletions dist/ExtUtils-ParseXS/t/001-basic.t
Original file line number Diff line number Diff line change
Expand Up @@ -1656,6 +1656,16 @@ EOF
[ 0, 0, qr/\Qfoo(a, b , bar, c? c : "boo!")/, "" ],
],

[
"autocall args empty C_ARGS",
[ Q(<<'EOF') ],
|void
|foo(int a)
| C_ARGS:
EOF
[ 0, 0, qr/\Qfoo()/, "" ],
],

[
# Whether this is sensible or not is another matter.
# For now, just check that it works as-is.
Expand Down
Loading