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. Successfully bootstrapped & regrtested on x86_64-pc-linux-gnu. Pushed to trunk as r16-3092-gd3fe5a560f0bcc. 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. --- gcc/common.opt | 12 ++++ gcc/common.opt.urls | 9 +++ gcc/diagnostics/context.cc | 27 +++++++++ gcc/diagnostics/context.h | 3 + gcc/diagnostics/html-sink.cc | 2 +- gcc/diagnostics/output-spec.cc | 14 ++--- gcc/diagnostics/sink.h | 2 + gcc/diagnostics/text-sink.h | 2 + gcc/doc/invoke.texi | 56 ++++++++++++++++--- gcc/lto-wrapper.cc | 9 +++ gcc/opts-common.cc | 3 +- gcc/opts.cc | 15 +++++ .../concepts/nested-diagnostics-1-truncated.C | 2 +- .../g++.dg/concepts/nested-diagnostics-1.C | 2 +- .../g++.dg/concepts/nested-diagnostics-2.C | 2 +- .../diagnostic-test-nesting-no-show-nesting.c | 9 +++ .../diagnostic-test-nesting-show-nesting.c | 24 ++++++++ ...c-test-nesting-text-indented-show-levels.c | 2 +- ...ostic-test-nesting-text-indented-unicode.c | 2 +- .../diagnostic-test-nesting-text-indented.c | 2 +- gcc/testsuite/gcc.dg/plugin/plugin.exp | 2 + gcc/toplev.cc | 6 ++ 22 files changed, 183 insertions(+), 24 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/plugin/diagnostic-test-nesting-no-show-nesting.c create mode 100644 gcc/testsuite/gcc.dg/plugin/diagnostic-test-nesting-show-nesting.c diff --git a/gcc/common.opt b/gcc/common.opt index 70659fabebd5..655088a92ac8 100644 --- a/gcc/common.opt +++ b/gcc/common.opt @@ -1618,6 +1618,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. diff --git a/gcc/common.opt.urls b/gcc/common.opt.urls index 38dd9d317598..0bc36c483d3b 100644 --- a/gcc/common.opt.urls +++ b/gcc/common.opt.urls @@ -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-) diff --git a/gcc/diagnostics/context.cc b/gcc/diagnostics/context.cc index e127c8fa4d23..c948246e55db 100644 --- a/gcc/diagnostics/context.cc +++ b/gcc/diagnostics/context.cc @@ -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 diff --git a/gcc/diagnostics/context.h b/gcc/diagnostics/context.h index df44a9b0212e..dea4588f96e2 100644 --- a/gcc/diagnostics/context.h +++ b/gcc/diagnostics/context.h @@ -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) { diff --git a/gcc/diagnostics/html-sink.cc b/gcc/diagnostics/html-sink.cc index 9309bd633280..448d4613e905 100644 --- a/gcc/diagnostics/html-sink.cc +++ b/gcc/diagnostics/html-sink.cc @@ -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, diff --git a/gcc/diagnostics/output-spec.cc b/gcc/diagnostics/output-spec.cc index 83f128cc536b..13565f989b83 100644 --- a/gcc/diagnostics/output-spec.cc +++ b/gcc/diagnostics/output-spec.cc @@ -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; diff --git a/gcc/diagnostics/sink.h b/gcc/diagnostics/sink.h index e1a3790b3fc2..24eb70761fd1 100644 --- a/gcc/diagnostics/sink.h +++ b/gcc/diagnostics/sink.h @@ -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; diff --git a/gcc/diagnostics/text-sink.h b/gcc/diagnostics/text-sink.h index e567ec821106..f280e72cb4e0 100644 --- a/gcc/diagnostics/text-sink.h +++ b/gcc/diagnostics/text-sink.h @@ -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"); diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index 105a60d849f5..4037f0c5dcf6 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -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 @@ -5427,7 +5430,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. @@ -6049,6 +6053,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. @@ -6097,18 +6135,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. diff --git a/gcc/lto-wrapper.cc b/gcc/lto-wrapper.cc index 03fca978645e..dbe3ad0d2d2b 100644 --- a/gcc/lto-wrapper.cc +++ b/gcc/lto-wrapper.cc @@ -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: diff --git a/gcc/opts-common.cc b/gcc/opts-common.cc index e6d7f4d7b504..379402e68a63 100644 --- a/gcc/opts-common.cc +++ b/gcc/opts-common.cc @@ -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. */ }; diff --git a/gcc/opts.cc b/gcc/opts.cc index 1468b0906f28..a02d017ac45c 100644 --- a/gcc/opts.cc +++ b/gcc/opts.cc @@ -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_: diff --git a/gcc/testsuite/g++.dg/concepts/nested-diagnostics-1-truncated.C b/gcc/testsuite/g++.dg/concepts/nested-diagnostics-1-truncated.C index 0cb16105bb5b..5b5e3fe7243f 100644 --- a/gcc/testsuite/g++.dg/concepts/nested-diagnostics-1-truncated.C +++ b/gcc/testsuite/g++.dg/concepts/nested-diagnostics-1-truncated.C @@ -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/g++.dg/concepts/nested-diagnostics-1.C b/gcc/testsuite/g++.dg/concepts/nested-diagnostics-1.C index e642676841d3..a071b5501c63 100644 --- a/gcc/testsuite/g++.dg/concepts/nested-diagnostics-1.C +++ b/gcc/testsuite/g++.dg/concepts/nested-diagnostics-1.C @@ -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 {}; diff --git a/gcc/testsuite/g++.dg/concepts/nested-diagnostics-2.C b/gcc/testsuite/g++.dg/concepts/nested-diagnostics-2.C index cc15f11d63f4..9530bc100af3 100644 --- a/gcc/testsuite/g++.dg/concepts/nested-diagnostics-2.C +++ b/gcc/testsuite/g++.dg/concepts/nested-diagnostics-2.C @@ -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 index 000000000000..3492899e20e1 --- /dev/null +++ b/gcc/testsuite/gcc.dg/plugin/diagnostic-test-nesting-no-show-nesting.c @@ -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 index 000000000000..8fc2edbfb781 --- /dev/null +++ b/gcc/testsuite/gcc.dg/plugin/diagnostic-test-nesting-show-nesting.c @@ -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 "" } */ diff --git a/gcc/testsuite/gcc.dg/plugin/diagnostic-test-nesting-text-indented-show-levels.c b/gcc/testsuite/gcc.dg/plugin/diagnostic-test-nesting-text-indented-show-levels.c index f44c8eb458d2..4be52fe68ebd 100644 --- a/gcc/testsuite/gcc.dg/plugin/diagnostic-test-nesting-text-indented-show-levels.c +++ b/gcc/testsuite/gcc.dg/plugin/diagnostic-test-nesting-text-indented-show-levels.c @@ -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); diff --git a/gcc/testsuite/gcc.dg/plugin/diagnostic-test-nesting-text-indented-unicode.c b/gcc/testsuite/gcc.dg/plugin/diagnostic-test-nesting-text-indented-unicode.c index 39e29f7a71a8..c069c3f45125 100644 --- a/gcc/testsuite/gcc.dg/plugin/diagnostic-test-nesting-text-indented-unicode.c +++ b/gcc/testsuite/gcc.dg/plugin/diagnostic-test-nesting-text-indented-unicode.c @@ -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); diff --git a/gcc/testsuite/gcc.dg/plugin/diagnostic-test-nesting-text-indented.c b/gcc/testsuite/gcc.dg/plugin/diagnostic-test-nesting-text-indented.c index e10342950a26..a35254d7ff68 100644 --- a/gcc/testsuite/gcc.dg/plugin/diagnostic-test-nesting-text-indented.c +++ b/gcc/testsuite/gcc.dg/plugin/diagnostic-test-nesting-text-indented.c @@ -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); diff --git a/gcc/testsuite/gcc.dg/plugin/plugin.exp b/gcc/testsuite/gcc.dg/plugin/plugin.exp index 3bb6063c3a9e..c7cc36c1cef5 100644 --- a/gcc/testsuite/gcc.dg/plugin/plugin.exp +++ b/gcc/testsuite/gcc.dg/plugin/plugin.exp @@ -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 \ diff --git a/gcc/toplev.cc b/gcc/toplev.cc index d349d83ebad9..d26467450e37 100644 --- a/gcc/toplev.cc +++ b/gcc/toplev.cc @@ -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 -- 2.26.3