From 793350758c5c88b29b1c9459f3b3fb1bb00bc0c0 Mon Sep 17 00:00:00 2001 From: Jan Beulich Date: Mon, 4 Jul 2016 07:41:32 +0000 Subject: [PATCH] fix interaction of -S and -x {c,c++}-header Irrespective of the use of -o this so far resulted in "error: output filename specified twice", since cc1_options already produces a -o option when -S was specified. gcc/ 2016-07-04 Jan Beulich * gcc.c (default_compilers["@c-header"]): Conditionalize "-o". gcc/cp/ 2016-07-04 Jan Beulich * lang-specs.h ("@c++-header"): Conditionalize "-o". gcc/testsuite/ 2016-07-04 Jan Beulich * g++.dg/header.c: New. * gcc.dg/header.c: New. From-SVN: r237955 --- gcc/ChangeLog | 4 ++++ gcc/cp/ChangeLog | 4 ++++ gcc/cp/lang-specs.h | 2 +- gcc/gcc.c | 2 +- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/g++.dg/header.C | 9 +++++++++ gcc/testsuite/gcc.dg/header.c | 9 +++++++++ 7 files changed, 33 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/g++.dg/header.C create mode 100644 gcc/testsuite/gcc.dg/header.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b8fd1f17627..7ad413572b4 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,7 @@ +2016-07-04 Jan Beulich + + * gcc.c (default_compilers["@c-header"]): Conditionalize "-o". + 2016-07-01 Michael Meissner PR target/71720 diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 327391bf775..7da1c55e93e 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,7 @@ +2016-07-04 Jan Beulich + + * lang-specs.h ("@c++-header"): Conditionalize "-o". + 2016-06-29 Thomas Schwinge * parser.c (cp_parser_pragma) : diff --git a/gcc/cp/lang-specs.h b/gcc/cp/lang-specs.h index 9707fac2ad4..9217950a0da 100644 --- a/gcc/cp/lang-specs.h +++ b/gcc/cp/lang-specs.h @@ -47,7 +47,7 @@ along with GCC; see the file COPYING3. If not see cc1plus %{save-temps*|no-integrated-cpp:-fpreprocessed %{save-temps*:%b.ii} %{!save-temps*:%g.ii}}\ %{!save-temps*:%{!no-integrated-cpp:%(cpp_unique_options)}}\ %(cc1_options) %2\ - %{!fsyntax-only:-o %g.s \ + %{!fsyntax-only:%{!S:-o %g.s} \ %{!fdump-ada-spec*:%{!o*:--output-pch=%i.gch}\ %W{o*:--output-pch=%*}}%V}}}}", CPLUSPLUS_CPP_SPEC, 0, 0}, diff --git a/gcc/gcc.c b/gcc/gcc.c index 634f8e6002a..7460f6af148 100644 --- a/gcc/gcc.c +++ b/gcc/gcc.c @@ -1330,7 +1330,7 @@ static const struct compiler default_compilers[] = %W{o*:--output-pch=%*}}%V}}\ %{!save-temps*:%{!traditional-cpp:%{!no-integrated-cpp:\ cc1 %(cpp_unique_options) %(cc1_options)\ - %{!fsyntax-only:-o %g.s \ + %{!fsyntax-only:%{!S:-o %g.s} \ %{!fdump-ada-spec*:%{!o*:--output-pch=%i.gch}\ %W{o*:--output-pch=%*}}%V}}}}}}}", 0, 0, 0}, {".i", "@cpp-output", 0, 0, 0}, diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index ced6ca7a780..86c1b5d373b 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2016-07-04 Jan Beulich + + * g++.dg/header.c: New. + * gcc.dg/header.c: New. + 2016-07-02 Jakub Jelinek PR c/71719 diff --git a/gcc/testsuite/g++.dg/header.C b/gcc/testsuite/g++.dg/header.C new file mode 100644 index 00000000000..41a6dcbef3f --- /dev/null +++ b/gcc/testsuite/g++.dg/header.C @@ -0,0 +1,9 @@ +/* This really should use "dg-do compile" without the -S in dg-options, + but the extra options get put after the input file in that case, and + hence the test would fail. */ +/* { dg-do assemble } */ +/* { dg-options "-S -x c++-header" } */ + +struct s { + unsigned field; +}; diff --git a/gcc/testsuite/gcc.dg/header.c b/gcc/testsuite/gcc.dg/header.c new file mode 100644 index 00000000000..3241a963442 --- /dev/null +++ b/gcc/testsuite/gcc.dg/header.c @@ -0,0 +1,9 @@ +/* This really should use "dg-do compile" without the -S in dg-options, + but the extra options get put after the input file in that case, and + hence the test would fail. */ +/* { dg-do assemble } */ +/* { dg-options "-S -x c-header" } */ + +struct s { + unsigned field; +}; -- 2.30.2