public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH 0/5] RFC: Overhaul of diagnostics (v2)
@ 2015-09-22 21:09 David Malcolm
  2015-09-22 21:09 ` [PATCH 1/5] Testsuite: add dg-{begin|end}-multiline-output commands David Malcolm
                   ` (6 more replies)
  0 siblings, 7 replies; 83+ messages in thread
From: David Malcolm @ 2015-09-22 21:09 UTC (permalink / raw)
  To: gcc-patches; +Cc: David Malcolm

This is an updated version of this patch kit:
  https://gcc.gnu.org/ml/gcc-patches/2015-09/msg00726.html
It's still at the level of an RFC/work-in-progress; I'm posting for
feedback rather than for formal approval at this time (though the
first two patches are perhaps ready).

For the sake of simplicity, for now I've eliminated anything that
isn't about getting us underlines under expression ranges.  I've also
reduced the scope to just the C frontend.

It captures source ranges for C expressions as they are parsed within
c_expr, and stores them for some trees within GENERIC: in the latter
case only for those that already have a location_t i.e. for all
"compound expressions", but not for e.g. INTEGER_CSTs and VAR_DECLs.
It does this by expanding the ad-hoc lookaside data to include a
source_range (as per Jakub's suggestion).

Doing it this way avoids the need to introduce any new tree nodes, or
to add any fields to any existing tree types.

As in v1 of the kit, the ranges for tokens are stashed into new fields
within the tokens.  I'm thinking for v3 of the kit that that might be
redundant, and that it may be better to stash the token ranges into the
location_t (via the ad-hoc table) immediately as the tokens
are lexed.

The benefit of that approach is (a) the conceptual simplicity that
everything could simply use a location_t, which would become both
a caret location plus a range surrounding it and (b) we'd be able to get
a range from a location_t in the rich_location, and hence (I hope) many
diagnostics would get range underlining "for free".

The drawback is that it could bloat the ad-hoc table.  Can the ad-hoc
table ever get smaller, or does it only ever get inserted into?
An idea I had is that we could stash short ranges directly into the
32 bits of location_t, by offsetting the per-column-bits somewhat.
That way short ranges wouldn't need to use the ad-hoc table, and
(I hope) most tokens could use this optimization.

My plan is to investigate the impact these patches have on the time
and memory consumption of the compiler, and to get some stats on
whether the location_t packing idea is worth it (and maybe
investigate how big an impact going to 64 bits for location_t would
be).

Bootstraps&regrtests; adds 143 PASS results to gcc.sum.
(this v2 patch kit is on top of r227977; v1 was on top of r227562)

Thoughts?

Dave

[BTW, I'm going to be on vacation and away from email from this
Saturday, the 26th through to October 5th]

David Malcolm (5):
  Testsuite: add dg-{begin|end}-multiline-output commands
  Reimplement diagnostic_show_locus, introducing rich_location classes
    (v2)
  Implement token range tracking within libcpp and the C FE (v2)
  Implement tree expression tracking in C FE (v2)
  Add plugin to recursively dump the source-ranges in a tree (v2)

 boehm-gc/testsuite/lib/boehm-gc.exp                |   1 +
 gcc/Makefile.in                                    |   1 +
 gcc/c-family/c-common.c                            |  25 +-
 gcc/c-family/c-common.h                            |   4 +-
 gcc/c-family/c-lex.c                               |   9 +-
 gcc/c-family/c-pragma.h                            |   4 +-
 gcc/c/c-decl.c                                     |   3 +-
 gcc/c/c-errors.c                                   |  12 +-
 gcc/c/c-objc-common.c                              |   2 +-
 gcc/c/c-parser.c                                   |  95 ++-
 gcc/c/c-tree.h                                     |  11 +
 gcc/c/c-typeck.c                                   |  10 +
 gcc/cp/error.c                                     |   5 +-
 gcc/cp/parser.c                                    |   3 +-
 gcc/diagnostic-color.c                             |   5 +-
 gcc/diagnostic-core.h                              |   8 +
 gcc/diagnostic-show-locus.c                        | 700 ++++++++++++++++++++-
 gcc/diagnostic.c                                   | 196 +++++-
 gcc/diagnostic.h                                   |  48 +-
 gcc/fortran/cpp.c                                  |  13 +-
 gcc/fortran/error.c                                |  34 +-
 gcc/gcc-rich-location.c                            |  86 +++
 gcc/gcc-rich-location.h                            |  47 ++
 gcc/genmatch.c                                     |  27 +-
 gcc/gimple.h                                       |   6 +-
 gcc/input.c                                        |   7 +
 gcc/pretty-print.c                                 |  21 +
 gcc/pretty-print.h                                 |  25 +-
 gcc/print-tree.c                                   |  21 +
 gcc/rtl-error.c                                    |   3 +-
 .../gcc.dg/plugin/diagnostic-test-expressions-1.c  | 422 +++++++++++++
 .../gcc.dg/plugin/diagnostic-test-show-locus-bw.c  | 124 ++++
 .../plugin/diagnostic-test-show-locus-color.c      | 131 ++++
 .../gcc.dg/plugin/diagnostic-test-show-trees-1.c   |  65 ++
 .../gcc.dg/plugin/diagnostic_plugin_show_trees.c   | 174 +++++
 .../plugin/diagnostic_plugin_test_show_locus.c     | 285 +++++++++
 .../diagnostic_plugin_test_tree_expression_range.c | 159 +++++
 gcc/testsuite/gcc.dg/plugin/plugin.exp             |   7 +
 gcc/testsuite/lib/gcc-dg.exp                       |   1 +
 gcc/testsuite/lib/multiline.exp                    | 241 +++++++
 gcc/testsuite/lib/prune.exp                        |   5 +
 gcc/tree-cfg.c                                     |   9 +-
 gcc/tree-diagnostic.c                              |   2 +-
 gcc/tree-inline.c                                  |   5 +-
 gcc/tree-pretty-print.c                            |   2 +-
 gcc/tree.c                                         |  40 +-
 gcc/tree.h                                         |  40 ++
 libatomic/testsuite/lib/libatomic.exp              |   1 +
 libcpp/errors.c                                    |   7 +-
 libcpp/include/cpplib.h                            |   8 +-
 libcpp/include/line-map.h                          | 220 ++++++-
 libcpp/lex.c                                       |  14 +
 libcpp/line-map.c                                  | 156 ++++-
 libgo/testsuite/lib/libgo.exp                      |   1 +
 libgomp/testsuite/lib/libgomp.exp                  |   1 +
 libitm/testsuite/lib/libitm.exp                    |   1 +
 libvtv/testsuite/lib/libvtv.exp                    |   1 +
 57 files changed, 3380 insertions(+), 174 deletions(-)
 create mode 100644 gcc/gcc-rich-location.c
 create mode 100644 gcc/gcc-rich-location.h
 create mode 100644 gcc/testsuite/gcc.dg/plugin/diagnostic-test-expressions-1.c
 create mode 100644 gcc/testsuite/gcc.dg/plugin/diagnostic-test-show-locus-bw.c
 create mode 100644 gcc/testsuite/gcc.dg/plugin/diagnostic-test-show-locus-color.c
 create mode 100644 gcc/testsuite/gcc.dg/plugin/diagnostic-test-show-trees-1.c
 create mode 100644 gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_show_trees.c
 create mode 100644 gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_test_show_locus.c
 create mode 100644 gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_test_tree_expression_range.c
 create mode 100644 gcc/testsuite/lib/multiline.exp

-- 
1.8.5.3

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

end of thread, other threads:[~2016-01-06 15:37 UTC | newest]

Thread overview: 83+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-22 21:09 [PATCH 0/5] RFC: Overhaul of diagnostics (v2) David Malcolm
2015-09-22 21:09 ` [PATCH 1/5] Testsuite: add dg-{begin|end}-multiline-output commands David Malcolm
2015-09-25 17:22   ` Jeff Law
2015-09-27  1:29     ` Bernhard Reutner-Fischer
2015-09-22 21:10 ` [PATCH 5/5] Add plugin to recursively dump the source-ranges in a tree (v2) David Malcolm
2015-09-28  8:23   ` Dodji Seketeli
2015-09-22 21:10 ` [PATCH 3/5] Implement token range tracking within libcpp and the C FE (v2) David Malcolm
2015-09-25  9:58   ` Dodji Seketeli
2015-09-25 14:53     ` David Malcolm
2015-09-25 16:15       ` Dodji Seketeli
2015-09-22 21:33 ` [PATCH 2/5] Reimplement diagnostic_show_locus, introducing rich_location classes (v2) David Malcolm
2015-09-25  9:49   ` Dodji Seketeli
2015-09-25 12:34     ` Manuel López-Ibáñez
2015-09-25 16:21       ` Dodji Seketeli
2015-09-25 20:39     ` [PATCH] v3 of diagnostic_show_locus and rich_location (was Re: [PATCH 2/5] Reimplement diagnostic_show_locus, introducing rich_location classes (v2)) David Malcolm
2015-09-25 20:42       ` Manuel López-Ibáñez
2015-09-25 21:14         ` Manuel López-Ibáñez
2015-09-25 22:10           ` Manuel López-Ibáñez
2015-09-26  4:51             ` David Malcolm
2015-09-26  6:18               ` Manuel López-Ibáñez
2015-09-25 22:40           ` David Malcolm
2015-09-26  6:41             ` Manuel López-Ibáñez
2015-09-27 14:19       ` Dodji Seketeli
2015-10-12 15:45         ` [PATCH] v4 of diagnostic_show_locus and rich_location David Malcolm
2015-10-12 16:37           ` Manuel López-Ibáñez
2015-10-13 18:09             ` David Malcolm
2015-12-29 20:55       ` [PATCH] v3 of diagnostic_show_locus and rich_location (was Re: [PATCH 2/5] Reimplement diagnostic_show_locus, introducing rich_location classes (v2)) Mike Stump
2016-01-06 15:37         ` David Malcolm
2015-09-22 22:23 ` [PATCH 4/5] Implement tree expression tracking in C FE (v2) David Malcolm
2015-09-25 14:22   ` Dodji Seketeli
2015-09-25 15:04     ` David Malcolm
2015-09-25 16:36       ` Dodji Seketeli
2015-09-23 13:36 ` [PATCH 0/5] RFC: Overhaul of diagnostics (v2) Michael Matz
2015-09-23 13:43   ` Richard Biener
2015-09-23 13:53     ` Michael Matz
2015-09-23 15:51       ` Jeff Law
2015-09-24  2:39     ` David Malcolm
2015-09-24  9:03       ` Richard Biener
2015-09-25 16:50         ` Jeff Law
2015-10-13 15:33         ` Benchmarks of v2 (was Re: [PATCH 0/5] RFC: Overhaul of diagnostics (v2)) David Malcolm
2015-10-14  9:00           ` Richard Biener
2015-10-14 12:49             ` Michael Matz
2015-10-16 15:57             ` David Malcolm
2015-10-19 14:59               ` Michael Matz
2015-10-22 15:05                 ` David Malcolm
2015-11-13 16:02             ` David Malcolm
2015-10-23 20:25 ` [PATCH 00/10] Overhaul of diagnostics (v5) David Malcolm
2015-10-23 20:24   ` [PATCH 01/10] Improvements to description of source_location in line-map.h David Malcolm
2015-10-23 21:02     ` Jeff Law
2015-10-23 20:24   ` [PATCH 03/10] libstdc++v3: Explicitly disable carets and colorization within testsuite David Malcolm
2015-10-23 21:10     ` Jeff Law
2015-10-23 20:24   ` [PATCH 06/10] Track expression ranges in C frontend David Malcolm
2015-10-30  8:01     ` Jeff Law
2015-11-02 19:14       ` Status of rich location work (was Re: [PATCH 06/10] Track expression ranges in C frontend) David Malcolm
2015-11-02 19:53         ` David Malcolm
2015-11-02 22:26         ` Jeff Law
2015-11-06  7:12         ` Dodji Seketeli
2015-11-13 16:37         ` libcpp/C FE source range patch committed (r230331) David Malcolm
2015-10-23 20:25   ` [PATCH 04/10] Reimplement diagnostic_show_locus, introducing rich_location classes (v5) David Malcolm
2015-10-27 23:12     ` Jeff Law
2015-10-28 17:52       ` David Malcolm
2015-10-28 17:51         ` [PATCH 4b] diagnostic-show-locus.c changes: Insertions David Malcolm
2015-10-30  4:53           ` Jeff Law
2015-10-30 19:42             ` David Malcolm
2015-11-06 19:59             ` David Malcolm
2015-10-28 17:51         ` [PATCH 4a] diagnostic-show-locus.c changes: Deletions David Malcolm
2015-10-28 17:59         ` [PATCH 4c] Other changes: everything apart from diagnostic-show-locus.c changes David Malcolm
2015-10-30  4:49         ` [PATCH 04/10] Reimplement diagnostic_show_locus, introducing rich_location classes (v5) Jeff Law
2015-10-23 20:26   ` [PATCH 07/10] Add plugin to recursively dump the source-ranges in a tree (v2) David Malcolm
2015-10-27 21:32     ` Jeff Law
2015-10-23 20:26   ` [PATCH 08/10] Wire things up so that libcpp users get token underlines David Malcolm
2015-10-30  6:15     ` Jeff Law
2015-10-23 20:26   ` [PATCH 10/10] Compress short ranges into source_location David Malcolm
2015-10-30  6:07     ` Jeff Law
2015-11-04 20:42     ` Dodji Seketeli
2015-10-23 20:26   ` [PATCH 02/10] Add stats on adhoc table to dump_line_table_statistics David Malcolm
2015-10-23 21:07     ` Jeff Law
2015-10-23 20:26   ` [PATCH 05/10] Add ranges to libcpp tokens (via ad-hoc data, unoptimized) David Malcolm
2015-10-27 21:29     ` Jeff Law
2015-10-23 20:29   ` [PATCH 09/10] Delay some resolution of ad-hoc locations, preserving ranges David Malcolm
2015-10-27 22:15     ` Jeff Law
2015-10-23 21:25   ` [PATCH 00/10] Overhaul of diagnostics (v5) Jeff Law
2015-10-23 21:25     ` David Malcolm

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