Still having major problems with cpplib and imake

Zack Weinberg zack@wolery.cumb.org
Fri May 12 11:37:00 GMT 2000


On Fri, May 12, 2000 at 09:12:11AM -0400, Dave Brolley wrote:
> Jakub Jelinek wrote:
> 
> > But cpp does not honour whitespace, which is a bigger problem.
> >
> 
> > make requires tabs at the beginning of lines, which are replaced by cpplib
> > with spaces.
> > Just do the diff between the Makefiles.
> > Is there something that can be done about it, or does imake work purely by
> > luck on all platforms using undefined cpp behaviour?
> 
> Neil and Zack:
>
> -traditional preprocessors generally preserve all whitesapce
> verbatim, including whitespace in macro arguments. This should be
> easy for cpplib to do in open text, but harder in macro arguments
> due to the token-based representation. Tabs are rare in macro
> arguments, so keeping a count of the witespaces might be sufficient
> there.

I was planning to do best-effort reconstruction of whitespace using
the column number information stored with the tokens, once we get that
right.

Note this has nothing to do with -traditional, we'll lose the leading
tabs in both modes.

> #define cat(a,b) foo/**/bar
> #define foo 1 -
> #define bar 1
> #define foobar 1
> 
> #if cat (foo,bar)
> should_be_compiled ();
> #endif
> #if cat (foo, bar)
> should_not_be_compiled ();
> #endif

Hmm... we get this wrong now, but we could get it right without much
effort.  Just got to distinguish /**/ from ## a bit more.

zw


More information about the Gcc-bugs mailing list