[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#2910: 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>

Ian.


Reply to: