[Bug preprocessor/101298] New: Inclusion of a file without trailing newline breaks -fdirectives-only
boris at kolpackov dot net
gcc-bugzilla@gcc.gnu.org
Fri Jul 2 13:12:40 GMT 2021
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101298
Bug ID: 101298
Summary: Inclusion of a file without trailing newline breaks
-fdirectives-only
Product: gcc
Version: 11.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: preprocessor
Assignee: unassigned at gcc dot gnu.org
Reporter: boris at kolpackov dot net
Target Milestone: ---
cat <<EOF >test.cxx
#include "test.hxx"
#include <iostream>
int main () {}
EOF
echo -n "// no newline" >test.hxx
g++ -E -fdirectives-only -o test.ii test.cxx
In file included from test.cxx:1:
test.hxx:1:1: error: unterminated comment
echo -n "void f () {}" >test.hxx
g++ -E -fdirectives-only -o test.ii test.cxx
grep "void f () {}" test.ii
void f () {}# 2 "test.cxx" 2
g++ -c -fdirectives-only test.ii
In file included from test.cxx:1:
test.hxx:1:13: error: stray ‘#’ in program
This used to work fine prior to GCC 11. I believe this issue is similar but not
the same as bug #100646.
More information about the Gcc-bugs
mailing list