diff options
author | law <law@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-11-30 05:16:36 +0000 |
---|---|---|
committer | law <law@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-11-30 05:16:36 +0000 |
commit | bc4381667a31bd5f1e677d64c789b1e959df00d5 (patch) | |
tree | a6b80dca8f72a2e7640e4d535901e42325b2a954 /libcpp | |
parent | 1cd66bce1663eb648638d311b493de0dcc4146c3 (diff) | |
parent | 738c50b853f5ba0eaf93e23f6d29cbac761eef9e (diff) | |
download | gcc-reload-v2a.tar.gz |
Weekly merge from trunk. No regressions.reload-v2a
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/reload-v2a@181834 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libcpp')
-rw-r--r-- | libcpp/ChangeLog | 12 | ||||
-rw-r--r-- | libcpp/expr.c | 4 | ||||
-rw-r--r-- | libcpp/include/line-map.h | 10 | ||||
-rw-r--r-- | libcpp/line-map.c | 90 |
4 files changed, 114 insertions, 2 deletions
diff --git a/libcpp/ChangeLog b/libcpp/ChangeLog index 8f7d494fc91..1df9e080268 100644 --- a/libcpp/ChangeLog +++ b/libcpp/ChangeLog @@ -1,3 +1,15 @@ +2011-11-22 Diego Novillo <dnovillo@google.com> + + * include/line-map.h (linemap_dump): Declare. + (line_table_dump): Declare. + * line-map.c (linemap_dump): New. + (line_table_dump): New. + +2011-11-21 Ed Smith-Rowland <3dw4rd@verizon.net> + + PR c++/50958 + * expr.c (cpp_userdef_char_remove_type): Fix typo. + 2011-11-03 Michael Matz <matz@suse.de> PR bootstrap/50857 diff --git a/libcpp/expr.c b/libcpp/expr.c index 7bbc72d6f26..d56e56a6311 100644 --- a/libcpp/expr.c +++ b/libcpp/expr.c @@ -284,9 +284,9 @@ cpp_userdef_char_remove_type (enum cpp_ttype type) else if (type == CPP_WCHAR_USERDEF) return CPP_WCHAR; else if (type == CPP_CHAR16_USERDEF) - return CPP_STRING16; + return CPP_CHAR16; else if (type == CPP_CHAR32_USERDEF) - return CPP_STRING32; + return CPP_CHAR32; else return type; } diff --git a/libcpp/include/line-map.h b/libcpp/include/line-map.h index 112bc020309..4e30742596c 100644 --- a/libcpp/include/line-map.h +++ b/libcpp/include/line-map.h @@ -705,4 +705,14 @@ void linemap_get_statistics (struct line_maps *, struct linemap_stats *); stream STREAM. SET is the line map set LOC comes from. */ void linemap_dump_location (struct line_maps *, source_location, FILE *); +/* Dump line map at index IX in line table SET to STREAM. If STREAM + is NULL, use stderr. IS_MACRO is true if the caller wants to + dump a macro map, false otherwise. */ +void linemap_dump (FILE *, struct line_maps *, unsigned, bool); + +/* Dump line table SET to STREAM. If STREAM is NULL, stderr is used. + NUM_ORDINARY specifies how many ordinary maps to dump. NUM_MACRO + specifies how many macro maps to dump. */ +void line_table_dump (FILE *, struct line_maps *, unsigned int, unsigned int); + #endif /* !LIBCPP_LINE_MAP_H */ diff --git a/libcpp/line-map.c b/libcpp/line-map.c index 23a0347cb5f..d7752bb4e61 100644 --- a/libcpp/line-map.c +++ b/libcpp/line-map.c @@ -1153,6 +1153,57 @@ linemap_expand_location (struct line_maps *set, return xloc; } + +/* Dump line map at index IX in line table SET to STREAM. If STREAM + is NULL, use stderr. IS_MACRO is true if the caller wants to + dump a macro map, false otherwise. */ + +void +linemap_dump (FILE *stream, struct line_maps *set, unsigned ix, bool is_macro) +{ + const char *lc_reasons_v[LC_ENTER_MACRO + 1] + = { "LC_ENTER", "LC_LEAVE", "LC_RENAME", "LC_RENAME_VERBATIM", + "LC_ENTER_MACRO" }; + const char *reason; + struct line_map *map; + + if (stream == NULL) + stream = stderr; + + if (!is_macro) + map = LINEMAPS_ORDINARY_MAP_AT (set, ix); + else + map = LINEMAPS_MACRO_MAP_AT (set, ix); + + reason = (map->reason <= LC_ENTER_MACRO) ? lc_reasons_v[map->reason] : "???"; + + fprintf (stream, "Map #%u [%p] - LOC: %u - REASON: %s - SYSP: %s\n", + ix, (void *) map, map->start_location, reason, + (!is_macro && ORDINARY_MAP_IN_SYSTEM_HEADER_P (map)) ? "yes" : "no"); + if (!is_macro) + { + unsigned includer_ix; + struct line_map *includer_map; + + includer_ix = ORDINARY_MAP_INCLUDER_FILE_INDEX (map); + includer_map = includer_ix < LINEMAPS_ORDINARY_USED (set) + ? LINEMAPS_ORDINARY_MAP_AT (set, includer_ix) + : NULL; + + fprintf (stream, "File: %s:%d\n", ORDINARY_MAP_FILE_NAME (map), + ORDINARY_MAP_STARTING_LINE_NUMBER (map)); + fprintf (stream, "Included from: [%d] %s\n", includer_ix, + includer_map ? ORDINARY_MAP_FILE_NAME (includer_map) : "None"); + } + else + fprintf (stream, "Macro: %s (%u tokens)\n", + linemap_map_get_macro_name (map), + MACRO_MAP_NUM_MACRO_TOKENS (map)); + + fprintf (stream, "\n"); +} + + /* Dump debugging information about source location LOC into the file stream STREAM. SET is the line map set LOC comes from. */ @@ -1254,3 +1305,42 @@ linemap_get_statistics (struct line_maps *set, s->duplicated_macro_maps_locations_size = duplicated_macro_maps_locations_size; } + + +/* Dump line table SET to STREAM. If STREAM is NULL, stderr is used. + NUM_ORDINARY specifies how many ordinary maps to dump. NUM_MACRO + specifies how many macro maps to dump. */ + +void +line_table_dump (FILE *stream, struct line_maps *set, unsigned int num_ordinary, + unsigned int num_macro) +{ + unsigned int i; + + if (set == NULL) + return; + + if (stream == NULL) + stream = stderr; + + fprintf (stream, "# of ordinary maps: %d\n", LINEMAPS_ORDINARY_USED (set)); + fprintf (stream, "# of macro maps: %d\n", LINEMAPS_MACRO_USED (set)); + fprintf (stream, "Include stack depth: %d\n", set->depth); + fprintf (stream, "Highest location: %u\n", set->highest_location); + + if (num_ordinary) + { + fprintf (stream, "\nOrdinary line maps\n"); + for (i = 0; i < num_ordinary && i < LINEMAPS_ORDINARY_USED (set); i++) + linemap_dump (stream, set, i, false); + fprintf (stream, "\n"); + } + + if (num_macro) + { + fprintf (stream, "\nMacro line maps\n"); + for (i = 0; i < num_macro && i < LINEMAPS_MACRO_USED (set); i++) + linemap_dump (stream, set, i, true); + fprintf (stream, "\n"); + } +} |