public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Improve wording for -freport-bug option.
@ 2022-01-27 10:37 Martin Liška
  2022-01-27 10:47 ` Jakub Jelinek
  0 siblings, 1 reply; 6+ messages in thread
From: Martin Liška @ 2022-01-27 10:37 UTC (permalink / raw)
  To: gcc-patches; +Cc: Richard Biener, Jakub Jelinek

Hi.

The patch addresses a few things related to ICE report:

- 'Internal compiler error: Error reporting routines re-entered.' - unify 'internal' wording
- I shortened:

'''
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://bugs.opensuse.org/> for instructions.
'''

- let's recommend using -freport-bug.

Now one can see:

$ ./xgcc -B. ~/Programming/testcases/pr100019.C -c
...
Please submit a full bug report, with preprocessed source (by using -freport-bug) and the complete backtrace.
See <https://gcc.gnu.org/bugs/> for instructions.

$ ./xgcc -B. ~/Programming/testcases/pr100019.C -c -freport-bug
...
Please submit a full bug report, with preprocessed source and the complete backtrace.
See <https://gcc.gnu.org/bugs/> for instructions.
Preprocessed source stored into /tmp/ccLgekCL.out file, please attach this to your bugreport.

Ready to be installed?
Thanks,
Martin


	PR web/104254

gcc/ChangeLog:

	* diagnostic.cc (diagnostic_initialize):
	Initialize report_bug flag.
	(diagnostic_action_after_output):
	Explain that -freport-bug option can be used for pre-processed
	file creation.  Make the message shorter.
	(error_recursion): Rename Internal to internal.
	* diagnostic.h (struct diagnostic_context): New field.
	* opts.cc (common_handle_option): Init the field here.
---
  gcc/diagnostic.cc | 20 +++++++++++---------
  gcc/diagnostic.h  |  3 +++
  gcc/opts.cc       |  4 ++++
  3 files changed, 18 insertions(+), 9 deletions(-)

diff --git a/gcc/diagnostic.cc b/gcc/diagnostic.cc
index f5f43d5e9a7..7acdee49551 100644
--- a/gcc/diagnostic.cc
+++ b/gcc/diagnostic.cc
@@ -219,6 +219,8 @@ diagnostic_initialize (diagnostic_context *context, int n_opts)
    context->show_line_numbers_p = false;
    context->min_margin_width = 0;
    context->show_ruler_p = false;
+  context->report_bug = false;
+
    if (const char *var = getenv ("GCC_EXTRA_DIAGNOSTIC_OUTPUT"))
      {
        if (!strcmp (var, "fixits-v1"))
@@ -665,12 +667,12 @@ diagnostic_action_after_output (diagnostic_context *context,
  	if (context->abort_on_error)
  	  real_abort ();
  
-	fnotice (stderr, "Please submit a full bug report,\n"
-		 "with preprocessed source if appropriate.\n");
-	if (count > 0)
-	  fnotice (stderr,
-		   ("Please include the complete backtrace "
-		    "with any bug report.\n"));
+	const char *details
+	  = context->report_bug ? "" : "(by using -freport-bug) ";
+	const char *ending = count > 0  ? "and the complete backtrace" : "";
+
+	fnotice (stderr, "\nPlease submit a full bug report, "
+		 "with preprocessed source %s%s.\n", details, ending);
  	fnotice (stderr, "See %s for instructions.\n", bug_report_url);
  
  	exit (ICE_EXIT_CODE);
@@ -1437,8 +1439,8 @@ num_digits (int value)
  
  /* Given a partial pathname as input, return another pathname that
     shares no directory elements with the pathname of __FILE__.  This
-   is used by fancy_abort() to print `Internal compiler error in expr.cc'
-   instead of `Internal compiler error in ../../GCC/gcc/expr.cc'.  */
+   is used by fancy_abort() to print `internal compiler error in expr.cc'
+   instead of `internal compiler error in ../../GCC/gcc/expr.cc'.  */
  
  const char *
  trim_filename (const char *name)
@@ -1988,7 +1990,7 @@ error_recursion (diagnostic_context *context)
      pp_newline_and_flush (context->printer);
  
    fnotice (stderr,
-	   "Internal compiler error: Error reporting routines re-entered.\n");
+	   "internal compiler error: Error reporting routines re-entered.\n");
  
    /* Call diagnostic_action_after_output to get the "please submit a bug
       report" message.  */
diff --git a/gcc/diagnostic.h b/gcc/diagnostic.h
index ccaa33b5817..3ca32979dde 100644
--- a/gcc/diagnostic.h
+++ b/gcc/diagnostic.h
@@ -340,6 +340,9 @@ struct diagnostic_context
       source output.  */
    bool show_ruler_p;
  
+  /* True if -freport-bug option is used.  */
+  bool report_bug;
+
    /* Used to specify additional diagnostic output to be emitted after the
       rest of the diagnostic.  This is for implementing
       -fdiagnostics-parseable-fixits and GCC_EXTRA_DIAGNOSTIC_OUTPUT.  */
diff --git a/gcc/opts.cc b/gcc/opts.cc
index f21c821ab2e..7d30deb8e4b 100644
--- a/gcc/opts.cc
+++ b/gcc/opts.cc
@@ -3158,6 +3158,10 @@ common_handle_option (struct gcc_options *opts,
  	dc->tabstop = value;
        break;
  
+    case OPT_freport_bug:
+      dc->report_bug = value;
+      break;
+
      default:
        /* If the flag was handled in a standard way, assume the lack of
  	 processing here is intentional.  */
-- 
2.34.1


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

* Re: [PATCH] Improve wording for -freport-bug option.
  2022-01-27 10:37 [PATCH] Improve wording for -freport-bug option Martin Liška
@ 2022-01-27 10:47 ` Jakub Jelinek
  2022-01-27 10:59   ` Martin Liška
  0 siblings, 1 reply; 6+ messages in thread
From: Jakub Jelinek @ 2022-01-27 10:47 UTC (permalink / raw)
  To: Martin Liška; +Cc: gcc-patches, Richard Biener

On Thu, Jan 27, 2022 at 11:37:29AM +0100, Martin Liška wrote:
> @@ -665,12 +667,12 @@ diagnostic_action_after_output (diagnostic_context *context,
>  	if (context->abort_on_error)
>  	  real_abort ();
> -	fnotice (stderr, "Please submit a full bug report,\n"
> -		 "with preprocessed source if appropriate.\n");
> -	if (count > 0)
> -	  fnotice (stderr,
> -		   ("Please include the complete backtrace "
> -		    "with any bug report.\n"));
> +	const char *details
> +	  = context->report_bug ? "" : "(by using -freport-bug) ";
> +	const char *ending = count > 0  ? "and the complete backtrace" : "";
> +
> +	fnotice (stderr, "\nPlease submit a full bug report, "
> +		 "with preprocessed source %s%s.\n", details, ending);

This is highly translation unfriendly.
You need to use separate full strings for all the different cases.

	Jakub


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

* Re: [PATCH] Improve wording for -freport-bug option.
  2022-01-27 10:47 ` Jakub Jelinek
@ 2022-01-27 10:59   ` Martin Liška
  2022-01-27 11:06     ` Jakub Jelinek
  0 siblings, 1 reply; 6+ messages in thread
From: Martin Liška @ 2022-01-27 10:59 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: gcc-patches, Richard Biener

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

On 1/27/22 11:47, Jakub Jelinek wrote:
> On Thu, Jan 27, 2022 at 11:37:29AM +0100, Martin Liška wrote:
>> @@ -665,12 +667,12 @@ diagnostic_action_after_output (diagnostic_context *context,
>>   	if (context->abort_on_error)
>>   	  real_abort ();
>> -	fnotice (stderr, "Please submit a full bug report,\n"
>> -		 "with preprocessed source if appropriate.\n");
>> -	if (count > 0)
>> -	  fnotice (stderr,
>> -		   ("Please include the complete backtrace "
>> -		    "with any bug report.\n"));
>> +	const char *details
>> +	  = context->report_bug ? "" : "(by using -freport-bug) ";
>> +	const char *ending = count > 0  ? "and the complete backtrace" : "";
>> +
>> +	fnotice (stderr, "\nPlease submit a full bug report, "
>> +		 "with preprocessed source %s%s.\n", details, ending);
> 
> This is highly translation unfriendly.
> You need to use separate full strings for all the different cases.
> 
> 	Jakub
> 

I see, there's updated version that should be fine.

$ ./xgcc -B. ~/Programming/testcases/pr100019.C -c
...
Please submit a full bug report, with preprocessed source (by using -freport-bug).
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

$ ./xgcc -B. ~/Programming/testcases/pr100019.C -c -freport-bug
...
Please submit a full bug report, with preprocessed source.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
Preprocessed source stored into /tmp/ccReyRI7.out file, please attach this to your bugreport.


Martin

[-- Attachment #2: 0001-Improve-wording-for-freport-bug-option.patch --]
[-- Type: text/x-patch, Size: 3897 bytes --]

From a438f0b40dfbc4580ce5de2a6fba004d1fdb3930 Mon Sep 17 00:00:00 2001
From: Martin Liska <mliska@suse.cz>
Date: Thu, 27 Jan 2022 11:22:42 +0100
Subject: [PATCH] Improve wording for -freport-bug option.

	PR web/104254

gcc/ChangeLog:

	* diagnostic.cc (diagnostic_initialize):
	Initialize report_bug flag.
	(diagnostic_action_after_output):
	Explain that -freport-bug option can be used for pre-processed
	file creation.  Make the message shorter.
	(error_recursion): Rename Internal to internal.
	* diagnostic.h (struct diagnostic_context): New field.
	* opts.cc (common_handle_option): Init the field here.
---
 gcc/diagnostic.cc | 22 ++++++++++++++--------
 gcc/diagnostic.h  |  3 +++
 gcc/opts.cc       |  4 ++++
 3 files changed, 21 insertions(+), 8 deletions(-)

diff --git a/gcc/diagnostic.cc b/gcc/diagnostic.cc
index f5f43d5e9a7..29f21a16afe 100644
--- a/gcc/diagnostic.cc
+++ b/gcc/diagnostic.cc
@@ -219,6 +219,8 @@ diagnostic_initialize (diagnostic_context *context, int n_opts)
   context->show_line_numbers_p = false;
   context->min_margin_width = 0;
   context->show_ruler_p = false;
+  context->report_bug = false;
+
   if (const char *var = getenv ("GCC_EXTRA_DIAGNOSTIC_OUTPUT"))
     {
       if (!strcmp (var, "fixits-v1"))
@@ -665,12 +667,16 @@ diagnostic_action_after_output (diagnostic_context *context,
 	if (context->abort_on_error)
 	  real_abort ();
 
-	fnotice (stderr, "Please submit a full bug report,\n"
-		 "with preprocessed source if appropriate.\n");
+	if (context->report_bug)
+	  fnotice (stderr, "\nPlease submit a full bug report, "
+		   "with preprocessed source.\n");
+	else
+	  fnotice (stderr, "\nPlease submit a full bug report, "
+		   "with preprocessed source (by using -freport-bug).\n");
+
 	if (count > 0)
-	  fnotice (stderr,
-		   ("Please include the complete backtrace "
-		    "with any bug report.\n"));
+	  fnotice (stderr, "Please include the complete backtrace "
+		   "with any bug report.\n");
 	fnotice (stderr, "See %s for instructions.\n", bug_report_url);
 
 	exit (ICE_EXIT_CODE);
@@ -1437,8 +1443,8 @@ num_digits (int value)
 
 /* Given a partial pathname as input, return another pathname that
    shares no directory elements with the pathname of __FILE__.  This
-   is used by fancy_abort() to print `Internal compiler error in expr.cc'
-   instead of `Internal compiler error in ../../GCC/gcc/expr.cc'.  */
+   is used by fancy_abort() to print `internal compiler error in expr.cc'
+   instead of `internal compiler error in ../../GCC/gcc/expr.cc'.  */
 
 const char *
 trim_filename (const char *name)
@@ -1988,7 +1994,7 @@ error_recursion (diagnostic_context *context)
     pp_newline_and_flush (context->printer);
 
   fnotice (stderr,
-	   "Internal compiler error: Error reporting routines re-entered.\n");
+	   "internal compiler error: Error reporting routines re-entered.\n");
 
   /* Call diagnostic_action_after_output to get the "please submit a bug
      report" message.  */
diff --git a/gcc/diagnostic.h b/gcc/diagnostic.h
index ccaa33b5817..3ca32979dde 100644
--- a/gcc/diagnostic.h
+++ b/gcc/diagnostic.h
@@ -340,6 +340,9 @@ struct diagnostic_context
      source output.  */
   bool show_ruler_p;
 
+  /* True if -freport-bug option is used.  */
+  bool report_bug;
+
   /* Used to specify additional diagnostic output to be emitted after the
      rest of the diagnostic.  This is for implementing
      -fdiagnostics-parseable-fixits and GCC_EXTRA_DIAGNOSTIC_OUTPUT.  */
diff --git a/gcc/opts.cc b/gcc/opts.cc
index f21c821ab2e..7d30deb8e4b 100644
--- a/gcc/opts.cc
+++ b/gcc/opts.cc
@@ -3158,6 +3158,10 @@ common_handle_option (struct gcc_options *opts,
 	dc->tabstop = value;
       break;
 
+    case OPT_freport_bug:
+      dc->report_bug = value;
+      break;
+
     default:
       /* If the flag was handled in a standard way, assume the lack of
 	 processing here is intentional.  */
-- 
2.34.1


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

* Re: [PATCH] Improve wording for -freport-bug option.
  2022-01-27 10:59   ` Martin Liška
@ 2022-01-27 11:06     ` Jakub Jelinek
  2022-01-27 11:38       ` Martin Liška
  0 siblings, 1 reply; 6+ messages in thread
From: Jakub Jelinek @ 2022-01-27 11:06 UTC (permalink / raw)
  To: Martin Liška; +Cc: gcc-patches, Richard Biener

On Thu, Jan 27, 2022 at 11:59:51AM +0100, Martin Liška wrote:
> @@ -1988,7 +1994,7 @@ error_recursion (diagnostic_context *context)
>      pp_newline_and_flush (context->printer);
>  
>    fnotice (stderr,
> -	   "Internal compiler error: Error reporting routines re-entered.\n");
> +	   "internal compiler error: Error reporting routines re-entered.\n");

Why do we capitalize the "E" in there?
Looking for internal_error calls, I think we mostly use lower case after
"internal compiler error: ", except for some cases where it should be
capitalized like "SSA corruption" etc., but
varasm.cc:	internal_error ("Section already exists: %qs", name);
looks wrong.

	Jakub


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

* Re: [PATCH] Improve wording for -freport-bug option.
  2022-01-27 11:06     ` Jakub Jelinek
@ 2022-01-27 11:38       ` Martin Liška
  2022-01-27 11:49         ` Jakub Jelinek
  0 siblings, 1 reply; 6+ messages in thread
From: Martin Liška @ 2022-01-27 11:38 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: gcc-patches, Richard Biener

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

On 1/27/22 12:06, Jakub Jelinek wrote:
> On Thu, Jan 27, 2022 at 11:59:51AM +0100, Martin Liška wrote:
>> @@ -1988,7 +1994,7 @@ error_recursion (diagnostic_context *context)
>>       pp_newline_and_flush (context->printer);
>>   
>>     fnotice (stderr,
>> -	   "Internal compiler error: Error reporting routines re-entered.\n");
>> +	   "internal compiler error: Error reporting routines re-entered.\n");
> 
> Why do we capitalize the "E" in there?

That should not be capitalized. Fixed in attached patch.

> Looking for internal_error calls, I think we mostly use lower case after
> "internal compiler error: ", except for some cases where it should be
> capitalized like "SSA corruption" etc., but
> varasm.cc:	internal_error ("Section already exists: %qs", name);
> looks wrong.

Yep, we have many more examples where a leading capital letter is used:

gcc/config/cris/cris.cc:      internal_error ("MULT case in %<cris_op_str%>");
gcc/config/cris/cris.h: do { if (!(x)) internal_error ("CRIS-port assertion failed: %s", #x); } while (0)
gcc/config/mmix/mmix.cc:    internal_error ("MMIX Internal: Last named vararg would not fit in a register");
gcc/config/mmix/mmix.cc:        internal_error ("MMIX Internal: Bad register: %d", regno);
gcc/config/mmix/mmix.cc:        internal_error ("MMIX Internal: Bad register: %d", regno);
gcc/config/mmix/mmix.cc:      internal_error ("MMIX Internal: Missing %qc case in %<mmix_print_operand%>", code);
gcc/config/mmix/mmix.cc:        internal_error ("MMIX Internal: Bad register: %d", regno);
gcc/config/mmix/mmix.cc:      internal_error ("MMIX Internal: %s is not a shiftable integer", s);
gcc/config/mmix/mmix.cc:      internal_error ("MMIX Internal: %s is not a shiftable integer", s);
gcc/config/rs6000/host-darwin.cc:  internal_error ("Segmentation Fault (code)");
gcc/config/rs6000/host-darwin.cc:  internal_error ("Segmentation Fault");
gcc/d/decl.cc:    internal_error ("Mismatch between declaration %qE size (%wd) and "
gcc/fortran/arith.cc:   gfc_internal_error ("Fix min_int calculation");
gcc/fortran/data.cc:      gfc_internal_error ("TODO: Vector sections in data statements");
gcc/fortran/decl.cc:                gfc_internal_error ("Cannot set pointee array spec.");
gcc/fortran/decl.cc:      gfc_internal_error ("Missing symbol");
gcc/fortran/decl.cc:        gfc_internal_error ("Cannot set Cray pointee array spec.");
gcc/fortran/decl.cc:      gfc_internal_error ("Failed to create structure type '%s' at %C", name);
gcc/fortran/frontend-passes.cc: gfc_internal_error ("Illegal id in copy_walk_reduction_arg");
gcc/fortran/frontend-passes.cc:       gfc_internal_error ("Scalarization using DIMEN_RANGE unimplemented");
gcc/fortran/interface.cc:  gfc_internal_error ("Unable to find symbol %qs", sym->name);
gcc/fortran/intrinsic.cc:      gfc_internal_error ("Invalid standard code on intrinsic %qs (%d)",
gcc/fortran/intrinsic.cc:  gfc_internal_error ("Cannot convert %qs to %qs at %L", type_name,
gcc/fortran/simplify.cc:        gfc_internal_error ("IBITS: Bad bit");
gcc/fortran/simplify.cc:        gfc_internal_error ("Reshaped array too large at %C");
gcc/fortran/simplify.cc:        gfc_internal_error ("Bad type in gfc_simplify_sign");
gcc/fortran/simplify.cc:        gfc_internal_error ("Failure getting length of a constant array.");
gcc/fortran/simplify.cc:    gfc_internal_error ("Failure getting length of a constant array.");
gcc/fortran/target-memory.cc:      gfc_internal_error ("Invalid expression in gfc_element_size.");
gcc/fortran/target-memory.cc:      gfc_internal_error ("Invalid expression in gfc_target_encode_expr.");
gcc/fortran/target-memory.cc:      gfc_internal_error ("Invalid expression in gfc_target_interpret_expr.");
gcc/fortran/trans-intrinsic.cc:      gfc_internal_error ("Intrinsic function %qs (%d) not recognized",
gcc/fortran/trans-io.cc:      gfc_internal_error ("Bad IO basetype (%d)", ts->type);
gcc/ipa-sra.cc:      internal_error ("IPA-SRA access verification failed");
gcc/ipa-sra.cc: internal_error ("Function %qs, parameter %u, has IPA-SRA accesses "
gcc/ipa-sra.cc: internal_error ("Function %s, parameter %u, is used but does not "
gcc/rtl.cc:  internal_error ("RTL check: expected code '%s', have '%s' in %s, at %s:%d",
gcc/tree-into-ssa.cc:           internal_error ("SSA corruption");
gcc/tree-outof-ssa.cc:                internal_error ("SSA corruption");
gcc/tree-ssa-coalesce.cc:  internal_error ("SSA corruption");
gcc/varasm.cc:  internal_error ("Section already exists: %qs", name);

I can prepare a separate patch for next stage1 if you want?

Thanks,
Martin

> 
> 	Jakub
> 

[-- Attachment #2: 0001-Improve-wording-for-freport-bug-option.patch --]
[-- Type: text/x-patch, Size: 3897 bytes --]

From 6126a82dea18c849e0440a9f5cded8f2a7c65f14 Mon Sep 17 00:00:00 2001
From: Martin Liska <mliska@suse.cz>
Date: Thu, 27 Jan 2022 11:22:42 +0100
Subject: [PATCH] Improve wording for -freport-bug option.

	PR web/104254

gcc/ChangeLog:

	* diagnostic.cc (diagnostic_initialize):
	Initialize report_bug flag.
	(diagnostic_action_after_output):
	Explain that -freport-bug option can be used for pre-processed
	file creation.  Make the message shorter.
	(error_recursion): Rename Internal to internal.
	* diagnostic.h (struct diagnostic_context): New field.
	* opts.cc (common_handle_option): Init the field here.
---
 gcc/diagnostic.cc | 22 ++++++++++++++--------
 gcc/diagnostic.h  |  3 +++
 gcc/opts.cc       |  4 ++++
 3 files changed, 21 insertions(+), 8 deletions(-)

diff --git a/gcc/diagnostic.cc b/gcc/diagnostic.cc
index f5f43d5e9a7..10472046bdc 100644
--- a/gcc/diagnostic.cc
+++ b/gcc/diagnostic.cc
@@ -219,6 +219,8 @@ diagnostic_initialize (diagnostic_context *context, int n_opts)
   context->show_line_numbers_p = false;
   context->min_margin_width = 0;
   context->show_ruler_p = false;
+  context->report_bug = false;
+
   if (const char *var = getenv ("GCC_EXTRA_DIAGNOSTIC_OUTPUT"))
     {
       if (!strcmp (var, "fixits-v1"))
@@ -665,12 +667,16 @@ diagnostic_action_after_output (diagnostic_context *context,
 	if (context->abort_on_error)
 	  real_abort ();
 
-	fnotice (stderr, "Please submit a full bug report,\n"
-		 "with preprocessed source if appropriate.\n");
+	if (context->report_bug)
+	  fnotice (stderr, "\nPlease submit a full bug report, "
+		   "with preprocessed source.\n");
+	else
+	  fnotice (stderr, "\nPlease submit a full bug report, "
+		   "with preprocessed source (by using -freport-bug).\n");
+
 	if (count > 0)
-	  fnotice (stderr,
-		   ("Please include the complete backtrace "
-		    "with any bug report.\n"));
+	  fnotice (stderr, "Please include the complete backtrace "
+		   "with any bug report.\n");
 	fnotice (stderr, "See %s for instructions.\n", bug_report_url);
 
 	exit (ICE_EXIT_CODE);
@@ -1437,8 +1443,8 @@ num_digits (int value)
 
 /* Given a partial pathname as input, return another pathname that
    shares no directory elements with the pathname of __FILE__.  This
-   is used by fancy_abort() to print `Internal compiler error in expr.cc'
-   instead of `Internal compiler error in ../../GCC/gcc/expr.cc'.  */
+   is used by fancy_abort() to print `internal compiler error in expr.cc'
+   instead of `internal compiler error in ../../GCC/gcc/expr.cc'.  */
 
 const char *
 trim_filename (const char *name)
@@ -1988,7 +1994,7 @@ error_recursion (diagnostic_context *context)
     pp_newline_and_flush (context->printer);
 
   fnotice (stderr,
-	   "Internal compiler error: Error reporting routines re-entered.\n");
+	   "internal compiler error: error reporting routines re-entered.\n");
 
   /* Call diagnostic_action_after_output to get the "please submit a bug
      report" message.  */
diff --git a/gcc/diagnostic.h b/gcc/diagnostic.h
index ccaa33b5817..3ca32979dde 100644
--- a/gcc/diagnostic.h
+++ b/gcc/diagnostic.h
@@ -340,6 +340,9 @@ struct diagnostic_context
      source output.  */
   bool show_ruler_p;
 
+  /* True if -freport-bug option is used.  */
+  bool report_bug;
+
   /* Used to specify additional diagnostic output to be emitted after the
      rest of the diagnostic.  This is for implementing
      -fdiagnostics-parseable-fixits and GCC_EXTRA_DIAGNOSTIC_OUTPUT.  */
diff --git a/gcc/opts.cc b/gcc/opts.cc
index f21c821ab2e..7d30deb8e4b 100644
--- a/gcc/opts.cc
+++ b/gcc/opts.cc
@@ -3158,6 +3158,10 @@ common_handle_option (struct gcc_options *opts,
 	dc->tabstop = value;
       break;
 
+    case OPT_freport_bug:
+      dc->report_bug = value;
+      break;
+
     default:
       /* If the flag was handled in a standard way, assume the lack of
 	 processing here is intentional.  */
-- 
2.34.1


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

* Re: [PATCH] Improve wording for -freport-bug option.
  2022-01-27 11:38       ` Martin Liška
@ 2022-01-27 11:49         ` Jakub Jelinek
  0 siblings, 0 replies; 6+ messages in thread
From: Jakub Jelinek @ 2022-01-27 11:49 UTC (permalink / raw)
  To: Martin Liška; +Cc: gcc-patches, Richard Biener

On Thu, Jan 27, 2022 at 12:38:47PM +0100, Martin Liška wrote:
> Yep, we have many more examples where a leading capital letter is used:
> 
> gcc/config/cris/cris.cc:      internal_error ("MULT case in %<cris_op_str%>");
> gcc/config/cris/cris.h: do { if (!(x)) internal_error ("CRIS-port assertion failed: %s", #x); } while (0)
> gcc/config/mmix/mmix.cc:    internal_error ("MMIX Internal: Last named vararg would not fit in a register");
> gcc/config/mmix/mmix.cc:        internal_error ("MMIX Internal: Bad register: %d", regno);
> gcc/config/mmix/mmix.cc:        internal_error ("MMIX Internal: Bad register: %d", regno);
> gcc/config/mmix/mmix.cc:      internal_error ("MMIX Internal: Missing %qc case in %<mmix_print_operand%>", code);
> gcc/config/mmix/mmix.cc:        internal_error ("MMIX Internal: Bad register: %d", regno);
> gcc/config/mmix/mmix.cc:      internal_error ("MMIX Internal: %s is not a shiftable integer", s);
> gcc/config/mmix/mmix.cc:      internal_error ("MMIX Internal: %s is not a shiftable integer", s);
> gcc/config/rs6000/host-darwin.cc:  internal_error ("Segmentation Fault (code)");
> gcc/config/rs6000/host-darwin.cc:  internal_error ("Segmentation Fault");
> gcc/d/decl.cc:    internal_error ("Mismatch between declaration %qE size (%wd) and "
> gcc/fortran/arith.cc:   gfc_internal_error ("Fix min_int calculation");
> gcc/fortran/data.cc:      gfc_internal_error ("TODO: Vector sections in data statements");
> gcc/fortran/decl.cc:                gfc_internal_error ("Cannot set pointee array spec.");
> gcc/fortran/decl.cc:      gfc_internal_error ("Missing symbol");
> gcc/fortran/decl.cc:        gfc_internal_error ("Cannot set Cray pointee array spec.");
> gcc/fortran/decl.cc:      gfc_internal_error ("Failed to create structure type '%s' at %C", name);
> gcc/fortran/frontend-passes.cc: gfc_internal_error ("Illegal id in copy_walk_reduction_arg");
> gcc/fortran/frontend-passes.cc:       gfc_internal_error ("Scalarization using DIMEN_RANGE unimplemented");
> gcc/fortran/interface.cc:  gfc_internal_error ("Unable to find symbol %qs", sym->name);
> gcc/fortran/intrinsic.cc:      gfc_internal_error ("Invalid standard code on intrinsic %qs (%d)",
> gcc/fortran/intrinsic.cc:  gfc_internal_error ("Cannot convert %qs to %qs at %L", type_name,
> gcc/fortran/simplify.cc:        gfc_internal_error ("IBITS: Bad bit");
> gcc/fortran/simplify.cc:        gfc_internal_error ("Reshaped array too large at %C");
> gcc/fortran/simplify.cc:        gfc_internal_error ("Bad type in gfc_simplify_sign");
> gcc/fortran/simplify.cc:        gfc_internal_error ("Failure getting length of a constant array.");
> gcc/fortran/simplify.cc:    gfc_internal_error ("Failure getting length of a constant array.");
> gcc/fortran/target-memory.cc:      gfc_internal_error ("Invalid expression in gfc_element_size.");
> gcc/fortran/target-memory.cc:      gfc_internal_error ("Invalid expression in gfc_target_encode_expr.");
> gcc/fortran/target-memory.cc:      gfc_internal_error ("Invalid expression in gfc_target_interpret_expr.");
> gcc/fortran/trans-intrinsic.cc:      gfc_internal_error ("Intrinsic function %qs (%d) not recognized",
> gcc/fortran/trans-io.cc:      gfc_internal_error ("Bad IO basetype (%d)", ts->type);
> gcc/ipa-sra.cc:      internal_error ("IPA-SRA access verification failed");
> gcc/ipa-sra.cc: internal_error ("Function %qs, parameter %u, has IPA-SRA accesses "
> gcc/ipa-sra.cc: internal_error ("Function %s, parameter %u, is used but does not "
> gcc/rtl.cc:  internal_error ("RTL check: expected code '%s', have '%s' in %s, at %s:%d",
> gcc/tree-into-ssa.cc:           internal_error ("SSA corruption");
> gcc/tree-outof-ssa.cc:                internal_error ("SSA corruption");
> gcc/tree-ssa-coalesce.cc:  internal_error ("SSA corruption");
> gcc/varasm.cc:  internal_error ("Section already exists: %qs", name);
> 
> I can prepare a separate patch for next stage1 if you want?

Ok.  MMIX, MULT, CRIS, IPA-SRA, SSA all look desirable to be
capitalized.  And I'd leave out gcc/fortran/, it has very different rules
and I think generally capitalizes diagnostics.

> 	PR web/104254
> 
> gcc/ChangeLog:
> 
> 	* diagnostic.cc (diagnostic_initialize):
> 	Initialize report_bug flag.
> 	(diagnostic_action_after_output):
> 	Explain that -freport-bug option can be used for pre-processed
> 	file creation.  Make the message shorter.
> 	(error_recursion): Rename Internal to internal.
> 	* diagnostic.h (struct diagnostic_context): New field.
> 	* opts.cc (common_handle_option): Init the field here.

Ok, thanks.

	Jakub


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

end of thread, other threads:[~2022-01-27 11:49 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-27 10:37 [PATCH] Improve wording for -freport-bug option Martin Liška
2022-01-27 10:47 ` Jakub Jelinek
2022-01-27 10:59   ` Martin Liška
2022-01-27 11:06     ` Jakub Jelinek
2022-01-27 11:38       ` Martin Liška
2022-01-27 11:49         ` Jakub Jelinek

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).