[Bug preprocessor/64965] __FILE__ doesn't work if the filename contains newline
redi at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Fri Sep 29 11:34:00 GMT 2017
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64965
--- Comment #6 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Andrew, if you write PR 66317 or Bug 66317 (or variations like Bug
preprocessor/66317) then Bugzilla automatically makes it a hyperlink :-)
Reproducer from that bug:
Test case (a 2 line source file named "filename_bug.c"):
#line 1 "new\nline.c"
const char filename[] = __FILE__;
Output of "cpp filename_bug.c" (there is no newline on the last line of
output):
# 1 "filename_bug.c"
# 1 "<built-in>"
# 1 "<command-line>"
# 1 "/usr/include/stdc-predef.h" 1 3 4
# 1 "<command-line>" 2
# 1 "filename_bug.c"
# 1 "new
line.c"
new
line.c:1:1: warning: missing terminating " character
new
line.c:1:25: internal compiler error: invalid built-in macro "__FILE__"
...
Also https://bugs.debian.org/838874
More information about the Gcc-bugs
mailing list