WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
NEW
137609
webkitdirs::isCrossCompilation() cause Perl uninitialized warnings when using native GCC toolchain
https://bugs.webkit.org/show_bug.cgi?id=137609
Summary
webkitdirs::isCrossCompilation() cause Perl uninitialized warnings when using...
Adrien Destugues
Reported
2014-10-10 05:27:15 PDT
webkitdirs.pm fails when CC is set to native compiler
Attachments
Patch
(1.58 KB, patch)
2014-10-10 05:32 PDT
,
Adrien Destugues
dbates
: review+
Details
Formatted Diff
Diff
View All
Add attachment
proposed patch, testcase, etc.
Adrien Destugues
Comment 1
2014-10-10 05:32:51 PDT
Created
attachment 239621
[details]
Patch
Daniel Bates
Comment 2
2016-04-25 21:00:42 PDT
Comment on
attachment 239621
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=239621&action=review
> Tools/ChangeLog:12 > + The perl regexp returns an empty array when there is no match (when > + the compiler in CC is not configured with --target or --host). Trying > + to test the first element of the array will trigger a warning > + "Use of uninitialized value $host[0] in string ne". Test that the > + array is not empty first.
Maybe a better way to describe the issue is to say: Fixes an issue where webkitdirs::isCrossCompilation() causes Perl uninitialized warnings when the GCC compiler specified by the environment variable CC was not built for cross compilation.
> Tools/Scripts/webkitdirs.pm:1079 > my @host = $compiler_options =~ m/--host=(.*?)\s/; > my @target = $compiler_options =~ m/--target=(.*?)\s/; > > - return ($host[0] ne "" && $target[0] ne "" && $host[0] ne $target[0]); > + return (@host && @target && $host[0] ne "" && $target[0] ne "" && $host[0] ne $target[0]);
We are underutilizing the use of an array for holding the captured output of the regular expressions because the regular expression on lines 1076 and 1077 each have exactly one capture group. Using the fact that a captured group is always a string and the property that the empty string evaluates to false in a boolean context, I would write this code as: my $host = $1 if $compiler_options =~ /--host=(.*?)\s/; my $target = $1 if $compiler_options =~ /--target=(.*?)\s/; return ($host && $target && $host ne $target);
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug