fix interaction of -S and -x {c,c++}-header
authorJan Beulich <jbeulich@suse.com>
Mon, 4 Jul 2016 07:41:32 +0000 (07:41 +0000)
committerJan Beulich <jbeulich@gcc.gnu.org>
Mon, 4 Jul 2016 07:41:32 +0000 (07:41 +0000)
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  <jbeulich@suse.com>

* gcc.c (default_compilers["@c-header"]): Conditionalize "-o".

gcc/cp/
2016-07-04  Jan Beulich  <jbeulich@suse.com>

* lang-specs.h ("@c++-header"): Conditionalize "-o".

gcc/testsuite/
2016-07-04  Jan Beulich  <jbeulich@suse.com>

* g++.dg/header.c: New.
* gcc.dg/header.c: New.

From-SVN: r237955

gcc/ChangeLog
gcc/cp/ChangeLog
gcc/cp/lang-specs.h
gcc/gcc.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/header.C [new file with mode: 0644]
gcc/testsuite/gcc.dg/header.c [new file with mode: 0644]

index b8fd1f17627e3f79c44a27357183adb8c6009775..7ad413572b474f8c13790b25b56c706c50529d71 100644 (file)
@@ -1,3 +1,7 @@
+2016-07-04  Jan Beulich  <jbeulich@suse.com>
+
+       * gcc.c (default_compilers["@c-header"]): Conditionalize "-o".
+
 2016-07-01  Michael Meissner  <meissner@linux.vnet.ibm.com>
 
        PR target/71720
index 327391bf775f27d877051d3c6a55e91822e7838f..7da1c55e93efe8414bb3eb4f12d927f17934a4bf 100644 (file)
@@ -1,3 +1,7 @@
+2016-07-04  Jan Beulich  <jbeulich@suse.com>
+
+       * lang-specs.h ("@c++-header"): Conditionalize "-o".
+
 2016-06-29  Thomas Schwinge  <thomas@codesourcery.com>
 
        * parser.c (cp_parser_pragma) <PRAGMA_OMP_CANCELLATION_POINT>:
index 9707fac2ad4593823c86cfa51b5ca73e922207de..9217950a0da44d97b53c5785719baa94d6c26dfd 100644 (file)
@@ -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},
index 634f8e6002a9d8ed7426942c0411a05562bbaf1d..7460f6af148969734c6cffeef870388355ef76cf 100644 (file)
--- 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},
index ced6ca7a7802dadfbd66e300087717a5c06f5ecb..86c1b5d373b2d93d3a24a8b303c7ea5521d8d2ad 100644 (file)
@@ -1,3 +1,8 @@
+2016-07-04  Jan Beulich  <jbeulich@suse.com>
+
+       * g++.dg/header.c: New.
+       * gcc.dg/header.c: New.
+
 2016-07-02  Jakub Jelinek  <jakub@redhat.com>
 
        PR c/71719
diff --git a/gcc/testsuite/g++.dg/header.C b/gcc/testsuite/g++.dg/header.C
new file mode 100644 (file)
index 0000000..41a6dcb
--- /dev/null
@@ -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 (file)
index 0000000..3241a96
--- /dev/null
@@ -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;
+};