Skip to content

Commit 6f9b4dc

Browse files
djeriusplicease
authored andcommitted
avoid unitialized warnings when resolving extra compiler/link flags in xs_ok
xs_ok merges the compile and link flags passed to it with those provided by ExtUtils::CppGuess. It assumes that if there are extra flags returned by ExtUtils::CppGuess, then there are also extra flags passed to xs_ok. On some systems, this assumption does not hold, and results in undefined values being passed to Text::ParseWords::shellwords when parsing extra flags passed to xs_ok, causing warnings such as use of uninitialized value $line in substitution (s///) at .../Text/ParseWords.pm line 21. to be emitted.
1 parent 3209ede commit 6f9b4dc

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/Test/Alien/CPP.pm

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,9 @@ sub xs_ok
9898
my @new = ref($cppguess{$name}) eq 'ARRAY' ? @{ delete $cppguess{$name} } : shellwords(delete $cppguess{$name});
9999
my @old = do {
100100
my $value = delete $xs->{$stage{$name}}->{$name};
101-
ref($value) eq 'ARRAY' ? @$value : shellwords($value);
101+
!defined $value ? ()
102+
: ref($value) eq 'ARRAY' ? @$value
103+
: shellwords($value);
102104
};
103105
$xs->{$stage{$name}}->{$name} = [@old, @new];
104106
}

0 commit comments

Comments
 (0)