summaryrefslogtreecommitdiff
path: root/libcpp
diff options
context:
space:
mode:
authorMartin Liska <mliska@suse.cz>2019-05-14 13:41:53 +0200
committerMartin Liska <marxin@gcc.gnu.org>2019-05-14 11:41:53 +0000
commit19eda56db6c7a6aff1064efb49c18734e82eb382 (patch)
tree9847ec5913b77c7cfc4c8dd7716d8f51e97b21dc /libcpp
parente6fc8353fcfc15827c6a3c3dc97538f3507878d3 (diff)
Fix min_location usage in line-map.c (PR preprocessor/90382).
2019-05-14 Martin Liska <mliska@suse.cz> PR preprocessor/90382 * line-map.c (first_map_in_common_1): Handle ADHOC locations. From-SVN: r271163
Diffstat (limited to 'libcpp')
-rw-r--r--libcpp/ChangeLog6
-rw-r--r--libcpp/line-map.c9
2 files changed, 13 insertions, 2 deletions
diff --git a/libcpp/ChangeLog b/libcpp/ChangeLog
index 4969b4a9630..317d1bdd208 100644
--- a/libcpp/ChangeLog
+++ b/libcpp/ChangeLog
@@ -1,6 +1,12 @@
2019-05-14 Martin Liska <mliska@suse.cz>
PR preprocessor/90382
+ * line-map.c (first_map_in_common_1): Handle ADHOC
+ locations.
+
+2019-05-14 Martin Liska <mliska@suse.cz>
+
+ PR preprocessor/90382
* include/line-map.h (get_data_from_adhoc_loc): Add const to
the first argument.
(get_location_from_adhoc_loc): Likewise.
diff --git a/libcpp/line-map.c b/libcpp/line-map.c
index e1fc0e9faf4..31439f4aba3 100644
--- a/libcpp/line-map.c
+++ b/libcpp/line-map.c
@@ -1251,8 +1251,13 @@ first_map_in_common_1 (struct line_maps *set,
location_t *loc1)
{
location_t l0 = *loc0, l1 = *loc1;
- const struct line_map *map0 = linemap_lookup (set, l0),
- *map1 = linemap_lookup (set, l1);
+ const struct line_map *map0 = linemap_lookup (set, l0);
+ if (IS_ADHOC_LOC (l0))
+ l0 = get_location_from_adhoc_loc (set, l0);
+
+ const struct line_map *map1 = linemap_lookup (set, l1);
+ if (IS_ADHOC_LOC (l1))
+ l1 = get_location_from_adhoc_loc (set, l1);
while (linemap_macro_expansion_map_p (map0)
&& linemap_macro_expansion_map_p (map1)