On Wed, 2020-01-08 at 21:17 -0700, Jeff Law wrote: > On Wed, 2020-01-08 at 04:02 -0500, David Malcolm wrote: > > I may be able to self-approve this. It's used by the > > diagnostic_path > > patch, and by the analyzer test suite. Perhaps better to make > > undocumeted, or do it via a DejaGnu pruning directive, but I wanted > > to get v5 of the kit posted. > > > > This patch implements -fdiagnostics-nn-line-numbers, a new option > > which makes diagnostic_show_locus print "NN" rather than specific > > line numbers when printing the left margin. > > > > This is intended purely to make it easier to write certain kinds of > > DejaGnu test; various integration tests for diagnostic paths later > > in the patch kit make use of it. > > > > gcc/ChangeLog: > > * common.opt (fdiagnostics-nn-line-numbers): New option. > > * diagnostic-show-locus.c > > (layout::m_use_nn_for_line_numbers_p): > > New field. > > (layout::layout): Initialize it. > > (layout::calculate_linenum_width): Use it when computing > > m_linenum_width. > > (layout::print_source_line): Implement printing "NN" rather > > than > > the line number. > > (selftest::test_line_numbers_multiline_range): Add a test of > > "NN" > > printing. > > * diagnostic.c (diagnostic_initialize): Initialize > > use_nn_for_line_numbers_p. > > (num_digits): Add "use_nn_p" param. > > (selftest::test_num_digits): Add a test for use_nn_p==true. > > * diagnostic.h (diagnostic_context::use_nn_for_line_numbers_p): > > New field. > > (num_digits): Add optional "use_nn_p" param. > > * doc/invoke.texi (-fdiagnostics-nn-line-numbers): New option. > > * dwarf2out.c (gen_producer_string): Ignore > > OPT_fdiagnostics_nn_line_numbers. > > * lto-wrapper.c (merge_and_complain): Handle > > OPT_fdiagnostics_nn_line_numbers. > > (append_compiler_options): Likewise. > > (append_diag_options): Likewise. > > * opts.c (common_handle_option): Likewise. > > * toplev.c (general_init): Initialize > > global_dc->use_nn_for_line_numbers_p. > Reminds me a lot of the option to not print insn numbers and certain > addresses in RTL dumps -- which makes comparing them easier. > > OK > jeff
Thanks. I've actually reworked my working copy to use a DejaGnu-based postprocessing approach instead: https://gcc.gnu.org/ml/gcc-patches/2020-01/msg00398.html which avoids adding an option. Does this latter approach look OK? (and is the other patch OK?) Thanks Dave