]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Improve wording for -freport-bug option.
authorMartin Liska <mliska@suse.cz>
Thu, 27 Jan 2022 10:22:42 +0000 (11:22 +0100)
committerMartin Liska <mliska@suse.cz>
Thu, 27 Jan 2022 12:34:29 +0000 (13:34 +0100)
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
gcc/diagnostic.h
gcc/opts.cc

index f5f43d5e9a7d60815adaaf781b343d343fb6adb4..10472046bdc13e77792d023564f2840e6cdd6fe8 100644 (file)
@@ -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.  */
index ccaa33b581721b1ef4b13071d5e816d40dff13b4..3ca32979dde5d4e52951f7fe49b67db11cfbc8c2 100644 (file)
@@ -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.  */
index f21c821ab2ea205c87cc63bd6192f809d1d4f1af..7d30deb8e4be661d19338dcde4a8b4e3426928fb 100644 (file)
@@ -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.  */