[Bug preprocessor/105005] New: Misleading error message at #line directive with no arguments
burda.ludek at seznam dot cz
gcc-bugzilla@gcc.gnu.org
Mon Mar 21 18:37:27 GMT 2022
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105005
Bug ID: 105005
Summary: Misleading error message at #line directive with no
arguments
Product: gcc
Version: 7.5.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: preprocessor
Assignee: unassigned at gcc dot gnu.org
Reporter: burda.ludek at seznam dot cz
Target Milestone: ---
Preprocessor gives a
"error: unexpected end of file after #line"
error message when no arguments are provided for #line directive, although
there is no actual EOF after the directive.
exemplar code:
```example.c
#line
#warning "some warning, not an EOF"
```
console output after "gcc -E example.c -o example" command
```
example.c:1:6: error: unexpected end of file after #line
#line
^
example.c:2:2: warning: #warning "some warning, not an EOF" [-Wcpp]
#warning "some warning, not an EOF"
^~~~~~~
```
This had been tested on
gcc version 7.5.0 (Ubuntu 7.5.0-3ubuntu1~18.04)
Configured with: ../src/configure -v --with-pkgversion='Ubuntu
7.5.0-3ubuntu1~18.04' --with-bugurl=file:///usr/share/doc/gcc-7/README.Bugs
--enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++ --prefix=/usr
--with-gcc-major-version-only --program-suffix=-7
--program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id
--libexecdir=/usr/lib --without-included-gettext --enable-threads=posix
--libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu
--enable-libstdcxx-debug --enable-libstdcxx-time=yes
--with-default-libstdcxx-abi=new --enable-gnu-unique-object
--disable-vtable-verify --enable-libmpx --enable-plugin --enable-default-pie
--with-system-zlib --with-target-system-zlib --enable-objc-gc=auto
--enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64
--with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic
--enable-offload-targets=nvptx-none --without-cuda-driver
--enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu
--target=x86_64-linux-gnu
I managed to find the invalid piece of code causing this issue, it can be found
even in the newest gcc github version https://github.com/gcc-mirror . I'll
create a pull request with a fix of the bug rightaway I submit this bug report
so I can link this bug report there. I never participated in contributing
before, I'd be grateful for any kind of feedback. I followed the instructions
from there https://gcc.gnu.org/bugs/#need and I hope I didn't ommit any
necessary information in this bug report, otherwise please let me know and I
can provide such.
More information about the Gcc-bugs
mailing list