[Bug preprocessor/41492] Please ignore #! on the first line of a file

felix.von.s at posteo dot de gcc-bugzilla@gcc.gnu.org
Sun Aug 11 06:14:00 GMT 2019


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

felix <felix.von.s at posteo dot de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |felix.von.s at posteo dot de

--- Comment #2 from felix <felix.von.s at posteo dot de> ---
Please reconsider. For one thing, this extension does not in any way interfere
with normal preprocessor syntax. For another, stripping the shebang line in an
external preprocessor introduces overhead and complications: one has to create
a temporary source file, probably insert a #line directive in the shebang
line's place, and arrange for the temporary file to be deleted when compilation
finishes. Being able to have the compiler read the file directly would make
this so much simpler.

Also, I sometimes develop small C programs by alternating between rapid
write-compile-run cycle with Tiny C Compiler and running the program though a
normal compiler to look for warnings and produce an optimised binary. Right
now, if I do this, I have to comment out or remove the shebang line when
compiling, and add it back when I want to invoke the source file directly from
the command line through TCC. This hardly stops me dead in my tracks, but is
sure irritating.

Plus, the compiler can easily keep generating a warning for erroneous shebang
lines (or for all shebang lines when -Wpedantic is in force), so the likelihood
of this feature leading to accepting erroneous code is minimal.


More information about the Gcc-bugs mailing list