public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH 2/5] match.pd: Remove commented out line pragmas unless -vv is used.
@ 2023-04-28 10:38 Tamar Christina
  2023-04-28 11:49 ` Richard Biener
  2023-04-28 13:17 ` Paul Koning
  0 siblings, 2 replies; 4+ messages in thread
From: Tamar Christina @ 2023-04-28 10:38 UTC (permalink / raw)
  To: gcc-patches; +Cc: nd, rguenther, jlaw

[-- Attachment #1: Type: text/plain, Size: 1289 bytes --]

Hi All,

genmatch currently outputs commented out line directives that have no effect
but the compiler still has to parse only to discard.

They are however handy when debugging genmatch output.  As such this moves them
behind the -vv flag.

Bootstrapped Regtested on aarch64-none-linux-gnu and no issues.

Ok for master?

Thanks,
Tamar

gcc/ChangeLog:

	PR bootstrap/84402
	* genmatch.cc (output_line_directive): Only emit commented directive
	when -vv.
	(main): Initialize verbose.

--- inline copy of patch -- 
diff --git a/gcc/genmatch.cc b/gcc/genmatch.cc
index 638606b2502f640e59527fc5a0b23fa3bedd0cee..6d62cdea2082d92e5ecc1102c80205115a4e3040 100644
--- a/gcc/genmatch.cc
+++ b/gcc/genmatch.cc
@@ -209,7 +209,7 @@ output_line_directive (FILE *f, location_t location,
       else
 	fprintf (f, "%s:%d", file, loc.line);
     }
-  else
+  else if (verbose == 2)
     /* Other gen programs really output line directives here, at least for
        development it's right now more convenient to have line information
        from the generated file.  Still keep the directives as comment for now
@@ -5221,6 +5221,7 @@ main (int argc, char **argv)
     return 1;
 
   bool gimple = true;
+  verbose = 0;
   char *input = argv[argc-1];
   for (int i = 1; i < argc - 1; ++i)
     {




-- 

[-- Attachment #2: rb17227.patch --]
[-- Type: text/plain, Size: 770 bytes --]

diff --git a/gcc/genmatch.cc b/gcc/genmatch.cc
index 638606b2502f640e59527fc5a0b23fa3bedd0cee..6d62cdea2082d92e5ecc1102c80205115a4e3040 100644
--- a/gcc/genmatch.cc
+++ b/gcc/genmatch.cc
@@ -209,7 +209,7 @@ output_line_directive (FILE *f, location_t location,
       else
 	fprintf (f, "%s:%d", file, loc.line);
     }
-  else
+  else if (verbose == 2)
     /* Other gen programs really output line directives here, at least for
        development it's right now more convenient to have line information
        from the generated file.  Still keep the directives as comment for now
@@ -5221,6 +5221,7 @@ main (int argc, char **argv)
     return 1;
 
   bool gimple = true;
+  verbose = 0;
   char *input = argv[argc-1];
   for (int i = 1; i < argc - 1; ++i)
     {




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 2/5] match.pd: Remove commented out line pragmas unless -vv is used.
  2023-04-28 10:38 [PATCH 2/5] match.pd: Remove commented out line pragmas unless -vv is used Tamar Christina
@ 2023-04-28 11:49 ` Richard Biener
  2023-04-28 13:17 ` Paul Koning
  1 sibling, 0 replies; 4+ messages in thread
From: Richard Biener @ 2023-04-28 11:49 UTC (permalink / raw)
  To: Tamar Christina; +Cc: gcc-patches, nd, jlaw

On Fri, 28 Apr 2023, Tamar Christina wrote:

> Hi All,
> 
> genmatch currently outputs commented out line directives that have no effect
> but the compiler still has to parse only to discard.
> 
> They are however handy when debugging genmatch output.  As such this moves them
> behind the -vv flag.
> 
> Bootstrapped Regtested on aarch64-none-linux-gnu and no issues.
> 
> Ok for master?
> 
> Thanks,
> Tamar
> 
> gcc/ChangeLog:
> 
> 	PR bootstrap/84402
> 	* genmatch.cc (output_line_directive): Only emit commented directive
> 	when -vv.
> 	(main): Initialize verbose.
> 
> --- inline copy of patch -- 
> diff --git a/gcc/genmatch.cc b/gcc/genmatch.cc
> index 638606b2502f640e59527fc5a0b23fa3bedd0cee..6d62cdea2082d92e5ecc1102c80205115a4e3040 100644
> --- a/gcc/genmatch.cc
> +++ b/gcc/genmatch.cc
> @@ -209,7 +209,7 @@ output_line_directive (FILE *f, location_t location,
>        else
>  	fprintf (f, "%s:%d", file, loc.line);
>      }
> -  else
> +  else if (verbose == 2)
>      /* Other gen programs really output line directives here, at least for
>         development it's right now more convenient to have line information
>         from the generated file.  Still keep the directives as comment for now
> @@ -5221,6 +5221,7 @@ main (int argc, char **argv)
>      return 1;
>  
>    bool gimple = true;
> +  verbose = 0;

That's redundant - globals are default zero-initialized.

OK with removing this line.

Thanks,
Richard.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 2/5] match.pd: Remove commented out line pragmas unless -vv is used.
  2023-04-28 10:38 [PATCH 2/5] match.pd: Remove commented out line pragmas unless -vv is used Tamar Christina
  2023-04-28 11:49 ` Richard Biener
@ 2023-04-28 13:17 ` Paul Koning
  2023-04-28 14:02   ` Tamar Christina
  1 sibling, 1 reply; 4+ messages in thread
From: Paul Koning @ 2023-04-28 13:17 UTC (permalink / raw)
  To: Tamar Christina; +Cc: Hans-Peter Nilsson via Gcc-patches, nd, rguenther, jlaw

On the check for verbose==2, should that be verbose >= 2 ?

	paul

> On Apr 28, 2023, at 6:38 AM, Tamar Christina via Gcc-patches <gcc-patches@gcc.gnu.org> wrote:
> 
> Hi All,
> 
> genmatch currently outputs commented out line directives that have no effect
> but the compiler still has to parse only to discard.
> 
> They are however handy when debugging genmatch output.  As such this moves them
> behind the -vv flag.
> 
> Bootstrapped Regtested on aarch64-none-linux-gnu and no issues.
> 
> Ok for master?
> 
> Thanks,
> Tamar
> 
> gcc/ChangeLog:
> 
> 	PR bootstrap/84402
> 	* genmatch.cc (output_line_directive): Only emit commented directive
> 	when -vv.
> 	(main): Initialize verbose.
> 
> --- inline copy of patch -- 
> diff --git a/gcc/genmatch.cc b/gcc/genmatch.cc
> index 638606b2502f640e59527fc5a0b23fa3bedd0cee..6d62cdea2082d92e5ecc1102c80205115a4e3040 100644
> --- a/gcc/genmatch.cc
> +++ b/gcc/genmatch.cc
> @@ -209,7 +209,7 @@ output_line_directive (FILE *f, location_t location,
>       else
> 	fprintf (f, "%s:%d", file, loc.line);
>     }
> -  else
> +  else if (verbose == 2)
>     /* Other gen programs really output line directives here, at least for
>        development it's right now more convenient to have line information
>        from the generated file.  Still keep the directives as comment for now
> @@ -5221,6 +5221,7 @@ main (int argc, char **argv)
>     return 1;
> 
>   bool gimple = true;
> +  verbose = 0;
>   char *input = argv[argc-1];
>   for (int i = 1; i < argc - 1; ++i)
>     {
> 
> 
> 
> 
> -- 
> <rb17227.patch>


^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: [PATCH 2/5] match.pd: Remove commented out line pragmas unless -vv is used.
  2023-04-28 13:17 ` Paul Koning
@ 2023-04-28 14:02   ` Tamar Christina
  0 siblings, 0 replies; 4+ messages in thread
From: Tamar Christina @ 2023-04-28 14:02 UTC (permalink / raw)
  To: Paul Koning; +Cc: Hans-Peter Nilsson via Gcc-patches, nd, rguenther, jlaw

> On the check for verbose==2, should that be verbose >= 2 ?
> 

That's fair enough. Made the change.

Thanks,
Tamar.

> 	paul
> 
> > On Apr 28, 2023, at 6:38 AM, Tamar Christina via Gcc-patches <gcc-
> patches@gcc.gnu.org> wrote:
> >
> > Hi All,
> >
> > genmatch currently outputs commented out line directives that have no
> > effect but the compiler still has to parse only to discard.
> >
> > They are however handy when debugging genmatch output.  As such this
> > moves them behind the -vv flag.
> >
> > Bootstrapped Regtested on aarch64-none-linux-gnu and no issues.
> >
> > Ok for master?
> >
> > Thanks,
> > Tamar
> >
> > gcc/ChangeLog:
> >
> > 	PR bootstrap/84402
> > 	* genmatch.cc (output_line_directive): Only emit commented directive
> > 	when -vv.
> > 	(main): Initialize verbose.
> >
> > --- inline copy of patch --
> > diff --git a/gcc/genmatch.cc b/gcc/genmatch.cc index
> >
> 638606b2502f640e59527fc5a0b23fa3bedd0cee..6d62cdea2082d92e5ecc1
> 102c802
> > 05115a4e3040 100644
> > --- a/gcc/genmatch.cc
> > +++ b/gcc/genmatch.cc
> > @@ -209,7 +209,7 @@ output_line_directive (FILE *f, location_t location,
> >       else
> > 	fprintf (f, "%s:%d", file, loc.line);
> >     }
> > -  else
> > +  else if (verbose == 2)
> >     /* Other gen programs really output line directives here, at least for
> >        development it's right now more convenient to have line information
> >        from the generated file.  Still keep the directives as comment
> > for now @@ -5221,6 +5221,7 @@ main (int argc, char **argv)
> >     return 1;
> >
> >   bool gimple = true;
> > +  verbose = 0;
> >   char *input = argv[argc-1];
> >   for (int i = 1; i < argc - 1; ++i)
> >     {
> >
> >
> >
> >
> > --
> > <rb17227.patch>


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-04-28 14:03 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-28 10:38 [PATCH 2/5] match.pd: Remove commented out line pragmas unless -vv is used Tamar Christina
2023-04-28 11:49 ` Richard Biener
2023-04-28 13:17 ` Paul Koning
2023-04-28 14:02   ` Tamar Christina

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).