Skip to content

Commit

Permalink
ParseXS: change error msgs argument => parameter
Browse files Browse the repository at this point in the history
Several error messages complain about things like "duplicate argument"
when they mean "duplicate parameter".

So update these messages to be more accurate.
  • Loading branch information
iabyn committed Oct 8, 2024
1 parent 12774ce commit 543cb98
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 16 deletions.
8 changes: 4 additions & 4 deletions dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS.pm
Original file line number Diff line number Diff line change
Expand Up @@ -2087,7 +2087,7 @@ sub INPUT_handler {
(\w+ | length\(\w+\)) # name or length(name)
$
/xs
or $self->blurt("Error: invalid argument declaration '$ln'"), next;
or $self->blurt("Error: invalid parameter declaration '$ln'"), next;

# length(s) is only allowed in the XSUB's signature.
if ($var_name =~ /^length\((\w+)\)$/) {
Expand Down Expand Up @@ -2116,7 +2116,7 @@ sub INPUT_handler {
or (!$param->{is_synthetic} and exists $param->{type})
) {
$self->blurt(
"Error: duplicate definition of argument '$var_name' ignored");
"Error: duplicate definition of parameter '$var_name' ignored");
next;
}
$param->{in_input} = 1;
Expand Down Expand Up @@ -2230,7 +2230,7 @@ sub OUTPUT_handler {
#
my ($outarg, $outcode) = /^\s*(\S+)\s*(.*?)\s*$/s;

$self->blurt("Error: duplicate OUTPUT argument '$outarg' ignored"), next
$self->blurt("Error: duplicate OUTPUT parameter '$outarg' ignored"), next
if $self->{xsub_map_varname_to_seen_in_OUTPUT}->{$outarg}++;

if (!$self->{xsub_seen_RETVAL_in_OUTPUT} and $outarg eq 'RETVAL') {
Expand All @@ -2251,7 +2251,7 @@ sub OUTPUT_handler {
: $self->{xsub_sig}{names}{$outarg}{arg_num};

unless (defined $var_num) {
$self->blurt("Error: OUTPUT $outarg not an argument");
$self->blurt("Error: OUTPUT $outarg not an parameter");
next;
}

Expand Down
4 changes: 2 additions & 2 deletions dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS/Node.pm
Original file line number Diff line number Diff line change
Expand Up @@ -557,7 +557,7 @@ sub parse {
# regex doesn't work. This code path should ideally never be
# reached, and indicates a design weakness in $C_arg.
@param_texts = split(/\s*,\s*/, $sig_text);
Warn($pxs, "Warning: cannot parse argument list '$sig_text', fallback to split");
Warn($pxs, "Warning: cannot parse parameter list '$sig_text', fallback to split");
}
}
else {
Expand Down Expand Up @@ -649,7 +649,7 @@ sub parse {

if (exists $self->{names}{$name}) {
$pxs->blurt(
"Error: duplicate definition of argument '$name' ignored");
"Error: duplicate definition of parameter '$name' ignored");
next;
}

Expand Down
20 changes: 10 additions & 10 deletions dist/ExtUtils-ParseXS/t/001-basic.t
Original file line number Diff line number Diff line change
Expand Up @@ -894,7 +894,7 @@ EOF

for my $var (qw(a b c alien)) {
my $count = () =
$stderr =~ /duplicate definition of argument '$var'/g;
$stderr =~ /duplicate definition of parameter '$var'/g;
is($count, 1, "One dup error for \"$var\"");
}
}
Expand Down Expand Up @@ -1190,7 +1190,7 @@ EOF
'int',
'X::Y::f1(THIS, int i)',
],
[ 1, 0, qr/\QError: duplicate definition of argument 'THIS' /,
[ 1, 0, qr/\QError: duplicate definition of parameter 'THIS' /,
"C++: f1 dup THIS" ],
],

Expand All @@ -1200,7 +1200,7 @@ EOF
'int',
'X::Y::f2(int THIS, int i)',
],
[ 1, 0, qr/\QError: duplicate definition of argument 'THIS' /,
[ 1, 0, qr/\QError: duplicate definition of parameter 'THIS' /,
"C++: f2 dup THIS" ],
],

Expand All @@ -1210,7 +1210,7 @@ EOF
'int',
'X::Y::new(int CLASS, int i)',
],
[ 1, 0, qr/\QError: duplicate definition of argument 'CLASS' /,
[ 1, 0, qr/\QError: duplicate definition of parameter 'CLASS' /,
"C++: new dup CLASS" ],
],

Expand Down Expand Up @@ -1251,7 +1251,7 @@ EOF
' int THIS',
' long THIS',
],
[ 1, 0, qr/\QError: duplicate definition of argument 'THIS'/,
[ 1, 0, qr/\QError: duplicate definition of parameter 'THIS'/,
"dup err" ],
],

Expand All @@ -1262,7 +1262,7 @@ EOF
'int',
'X::Y::f6(int THIS)',
],
[ 1, 0, qr/\QError: duplicate definition of argument 'THIS'/,
[ 1, 0, qr/\QError: duplicate definition of parameter 'THIS'/,
"dup err" ],
],

Expand All @@ -1273,7 +1273,7 @@ EOF
'int',
'X::Y::f7(THIS)',
],
[ 1, 0, qr/\QError: duplicate definition of argument 'THIS'/,
[ 1, 0, qr/\QError: duplicate definition of parameter 'THIS'/,
"dup err" ],
],

Expand All @@ -1300,7 +1300,7 @@ EOF
' int CLASS',
' long CLASS',
],
[ 1, 0, qr/\QError: duplicate definition of argument 'CLASS'/,
[ 1, 0, qr/\QError: duplicate definition of parameter 'CLASS'/,
"dup err" ],
],

Expand All @@ -1311,7 +1311,7 @@ EOF
'int',
'X::Y::new(int CLASS)',
],
[ 1, 0, qr/\QError: duplicate definition of argument 'CLASS'/,
[ 1, 0, qr/\QError: duplicate definition of parameter 'CLASS'/,
"dup err" ],
],

Expand All @@ -1322,7 +1322,7 @@ EOF
'int',
'X::Y::new(CLASS)',
],
[ 1, 0, qr/\QError: duplicate definition of argument 'CLASS'/,
[ 1, 0, qr/\QError: duplicate definition of parameter 'CLASS'/,
"dup err" ],
],

Expand Down

0 comments on commit 543cb98

Please sign in to comment.