[Bug preprocessor/12075] New: non-terminated quotes within #if'ed out text comments confuse preprocessor

andi at lisas dot de gcc-bugzilla@gcc.gnu.org
Wed Aug 27 09:14:00 GMT 2003


PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12075

           Summary: non-terminated quotes within #if'ed out text comments
                    confuse preprocessor
           Product: gcc
           Version: 3.3.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: preprocessor
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: andi at lisas dot de
                CC: gcc-bugs at gcc dot gnu dot org

Version: gcc version 3.3.2 20030812 (Debian prerelease) (latest unstable package)
System: Debian unstable, x86 P3, Linux 2.6.0-test3
Build options: ../src/configure -v
--enable-languages=c,c++,java,f77,pascal,objc,ada,treelang --prefix=/usr
--mandir=/usr/share/man --infodir=/usr/share/info
--with-gxx-include-dir=/usr/include/c++/3.3 --enable-shared --with-system-zlib
--enable-nls --without-included-gettext --enable-__cxa_atexit
--enable-clocale=gnu --enable-debug --enable-java-gc=boehm
--enable-java-awt=xlib --enable-objc-gc i486-linux
Command line: gcc-3.3 sometest.c

Found this problem while trying to build a gcc-2.95.3 ARM cross-compiler.

The following sample program sometest.c:

void main()
{
        int i;
#if 0
        This is a
                "very good
                 test".
#endif
        i = 1;
}

yields the following output:

andi@pc1036:~/prg$ gcc-2.95 sometest.c
sometest.c: In function `main':
sometest.c:2: warning: return type of `main' is not `int'
andi@pc1036:~/prg$ gcc-3.0 sometest.c
sometest.c:6:17: warning: multi-line string literals are deprecated
sometest.c: In function `main':
sometest.c:2: warning: return type of `main' is not `int'
andi@pc1036:~/prg$ gcc-3.3 -v -save-temps sometest.c 
Reading specs from /usr/lib/gcc-lib/i486-linux/3.3.2/specs
Configured with: ../src/configure -v
--enable-languages=c,c++,java,f77,pascal,objc,ada,treelang --prefix=/usr
--mandir=/usr/share/man --infodir=/usr/share/info
--with-gxx-include-dir=/usr/include/c++/3.3 --enable-shared --with-system-zlib
--enable-nls --without-included-gettext --enable-__cxa_atexit
--enable-clocale=gnu --enable-debug --enable-java-gc=boehm
--enable-java-awt=xlib --enable-objc-gc i486-linux
Thread model: posix
gcc version 3.3.2 20030812 (Debian prerelease)
 /usr/lib/gcc-lib/i486-linux/3.3.2/cc1 -E -quiet -v -D__GNUC__=3
-D__GNUC_MINOR__=3 -D__GNUC_PATCHLEVEL__=2 sometest.c sometest.i
ignoring nonexistent directory "/usr/i486-linux/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/include
 /usr/lib/gcc-lib/i486-linux/3.3.2/include
 /usr/include
End of search list.
sometest.c:6:17: missing terminating " character
sometest.c:7:22: missing terminating " character
andi@pc1036:~/prg$ 

The resulting sometest.i is:

# 1 "sometest.c"
# 1 "<built-in>"
# 1 "<command line>"
# 1 "sometest.c"
void main()
{
        int i;





        i = 1;
}

Correct me if I'm wrong, but shouldn't the preprocessor dutyfully ignore the
WHOLE content between hashed preprocessor commands (#if 0, #endif), including
any "strange" string quotes??

Thanks!

Andreas Mohr, Wine developer and random driver hacker

P.S.: You might really want to explain what exactly "Host triplet", "Target
triplet" and "Build triplet" is supposed to be (ok, I can guess what it is
supposed to be, but then I still don't know the exact info content that it
should have). It's not even explained on the "Reporting Bugs" page...



More information about the Gcc-bugs mailing list