bug in preprocessor

Jeffrey L. Copeland copeland@alumni.caltech.edu
Mon Nov 1 11:13:00 GMT 1999


Given the following code from config.h in the BSD time code, 

    #if COMMENT
      Add the following to the end of the "CFLAGS=" line as needed.
       -DHAVE_ADJTIME=0 if `adjtime' does not exist (SVR0?)
       -DHAVE_GETTEXT=1 if `gettext' works (GNU, Linux, Solaris); also see
    LDLIBS
       -DHAVE_LONG_DOUBLE=1 if your compiler supports the `long double' type
       -DHAVE_SETTIMEOFDAY=0 if settimeofday does not exist (SVR0?)
       -DHAVE_SETTIMEOFDAY=1 if settimeofday has just 1 arg (SVR4)
       -DHAVE_SETTIMEOFDAY=2 if settimeofday uses 2nd arg (4.3BSD)
       -DHAVE_SETTIMEOFDAY=3 if settimeofday ignores 2nd arg (4.4BSD)
	   .
	   .
	   .
    #endif

the following errors are generated:

    In file included from ../time/private.h:23,
		     from ../time/localtime.c:43:
    ../time/config.h:3: unterminated string or character constant
    ../time/config.h:4: unterminated string or character constant
    ../time/config.h:5: unterminated string or character constant
    ../time/config.h:10: unterminated string or character constant
	.
	.
	.

This doesn't conform to existing practice of other compilers.  Certainly
the code inside the #ifdef isn't intended to be compiled -- at least at
this time.  Perhaps an option is needed to prevent the behaviour?

JLC


-- 
Jeffrey Copeland
Home:	425-401-6528, 14150 NE 20th St, #378, Bellevue, WA 98007


More information about the Gcc-bugs mailing list