diff mbox

Do not error when -E provided (PR pch/78970).

Message ID 6b9f8c99-0ea4-09e2-f222-97a3d28943fa@suse.cz
State New
Headers show

Commit Message

Martin Liška Jan. 9, 2017, 3:09 p.m. UTC
Hello.

As reported here https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78970#c7,
we should not report error when one want to pre-compile a {c,c++}-header file.

Patch can bootstrap on x86_64-linux-gnu and survives regression tests.

Ready to be installed?
Martin

Comments

Jakub Jelinek Jan. 9, 2017, 3:12 p.m. UTC | #1
On Mon, Jan 09, 2017 at 04:09:57PM +0100, Martin Liška wrote:
> Hello.

> 

> As reported here https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78970#c7,

> we should not report error when one want to pre-compile a {c,c++}-header file.

> 

> Patch can bootstrap on x86_64-linux-gnu and survives regression tests.

> 

> Ready to be installed?

> Martin


> >From bf226badedf38c81d09e34bde6ce0ff694e5b4fd Mon Sep 17 00:00:00 2001

> From: marxin <mliska@suse.cz>

> Date: Mon, 9 Jan 2017 14:20:41 +0100

> Subject: [PATCH] Do not error when -E provided (PR pch/78970).

> 

> gcc/ChangeLog:

> 

> 2017-01-09  Martin Liska  <mliska@suse.cz>

> 

> 	PR pch/78970

> 	* gcc.c (driver_handle_option): Handle OPT_E and set

> 	have_E.

> 	(lookup_compiler): Do not show error message with have_E.

> ---

>  gcc/gcc.c | 10 +++++++++-

>  1 file changed, 9 insertions(+), 1 deletion(-)

> 

> diff --git a/gcc/gcc.c b/gcc/gcc.c

> index 1d2ed99ef5f..b9cdc5d81a8 100644

> --- a/gcc/gcc.c

> +++ b/gcc/gcc.c

> @@ -1931,6 +1931,9 @@ static int have_c = 0;

>  /* Was the option -o passed.  */

>  static int have_o = 0;

>  

> +/* Were the option -E passed.  */


Was ?

Ok with that change.

	Jakub
Martin Liška Jan. 10, 2017, 1:32 p.m. UTC | #2
On 01/09/2017 04:12 PM, Jakub Jelinek wrote:
> Was ?

>

> Ok with that change.

>

> 	Jakub


Thanks for review, installed as r244227.

I've finished testing for both active branches, may I install the patch?

Martin
Jakub Jelinek Jan. 10, 2017, 1:32 p.m. UTC | #3
On Tue, Jan 10, 2017 at 02:32:07PM +0100, Martin Liška wrote:
> On 01/09/2017 04:12 PM, Jakub Jelinek wrote:

> > Was ?

> > 

> > Ok with that change.

> > 

> > 	Jakub

> 

> Thanks for review, installed as r244227.

> 

> I've finished testing for both active branches, may I install the patch?


Ok.

	Jakub
diff mbox

Patch

From bf226badedf38c81d09e34bde6ce0ff694e5b4fd Mon Sep 17 00:00:00 2001
From: marxin <mliska@suse.cz>
Date: Mon, 9 Jan 2017 14:20:41 +0100
Subject: [PATCH] Do not error when -E provided (PR pch/78970).

gcc/ChangeLog:

2017-01-09  Martin Liska  <mliska@suse.cz>

	PR pch/78970
	* gcc.c (driver_handle_option): Handle OPT_E and set
	have_E.
	(lookup_compiler): Do not show error message with have_E.
---
 gcc/gcc.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/gcc/gcc.c b/gcc/gcc.c
index 1d2ed99ef5f..b9cdc5d81a8 100644
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -1931,6 +1931,9 @@  static int have_c = 0;
 /* Was the option -o passed.  */
 static int have_o = 0;
 
+/* Were the option -E passed.  */
+static int have_E = 0;
+
 /* Pointer to output file name passed in with -o. */
 static const char *output_file = 0;
 
@@ -4067,6 +4070,10 @@  driver_handle_option (struct gcc_options *opts,
       validated = true;
       break;
 
+    case OPT_E:
+      have_E = true;
+      break;
+
     case OPT_x:
       spec_lang = arg;
       if (!strcmp (spec_lang, "none"))
@@ -8328,7 +8335,8 @@  lookup_compiler (const char *name, size_t length, const char *language)
 	  {
 	    if (name != NULL && strcmp (name, "-") == 0
 		&& (strcmp (cp->suffix, "@c-header") == 0
-		    || strcmp (cp->suffix, "@c++-header") == 0))
+		    || strcmp (cp->suffix, "@c++-header") == 0)
+		&& !have_E)
 	      fatal_error (input_location,
 			   "cannot use %<-%> as input filename for a "
 			   "precompiled header");
-- 
2.11.0