aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaciej W. Rozycki <macro@wdc.com>2019-11-30 11:10:50 +0000
committerMaciej W. Rozycki <macro@wdc.com>2019-11-30 11:10:50 +0000
commit37c402ccc8ee9d252c33951b435eada741d809b1 (patch)
treeae9b2d3a93d86332aadf4cefe4fc8ecc873b0f93
parentdb18c6f364d0aaae752e7ca61ba92713f0ec9895 (diff)
driver: Do not warn about ineffective `-x' option if no inputs were given
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.c (process_command): Only warn about an ineffective `-x' option if any input files have actually been supplied. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@278872 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/gcc.c2
2 files changed, 6 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index e17440407cb..2a29e1b2b4d 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,10 @@
2019-11-30 Maciej W. Rozycki <macro@wdc.com>
+ * gcc.c (process_command): Only warn about an ineffective `-x'
+ option if any input files have actually been supplied.
+
+2019-11-30 Maciej W. Rozycki <macro@wdc.com>
+
* doc/install.texi (Options specification): Remove the list of
target library subdirectories supporting
`--enable-version-specific-runtime-libs'. Document defaults for
diff --git a/gcc/gcc.c b/gcc/gcc.c
index 539ded01ce6..4428d50c390 100644
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -4741,7 +4741,7 @@ process_command (unsigned int decoded_options_count,
/* 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