diff options
Diffstat (limited to 'libcpp')
-rw-r--r-- | libcpp/ChangeLog | 7 | ||||
-rw-r--r-- | libcpp/directives.c | 6 | ||||
-rw-r--r-- | libcpp/include/line-map.h | 3 |
3 files changed, 14 insertions, 2 deletions
diff --git a/libcpp/ChangeLog b/libcpp/ChangeLog index 51304424753..c0f04ac0445 100644 --- a/libcpp/ChangeLog +++ b/libcpp/ChangeLog @@ -1,3 +1,10 @@ +2015-05-12 David Malcolm <dmalcolm@redhat.com> + + * directives.c (do_line): Set seen_line_directive on line_table. + (do_linemarker): Likewise. + * include/line-map.h (struct line_maps): Add new field + "seen_line_directive". + 2015-05-08 Jason Merrill <jason@redhat.com> * include/cpplib.h: Add CPP_W_CXX11_COMPAT. diff --git a/libcpp/directives.c b/libcpp/directives.c index 2a824e6ed3f..356ec135100 100644 --- a/libcpp/directives.c +++ b/libcpp/directives.c @@ -911,7 +911,7 @@ strtolinenum (const uchar *str, size_t len, linenum_type *nump, bool *wrapped) static void do_line (cpp_reader *pfile) { - const struct line_maps *line_table = pfile->line_table; + struct line_maps *line_table = pfile->line_table; const struct line_map *map = LINEMAPS_LAST_ORDINARY_MAP (line_table); /* skip_rest_of_line() may cause line table to be realloc()ed so note down @@ -965,6 +965,7 @@ do_line (cpp_reader *pfile) skip_rest_of_line (pfile); _cpp_do_file_change (pfile, LC_RENAME_VERBATIM, new_file, new_lineno, map_sysp); + line_table->seen_line_directive = true; } /* Interpret the # 44 "file" [flags] notation, which has slightly @@ -973,7 +974,7 @@ do_line (cpp_reader *pfile) static void do_linemarker (cpp_reader *pfile) { - const struct line_maps *line_table = pfile->line_table; + struct line_maps *line_table = pfile->line_table; const struct line_map *map = LINEMAPS_LAST_ORDINARY_MAP (line_table); const cpp_token *token; const char *new_file = ORDINARY_MAP_FILE_NAME (map); @@ -1052,6 +1053,7 @@ do_linemarker (cpp_reader *pfile) pfile->line_table->highest_location--; _cpp_do_file_change (pfile, reason, new_file, new_lineno, new_sysp); + line_table->seen_line_directive = true; } /* Arrange the file_change callback. pfile->line has changed to diff --git a/libcpp/include/line-map.h b/libcpp/include/line-map.h index e1681ea591d..ddeaf0c1954 100644 --- a/libcpp/include/line-map.h +++ b/libcpp/include/line-map.h @@ -386,6 +386,9 @@ struct GTY(()) line_maps { /* The special location value that is used as spelling location for built-in tokens. */ source_location builtin_location; + + /* True if we've seen a #line or # 44 "file" directive. */ + bool seen_line_directive; }; /* Returns the pointer to the memory region where information about |