summaryrefslogtreecommitdiff
path: root/libcpp
diff options
context:
space:
mode:
authordmalcolm <dmalcolm@138bc75d-0d04-0410-961f-82ee72b054a4>2016-02-23 17:44:28 +0000
committerdmalcolm <dmalcolm@138bc75d-0d04-0410-961f-82ee72b054a4>2016-02-23 17:44:28 +0000
commit52609ec38167b4d90e27cad947ad2f81438f9d66 (patch)
tree6c0de6232fb3db3c73408db9d8aeaa7ce4297065 /libcpp
parentd5bf2cc892f85286f6b12b34aa363d0b4b1944e8 (diff)
downloadgcc-52609ec38167b4d90e27cad947ad2f81438f9d66.tar.gz
PR preprocessor/69126: avoid comparing ad-hoc and non-ad-hoc locations
gcc/testsuite/ChangeLog: PR preprocessor/69126 PR preprocessor/69543 * c-c++-common/pr69126-2-long.c: New test. * c-c++-common/pr69126-2-short.c: New test. * c-c++-common/pr69543-1.c: Remove xfail. libcpp/ChangeLog: PR preprocessor/69126 PR preprocessor/69543 * line-map.c (linemap_compare_locations): At the function top, replace inlined bodies of get_location_from_adhoc_loc with calls to get_location_from_adhoc_loc. Add a pair of calls to get_location_from_adhoc_loc at the bottom of the function, to avoid meaningless comparisons of ad-hoc and non-ad-hoc locations. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@233638 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libcpp')
-rw-r--r--libcpp/ChangeLog10
-rw-r--r--libcpp/line-map.c9
2 files changed, 17 insertions, 2 deletions
diff --git a/libcpp/ChangeLog b/libcpp/ChangeLog
index a5cef17df45..1dfcf8dbb72 100644
--- a/libcpp/ChangeLog
+++ b/libcpp/ChangeLog
@@ -1,3 +1,13 @@
+2016-02-23 David Malcolm <dmalcolm@redhat.com>
+
+ PR preprocessor/69126
+ PR preprocessor/69543
+ * line-map.c (linemap_compare_locations): At the function top,
+ replace inlined bodies of get_location_from_adhoc_loc with calls
+ to get_location_from_adhoc_loc. Add a pair of calls to
+ get_location_from_adhoc_loc at the bottom of the function, to
+ avoid meaningless comparisons of ad-hoc and non-ad-hoc locations.
+
2016-02-08 David Malcolm <dmalcolm@redhat.com>
PR preprocessor/69664
diff --git a/libcpp/line-map.c b/libcpp/line-map.c
index e9175dfa307..c05a001dcc4 100644
--- a/libcpp/line-map.c
+++ b/libcpp/line-map.c
@@ -1328,9 +1328,9 @@ linemap_compare_locations (struct line_maps *set,
source_location l0 = pre, l1 = post;
if (IS_ADHOC_LOC (l0))
- l0 = set->location_adhoc_data_map.data[l0 & MAX_SOURCE_LOCATION].locus;
+ l0 = get_location_from_adhoc_loc (set, l0);
if (IS_ADHOC_LOC (l1))
- l1 = set->location_adhoc_data_map.data[l1 & MAX_SOURCE_LOCATION].locus;
+ l1 = get_location_from_adhoc_loc (set, l1);
if (l0 == l1)
return 0;
@@ -1365,6 +1365,11 @@ linemap_compare_locations (struct line_maps *set,
return i1 - i0;
}
+ if (IS_ADHOC_LOC (l0))
+ l0 = get_location_from_adhoc_loc (set, l0);
+ if (IS_ADHOC_LOC (l1))
+ l1 = get_location_from_adhoc_loc (set, l1);
+
return l1 - l0;
}