From: Simon Ruderich Date: Mon, 26 Mar 2012 00:34:12 +0000 (+0200) Subject: Use /o in regexps where possible. X-Git-Tag: 0.01~63 X-Git-Url: https://ruderich.org/simon/gitweb/?a=commitdiff_plain;h=124a578b28479e28b9d801888f6a5c93666c24d3;p=blhc%2Fblhc.git Use /o in regexps where possible. /o is a bit faster and works fine as our parsing regexps never change. --- diff --git a/bin/blhc b/bin/blhc index f4a242c..5443eef 100755 --- a/bin/blhc +++ b/bin/blhc @@ -311,7 +311,7 @@ sub is_non_verbose_build { $file =~ m{/([a-zA-Z0-9._-]+)$}; $file = $1; - if ($next_line =~ /\Q$file\E/ and $next_line =~ /$cc_regex/) { + if ($next_line =~ /\Q$file\E/ and $next_line =~ /$cc_regex/o) { # We still have to skip the current line as it doesn't contain any # compiler commands. ${$skip_ref} = 1; @@ -450,7 +450,7 @@ while (my $line = <>) { } # Ignore compiler warnings for now. - next if $line =~ /$warning_regex/; + next if $line =~ /$warning_regex/o; # Remove all ANSI color sequences which are sometimes used in non-verbose # builds. @@ -501,7 +501,7 @@ while (my $line = <>) { } # Ignore lines with no compiler commands. - next if $line !~ /\b$cc_regex(?:\s|\\)/ and not $non_verbose; + next if $line !~ /\b$cc_regex(?:\s|\\)/o and not $non_verbose; # Ignore false positives. # @@ -512,8 +512,8 @@ while (my $line = <>) { (?:C|c)ompiler[\s.]*:?\s+ $cc_regex (?:\s-std=[a-z0-9:+]+)?\s*$ - /x - or $line =~ /^\s*(?:- )?(?:HOST_)?(?:CC|CXX)\s*=\s*$cc_regex\s*$/ + /xo + or $line =~ /^\s*(?:- )?(?:HOST_)?(?:CC|CXX)\s*=\s*$cc_regex\s*$/o or $line =~ /^\s*-- Check for working (?:C|CXX) compiler: / or $line =~ /^\s*(?:echo )?Using [A-Z_]+\s*=\s*/; # `make` output. @@ -596,7 +596,7 @@ for (my $i = 0; $i < scalar @input; $i++) { # Remove everything until and including the compiler command. Makes checks # easier and faster. - $line =~ s/^.*?$cc_regex//; + $line =~ s/^.*?$cc_regex//o; # Skip unnecessary tests when only preprocessing. my $flag_preprocess = 0; @@ -616,7 +616,7 @@ for (my $i = 0; $i < scalar @input; $i++) { } # Get all file extensions on this line. - my @extensions = $line =~ /$file_extension_regex/g; + my @extensions = $line =~ /$file_extension_regex/go; # Ignore all unknown extensions to speedup the search below. @extensions = grep { exists $extension{$_} } @extensions;