From 4988731947a1ea315acca433ca6abe143d38c1ed Mon Sep 17 00:00:00 2001
From: David Malcolm <dmalcolm@redhat.com>
Date: Thu, 3 Sep 2015 21:07:57 -0400
Subject: [PATCH 00/67] Backup of rich-errors-v31

master = 0c0caab66d411b8df6a9057d788f1c8bcf77a83a (r226697)

David Malcolm (67):
  Trivial typo fix in pretty-print.h (independent, has ChangeLog)
  FIXME: testsuite: for now, hack out the deletion of test plugins
  *** rich-location-status.txt: INITIAL STATE ***
  FIXME: Change of location_get_source_line signature (compiles, no
    ChangeLog)
  FIXME: Add multiline.exp, and support code in prune.exp
  FIXME: move diagnostic_show_locus and friends out into a new source
    file (compiles, no ChangeLog)
  FIXME: Reimplement diagnostic_show_locus, introducing rich_location
    classes (compiles, no ChangeLog)
  FIXME: add overloads of inform, warning_at, etc that take a
    source_range (compiles, no ChangeLog)
  FIXME: Add -fdump-location-details, though I don't know if I ever used
    it (compiles, no ChangeLog or test coverage)
  *** rich-location-status.text: DONE: add source_range and
    rich-location class to libcpp and diagnostics internal APIs ***
  FIXME: Implement token tracking within libcpp and C/C++ FEs (compiles,
    no ChangeLog)
  *** rich-location-status.text: DONE: capture token range information
    in libcpp and c-family/C/C++ ***
  FIXME: *** C frontend: use token ranges in various diagnostics ***
    (compiles, no ChangeLog)
  FIXME: C FE: store token ranges in c_declspecs, and use them for
    various diagnostics (compiles, no ChangeLog)
  FIXME: C/C family: various uses of token ranges that don't yet have
    test explicit coverage (compiles, no test coverage, no ChangeLog)
  *** rich-location-status.text: DONE: start using *token* range
    information in C frontend ***
  FIXME: *** C++ FE: Use token ranges for various diagnostics ***
    (compiles, no ChangeLog)
  *** rich-location-status.text: DONE: start using *token* range
    information in C++ frontend ***
  FIXME: ObjC: c/c-parser.c: use token ranges; (compiles, untested, no
    ChangeLog)
  *** rich-location-status.text: DONE: use token range information in
    c-family (shared C/C++/ObjC) ***
  FIXME: tree source-ranges: initial implementation (compiles, no
    ChangeLog)
  *** rich-location-status.text: DONE: create SOURCE_RANGE tree type ***
  FIXME: tree.h: add CAN_HAVE_RANGE_P and EXPR_HAS_RANGE; change
    EXPR_RANGE_OR_LOC (not sure about this last one) (compiles)
  FIXME: c_fully_fold_internal: preserve tree ranges (compiles, no
    ChangeLog)
  FIXME: C: capture tree ranges for numberic literals and identifiers
  FIXME: gcc-rich-location.[ch]: add methods for working with tree
    ranges (compiles, no ChangeLog)
  FIXME: add stub implementation of gcc_rich_location::add_decl
    (compiles, no ChangeLog)
  FIXME: Add the C frontend tree-range unittesting plugin (including the
    plugin.exp change) (compiles but needs linker hack, no ChangeLog)
  FIXME: Add plugin to recursively dump the source-ranges in a tree
    (compiles, needs link hack; testcase is failing for some reason; no
    ChangeLog)
  FIXME: *** C: tree source ranges: generate/unittest tree source ranges
    for various expressions ***
  FIXME: Start adding examples of tree-based range output (compiles, new
    tests pass, no ChangeLog)
  FIXME: Use tree ranges in default_tree_printer and percent_K_format
    (compiles, no test case, no ChangeLog)
  C/C++/c-family: Update binary_op_error to report the tree ranges of
    LHS and RHS (compiles, no test case, no ChangeLog)
  FIXME: c-family: warn_for_div_by_zero: use tree range for RHS
    (compiles, no test case, no ChangeLog)
  FIXME: Add gcc/location-hacks.[ch]
  FIXME: Add a bunch of testcases that I think needed location-hacks to
    function
  FIXME: Add show-locus testing to a bunch of testcases, which I think
    needed location-hacks to function
  FIXME: Add input_source_range to input.[ch] (though I think I only use
    it in C++ FE)
  FIXME: c/c-typeck.c: use tree range in inform_declaration; might be
    better to use overloaded 'inform' rather than explicitly build a
    gcc_rich_location
  FIXME: add a declaration of an overload of c_fully_fold; I'm not sure
    this was implemented, or was used anywhere
  FIXME: C: capture some tree *decl* ranges
  FIXME: C FE: start using tree decl ranges
  FIXME: C++ FE: various capture and use of tree ranges
  FIXME: WIP: use add_range_for_macro when showing macro expansions in
    diagnostics
  FIXME: Various commented-out debugging hacks and other stuff that may
    or may not be useful
  FIXME: Add some notes to location-hacks.c
  FIXME: Disable early attempts at tree-range tracking in C++ FE for now
  FIXME: c_parser_conditional_expression: bulletproof
    EXPR_LOCATION_RANGE vs error_mark_node
  FIXME: C FE: Use ranges for rhs in convert_for_assignment (uses
    EXPR_LOCATION_RANGE)
  FIXME: C FE: Convert location hack gcc.dg/20150303-01.c to a non-hack
    example in -2.c (needs tree ranges)
  FIXME: Bulletproof c-typeck.c:convert_for_assignment (was using for
    callsite args, but other users might not have a range)
  FIXME: Convert location hack gcc.dg/20150303-04.c to a non-hack
    example in -2.c (needs tree ranges)
  FIXME: C tree ranges: Add another example of a bad binary op to
    -ranges-2.c
  *** rich-location-status.text: DONE: add tree range information to C
    frontend ***
  FIXME: C: Show ranges (of trees) in c_finish_return (and show fundecl
    when relevant)
  FIXME: C: Add example of use of %q+D to tree range testcase
  *** rich-location-status.text: DONE: start using *tree* range
    information in C frontend ***
  FIXME: libcpp: add location tracking within string literals
  FIXME: Track locations within string literals in tree_string
  *** rich-location-status.text: DONE: add string-literal information to
    libcpp ***
  FIXME: gcc-rich-location.[ch]: add methods for working with ranges
    within string literals
  FIXME: WIP on c-family/c-format.c to use string literal location info
  *** rich-location-status.text: DONE: use string-literal information in
    c-format.c ***
  FIXME: gcc-rich-location.[ch]: add
    gcc_rich_location::add_range_for_macro (uses location-hacks for now)
  FIXME: Add the WIP C frontend gimple-range unittesting plugin (without
    the plugin.exp change)
  FIXME: Add the WIP C frontend SSA source_range unittesting plugin
    (without the plugin.exp change)
  FIXME: Add .custom-dump.txt, dumping line map and *string literal
    location data*

 gcc/Makefile.in                                    |    4 +-
 gcc/box-drawing.c                                  |   99 ++
 gcc/box-drawing.h                                  |   43 +
 gcc/c-family/c-common.c                            |   47 +-
 gcc/c-family/c-common.h                            |   10 +-
 gcc/c-family/c-format.c                            |  104 +-
 gcc/c-family/c-indentation.c                       |   10 +-
 gcc/c-family/c-lex.c                               |   33 +-
 gcc/c-family/c-pragma.h                            |    4 +-
 gcc/c/c-convert.c                                  |   17 +-
 gcc/c/c-decl.c                                     |   41 +-
 gcc/c/c-errors.c                                   |   95 +-
 gcc/c/c-objc-common.c                              |    2 +-
 gcc/c/c-parser.c                                   |  182 +++-
 gcc/c/c-tree.h                                     |   26 +-
 gcc/c/c-typeck.c                                   |  194 ++--
 gcc/common.opt                                     |    4 +
 gcc/cp/call.c                                      |   47 +-
 gcc/cp/cp-tree.h                                   |    5 +-
 gcc/cp/decl.c                                      |    2 +
 gcc/cp/error.c                                     |   24 +-
 gcc/cp/parser.c                                    |   75 +-
 gcc/cp/parser.h                                    |    2 +
 gcc/cp/typeck.c                                    |   30 +-
 gcc/diagnostic-color.c                             |    4 +-
 gcc/diagnostic-core.h                              |   15 +
 gcc/diagnostic-show-locus.c                        | 1016 ++++++++++++++++++++
 gcc/diagnostic.c                                   |  497 ++++++----
 gcc/diagnostic.h                                   |   46 +-
 gcc/fortran/cpp.c                                  |   13 +-
 gcc/fortran/error.c                                |   40 +-
 gcc/gcc-rich-location.c                            |  268 ++++++
 gcc/gcc-rich-location.h                            |   92 ++
 gcc/genmatch.c                                     |   27 +-
 gcc/gimplify.c                                     |    4 +
 gcc/input.c                                        |   23 +-
 gcc/input.h                                        |    5 +-
 gcc/intl.c                                         |   10 +
 gcc/location-hacks.c                               |  212 ++++
 gcc/opts.c                                         |    4 +
 gcc/pretty-print.c                                 |   21 +
 gcc/pretty-print.h                                 |   27 +-
 gcc/print-tree.c                                   |   21 +
 gcc/rtl-error.c                                    |    3 +-
 gcc/testsuite/g++.dg/diagnostic/20150303-02.C      |   18 +
 gcc/testsuite/g++.dg/diagnostic/20150303-03.C      |   12 +
 gcc/testsuite/g++.dg/diagnostic/20150304-02.C      |   23 +
 gcc/testsuite/g++.dg/diagnostic/20150324-01.C      |   14 +
 gcc/testsuite/g++.dg/diagnostic/bitfld1.C          |    6 +
 .../g++.dg/diagnostic/multiline-rich-location-01.C |   21 +
 .../g++.dg/diagnostic/multiline-rich-location-02.C |   64 ++
 .../g++.dg/diagnostic/multiline-rich-location-03.C |   34 +
 .../pr52952-mismatching-argument-type-ucn-4.C      |   17 +
 .../pr52952-mismatching-argument-type-ucn-8.C      |   17 +
 gcc/testsuite/g++.dg/diagnostic/token-ranges.C     |  104 ++
 gcc/testsuite/g++.dg/diagnostic/wrong-tag-1.C      |   11 +
 gcc/testsuite/g++.dg/other/error16.C               |    6 +
 gcc/testsuite/gcc.dg/20150304-01.c                 |   24 +
 gcc/testsuite/gcc.dg/cpp-divbyzero.c               |   18 +
 gcc/testsuite/gcc.dg/diagnostic-token-ranges.c     |  135 +++
 gcc/testsuite/gcc.dg/diagnostic-tree-expr-ranges.c |  164 ++++
 gcc/testsuite/gcc.dg/divbyzero.c                   |   16 +
 .../format/pr52952-mismatching-argument-type-hex.c |   17 +
 .../pr52952-mismatching-argument-type-multiple.c   |   18 +
 .../format/pr52952-mismatching-argument-type-oct.c |   17 +
 .../format/pr52952-mismatching-argument-type-u8.c  |   15 +
 .../format/pr52952-mismatching-argument-type.c     |   15 +
 .../format/pr52952-multiline-format-string.c       |   18 +
 .../format/pr52952-spurious-trailing-percent.c     |   15 +
 .../gcc.dg/plugin/diagnostic-test-expressions-1.c  |  562 +++++++++++
 .../plugin/diagnostic-test-show-locus-ascii.c      |  129 +++
 .../plugin/diagnostic-test-show-locus-utf-8.c      |   65 ++
 .../gcc.dg/plugin/diagnostic-test-show-trees-1.c   |  106 ++
 .../plugin/diagnostic-test-string-literals-1.c     |  139 +++
 .../gcc.dg/plugin/diagnostic_plugin_show_trees.c   |  186 ++++
 ...iagnostic_plugin_test_gimple_expression_range.c |  165 ++++
 .../plugin/diagnostic_plugin_test_show_locus.c     |  299 ++++++
 .../diagnostic_plugin_test_ssa_expression_range.c  |  164 ++++
 .../diagnostic_plugin_test_string_literals.c       |  197 ++++
 .../diagnostic_plugin_test_tree_expression_range.c |  162 ++++
 gcc/testsuite/gcc.dg/plugin/plugin.exp             |    9 +
 gcc/testsuite/lib/gcc-dg.exp                       |   12 +-
 gcc/testsuite/lib/multiline.exp                    |  241 +++++
 gcc/testsuite/lib/plugin-support.exp               |    2 +-
 gcc/testsuite/lib/prune.exp                        |    5 +
 gcc/toplev.c                                       |   34 +
 gcc/tree-core.h                                    |    5 +
 gcc/tree-diagnostic.c                              |   12 +-
 gcc/tree-pretty-print.c                            |    5 +-
 gcc/tree.c                                         |   76 +-
 gcc/tree.def                                       |    2 +
 gcc/tree.h                                         |   68 +-
 libcpp/charset.c                                   |  345 ++++++-
 libcpp/directives.c                                |    4 +-
 libcpp/errors.c                                    |    8 +-
 libcpp/expr.c                                      |    2 +
 libcpp/include/cpplib.h                            |  144 ++-
 libcpp/include/line-map.h                          |  236 +++++
 libcpp/internal.h                                  |    7 +-
 libcpp/lex.c                                       |   20 +-
 libcpp/line-map.c                                  |  196 ++++
 libcpp/macro.c                                     |    1 +
 rich-location-status.txt                           |   32 +
 103 files changed, 7335 insertions(+), 572 deletions(-)
 create mode 100644 gcc/box-drawing.c
 create mode 100644 gcc/box-drawing.h
 create mode 100644 gcc/diagnostic-show-locus.c
 create mode 100644 gcc/gcc-rich-location.c
 create mode 100644 gcc/gcc-rich-location.h
 create mode 100644 gcc/location-hacks.c
 create mode 100644 gcc/testsuite/g++.dg/diagnostic/20150303-02.C
 create mode 100644 gcc/testsuite/g++.dg/diagnostic/20150303-03.C
 create mode 100644 gcc/testsuite/g++.dg/diagnostic/20150304-02.C
 create mode 100644 gcc/testsuite/g++.dg/diagnostic/20150324-01.C
 create mode 100644 gcc/testsuite/g++.dg/diagnostic/multiline-rich-location-01.C
 create mode 100644 gcc/testsuite/g++.dg/diagnostic/multiline-rich-location-02.C
 create mode 100644 gcc/testsuite/g++.dg/diagnostic/multiline-rich-location-03.C
 create mode 100644 gcc/testsuite/g++.dg/diagnostic/pr52952-mismatching-argument-type-ucn-4.C
 create mode 100644 gcc/testsuite/g++.dg/diagnostic/pr52952-mismatching-argument-type-ucn-8.C
 create mode 100644 gcc/testsuite/g++.dg/diagnostic/token-ranges.C
 create mode 100644 gcc/testsuite/gcc.dg/20150304-01.c
 create mode 100644 gcc/testsuite/gcc.dg/cpp-divbyzero.c
 create mode 100644 gcc/testsuite/gcc.dg/diagnostic-token-ranges.c
 create mode 100644 gcc/testsuite/gcc.dg/diagnostic-tree-expr-ranges.c
 create mode 100644 gcc/testsuite/gcc.dg/format/pr52952-mismatching-argument-type-hex.c
 create mode 100644 gcc/testsuite/gcc.dg/format/pr52952-mismatching-argument-type-multiple.c
 create mode 100644 gcc/testsuite/gcc.dg/format/pr52952-mismatching-argument-type-oct.c
 create mode 100644 gcc/testsuite/gcc.dg/format/pr52952-mismatching-argument-type-u8.c
 create mode 100644 gcc/testsuite/gcc.dg/format/pr52952-mismatching-argument-type.c
 create mode 100644 gcc/testsuite/gcc.dg/format/pr52952-multiline-format-string.c
 create mode 100644 gcc/testsuite/gcc.dg/format/pr52952-spurious-trailing-percent.c
 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-ascii.c
 create mode 100644 gcc/testsuite/gcc.dg/plugin/diagnostic-test-show-locus-utf-8.c
 create mode 100644 gcc/testsuite/gcc.dg/plugin/diagnostic-test-show-trees-1.c
 create mode 100644 gcc/testsuite/gcc.dg/plugin/diagnostic-test-string-literals-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_gimple_expression_range.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_ssa_expression_range.c
 create mode 100644 gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_test_string_literals.c
 create mode 100644 gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_test_tree_expression_range.c
 create mode 100644 gcc/testsuite/lib/multiline.exp
 create mode 100644 rich-location-status.txt

-- 
1.8.5.3

