This is the mail archive of the gcc@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


Hi Zack,

Zack Weinberg wrote:

> > x.h:
> >
> > #ifndef _X_
> > #define _X_
> > #define Y 1
>           ^  I assume this was meant to be X ?

Sorry for typing mistake, of course:

x.h:
#ifndef _X_
#define _X_
#define X 1
#endif


> Hmmmm.  AFS has somewhat different semantics to real Unix
> filesystems.  Would you please send the .i file and the output of
> 
> $ gcc z.c -I../../c/bug -v -H -E -dD -o z.i

gcc z.c -I../../c/bug -v -H -E -dD -o z.i
Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/specs
gcc version egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)
 /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/cpp -lang-c -v
-I../../c/bug -undef -D__GNUC__=2 -D__GNUC_MINOR__=91 -D__ELF__ -Dunix
-Di386 -D__i386__ -Dlinux -D__ELF__ -D__unix__ -D__i386__ -D__i386__
-D__linux__ -D__unix -D__i386 -D__linux -Asystem(posix) -H -dD
-Asystem(unix) -Acpu(i386) -Amachine(i386) -Di386 -D__i386 -D__i386__
-D__tune_i386__ z.c -o z.i
GNU CPP version egcs-2.91.66 19990314/Linux (egcs-1.1.2 release) (i386
Linux/ELF)
#include "..." search starts here:
#include <...> search starts here:
 ../../c/bug
 /usr/local/include
 /usr/i386-redhat-linux/include
 /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include
 /usr/include
End of search list.
../../c/bug/x.h
../../c/bug/y.h



cat z.i

# 1 "z.c"
# 1 "../../c/bug/x.h" 1

#define _X_
#define X 1

# 1 "z.c" 2



int
main()
{
    return 1  + Y;
}


> -H is the same as --trace-includes; -dD causes #define lines to be
> left in the output.
> 
> zw

and for complettness the working case:

gcc z.c -I../bug -v -H -E -dD -o z.i
Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/specs
gcc version egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)
 /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/cpp -lang-c -v -I../bug
-undef -D__GNUC__=2 -D__GNUC_MINOR__=91 -D__ELF__ -Dunix -Di386
-D__i386__ -Dlinux -D__ELF__ -D__unix__ -D__i386__ -D__i386__
-D__linux__ -D__unix -D__i386 -D__linux -Asystem(posix) -H -dD
-Asystem(unix) -Acpu(i386) -Amachine(i386) -Di386 -D__i386 -D__i386__
-D__tune_i386__ z.c -o z.i
GNU CPP version egcs-2.91.66 19990314/Linux (egcs-1.1.2 release) (i386
Linux/ELF)
#include "..." search starts here:
#include <...> search starts here:
 ../bug
 /usr/local/include
 /usr/i386-redhat-linux/include
 /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include
 /usr/include
End of search list.
../bug/x.h
../bug/y.h



cat z.i

# 1 "z.c"
# 1 "../bug/x.h" 1

#define _X_
#define X 1

# 1 "z.c" 2

# 1 "../bug/y.h" 1

#define _Y_
#define Y 1

# 2 "z.c" 2


int
main()
{
    return 1  + 1 ;
}


I'm in the depth of despair.

ciao,

-- 
Alexander Mojaev
Uni Tuebingen, WSI, Computer Architecture 
Koestlinstr. 6, D-72074 Tuebingen, Germany
Phone: (+49/0) 7071 29 77174  Fax: (+49/0) 7071 92 2983
mailto:mojaev@informatik.uni-tuebingen.de 
http://www-ra.informatik.uni-tuebingen.de/mitarb/mojaev/

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