diagnostics: fix end-points of ranges within macros (PR c++/79300)

Programming / Compilers / GCC - dmalcolm [138bc75d-0d04-0410-961f-82ee72b054a4] - 6 July 2017 10:17 EDT

gcc/ChangeLog: PR c++/79300
- diagnostic-show-locus.c (layout::layout): Use start and finish spelling location for the start and finish of each range.
- genmatch.c (linemap_client_expand_location_to_spelling_point): Add unused aspect param.
- input.c (expand_location_1): Add "aspect" param, and use it to access the correct part of the location. (expand_location): Pass LOCATION_ASPECT_CARET to new param of expand_location_1. (expand_location_to_spelling_point): Likewise. (linemap_client_expand_location_to_spelling_point): Add "aspect" param, and pass it to expand_location_1.

gcc/testsuite/ChangeLog: PR c++/79300
- c-c++-common/Wmisleading-indentation-3.c (fn_14): Update expected underlining within macro expansion.
- c-c++-common/pr70264.c: Likewise.
- g++.dg/plugin/diagnostic-test-expressions-1.C (test_within_macro_1): New test. (test_within_macro_2): Likewise. (test_within_macro_3): Likewise. (test_within_macro_4): Likewise.
- gcc.dg/format/diagnostic-ranges.c (test_macro_3): Update expected underlining within macro expansion. (test_macro_4): Likewise.
- gcc.dg/plugin/diagnostic-test-expressions-1.c (test_within_macro_1): New test. (test_within_macro_2): Likewise. (test_within_macro_3): Likewise. (test_within_macro_4): Likewise.
- gcc.dg/spellcheck-fields-2.c (test_macro): Update expected underlining within macro expansion.

libcpp/ChangeLog: PR c++/79300
- include/line-map.h (enum location_aspect): New enum. (linemap_client_expand_location_to_spelling_point): Add enum location_aspect param.
- line-map.c (rich_location::get_expanded_location): Update for new param of linemap_client_expand_location_to_spelling_point. (rich_location::maybe_add_fixit): Likewise. (fixit_hint::affects_line_p): Likewise.

56df12f diagnostics: fix end-points of ranges within macros (PR c++/79300)
gcc/ChangeLog | 15 ++++
gcc/diagnostic-show-locus.c | 9 ++-
gcc/genmatch.c | 3 +-
gcc/input.c | 52 +++++++++++---
gcc/testsuite/ChangeLog | 22 ++++++
.../c-c++-common/Wmisleading-indentation-3.c | 2 +-
gcc/testsuite/c-c++-common/pr70264.c | 2 +-
.../g++.dg/plugin/diagnostic-test-expressions-1.C | 78 +++++++++++++++++++++
gcc/testsuite/gcc.dg/format/diagnostic-ranges.c | 4 +-
.../gcc.dg/plugin/diagnostic-test-expressions-1.c | 79 ++++++++++++++++++++++
gcc/testsuite/gcc.dg/spellcheck-fields-2.c | 2 +-
libcpp/ChangeLog | 11 +++
libcpp/include/line-map.h | 12 +++-
libcpp/line-map.c | 18 +++--
14 files changed, 284 insertions(+), 25 deletions(-)

Upstream: gcc.gnu.org


  • Share