GCC accepts multi-line strings without \ or " " &c

Matthias Klose doko@cs.tu-berlin.de
Sun May 16 09:14:00 GMT 1999


[This "bug" was reported to me as a co-maintainer of the Debian GNU/Linux EGCS
packages. Please Cc: 2910@bugs.debian.org in your response so it gets
archived in the Debian bugtracking system ( http://www.debian.org/Bugs/ ).
Please Cc me as I'm not on the egcs-bugs list.]

gcc-2.91.66 shows the same behaviour


Date: Sun, 5 May 96 20:27 BST
From: Ian Jackson <ijackson@chiark.chu.cam.ac.uk>
To: Debian bugs submission address <debian-bugs@pixar.com>
Subject: GCC accepts multi-line strings without \ or " " &c

Package: gcc
Version: 2.7.2-5

See the transcript below.  The authors may consider this a `language
extension', though it isn't documented in `(gcc.info.gz)Warning
Options' or `C Dialect Options' or in the table in `C Extensions'.

If so there should definitely be a separate option to generate a
warning for it, and I'd argue that -Wall ought to enable it.

chiark:~/junk> cat t.c
void spong(void) {
  (void)"this is a string
         with missing stuff";
}
chiark:~/junk> gcc -Wall -c t.c
chiark:~/junk> gcc -Wall -ansi -c t.c
chiark:~/junk> gcc -Wall -pedantic -c t.c
t.c:2: warning: string constant runs past end of line
t.c: In function `spong':
t.c:2: warning: ANSI C forbids newline in string constant
chiark:~/junk> gcc -Wall -ansi -pedantic -c t.c
t.c:2: warning: string constant runs past end of line
t.c: In function `spong':
t.c:2: warning: ANSI C forbids newline in string constant
chiark:~/junk> 



More information about the Gcc-bugs mailing list