This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: cpp problem found by imake


On Wed, May 03, 2000 at 12:11:56AM -0700, Zack Weinberg wrote:
> On Tue, May 02, 2000 at 11:47:33PM -0700, Zack Weinberg wrote:
> > On Wed, May 03, 2000 at 08:02:37AM +0200, Jakub Jelinek wrote:
> > 
> > > #define Header /usr/include/stdio
> > > #define MakeHeader(x) "x.h"
> > > #define Include MakeHeader(x)
> > 			     ^ You meant Header, right?
> > > #include Include
> > 
> > This should work, but it segfaults.  I'll fix that shortly.
> 
> Correction: this should not work, and the segfault appears to be due
> to unrelated bustage in my work area.
> 
> cpplib, cccp (from 2.95), and SunOS 4 cpp all wind up with
> 
> #include "Header.h"
> 
> from the above example, with 'x' replaced by 'Header' in the #define
> Include line.  This is not a surprise: what happened was something
> like
> 
>  Include -> MakeHeader ( Header )
> 	 -> " Header .h"	// -traditional, so no extra whitespace...
> 	 -> "Header.h"		// a string, not subject to further expansion.
> 
> I could easily change this, but that wouldn't be the way a "real K+R
> preprocessor" behaves.  The conclusion is that there simply is no way
> to paste together an include name with -traditional on.
> 
> I'm going to have to ask you what X11 is _really_ trying to achieve
> here, because this seems utterly perverse, and I'll bet there's a
> simpler and more portable way.  I've got XFree 4.0 source lying
> around, but I can't find the place where it does this.

We could kill the -traditional in imakedeps.h for
__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
the problem is that XF (both 3.3.6 and 4.0) cf files and Imakefiles seem to
be written mostly in traditional and only from time to time they think of
that ANSI preprocessors exist.
At least e.g. xf86.rules use following snippet, which won't work with ANSI
preprocessor, and I have no idea what else.
If you really tell me there is no way to get this to work in traditional,
then I might try to kill that -traditional and fix all the bugs I find, but
I don't know how much work that will be. And one has to fix both 4.0 and
3.3.x :(.

#ifndef DriverObjectList
#define DriverObjectList(drivers,list)                                  @@\
list: $(ICONFIGFILES)                                                   @@\
        RemoveFile(list)                                                @@\
        @echo Creating list for drivers; \                              @@\
        DRIVERS="drivers"; \                                            @@\
        if [ x"$$DRIVERS" != x ]; then \                                @@\
          for i in $$DRIVERS; do \                                      @@\
            echo $$i/$${i}_drv.o >> list; \                             @@\
          done; \                                                       @@\
        else \                                                          @@\
          echo "" > list; \                                             @@\
        fi                                                              @@\
                                                                        @@\
clean::                                                                 @@\
        RemoveFile(list)
#endif


	Jakub

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]