aboutsummaryrefslogtreecommitdiff
path: root/libcpp/ChangeLog
diff options
context:
space:
mode:
authorDavid Malcolm <dmalcolm@redhat.com>2016-03-09 18:23:27 +0000
committerDavid Malcolm <dmalcolm@gcc.gnu.org>2016-03-09 18:23:27 +0000
commitb4f3232d6979022a36b4055d7d3aaba693a39938 (patch)
treef2d383b45fd79fc7ab53b2857eb71e9b4a498cb4 /libcpp/ChangeLog
parent40499f81a6a65d903a8b6469797c58c52eaf8008 (diff)
downloadgcc-b4f3232d6979022a36b4055d7d3aaba693a39938.tar.gz
gcc-b4f3232d6979022a36b4055d7d3aaba693a39938.tar.bz2
gcc-b4f3232d6979022a36b4055d7d3aaba693a39938.zip
PR c++/70105: prevent nonsensical underline spew for macro expansions
diagnostic_show_locus can sometimes do the wrong thing when handling expressions built up from macros. PR c++/70105 (currently marked as a P3 regression) has an example of a diagnostic where over 500 lines of irrelevant source are printed, and underlined, giving >1000 lines of useless spew to stderr. This patch adds extra sanitization to diagnostic-show-locus.c, so that we only attempt to print underlines and secondary locations if such locations are "sufficiently sane" relative to the primary location of a diagnostic. This "sufficiently sane" condition is implemented by a new helper function compatible_locations_p, which requires such locations to have the same macro expansion hierarchy as the primary location, using linemap_macro_map_loc_unwind_toward_spelling, effectively mimicing the expansion performed by LRK_SPELLING_LOCATION. This may be too strong a condition, but it effectively fixes PR c++/70105, without removing any underlines in my testing. Successfully bootstrapped&regrtested in combination with the previous patch on x86_64-pc-linux-gnu; adds 15 new PASS results to g++.sum and 4 new PASS results to gcc.sum. gcc/ChangeLog: PR c/68473 PR c++/70105 * diagnostic-show-locus.c (compatible_locations_p): New function. (layout::layout): Sanitize ranges using compatible_locations_p. gcc/testsuite/ChangeLog: PR c/68473 PR c++/70105 * g++.dg/diagnostic/pr70105.C: New test. * gcc.dg/plugin/diagnostic-test-expressions-1.c (foo): New decl. (test_multiple_ordinary_maps): New test function. libcpp/ChangeLog: PR c/68473 PR c++/70105 * line-map.c (linemap_macro_map_loc_unwind_toward_spelling): Move decl... * include/line-map.h (linemap_macro_map_loc_unwind_toward_spelling): ...here, converting from static to extern. From-SVN: r234088
Diffstat (limited to 'libcpp/ChangeLog')
-rw-r--r--libcpp/ChangeLog10
1 files changed, 10 insertions, 0 deletions
diff --git a/libcpp/ChangeLog b/libcpp/ChangeLog
index d583e98a903..19b9310bb86 100644
--- a/libcpp/ChangeLog
+++ b/libcpp/ChangeLog
@@ -2,6 +2,16 @@
PR c/68473
PR c++/70105
+ * line-map.c (linemap_macro_map_loc_unwind_toward_spelling): Move
+ decl...
+ * include/line-map.h
+ (linemap_macro_map_loc_unwind_toward_spelling): ...here,
+ converting from static to extern.
+
+2016-03-09 David Malcolm <dmalcolm@redhat.com>
+
+ PR c/68473
+ PR c++/70105
* include/line-map.h (source_range::debug): Delete.
(struct location_range): Update comment. Replace
expanded_location fields "m_start", "m_finish", and "m_caret" with