aboutsummaryrefslogtreecommitdiff
path: root/libcpp/directives.c
diff options
context:
space:
mode:
authorBernd Schmidt <bschmidt@redhat.com>2016-03-25 16:15:39 +0000
committerJeff Law <law@redhat.com>2016-03-25 16:15:39 +0000
commit61fcaf46d5229bda1e1715edd916186e038d4983 (patch)
tree9471bd17deccc2f59b0dbe6408240bdddda296b2 /libcpp/directives.c
parente85e1cb7fcfec68bdf9c7fd77178c367e8fde0bf (diff)
PR lto/69650
* directives.c (do_linemarker): Test for file left but not entered here. * line-map.c (linemap_add): Not here. PR lto/69650 * gcc.dg/pr69650.c: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@234481 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libcpp/directives.c')
-rw-r--r--libcpp/directives.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/libcpp/directives.c b/libcpp/directives.c
index 63f54ef7230..6aa6bd1f86a 100644
--- a/libcpp/directives.c
+++ b/libcpp/directives.c
@@ -1046,6 +1046,19 @@ do_linemarker (cpp_reader *pfile)
skip_rest_of_line (pfile);
+ if (reason == LC_LEAVE)
+ {
+ const line_map_ordinary *from;
+ if (MAIN_FILE_P (map)
+ || (new_file
+ && (from = INCLUDED_FROM (pfile->line_table, map)) != NULL
+ && filename_cmp (ORDINARY_MAP_FILE_NAME (from), new_file) != 0))
+ {
+ cpp_warning (pfile, CPP_W_NONE,
+ "file \"%s\" linemarker ignored due to incorrect nesting", new_file);
+ return;
+ }
+ }
/* Compensate for the increment in linemap_add that occurs in
_cpp_do_file_change. We're currently at the start of the line
*following* the #line directive. A separate source_location for this