X-Git-Url: https://ruderich.org/simon/gitweb/?a=blobdiff_plain;f=bin%2Fblhc;h=87037453ac493594c06b3339118d28621be94f12;hb=2976a38e3eb5e7fd1568f9dd6d4baacd6e6b484e;hp=04b7125e87185f5c1706d4345685ffe75a2462b6;hpb=c3b000d786b82874943c7f8792179e64559bd58a;p=blhc%2Fblhc.git diff --git a/bin/blhc b/bin/blhc index 04b7125..8703745 100755 --- a/bin/blhc +++ b/bin/blhc @@ -142,13 +142,13 @@ my %extension = map { $_ => 1 } ( # Regexp to match file extensions. my $file_extension_regex = qr/ \s - \S+ # Filename without extension. + \S+ # Filename without extension. \. - ([^\\.\s]+) # File extension. - (?=\s|\\) # At end of word. Can't use \b because some files have non - # word characters at the end and because \b matches double - # extensions (like .cpp.o). Works always as all lines are - # terminated with "\n". + ([^\\.,;:\s]+) # File extension. + (?=\s|\\) # At end of word. Can't use \b because some files have non + # word characters at the end and because \b matches double + # extensions (like .cpp.o). Works always as all lines are + # terminated with "\n". /x; # Expected (hardening) flags. All flags are used as regexps. @@ -193,6 +193,7 @@ my @def_ldflags_pie = ( my @def_ldflags_pic = ( '-fPIC', '-fpic', + '-shared', ); # Renaming rules for the output so the regex parts are not visible. Also # stores string values of flag regexps above, see compile_flag_regexp(). @@ -571,23 +572,21 @@ FILE: foreach my $file (@ARGV) { } # Ignore lines with no compiler commands. - next if $line !~ /\b$cc_regex(?:\s|\\)/o and not $non_verbose; + next if not $non_verbose + and not $line =~ /\b$cc_regex(?:\s|\\)/o; + # Ignore lines with no filenames with extensions. May miss + # some non-verbose builds (e.g. "gcc -o test" [sic!]), but + # shouldn't be a problem as the log will most likely contain + # other non-verbose commands which are detected. + next if not $non_verbose + and not $line =~ /$file_extension_regex/o; # Ignore false positives. # # `./configure` output. next if not $non_verbose and $line =~ /^(?:checking|(?:C|c)onfigure:) /; - next if $line =~ /^\s*(?:Host\s+)?(?:C\s+)? - (?:C|c)ompiler[\s.]*:?\s+ - $cc_regex_full - (?:\s-std=[a-z0-9:+]+)?\s*$ - /xo - or $line =~ /^\s*(?:- )?(?:HOST_)?(?:CC|CXX)\s*=\s*$cc_regex_full\s*$/o - or $line =~ /^\s*-- Check for working (?:C|CXX) compiler: / - or $line =~ /^\s*(?:echo )?Using [A-Z_]+\s*=\s*/; - # `make` output. - next if $line =~ /^Making [a-z]+ in \S+/; # e.g. "[...] in c++" + next if $line =~ /^\s*(?:- )?(?:HOST_)?(?:CC|CXX)\s*=\s*$cc_regex_full\s*$/o; # Check if additional hardening options were used. Used to # ensure they are used for the complete build. @@ -602,7 +601,11 @@ FILE: foreach my $file (@ARGV) { close $fh; if (scalar @input == 0) { - print "No compiler commands!\n"; + if (not $option_buildd) { + print "No compiler commands!\n"; + } else { + print "W-no-compiler-commands\n"; + } $exit |= 1; next FILE; }