[FFmpeg-devel] [GASPP PATCH] Omit the "-c" argument from the preprocessing command

Martin Storsjö martin at martin.st
Thu Jul 25 11:25:04 EEST 2024


A command like "cc -c -E" is tautological; the -c is ignored, when
we explicitly specify that we want to preprocess only.

Since
https://github.com/llvm/llvm-project/commit/6461e537815f7fa68cef06842505353cf5600e9c
and https://github.com/llvm/llvm-project/pull/98607, Clang now
warns about the unused "-c" argument in this case.

We already did omit the "-c" argument when preprocessing
(with cl.exe) for armasm, but do this for other cases as well.
---
 gas-preprocessor.pl | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/gas-preprocessor.pl b/gas-preprocessor.pl
index 19b0131..aa3abc0 100755
--- a/gas-preprocessor.pl
+++ b/gas-preprocessor.pl
@@ -155,6 +155,8 @@ while ($index < $#preprocess_c_cmd) {
     $index++;
 }
 
+ at preprocess_c_cmd = grep ! /^-c$/, @preprocess_c_cmd;
+
 my $tempfile;
 if ($as_type ne "armasm") {
     @gcc_cmd = map { /\.[csS]$/ ? qw(-x assembler -) : $_ } @gcc_cmd;
@@ -163,7 +165,6 @@ if ($as_type ne "armasm") {
     # Clang warns about unused -D parameters when invoked with "-x assembler".
     @gcc_cmd = grep ! /^-D/, @gcc_cmd;
 } else {
-    @preprocess_c_cmd = grep ! /^-c$/, @preprocess_c_cmd;
     @preprocess_c_cmd = grep ! /^-m/, @preprocess_c_cmd;
 
     @preprocess_c_cmd = grep ! /^-G/, @preprocess_c_cmd;
-- 
2.34.1



More information about the ffmpeg-devel mailing list