]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
diagnostics: enable nested diagnostics by default [PR116253]
authorDavid Malcolm <dmalcolm@redhat.com>
Fri, 8 Aug 2025 20:55:46 +0000 (16:55 -0400)
committerDavid Malcolm <dmalcolm@redhat.com>
Fri, 8 Aug 2025 20:55:46 +0000 (16:55 -0400)
In GCC 15 I added an experimental nesting view in text sinks
for hierarchical diagnostics, such as C++ template problems.

This patch enables it for text sinks by default.  The old
behavior can be restored via -fno-diagnostics-show-nesting,
which the patch also adds to -fdiagnostics-plain-output.

The patch does not yet enable it for text sinks in sarif-replay.

gcc/ChangeLog:
PR diagnostics/116253
* common.opt (fdiagnostics-show-nesting): New option.
(fdiagnostics-show-nesting-locations): New option.
(fdiagnostics-show-nesting-levels): New option.
* common.opt.urls: Regenerate.
* diagnostics/context.cc (context::set_show_nesting): New.
(context::set_show_nesting_locations): New.
(context::set_show_nesting_levels): New.
* diagnostics/context.h (context::set_show_nesting): New decl.
(context::set_show_nesting_locations): New decl.
(context::set_show_nesting_levels): New decl.
* diagnostics/html-sink.cc: Tweak comment.
* diagnostics/output-spec.cc (text_scheme_handler::make_sink):
Rename "experimental-nesting" to "show-nesting" and enable by
default.  Rename "experimental-nesting-show-locations" to
"show-nesting-locations".  Rename
"experimental-nesting-show-levels" to "show-nesting-levels".
* diagnostics/sink.h (sink::dyn_cast_text_sink): New.
* diagnostics/text-sink.h (text_sink::dyn_cast_text_sink): New.
* doc/invoke.texi: Add -fdiagnostics-show-nesting,
-fdiagnostics-show-nesting-locations, and
-fdiagnostics-show-nesting-levels.  Update for changes to
output-spec.cc above.
* lto-wrapper.cc (merge_and_complain): Ignore
OPT_fdiagnostics_show_nesting,
OPT_fdiagnostics_show_nesting_locations, and
OPT_fdiagnostics_show_nesting_levels.
(append_compiler_options): Likewise.
(append_diag_options): Likewise.
* opts-common.cc (decode_cmdline_options_to_array): Add
"-fno-diagnostics-show-nesting" to -fdiagnostics-plain-output.
* opts.cc (common_handle_option): Handle the new options.
(gen_command_line_string): Ignore the new options.
* toplev.cc (general_init): Call set_show_nesting,
set_show_nesting_locations, and set_show_nesting_levels on
global_dc.

gcc/testsuite/ChangeLog:
PR diagnostics/116253
* g++.dg/concepts/nested-diagnostics-1-truncated.C: Update for
renamed keys to -fdiagnostics-set-output=text
* g++.dg/concepts/nested-diagnostics-1.C: Likewise.
* g++.dg/concepts/nested-diagnostics-2.C: Likewise.
* gcc.dg/plugin/diagnostic-test-nesting-no-show-nesting.c: New
test.
* gcc.dg/plugin/diagnostic-test-nesting-show-nesting.c: New test.
* gcc.dg/plugin/diagnostic-test-nesting-text-indented-show-levels.c:
Update for renamed keys to -fdiagnostics-set-output=text.
* gcc.dg/plugin/diagnostic-test-nesting-text-indented-unicode.c:
Likewise.
* gcc.dg/plugin/diagnostic-test-nesting-text-indented.c: Likewise.
* gcc.dg/plugin/plugin.exp: Add the new tests.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
22 files changed:
gcc/common.opt
gcc/common.opt.urls
gcc/diagnostics/context.cc
gcc/diagnostics/context.h
gcc/diagnostics/html-sink.cc
gcc/diagnostics/output-spec.cc
gcc/diagnostics/sink.h
gcc/diagnostics/text-sink.h
gcc/doc/invoke.texi
gcc/lto-wrapper.cc
gcc/opts-common.cc
gcc/opts.cc
gcc/testsuite/g++.dg/concepts/nested-diagnostics-1-truncated.C
gcc/testsuite/g++.dg/concepts/nested-diagnostics-1.C
gcc/testsuite/g++.dg/concepts/nested-diagnostics-2.C
gcc/testsuite/gcc.dg/plugin/diagnostic-test-nesting-no-show-nesting.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/plugin/diagnostic-test-nesting-show-nesting.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/plugin/diagnostic-test-nesting-text-indented-show-levels.c
gcc/testsuite/gcc.dg/plugin/diagnostic-test-nesting-text-indented-unicode.c
gcc/testsuite/gcc.dg/plugin/diagnostic-test-nesting-text-indented.c
gcc/testsuite/gcc.dg/plugin/plugin.exp
gcc/toplev.cc

index bf38f60d194ba6abf7787beb4ba5049504d63aaa..c58ac135ff71181aadd5b3e4c78afcef16a3bd3b 100644 (file)
@@ -1620,6 +1620,18 @@ fdiagnostics-minimum-margin-width=
 Common Joined UInteger Var(diagnostics_minimum_margin_width) Init(6)
 Set minimum width of left margin of source code when showing source.
 
+fdiagnostics-show-nesting
+Common Var(flag_diagnostics_show_nesting) Init(1)
+Use indentation to show nesting of diagnostics in text output.
+
+fdiagnostics-show-nesting-locations
+Common Var(flag_diagnostics_show_nesting_locations) Init(1)
+Show location information when showing nested diagnostics.
+
+fdiagnostics-show-nesting-levels
+Common Var(flag_diagnostics_show_nesting_levels) Init(0)
+Show nesting levels as numbers when showing nested diagnostics.
+
 fdisable-
 Common Joined RejectNegative Var(common_deferred_options) Defer
 -fdisable-[tree|rtl|ipa]-<pass>=range1+range2  Disable an optimization pass.
index 38dd9d3175980bd0242e02fa59ebc0e4a6d9e389..0bc36c483d3b58ee0c214e4300e24d4d9b01e4ec 100644 (file)
@@ -640,6 +640,15 @@ UrlSuffix(gcc/Diagnostic-Message-Formatting-Options.html#index-fdiagnostics-text
 fdiagnostics-minimum-margin-width=
 UrlSuffix(gcc/Diagnostic-Message-Formatting-Options.html#index-fdiagnostics-minimum-margin-width)
 
+fdiagnostics-show-nesting
+UrlSuffix(gcc/Diagnostic-Message-Formatting-Options.html#index-fdiagnostics-show-nesting)
+
+fdiagnostics-show-nesting-locations
+UrlSuffix(gcc/Diagnostic-Message-Formatting-Options.html#index-fdiagnostics-show-nesting-locations)
+
+fdiagnostics-show-nesting-levels
+UrlSuffix(gcc/Diagnostic-Message-Formatting-Options.html#index-fdiagnostics-show-nesting-levels)
+
 fdisable-
 UrlSuffix(gcc/Developer-Options.html#index-fdisable-)
 
index e127c8fa4d23072b360944301bf1d8027443352e..c948246e55db65b48ccf08d3e03e36c28f23e8db 100644 (file)
@@ -288,6 +288,33 @@ context::urls_init (int value)
        (m_reference_printer->get_url_format ());
 }
 
+void
+context::set_show_nesting (bool val)
+{
+  for (auto sink_ : m_sinks)
+    if (sink_->follows_reference_printer_p ())
+      if (auto text_sink_ = sink_->dyn_cast_text_sink ())
+       text_sink_->set_show_nesting (val);
+}
+
+void
+context::set_show_nesting_locations (bool val)
+{
+  for (auto sink_ : m_sinks)
+    if (sink_->follows_reference_printer_p ())
+      if (auto text_sink_ = sink_->dyn_cast_text_sink ())
+       text_sink_->set_show_locations_in_nesting (val);
+}
+
+void
+context::set_show_nesting_levels (bool val)
+{
+  for (auto sink_ : m_sinks)
+    if (sink_->follows_reference_printer_p ())
+      if (auto text_sink_ = sink_->dyn_cast_text_sink ())
+       text_sink_->set_show_nesting_levels (val);
+}
+
 /* Create the file_cache, if not already created, and tell it how to
    translate files on input.  */
 void
index df44a9b0212eca464af74cc702bd05ab50a42718..dea4588f96e2d78f6f3a12521af141a45adcfdc8 100644 (file)
@@ -392,6 +392,9 @@ public:
   }
   void set_show_path_depths (bool val) { m_show_path_depths = val; }
   void set_show_option_requested (bool val) { m_show_option_requested = val; }
+  void set_show_nesting (bool val);
+  void set_show_nesting_locations (bool val);
+  void set_show_nesting_levels (bool val);
   void set_max_errors (int val) { m_max_errors = val; }
   void set_escape_format (enum diagnostics_escape_format val)
   {
index 9309bd63328037fd923ae15931e61f56c1133962..448d4613e9054ba1c8e1f29cd23aa7cce8123a4c 100644 (file)
@@ -560,7 +560,7 @@ html_builder::on_report_diagnostic (const diagnostic_info &diagnostic,
     }
 }
 
-// For ease of comparison with experimental-nesting-show-levels=yes
+// For ease of comparison with show-nesting-levels=yes
 
 static void
 add_nesting_level_attr (xml::element &element,
index 83f128cc536b7b6ad282b162523b376e21133547..13565f989b83b75b307282f562fe982e0bff1598 100644 (file)
@@ -368,7 +368,7 @@ text_scheme_handler::make_sink (const context &ctxt,
                                const scheme_name_and_params &parsed_arg) const
 {
   bool show_color = pp_show_color (dc.get_reference_printer ());
-  bool show_nesting = false;
+  bool show_nesting = true;
   bool show_locations_in_nesting = true;
   bool show_levels = false;
   for (auto& iter : parsed_arg.m_kvs)
@@ -381,21 +381,21 @@ text_scheme_handler::make_sink (const context &ctxt,
            return nullptr;
          continue;
        }
-      if (key == "experimental-nesting")
+      if (key == "show-nesting")
        {
          if (!parse_bool_value (ctxt, unparsed_arg, key, value,
                                 show_nesting))
            return nullptr;
          continue;
        }
-      if (key == "experimental-nesting-show-locations")
+      if (key == "show-nesting-locations")
        {
          if (!parse_bool_value (ctxt, unparsed_arg, key, value,
                                 show_locations_in_nesting))
            return nullptr;
          continue;
        }
-      if (key == "experimental-nesting-show-levels")
+      if (key == "show-nesting-levels")
        {
          if (!parse_bool_value (ctxt, unparsed_arg, key, value, show_levels))
            return nullptr;
@@ -405,9 +405,9 @@ text_scheme_handler::make_sink (const context &ctxt,
       /* Key not found.  */
       auto_vec<const char *> known_keys;
       known_keys.safe_push ("color");
-      known_keys.safe_push ("experimental-nesting");
-      known_keys.safe_push ("experimental-nesting-show-locations");
-      known_keys.safe_push ("experimental-nesting-show-levels");
+      known_keys.safe_push ("show-nesting");
+      known_keys.safe_push ("show-nesting-locations");
+      known_keys.safe_push ("show-nesting-levels");
       ctxt.report_unknown_key (unparsed_arg, key, get_scheme_name (),
                               known_keys);
       return nullptr;
index e1a3790b3fc2ad626afd0107580b4c8758778f07..24eb70761fd1c2ca512497fcd253766594e2b606 100644 (file)
@@ -36,6 +36,8 @@ class sink
 public:
   virtual ~sink () {}
 
+  virtual text_sink *dyn_cast_text_sink () { return nullptr; }
+
   virtual void dump_kind (FILE *out) const = 0;
   virtual void dump (FILE *out, int indent) const;
 
index e567ec8211065c1af6b96bddd11b47c914ce45f1..f280e72cb4e0f1aaec5b4eb3fe4978ee9161a841 100644 (file)
@@ -51,6 +51,8 @@ public:
   {}
   ~text_sink ();
 
+  text_sink *dyn_cast_text_sink () final override { return this; }
+
   void dump_kind (FILE *out) const override
   {
     fprintf (out, "text_sink");
index 33ae98c40afb31f4ad7efaa9972dfec9db2b75d9..28466c449b9f0c1f9fcaa53e392f65eb86d3e52d 100644 (file)
@@ -322,6 +322,9 @@ Objective-C and Objective-C++ Dialects}.
 -fno-diagnostics-show-cwe
 -fno-diagnostics-show-rules
 -fno-diagnostics-show-highlight-colors
+-fno-diagnostics-show-nesting
+-fno-diagnostics-show-nesting-locations
+-fdiagnostics-show-nesting-levels
 -fdiagnostics-minimum-margin-width=@var{width}
 -fdiagnostics-parseable-fixits  -fdiagnostics-generate-patch
 -fdiagnostics-show-template-tree  -fno-elide-type
@@ -5429,7 +5432,8 @@ options:
 -fdiagnostics-urls=never
 -fdiagnostics-path-format=separate-events
 -fdiagnostics-text-art-charset=none
--fno-diagnostics-show-event-links}
+-fno-diagnostics-show-event-links
+-fno-diagnostics-show-nesting}
 In the future, if GCC changes the default appearance of its diagnostics, the
 corresponding option to disable the new behavior will be added to this list.
 
@@ -6051,6 +6055,40 @@ emoji variant of the character).
 The default is @samp{emoji}, except when the environment variable @env{LANG}
 is set to @samp{C}, in which case the default is @samp{ascii}.
 
+@opindex fno-diagnostics-show-nesting
+@opindex fdiagnostics-show-nesting
+@item -fno-diagnostics-show-nesting
+Some GCC diagnostics have an internal tree-like structure of nested
+sub-diagnostics, such as for problems when instantiating C++ templates.
+
+By default GCC uses indentation and bullet points in its text output to
+show the nesting structure of these diagnostics, moves location
+information to separate lines to make the structure clearer, and
+eliminates redundant repeated information.
+
+Selecting @option{-fno-diagnostics-show-nesting} suppresses this
+indentation, reformatting, and elision, restoring an older `look'' for the
+diagnostics.
+
+@opindex fno-diagnostics-show-nesting-locations
+@opindex fdiagnostics-show-nesting-locations
+@item -fno-diagnostics-show-nesting-locations
+
+When @option{fdiagnostics-show-nesting} is enabled, file names and
+line- and column- numbers are displayed on separate lines from the
+messages.  This location information can be disabled altogether with
+@option{-fno-diagnostics-show-nesting-locations}.
+This option exists for use by GCC developers, for writing DejaGnu test cases.
+
+@opindex fdiagnostics-show-nesting-levels
+@opindex fno-diagnostics-show-nesting-levels
+@item -fdiagnostics-show-nesting-levels
+When @option{fdiagnostics-show-nesting} is enabled, use
+@option{fdiagnostics-show-nesting-levels} to also display numbers
+showing the depth of the nesting.
+This option exists for use by GCC developers for debugging nested
+diagnostics, but may be of use to plugin authors.
+
 @opindex fdiagnostics-format
 @item -fdiagnostics-format=@var{FORMAT}
 Select a different format for printing diagnostics.
@@ -6099,18 +6137,18 @@ Supported keys are:
 Override colorization settings from @option{-fdiagnostics-color} for this
 text output.
 
-@item experimental-nesting=@r{[}yes@r{|}no@r{]}
-Enable an experimental mode that emphasizes hierarchical relationships
-within diagnostics messages, displaying location information on separate
-lines.
+@item show-nesting=@r{[}yes@r{|}no@r{]}
+Enable a mode that emphasizes hierarchical relationships
+within diagnostics messages, as per @option{-fdiagnostics-show-nesting}.
+Defaults to @code{yes}.
 
-@item experimental-nesting-show-locations=@r{[}yes@r{|}no@r{]}
-If @code{experimental-nesting=yes}, then by default locations are
+@item show-nesting-locations=@r{[}yes@r{|}no@r{]}
+If @code{show-nesting=yes}, then by default locations are
 shown; set this key to @code{no} to disable printing such locations.
 This exists for use by GCC developers, for writing DejaGnu test cases.
 
-@item experimental-nesting-show-levels=@r{[}yes@r{|}no@r{]}
-This is a debugging option for use with @code{experimental-nesting=yes}.
+@item show-nesting-levels=@r{[}yes@r{|}no@r{]}
+This is a debugging option for use with @code{show-nesting=yes}.
 Set this key to @code{yes} to print explicit nesting levels in the output.
 This exists for use by GCC developers.
 
index 03fca978645e2438b65046d41378e4eeaa45f943..dbe3ad0d2d2b395dac8fa1c5cc809ad8b675d0ce 100644 (file)
@@ -320,6 +320,9 @@ merge_and_complain (vec<cl_decoded_option> &decoded_options,
        case OPT_fdiagnostics_show_line_numbers:
        case OPT_fdiagnostics_show_option:
        case OPT_fdiagnostics_show_location_:
+       case OPT_fdiagnostics_show_nesting:
+       case OPT_fdiagnostics_show_nesting_locations:
+       case OPT_fdiagnostics_show_nesting_levels:
        case OPT_fshow_column:
        case OPT_fcommon:
        case OPT_fgnu_tm:
@@ -739,6 +742,9 @@ append_compiler_options (obstack *argv_obstack, vec<cl_decoded_option> opts)
        case OPT_fdiagnostics_show_line_numbers:
        case OPT_fdiagnostics_show_option:
        case OPT_fdiagnostics_show_location_:
+       case OPT_fdiagnostics_show_nesting:
+       case OPT_fdiagnostics_show_nesting_locations:
+       case OPT_fdiagnostics_show_nesting_levels:
        case OPT_fshow_column:
        case OPT_fPIC:
        case OPT_fpic:
@@ -801,6 +807,9 @@ append_diag_options (obstack *argv_obstack, vec<cl_decoded_option> opts)
        case OPT_fdiagnostics_show_line_numbers:
        case OPT_fdiagnostics_show_option:
        case OPT_fdiagnostics_show_location_:
+       case OPT_fdiagnostics_show_nesting:
+       case OPT_fdiagnostics_show_nesting_locations:
+       case OPT_fdiagnostics_show_nesting_levels:
        case OPT_fshow_column:
          break;
        default:
index e6d7f4d7b504a654e8fb396bcc5a30377835b884..379402e68a630256e733568d47da5deb4a759d14 100644 (file)
@@ -1096,7 +1096,8 @@ decode_cmdline_options_to_array (unsigned int argc, const char **argv,
            "-fdiagnostics-urls=never",
            "-fdiagnostics-path-format=separate-events",
            "-fdiagnostics-text-art-charset=none",
-           "-fno-diagnostics-show-event-links"
+           "-fno-diagnostics-show-event-links",
+           "-fno-diagnostics-show-nesting"
            /* We don't put "-fno-diagnostics-show-highlight-colors" here
               as -fdiagnostics-color=never makes it redundant.  */
          };
index 1468b0906f281b7de120feec26f4fc9e2d431dd5..a02d017ac45c3d7151b63733e5d5ce40e6f0946b 100644 (file)
@@ -3052,6 +3052,18 @@ common_handle_option (struct gcc_options *opts,
       dc->set_show_option_requested (value);
       break;
 
+    case OPT_fdiagnostics_show_nesting:
+      dc->set_show_nesting (value);
+      break;
+
+    case OPT_fdiagnostics_show_nesting_locations:
+      dc->set_show_nesting_locations (value);
+      break;
+
+    case OPT_fdiagnostics_show_nesting_levels:
+      dc->set_show_nesting_levels (value);
+      break;
+
     case OPT_fdiagnostics_minimum_margin_width_:
       dc->get_source_printing_options ().min_margin_width = value;
       break;
@@ -3880,6 +3892,9 @@ gen_command_line_string (cl_decoded_option *options,
       case OPT_fdiagnostics_show_line_numbers:
       case OPT_fdiagnostics_color_:
       case OPT_fdiagnostics_format_:
+      case OPT_fdiagnostics_show_nesting:
+      case OPT_fdiagnostics_show_nesting_locations:
+      case OPT_fdiagnostics_show_nesting_levels:
       case OPT_fverbose_asm:
       case OPT____:
       case OPT__sysroot_:
index 0cb16105bb5ba38700fc6f828288698e679fb84c..5b5e3fe7243fb6403c36f375a81015d9d1e76e44 100644 (file)
@@ -1,6 +1,6 @@
 // { dg-do compile { target c++17 } }
 // { dg-options "-fconcepts" }
-// { dg-additional-options "-fdiagnostics-set-output=text:experimental-nesting=yes,experimental-nesting-show-locations=no" }
+// { dg-additional-options "-fdiagnostics-set-output=text:show-nesting=yes,show-nesting-locations=no" }
 
 struct dog {};
 struct cat {};
index e642676841d3e3899260c1d0eecbb0b9472fe3fb..a071b5501c63ff27198bed1849590a2a0d4baaed 100644 (file)
@@ -1,6 +1,6 @@
 // { dg-do compile { target c++17 } }
 // { dg-options "-fconcepts" }
-// { dg-additional-options "-fdiagnostics-set-output=text:experimental-nesting=yes,experimental-nesting-show-locations=no" }
+// { dg-additional-options "-fdiagnostics-set-output=text:show-nesting=yes,show-nesting-locations=no" }
 // { dg-additional-options "-fconcepts-diagnostics-depth=3" }
 
 struct dog {};
index cc15f11d63f41d6c27112c8729575747084bcc65..9530bc100af3f6edc6ff8a1def1daf940d4c1a1d 100644 (file)
@@ -1,6 +1,6 @@
 // { dg-do compile { target c++17 } }
 // { dg-options "-fconcepts" }
-// { dg-additional-options "-fdiagnostics-set-output=text:experimental-nesting=yes,experimental-nesting-show-locations=no" }
+// { dg-additional-options "-fdiagnostics-set-output=text:show-nesting=yes,show-nesting-locations=no" }
 
 struct dog{};
 struct cat{};
diff --git a/gcc/testsuite/gcc.dg/plugin/diagnostic-test-nesting-no-show-nesting.c b/gcc/testsuite/gcc.dg/plugin/diagnostic-test-nesting-no-show-nesting.c
new file mode 100644 (file)
index 0000000..3492899
--- /dev/null
@@ -0,0 +1,9 @@
+/* { dg-do compile } */
+/* { dg-options "-fno-diagnostics-show-nesting" } */
+
+extern void foo (void);
+
+void test_nesting (void)
+{
+  foo (); /* { dg-error "top-level error" } */
+}
diff --git a/gcc/testsuite/gcc.dg/plugin/diagnostic-test-nesting-show-nesting.c b/gcc/testsuite/gcc.dg/plugin/diagnostic-test-nesting-show-nesting.c
new file mode 100644 (file)
index 0000000..8fc2edb
--- /dev/null
@@ -0,0 +1,24 @@
+/* { dg-do compile } */
+/* { dg-options "-fdiagnostics-show-nesting" } */
+
+extern void foo (void);
+
+void test_nesting (void)
+{
+  foo (); /* { dg-error "top-level error" } */
+}
+
+/* { dg-begin-multiline-output "" }
+  * child 0
+    * grandchild 0 0
+    * grandchild 0 1
+    * grandchild 0 2
+  * child 1
+    * grandchild 1 0
+    * grandchild 1 1
+    * grandchild 1 2
+  * child 2
+    * grandchild 2 0
+    * grandchild 2 1
+    * grandchild 2 2
+   { dg-end-multiline-output "" } */
index f44c8eb458d27cbd4be10208164d258495c673b9..4be52fe68ebda22f7e14144ed6d4e9a8117d1cb4 100644 (file)
@@ -1,5 +1,5 @@
 /* { dg-do compile } */
-/* { dg-options "-fdiagnostics-set-output=text:experimental-nesting=yes,experimental-nesting-show-levels=yes" } */
+/* { dg-options "-fdiagnostics-set-output=text:show-nesting=yes,show-nesting-levels=yes" } */
 
 extern void foo (void);
 
index 39e29f7a71a844470307c06bf5bd7d858763d07d..c069c3f451256e5b9abf580d8f6af160e2b09557 100644 (file)
@@ -1,5 +1,5 @@
 /* { dg-do compile } */
-/* { dg-options "-fdiagnostics-set-output=text:experimental-nesting=yes -fdiagnostics-text-art-charset=unicode" } */
+/* { dg-options "-fdiagnostics-set-output=text:show-nesting=yes -fdiagnostics-text-art-charset=unicode" } */
 
 extern void foo (void);
 
index e10342950a2613f6a54e7b9de8479d2cd4517657..a35254d7ff68c9fb1ca405ce1115aa6ad66b4a70 100644 (file)
@@ -1,5 +1,5 @@
 /* { dg-do compile } */
-/* { dg-options "-fdiagnostics-set-output=text:experimental-nesting=yes" } */
+/* { dg-options "-fdiagnostics-set-output=text:show-nesting=yes" } */
 
 extern void foo (void);
 
index 3bb6063c3a9e704d32052128785cfdf129f37532..c7cc36c1cef535339c128ffc41ef4ed35257c315 100644 (file)
@@ -112,6 +112,8 @@ set plugin_test_list [list \
          diagnostic-test-graphs-html.c \
          diagnostic-test-graphs-sarif.c } \
     { diagnostic_plugin_test_nesting.cc \
+         diagnostic-test-nesting-show-nesting.c \
+         diagnostic-test-nesting-no-show-nesting.c \
          diagnostic-test-nesting-text-plain.c \
          diagnostic-test-nesting-text-indented.c \
          diagnostic-test-nesting-text-indented-show-levels.c \
index d349d83ebad99299ae8c3aafaf36d169b149c796..d26467450e377395632d03aa2534e2e6f4804c86 100644 (file)
@@ -1094,6 +1094,12 @@ general_init (const char *argv0, bool init_signals, unique_argv original_argv)
     = global_options_init.x_flag_show_column;
   global_dc->set_show_highlight_colors
     (global_options_init.x_flag_diagnostics_show_highlight_colors);
+  global_dc->set_show_nesting
+    (global_options_init.x_flag_diagnostics_show_nesting);
+  global_dc->set_show_nesting_locations
+    (global_options_init.x_flag_diagnostics_show_nesting_locations);
+  global_dc->set_show_nesting_levels
+    (global_options_init.x_flag_diagnostics_show_nesting_levels);
   global_dc->set_internal_error_callback (internal_error_function);
   const unsigned lang_mask = lang_hooks.option_lang_mask ();
   global_dc->set_option_id_manager