diff mbox series

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

Message ID 20240725082504.883576-1-martin@martin.st
State Accepted
Headers show
Series [FFmpeg-devel,GASPP] Omit the "-c" argument from the preprocessing command | expand

Checks

Context Check Description
andriy/configure_x86 warning Failed to apply patch

Commit Message

Martin Storsjö July 25, 2024, 8:25 a.m. UTC
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(-)

Comments

Martin Storsjö July 29, 2024, 1:15 p.m. UTC | #1
On Thu, 25 Jul 2024, Martin Storsjö wrote:

> 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++;
> }
>
> +@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

Will push this soon.

// Martin
diff mbox series

Patch

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++;
 }
 
+@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;