Skip to content

Explicitly reject length(NAME) with typemaps other than T_PV #23479

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

Open
wants to merge 4 commits into
base: blead
Choose a base branch
from
Open
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 Porting/Maintainers.pl
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,7 @@ package Maintainers;
},

'ExtUtils::ParseXS' => {
'DISTRIBUTION' => 'LEONT/ExtUtils-ParseXS-3.57.tar.gz',
'DISTRIBUTION' => 'LEONT/ExtUtils-ParseXS-3.58.tar.gz',
'FILES' => q[dist/ExtUtils-ParseXS],
},

Expand Down
13 changes: 13 additions & 0 deletions dist/ExtUtils-ParseXS/Changes
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
Revision history for Perl extension ExtUtils::ParseXS.

3.59
- Throw an exception when combining the length operator with a
typemap other than T_PV

3.58 Sun Jul 20 09:10:41 PM CEST 2025
- ExtUtils::ParseXS has been extensively restructured internally.
Most of these changes shouldn't be visible externally, but might
affect XS code which was using invalid or unsupported syntax.

3.57 Fri May 2 05:40:59 PM CEST 2025
- Rewrite half of the internals to facilitate refcounted stack
later on

3.51 - Tue May 9 09:32:04 2023 AEST
- Initialize $self correctly in EU::PXS::Utilities::death()
- C++ builds: avoid generating C<< extern "C" extern "C" >>
Expand Down
2 changes: 1 addition & 1 deletion dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS.pm
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ use Symbol;

our $VERSION;
BEGIN {
$VERSION = '3.58';
$VERSION = '3.59';
require ExtUtils::ParseXS::Constants; ExtUtils::ParseXS::Constants->VERSION($VERSION);
require ExtUtils::ParseXS::CountLines; ExtUtils::ParseXS::CountLines->VERSION($VERSION);
require ExtUtils::ParseXS::Node; ExtUtils::ParseXS::Node->VERSION($VERSION);
Expand Down
2 changes: 1 addition & 1 deletion dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS/Constants.pm
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use strict;
use warnings;
use Symbol;

our $VERSION = '3.58';
our $VERSION = '3.59';

=head1 NAME

Expand Down
2 changes: 1 addition & 1 deletion dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS/CountLines.pm
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package ExtUtils::ParseXS::CountLines;
use strict;

our $VERSION = '3.58';
our $VERSION = '3.59';

our $SECTION_END_MARKER;

Expand Down
2 changes: 1 addition & 1 deletion dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS/Eval.pm
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package ExtUtils::ParseXS::Eval;
use strict;
use warnings;

our $VERSION = '3.58';
our $VERSION = '3.59';

=head1 NAME

Expand Down
6 changes: 4 additions & 2 deletions dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS/Node.pm
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package ExtUtils::ParseXS::Node;
use strict;
use warnings;

our $VERSION = '3.58';
our $VERSION = '3.59';

=head1 NAME

Expand Down Expand Up @@ -1407,7 +1407,9 @@ sub lookup_input_typemap {
# as a pseudo-parameter, then override the normal typedef - which
# would emit SvPV_nolen(...) - and instead, emit SvPV(...,
# STRLEN_length_of_foo)
if ($xstype eq 'T_PV' and $self->{has_length}) {
if ($self->{has_length}) {
die "length(NAME) not supported with typemaps other than T_PV"
if $xstype ne 'T_PV';
die "default value not supported with length(NAME) supplied"
if defined $default;
return "($type)SvPV($arg, STRLEN_length_of_$var);",
Expand Down
2 changes: 1 addition & 1 deletion dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS/Utilities.pm
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use Exporter;
use File::Spec;
use ExtUtils::ParseXS::Constants ();

our $VERSION = '3.58';
our $VERSION = '3.59';

our (@ISA, @EXPORT_OK);
@ISA = qw(Exporter);
Expand Down
2 changes: 1 addition & 1 deletion dist/ExtUtils-ParseXS/lib/ExtUtils/Typemaps.pm
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package ExtUtils::Typemaps;
use 5.006001;
use strict;
use warnings;
our $VERSION = '3.58';
our $VERSION = '3.59';

require ExtUtils::ParseXS;
require ExtUtils::ParseXS::Constants;
Expand Down
2 changes: 1 addition & 1 deletion dist/ExtUtils-ParseXS/lib/ExtUtils/Typemaps/Cmd.pm
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package ExtUtils::Typemaps::Cmd;
use 5.006001;
use strict;
use warnings;
our $VERSION = '3.58';
our $VERSION = '3.59';

use ExtUtils::Typemaps;

Expand Down
2 changes: 1 addition & 1 deletion dist/ExtUtils-ParseXS/lib/ExtUtils/Typemaps/InputMap.pm
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package ExtUtils::Typemaps::InputMap;
use 5.006001;
use strict;
use warnings;
our $VERSION = '3.58';
our $VERSION = '3.59';

=head1 NAME

Expand Down
2 changes: 1 addition & 1 deletion dist/ExtUtils-ParseXS/lib/ExtUtils/Typemaps/OutputMap.pm
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package ExtUtils::Typemaps::OutputMap;
use 5.006001;
use strict;
use warnings;
our $VERSION = '3.58';
our $VERSION = '3.59';

=head1 NAME
Expand Down
2 changes: 1 addition & 1 deletion dist/ExtUtils-ParseXS/lib/ExtUtils/Typemaps/Type.pm
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use strict;
use warnings;
require ExtUtils::Typemaps;

our $VERSION = '3.58';
our $VERSION = '3.59';

=head1 NAME

Expand Down
2 changes: 1 addition & 1 deletion dist/ExtUtils-ParseXS/lib/perlxs.pod
Original file line number Diff line number Diff line change
Expand Up @@ -2231,7 +2231,7 @@ this model, the less likely conflicts will occur.
=head1 XS VERSION

This document covers features supported by C<ExtUtils::ParseXS>
(also known as C<xsubpp>) 3.58.
(also known as C<xsubpp>) 3.59.

=head1 AUTHOR DIAGNOSTICS

Expand Down
9 changes: 8 additions & 1 deletion dist/ExtUtils-ParseXS/t/001-basic.t
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The first part of 001-basic.t uses a crude form of test framework. Newer tests in the file (basically the ones added by me in the last year) use a better framework. It would be better to use this new framework. Look for the "length() no matching var" test; it would be easy and better to add a new test directly after that test.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah that is helpful. Updated the PR

Original file line number Diff line number Diff line change
Expand Up @@ -967,7 +967,7 @@ EOF
|
|int
|foo( a , char * b , OUT int c , OUTLIST int d , \
| IN_OUT char * * e = 1 + 2 , long length(e) , \
| IN_OUT char * * e = 1 + 2 , long length(b) , \
| char* f="abc" , g = 0 , ... )
EOF

Expand Down Expand Up @@ -1607,6 +1607,13 @@ EOF
[ 1, 0, qr{\QError: length() on non-parameter 's'\E.*line 6},
"got expected error" ],
],

[
'length of int is invalid',
['int', 'foo(int a, size_t length(a)'],
[ 1, 1 , qr/length\(NAME\) not supported with typemaps other than T_PV/, 'Got expected error about length' ],
],

);

test_many($preamble, 'XS_Foo_', \@test_fns);
Expand Down
Loading