From: Simon Ruderich Date: Sun, 23 Jul 2017 15:56:23 +0000 (+0200) Subject: Refactor Ada handling of format CFLAGS X-Git-Tag: 0.08~11 X-Git-Url: https://ruderich.org/simon/gitweb/?a=commitdiff_plain;h=66d10eb3739f8e3649335e396eeaf273f36ecb28;p=blhc%2Fblhc.git Refactor Ada handling of format CFLAGS Will be used for Fortran flags in the next commit. --- diff --git a/bin/blhc b/bin/blhc index 0e90707..4a16a36 100755 --- a/bin/blhc +++ b/bin/blhc @@ -1087,14 +1087,12 @@ foreach my $file (@ARGV) { @ldflags = (@ldflags, @def_ldflags_bindnow); } - # Stores normal CFLAGS when @cflags_ada are temporarily used. - my @cflags_backup; - # Ada CFLAGS, only set if ada is used. - my @cflags_ada; # Ada doesn't support format hardening flags, see #680117 for more # information. Filter them out if ada is used. + my @cflags_backup; + my @cflags_noformat; if ($ada and $harden_format) { - @cflags_ada = grep { + @cflags_noformat = grep { my $ok = 1; foreach my $flag (@def_cflags_format) { $ok = 0 if $_ eq $flag; @@ -1236,7 +1234,7 @@ LINE: } my $compile_cpp = 0; - my $compile_ada = 0; + my $restore_cflags = 0; # Assume CXXFLAGS are required when a C++ file is specified in the # compiler line. if ($compile @@ -1246,10 +1244,10 @@ LINE: # Ada needs special CFLAGS, use them if only ada files are compiled. } elsif ($ada and extension_found(\%extensions_ada, @extensions)) { - $compile_ada = 1; + $restore_cflags = 1; $preprocess = 0; # Ada uses no CPPFLAGS @cflags_backup = @cflags; - @cflags = @cflags_ada; + @cflags = @cflags_noformat; } if ($option_buildd) { @@ -1324,7 +1322,7 @@ LINE: } # Restore normal CFLAGS. - if ($compile_ada) { + if ($restore_cflags) { @cflags = @cflags_backup; } }