public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug preprocessor/18200] New: Spurious "backslash-newline at end of file" warning
@ 2004-10-28 16:04 ftg at adelphia dot net
2004-10-28 16:14 ` [Bug preprocessor/18200] " pinskia at gcc dot gnu dot org
2004-10-28 16:27 ` ftg at adelphia dot net
0 siblings, 2 replies; 3+ messages in thread
From: ftg at adelphia dot net @ 2004-10-28 16:04 UTC (permalink / raw)
To: gcc-bugs
If the preprocessor finds a backslash-newline continuation on the next-to-last
line of a file which does not end with a newline (the file, not the next-to-last
line), it gives the warning.
Here's a 2-line file:
#define MYMACRO(x) \
x
and here it is in hex, to show the lack of a final newline:
[ftg@ftgme2 tmp]$ od -t x ~/tmp/test.defs
0000000 66656423 20656e69 4d594d20 4f524341
0000020 20297828 20202020 20202020 200a5c20
0000040 20202020 20202020 00000078
0000051
then:
[ftg@ftgme2 tmp]$ gcc -v -P -CC -I. -E -x c test.defs
Reading specs from /usr/lib/gcc/i586-mandrake-linux-gnu/3.4.1/specs
Configured with: ../configure --prefix=/usr --libdir=/usr/lib
--with-slibdir=/lib --mandir=/usr/share/man --infodir=/usr/share/info
--enable-shared --enable-threads=posix --disable-checking --enable-long-long
--enable-__cxa_atexit --enable-clocale=gnu --disable-libunwind-exceptions
--enable-languages=c,c++,ada,f77,objc,java --host=i586-mandrake-linux-gnu
--with-system-zlib
Thread model: posix
gcc version 3.4.1 (Mandrakelinux 10.1 3.4.1-4mdk)
/usr/lib/gcc/i586-mandrake-linux-gnu/3.4.1/cc1 -E -quiet -CC -v -I. -P
test.defs -mtune=pentium
ignoring nonexistent directory
"/usr/lib/gcc/i586-mandrake-linux-gnu/3.4.1/../../../../i586-mandrake-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
.
/usr/local/include
/usr/lib/gcc/i586-mandrake-linux-gnu/3.4.1/include
/usr/include
End of search list.
test.defs:1:30: warning: backslash-newline at end of file
If I add a newline as the last byte of the file, the warning is not given. The
warning is spurious because the backslash-newline is not at the end of the file.
Even if the warning has value in the case where the backslash-newline is
followed only by whitespace, that isn't the case here.
--
Summary: Spurious "backslash-newline at end of file" warning
Product: gcc
Version: 3.4.1
Status: UNCONFIRMED
Severity: minor
Priority: P2
Component: preprocessor
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: ftg at adelphia dot net
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18200
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug preprocessor/18200] Spurious "backslash-newline at end of file" warning
2004-10-28 16:04 [Bug preprocessor/18200] New: Spurious "backslash-newline at end of file" warning ftg at adelphia dot net
@ 2004-10-28 16:14 ` pinskia at gcc dot gnu dot org
2004-10-28 16:27 ` ftg at adelphia dot net
1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-10-28 16:14 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-10-28 16:14 -------
The warning is pretty clear at what it means:
test.defs:1:30: warning: backslash-newline at end of file
I don't see where the problem is. Also it is undefined in the C standard to have a file not in a new line.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18200
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug preprocessor/18200] Spurious "backslash-newline at end of file" warning
2004-10-28 16:04 [Bug preprocessor/18200] New: Spurious "backslash-newline at end of file" warning ftg at adelphia dot net
2004-10-28 16:14 ` [Bug preprocessor/18200] " pinskia at gcc dot gnu dot org
@ 2004-10-28 16:27 ` ftg at adelphia dot net
1 sibling, 0 replies; 3+ messages in thread
From: ftg at adelphia dot net @ 2004-10-28 16:27 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From ftg at adelphia dot net 2004-10-28 16:27 -------
I don't agree that it's clear. The file does not end with a backslash-newline
as the message states, and the message gives one no idea of what to do to
correct it.
If it is indeed the case that a file which does not end with a newline is
illegal in C, then that's the message that should be issued. However, it is
quite easy to create such files with modern editors such as KDE Kate.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18200
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2004-10-28 16:27 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-10-28 16:04 [Bug preprocessor/18200] New: Spurious "backslash-newline at end of file" warning ftg at adelphia dot net
2004-10-28 16:14 ` [Bug preprocessor/18200] " pinskia at gcc dot gnu dot org
2004-10-28 16:27 ` ftg at adelphia dot net
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).