X-Git-Url: https://ruderich.org/simon/gitweb/?p=blhc%2Fblhc.git;a=blobdiff_plain;f=bin%2Fblhc;h=6afff57ff521485c9c6a4db9437bc826ea26b18d;hp=4a16a36ee3edeeda74fab554625a86598ae176da;hb=cda2e04237c0657e09d248b7f33c6ad0dc56612e;hpb=66d10eb3739f8e3649335e396eeaf273f36ecb28 diff --git a/bin/blhc b/bin/blhc index 4a16a36..6afff57 100755 --- a/bin/blhc +++ b/bin/blhc @@ -33,7 +33,7 @@ our $VERSION = '0.07'; my $cc_regex = qr/ (? 1 } ( @source_no_preprocess_compile_ada, @source_no_preprocess_no_compile_ada, ); +my %extensions_fortran = map { $_ => 1 } ( + @source_no_preprocess_compile_fortran, + @source_preprocess_compile_fortran, +); my %extensions_object = map { $_ => 1 } ( @object, ); @@ -730,6 +742,8 @@ foreach my $file (@ARGV) { # different CFLAGS. But only perform ada checks if an ada compiler is used # for performance reasons. my $ada = 0; + # Fortran also requires different CFLAGS. + my $fortran = 0; # Number of parallel jobs to prevent false positives when detecting # non-verbose builds. As not all jobs declare the number of parallel jobs @@ -827,6 +841,10 @@ foreach my $file (@ARGV) { if ($line =~ /\bgnat\b/) { $ada = 1; } + # Fortran compiler. + if ($line =~ /\bgfortran\b/) { + $fortran = 1; + } } # This flags is not always available, but if it is use it. @@ -1088,10 +1106,11 @@ foreach my $file (@ARGV) { } # Ada doesn't support format hardening flags, see #680117 for more - # information. Filter them out if ada is used. + # information. Same for fortran. Filter them out if either language is + # used. my @cflags_backup; my @cflags_noformat; - if ($ada and $harden_format) { + if (($ada or $fortran) and $harden_format) { @cflags_noformat = grep { my $ok = 1; foreach my $flag (@def_cflags_format) { @@ -1248,6 +1267,12 @@ LINE: $preprocess = 0; # Ada uses no CPPFLAGS @cflags_backup = @cflags; @cflags = @cflags_noformat; + # Same for fortran. + } elsif ($fortran + and extension_found(\%extensions_fortran, @extensions)) { + $restore_cflags = 1; + @cflags_backup = @cflags; + @cflags = @cflags_noformat; } if ($option_buildd) {