aboutsummaryrefslogtreecommitdiff
path: root/libcpp
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2009-10-14 10:04:22 +0000
committerJakub Jelinek <jakub@redhat.com>2009-10-14 10:04:22 +0000
commit0bcc0a41f159a6f5ade12101f641348261be3a95 (patch)
tree1d09c51355f1f205dbfff2b154b3beaa1ef84a15 /libcpp
parent71e0a9bf70a45c5abde9e9f26a72bf304f7ac5c9 (diff)
PR preprocessor/41543
* input.h (BUILTINS_LOCATION): Change to 1 from 2. Assert BUILTINS_LOCATION < RESERVED_LOCATION_COUNT. * tree.c: Include intl.h. (expand_location): Handle BUILTINS_LOCATION. * Makefile.in (tree.o): Depend on intl.h. * include/line-map.h (RESERVED_LOCATION_COUNT): Define. * line-map.c (linemap_init): Initialize highest_location and highest_line to RESERVED_LOCATION_COUNT-1 instead of 0. * gcc.dg/debug/dwarf2/pr41543.c: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@152761 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libcpp')
-rw-r--r--libcpp/ChangeLog7
-rw-r--r--libcpp/include/line-map.h5
-rw-r--r--libcpp/line-map.c4
3 files changed, 14 insertions, 2 deletions
diff --git a/libcpp/ChangeLog b/libcpp/ChangeLog
index 9d9556ee0ad..3259c56f46e 100644
--- a/libcpp/ChangeLog
+++ b/libcpp/ChangeLog
@@ -1,3 +1,10 @@
+2009-10-14 Jakub Jelinek <jakub@redhat.com>
+
+ PR preprocessor/41543
+ * include/line-map.h (RESERVED_LOCATION_COUNT): Define.
+ * line-map.c (linemap_init): Initialize highest_location and
+ highest_line to RESERVED_LOCATION_COUNT-1 instead of 0.
+
2009-10-09 Jason Merrill <jason@redhat.com>
* charset.c (_cpp_valid_ucn): Update C++0x restrictions.
diff --git a/libcpp/include/line-map.h b/libcpp/include/line-map.h
index 31ac8e5d4c3..9e31a6ae3b9 100644
--- a/libcpp/include/line-map.h
+++ b/libcpp/include/line-map.h
@@ -143,6 +143,11 @@ extern const struct line_map *linemap_add
extern const struct line_map *linemap_lookup
(struct line_maps *, source_location);
+/* source_location values from 0 to RESERVED_LOCATION_COUNT-1 will
+ be reserved for libcpp user as special values, no token from libcpp
+ will contain any of those locations. */
+#define RESERVED_LOCATION_COUNT 2
+
/* Converts a map and a source_location to source line. */
#define SOURCE_LINE(MAP, LOC) \
((((LOC) - (MAP)->start_location) >> (MAP)->column_bits) + (MAP)->to_line)
diff --git a/libcpp/line-map.c b/libcpp/line-map.c
index 553cc2ab605..a82c4286f07 100644
--- a/libcpp/line-map.c
+++ b/libcpp/line-map.c
@@ -38,8 +38,8 @@ linemap_init (struct line_maps *set)
set->trace_includes = false;
set->depth = 0;
set->cache = 0;
- set->highest_location = 0;
- set->highest_line = 0;
+ set->highest_location = RESERVED_LOCATION_COUNT - 1;
+ set->highest_line = RESERVED_LOCATION_COUNT - 1;
set->max_column_hint = 0;
set->reallocator = 0;
}