diff mbox series

[v2,1/2] driver: Do not warn about ineffective `-x' option if no inputs were given

Message ID alpine.LFD.2.21.1911290521490.13542@redsun52.ssa.fujisawa.hgst.com
State Accepted
Headers show
Series Fix run-time handling of `libgcc_s' in testing | expand

Commit Message

Maciej W. Rozycki Nov. 29, 2019, 9:09 a.m. UTC
Fix an issue with the GCC driver and the `-x' option where a warning is 
issued in an invocation like:

$ riscv64-linux-gnu-gcc -print-multi-directory -x c++
riscv64-linux-gnu-gcc: warning: '-x c++' after last input file has no effect
lib64/lp64d
$ 

where no inputs were given and hence the use of `-x' is irrelevant.  
The statement printed is also untrue as the `-x' does not come after the 
last input file given that none was given.  Do not print it then if no 
inputs were supplied.

	gcc/
	* gcc.c (process_command): Only warn about an ineffective `-x' 
	option if any input files have actually been supplied.
---
Hi,

 This warning interferes with 2/2 and libgomp testing where `-x c++' is 
included with compiler invocation for a subset of tests.  This could 
probably be dealt with in the test suite, but I have concluded that the 
warning makes no sense in the first place and would better be simply 
removed instead.

  Maciej

New change in v2.
---
 gcc/gcc.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

gcc-spec-lang-warn-no-input.diff

Comments

Joseph Myers Nov. 29, 2019, 8:55 p.m. UTC | #1
On Fri, 29 Nov 2019, Maciej W. Rozycki wrote:

> Fix an issue with the GCC driver and the `-x' option where a warning is 
> issued in an invocation like:
> 
> $ riscv64-linux-gnu-gcc -print-multi-directory -x c++
> riscv64-linux-gnu-gcc: warning: '-x c++' after last input file has no effect
> lib64/lp64d
> $ 
> 
> where no inputs were given and hence the use of `-x' is irrelevant.  
> The statement printed is also untrue as the `-x' does not come after the 
> last input file given that none was given.  Do not print it then if no 
> inputs were supplied.
> 
> 	gcc/
> 	* gcc.c (process_command): Only warn about an ineffective `-x' 
> 	option if any input files have actually been supplied.

OK.
Maciej W. Rozycki Nov. 30, 2019, 11:13 a.m. UTC | #2
On Fri, 29 Nov 2019, Joseph Myers wrote:

> > 	* gcc.c (process_command): Only warn about an ineffective `-x' 
> > 	option if any input files have actually been supplied.
> 
> OK.

 Applied, thanks for your review.

  Maciej
diff mbox series

Patch

Index: gcc/gcc/gcc.c
===================================================================
--- gcc.orig/gcc/gcc.c
+++ gcc/gcc/gcc.c
@@ -4741,7 +4741,7 @@  process_command (unsigned int decoded_op
   /* More prefixes are enabled in main, after we read the specs file
      and determine whether this is cross-compilation or not.  */
 
-  if (n_infiles == last_language_n_infiles && spec_lang != 0)
+  if (n_infiles != 0 && n_infiles == last_language_n_infiles && spec_lang != 0)
     warning (0, "%<-x %s%> after last input file has no effect", spec_lang);
 
   /* Synthesize -fcompare-debug flag from the GCC_COMPARE_DEBUG