[gnu.gcc.bug] Char consts/gcc-cpp

steck@ERIC.CCS.NORTHEASTERN.EDU (Paul Steckler) (12/09/89)

Here is a bug in gcc 1.35's preprocessor that I found:

There is a header file on our Sun3 running SunOS 4 used for compiling
SunView applications, /usr/include/sundev/vuid_event.h.

Near the beginning of this header file, instead of a normal C comment,
Sun has something like this:


#ifdef COMMENT

  ....

#endif

Since COMMENT is undefined, this part should be ignored by the
compiler.  However, the preprocessor chokes on this section, because
there is a word that ends in apostrophe t.

The offending line ends with

         	The vuid interface doesn't

The preprocessor says "unterminated character constant" referring,
presumably to the "'t".

Should the preprocessor be doing that level of lexical analysis this
soon?

Here's the output:

> gcc version 1.35
>  /usr/local/lib/gcc-cpp -v -undef -D__GNUC__ -Dmc68000 -Dsun -Dunix 
	-D__mc68000__ -D__sun__ -D__unix__ -Dmc68020 draw_graph.c 
        /tmp/cca26996.cpp
> GNU CPP version 1.35
> /usr/include/sundev/vuid_event.h:39: unterminated character constant


If this has been fixed in 1.36, I apologize, I haven't installed it yet.


  ------------------------------------------------------------------------
 | Paul Steckler                     |     << Were I Britannia,           |
 | steck@eric.ccs.northeastern.edu   |        I'd waive the rules >>      |
  ------------------------------------------------------------------------

mdb@kosciusko.esd.3com.com (Mark D. Baushke) (12/10/89)

On 9 Dec 89 02:33:45 GMT, steck@ERIC.CCS.NORTHEASTERN.EDU (Paul Steckler) said:

Paul> Here is a bug in gcc 1.35's preprocessor that I found:

Paul gives a description of /usr/include/sundev/vuid_event.h having a
single apostrophe in a #ifdef block which is thrown away by non-ansi C
compilers and suggests this may be a bug in GCC.

Paul> Should the preprocessor be doing that level of lexical analysis this
Paul> soon?

Yes.

> /usr/include/sundev/vuid_event.h:39: unterminated character constant

Paul> If this has been fixed in 1.36, I apologize, I haven't installed it yet.

GCC is doing the right thing. That include file (and others) need to
be converted to ANSI C standards. A script which does the conversion
for you has been provided in all recent version of GCC called 'fixincludes'.

You should use fixincludes generate the 'private' gcc include
directory which is searched before /usr/include is searched.

Enjoy!
-- 
Mark D. Baushke
mdb@ESD.3Com.COM