X-Git-Url: https://ruderich.org/simon/gitweb/?a=blobdiff_plain;f=bin%2Fblhc;h=3abb9791e189b0e3f43139de7d0182218469414d;hb=cb96ed22d2d46c34a1a06fea374eeb0c6cf0269b;hp=d5af8a01983d8f24241b44b596075b6646dea055;hpb=19d0b5330bbfc99c924edd98ab603d8032aa3c76;p=blhc%2Fblhc.git diff --git a/bin/blhc b/bin/blhc index d5af8a0..3abb979 100755 --- a/bin/blhc +++ b/bin/blhc @@ -176,7 +176,8 @@ my $file_extension_regex = qr/ # terminated with "\n". /x; -# Expected (hardening) flags. All flags are used as regexps. +# Expected (hardening) flags. All flags are used as regexps (and compiled to +# real regexps below for better execution speed). my @def_cflags = ( '-g', '-O(?:2|3)', @@ -475,6 +476,7 @@ sub is_non_verbose_build { return 1; } +# Remove @flags from $flag_refs_ref, and $flag_renames_ref. sub remove_flags { my ($flag_refs_ref, $flag_renames_ref, @flags) = @_; @@ -492,6 +494,7 @@ sub remove_flags { return; } +# Modifies $flag_renames_ref hash. sub compile_flag_regexp { my ($flag_renames_ref, @flags) = @_; @@ -510,17 +513,16 @@ sub compile_flag_regexp { return @result; } +# Does any extension in @extensions exist in %{$extensions_ref}? sub extension_found { my ($extensions_ref, @extensions) = @_; - my $found = 0; foreach my $extension (@extensions) { if (exists $extensions_ref->{$extension}) { - $found = 1; - last; + return 1; } } - return $found; + return 0; } @@ -863,7 +865,7 @@ foreach my $file (@ARGV) { # C++ files. No hardening flags are relevant during this step, # thus ignore `moc-qt*` lines. The resulting files will be # compiled in a separate step (and therefore checked). - next if $line =~ m{^\S+/bin/moc-qt[45] + next if $line =~ m{^\S+/bin/moc(?:-qt[45])? \s.+\s -I\S+/mkspecs/[a-z]+-g\++(?:-64)? \s}x; @@ -1023,7 +1025,8 @@ LINE: } next; } - # Even if it's a verbose build, we might have to skip this line. + # Even if it's a verbose build, we might have to skip this line (see + # is_non_verbose_build()). next if $skip; # Remove everything until and including the compiler command. Makes