Skip to content

Commit 40db0dd

Browse files
committed
ParseXS - Disable alias value collision warnings by default
We always had a bug with the value 0, when fixing it, we discovered a lot of people were doing duplicate aliases with 0. This patch disables the warnings except when in a special author mode, as it makes no sense to show these warnings to end users. It would seem most times creating such aliases is not an issue and is entirely deliberate. So showing such warnings only to module authors and only on request also makes sense.
1 parent eae8123 commit 40db0dd

File tree

12 files changed

+75
-13
lines changed

12 files changed

+75
-13
lines changed

dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS.pm

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use Symbol;
1111

1212
our $VERSION;
1313
BEGIN {
14-
$VERSION = '3.48';
14+
$VERSION = '3.49';
1515
require ExtUtils::ParseXS::Constants; ExtUtils::ParseXS::Constants->VERSION($VERSION);
1616
require ExtUtils::ParseXS::CountLines; ExtUtils::ParseXS::CountLines->VERSION($VERSION);
1717
require ExtUtils::ParseXS::Utilities; ExtUtils::ParseXS::Utilities->VERSION($VERSION);
@@ -49,6 +49,9 @@ our @EXPORT_OK = qw(
4949
##############################
5050
# A number of "constants"
5151
our $DIE_ON_ERROR;
52+
our $AUTHOR_WARNINGS;
53+
$AUTHOR_WARNINGS = ($ENV{AUTHOR_WARNINGS} || 0)
54+
unless defined $AUTHOR_WARNINGS;
5255
our ($C_group_rex, $C_arg);
5356
# Group in C (no support for comments or literals)
5457
$C_group_rex = qr/ [({\[]
@@ -105,6 +108,7 @@ sub process_file {
105108
versioncheck => 1,
106109
FH => Symbol::gensym(),
107110
die_on_error => $DIE_ON_ERROR, # if true we die() and not exit() after errors
111+
author_warnings => $AUTHOR_WARNINGS,
108112
%options,
109113
);
110114
$args{except} = $args{except} ? ' TRY' : '';
@@ -136,6 +140,7 @@ sub process_file {
136140
$self->{IncludedFiles} = {};
137141

138142
$self->{die_on_error} = $args{die_on_error};
143+
$self->{author_warnings} = $args{author_warnings};
139144

140145
die "Missing required parameter 'filename'" unless $args{filename};
141146
$self->{filepathname} = $args{filename};
@@ -1372,7 +1377,10 @@ sub get_aliases {
13721377
# yet as 0 is the default for the base function ($fname)
13731378
push @keys, $fname
13741379
if $value eq "0" and !defined $self->{XsubAlias}{$fname};
1375-
if (@keys) {
1380+
if (@keys and $self->{author_warnings}) {
1381+
# We do not warn about value collisions unless author_warnings
1382+
# are enabled. They aren't helpful to a module consumer, only
1383+
# the module author.
13761384
@keys= map { "'$_'" }
13771385
map { my $copy= $_;
13781386
$copy=~s/^$self->{Packprefix}//;

dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS/Constants.pm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use strict;
33
use warnings;
44
use Symbol;
55

6-
our $VERSION = '3.48';
6+
our $VERSION = '3.49';
77

88
=head1 NAME
99

dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS/CountLines.pm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package ExtUtils::ParseXS::CountLines;
22
use strict;
33

4-
our $VERSION = '3.48';
4+
our $VERSION = '3.49';
55

66
our $SECTION_END_MARKER;
77

dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS/Eval.pm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ package ExtUtils::ParseXS::Eval;
22
use strict;
33
use warnings;
44

5-
our $VERSION = '3.48';
5+
our $VERSION = '3.49';
66

77
=head1 NAME
88

dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS/Utilities.pm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use Exporter;
55
use File::Spec;
66
use ExtUtils::ParseXS::Constants ();
77

8-
our $VERSION = '3.48';
8+
our $VERSION = '3.49';
99

1010
our (@ISA, @EXPORT_OK);
1111
@ISA = qw(Exporter);

dist/ExtUtils-ParseXS/lib/ExtUtils/Typemaps.pm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ package ExtUtils::Typemaps;
22
use 5.006001;
33
use strict;
44
use warnings;
5-
our $VERSION = '3.48';
5+
our $VERSION = '3.49';
66

77
require ExtUtils::ParseXS;
88
require ExtUtils::ParseXS::Constants;

dist/ExtUtils-ParseXS/lib/ExtUtils/Typemaps/Cmd.pm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ package ExtUtils::Typemaps::Cmd;
22
use 5.006001;
33
use strict;
44
use warnings;
5-
our $VERSION = '3.48';
5+
our $VERSION = '3.49';
66

77
use ExtUtils::Typemaps;
88

dist/ExtUtils-ParseXS/lib/ExtUtils/Typemaps/InputMap.pm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ package ExtUtils::Typemaps::InputMap;
22
use 5.006001;
33
use strict;
44
use warnings;
5-
our $VERSION = '3.48';
5+
our $VERSION = '3.49';
66

77
=head1 NAME
88

dist/ExtUtils-ParseXS/lib/ExtUtils/Typemaps/OutputMap.pm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ package ExtUtils::Typemaps::OutputMap;
22
use 5.006001;
33
use strict;
44
use warnings;
5-
our $VERSION = '3.48';
5+
our $VERSION = '3.49';
66

77
=head1 NAME
88

dist/ExtUtils-ParseXS/lib/ExtUtils/Typemaps/Type.pm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use strict;
44
use warnings;
55
require ExtUtils::Typemaps;
66

7-
our $VERSION = '3.48';
7+
our $VERSION = '3.49';
88

99
=head1 NAME
1010

0 commit comments

Comments
 (0)