[Bug preprocessor/81745] missing warning with -pedantic when a C file does not end with a newline character

vincent-gcc at vinc17 dot net gcc-bugzilla@gcc.gnu.org
Mon Aug 7 00:40:00 GMT 2017


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81745

--- Comment #7 from Vincent Lefèvre <vincent-gcc at vinc17 dot net> ---
And with only the preprocessor:

$ printf 'int main(void) { return 0; } \\' | gcc -E -
# 1 "<stdin>"
# 1 "<built-in>"
# 1 "<command-line>"
# 31 "<command-line>"
# 1 "/usr/include/stdc-predef.h" 1 3 4
# 32 "<command-line>" 2
# 1 "<stdin>"
int main(void) { return 0; } \
$ printf 'int main(void) { return 0; } \\\n' | gcc -E -
# 1 "<stdin>"
# 1 "<built-in>"
# 1 "<command-line>"
# 31 "<command-line>"
# 1 "/usr/include/stdc-predef.h" 1 3 4
# 32 "<command-line>" 2
# 1 "<stdin>"
<stdin>:1:30: warning: backslash-newline at end of file
int main(void) { return 0; }
$

Here one gets two different results!


More information about the Gcc-bugs mailing list