re PR preprocessor/39646 (__FILE__ breaks for empty file name)

libcpp:
	PR preprocessor/39646
	* include/line-map.h (enum lc_reason): Add LC_RENAME_VERBATIM.
	* line-map.c (linemap_add): Handle LC_RENAME_VERBATIM.
	* directives.c (do_line, do_linemarker): Use LC_RENAME_VERBATIM in
	place of LC_RENAME.

gcc/testsuite:
	* gcc.dg/cpp/line8.c: New test.

From-SVN: r146319
This commit is contained in:
Joseph Myers
2009-04-18 18:36:28 +01:00
committed by Joseph Myers
parent b8add5942c
commit c7f9c0b983
6 changed files with 32 additions and 5 deletions
+4 -1
View File
@@ -109,9 +109,12 @@ linemap_add (struct line_maps *set, enum lc_reason reason,
map = &set->maps[set->used];
if (to_file && *to_file == '\0')
if (to_file && *to_file == '\0' && reason != LC_RENAME_VERBATIM)
to_file = "<stdin>";
if (reason == LC_RENAME_VERBATIM)
reason = LC_RENAME;
/* If we don't keep our line maps consistent, we can easily
segfault. Don't rely on the client to do it for us. */
if (set->depth == 0)