diff options
author | Mattia Barbon <mattia@barbon.org> | 2016-01-03 21:54:31 +0100 |
---|---|---|
committer | Steffen Mueller <smueller@cpan.org> | 2016-01-03 22:06:28 +0100 |
commit | 449a79a3e9e452cf9cb57f06b5843a4053de674d (patch) | |
tree | e832a3b767e9a8627baaaeb9850f2942227b2ad3 | |
parent | f909f9f77e09a983fd06d560db3355cbb5c00608 (diff) | |
download | perl-449a79a3e9e452cf9cb57f06b5843a4053de674d.tar.gz |
Replace :: with __ in THIS like it's done for parameters/return values
Apart from being more consistent, this simplifies writing XS code
wrapping C++ classes into a nested Perl namespace (it reqquires only
a typedef for Foo__Bar rather than two, one for Foo_Bar and the other
for Foo::Bar).
Impact is likely to be minimmal: it will only affect classes:
- in C++ extensions (there is no way to make Foo::Bar *THIS compile in C)
- that use Foo::Bar only as a receiver (if they use it as a
parameter/return value the typedef is already there)
Given that a class is always used as the return valus in a normal
constructor, this case should be relatively rare.
given this Foo.xs file:
MODULE=Foo PACKAGE=Foo::Bar
TYPEMAP: <<EOT
TYPEMAP
Foo::Bar * T_PTRREF
EOT
Foo::Bar *
Foo::Bar::moo(Foo::Bar *foo)
the output of
perl -Ilib lib/ExtUtils/xsubpp -prototypes Foo.xs
| grep -A8 moo | head -n 10
changes from:
XS_EUPXS(XS_Foo__Bar_moo); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Foo__Bar_moo)
{
dVAR; dXSARGS;
if (items != 2)
croak_xs_usage(cv, "THIS, foo");
{
Foo::Bar * THIS;
Foo__Bar * RETVAL;
Foo__Bar * foo;
to:
XS_EUPXS(XS_Foo__Bar_moo); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Foo__Bar_moo)
{
dVAR; dXSARGS;
if (items != 2)
croak_xs_usage(cv, "THIS, foo");
{
Foo__Bar * THIS;
Foo__Bar * RETVAL;
Foo__Bar * foo;
10 files changed, 11 insertions, 11 deletions
diff --git a/dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS.pm b/dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS.pm index f67a82dc46..32d74e18e8 100644 --- a/dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS.pm +++ b/dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS.pm @@ -11,7 +11,7 @@ use Symbol; our $VERSION; BEGIN { - $VERSION = '3.30'; + $VERSION = '3.31'; } use ExtUtils::ParseXS::Constants $VERSION; use ExtUtils::ParseXS::CountLines $VERSION; @@ -579,7 +579,7 @@ EOF } ); } else { - print "\t$class *"; + print "\t" . map_type($self, "$class *"); $self->{var_types}->{"THIS"} = "$class *"; $self->generate_init( { type => "$class *", diff --git a/dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS/Constants.pm b/dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS/Constants.pm index 8856551eb4..2319a24c2c 100644 --- a/dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS/Constants.pm +++ b/dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS/Constants.pm @@ -3,7 +3,7 @@ use strict; use warnings; use Symbol; -our $VERSION = '3.30'; +our $VERSION = '3.31'; =head1 NAME diff --git a/dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS/CountLines.pm b/dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS/CountLines.pm index 2f45292ab9..222a95c245 100644 --- a/dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS/CountLines.pm +++ b/dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS/CountLines.pm @@ -1,7 +1,7 @@ package ExtUtils::ParseXS::CountLines; use strict; -our $VERSION = '3.30'; +our $VERSION = '3.31'; our $SECTION_END_MARKER; diff --git a/dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS/Eval.pm b/dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS/Eval.pm index 8c075a3f91..73153326e9 100644 --- a/dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS/Eval.pm +++ b/dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS/Eval.pm @@ -2,7 +2,7 @@ package ExtUtils::ParseXS::Eval; use strict; use warnings; -our $VERSION = '3.30'; +our $VERSION = '3.31'; =head1 NAME diff --git a/dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS/Utilities.pm b/dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS/Utilities.pm index 4de9f4e713..41a9f6de57 100644 --- a/dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS/Utilities.pm +++ b/dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS/Utilities.pm @@ -5,7 +5,7 @@ use Exporter; use File::Spec; use ExtUtils::ParseXS::Constants (); -our $VERSION = '3.30'; +our $VERSION = '3.31'; our (@ISA, @EXPORT_OK); @ISA = qw(Exporter); diff --git a/dist/ExtUtils-ParseXS/lib/ExtUtils/Typemaps.pm b/dist/ExtUtils-ParseXS/lib/ExtUtils/Typemaps.pm index a16ae06744..48d623ef71 100644 --- a/dist/ExtUtils-ParseXS/lib/ExtUtils/Typemaps.pm +++ b/dist/ExtUtils-ParseXS/lib/ExtUtils/Typemaps.pm @@ -2,7 +2,7 @@ package ExtUtils::Typemaps; use 5.006001; use strict; use warnings; -our $VERSION = '3.30'; +our $VERSION = '3.31'; require ExtUtils::ParseXS; require ExtUtils::ParseXS::Constants; diff --git a/dist/ExtUtils-ParseXS/lib/ExtUtils/Typemaps/Cmd.pm b/dist/ExtUtils-ParseXS/lib/ExtUtils/Typemaps/Cmd.pm index ccd5efeb2d..ffed504f9f 100644 --- a/dist/ExtUtils-ParseXS/lib/ExtUtils/Typemaps/Cmd.pm +++ b/dist/ExtUtils-ParseXS/lib/ExtUtils/Typemaps/Cmd.pm @@ -2,7 +2,7 @@ package ExtUtils::Typemaps::Cmd; use 5.006001; use strict; use warnings; -our $VERSION = '3.30'; +our $VERSION = '3.31'; use ExtUtils::Typemaps; diff --git a/dist/ExtUtils-ParseXS/lib/ExtUtils/Typemaps/InputMap.pm b/dist/ExtUtils-ParseXS/lib/ExtUtils/Typemaps/InputMap.pm index 67ea1c2205..86c646d543 100644 --- a/dist/ExtUtils-ParseXS/lib/ExtUtils/Typemaps/InputMap.pm +++ b/dist/ExtUtils-ParseXS/lib/ExtUtils/Typemaps/InputMap.pm @@ -2,7 +2,7 @@ package ExtUtils::Typemaps::InputMap; use 5.006001; use strict; use warnings; -our $VERSION = '3.30'; +our $VERSION = '3.31'; =head1 NAME diff --git a/dist/ExtUtils-ParseXS/lib/ExtUtils/Typemaps/OutputMap.pm b/dist/ExtUtils-ParseXS/lib/ExtUtils/Typemaps/OutputMap.pm index 42cbe5c46b..32cf9f9327 100644 --- a/dist/ExtUtils-ParseXS/lib/ExtUtils/Typemaps/OutputMap.pm +++ b/dist/ExtUtils-ParseXS/lib/ExtUtils/Typemaps/OutputMap.pm @@ -2,7 +2,7 @@ package ExtUtils::Typemaps::OutputMap; use 5.006001; use strict; use warnings; -our $VERSION = '3.30'; +our $VERSION = '3.31'; =head1 NAME diff --git a/dist/ExtUtils-ParseXS/lib/ExtUtils/Typemaps/Type.pm b/dist/ExtUtils-ParseXS/lib/ExtUtils/Typemaps/Type.pm index 7e0f4babf8..abe93cb8eb 100644 --- a/dist/ExtUtils-ParseXS/lib/ExtUtils/Typemaps/Type.pm +++ b/dist/ExtUtils-ParseXS/lib/ExtUtils/Typemaps/Type.pm @@ -4,7 +4,7 @@ use strict; use warnings; require ExtUtils::Typemaps; -our $VERSION = '3.30'; +our $VERSION = '3.31'; =head1 NAME |