This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
preprocessor bug...
- To: gcc-bugs at gcc dot gnu dot org
- Subject: preprocessor bug...
- From: "Marc W. Mengel" <mengel at fnal dot gov>
- Date: Wed, 16 Feb 2000 15:00:41 -0600 (EST)
On with gcc-2.95.2, sparc-sun-solaris-2.6, The following program:
- - - - - - - - - - - - - cut here - - - - - - - - - - - - - - - - -
#ifndef FROM_DOT
#include <X11/Xmd.h>
#else
#include "./Xmd.h"
#endif
SIZEOF(nag)
- - - - - - - - - - - - - cut here - - - - - - - - - - - - - - - - -
with a symlink ./Xmd.h -> /usr/include/X11/Xmd.h
Gives differing results with
gcc -E bug.c
versus
gcc -E -DFROM_DOT bug.c
to wit (according to diff):
- - - - - - - - - - - - - cut here - - - - - - - - - - - - - - - - -
3,5c3
<
<
< # 1 "Xmd.h" 1
---
> # 1 "/usr/include/X11/Xmd.h" 1 3
105c103
< # 117 "Xmd.h"
---
> # 117 "/usr/include/X11/Xmd.h" 3
119d116
< typedef signed char INT8;
121a119
> typedef char INT8;
143c141
< # 164 "Xmd.h"
---
> # 164 "/usr/include/X11/Xmd.h" 3
172c170
< # 4 "bug.c" 2
---
> # 2 "bug.c" 2
176c174,176
< sz_nag
---
>
>
> sz_ nag
- - - - - - - - - - - - - cut here - - - - - - - - - - - - - - - -
Now, of course, the differing pathnames I expect, but the
differing typedef and SIZEOF(nag) expansion seem completely wrong.
For those keeping score, the definitions in question are (of course) in #if
constructs:
- - - - - - - - - - - - - cut here - - - - - - - - - - - - - - - - -
#if __STDC__ || defined(sgi) || defined(AIXV3)
typedef signed char INT8;
#else
typedef char INT8;
#endif
- - - - - - - - - - - - - cut here - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - cut here - - - - - - - - - - - - - - - - -
#if ((__STDC__ || defined(__cplusplus) || defined(c_plusplus)) && !defined(UNIXCPP)) || defined(ANSICPP)
#define _SIZEOF(x) sz_##x
#define SIZEOF(x) _SIZEOF(x)
#else
#define SIZEOF(x) sz_/**/x
#endif /* if ANSI C compiler else not */
- - - - - - - - - - - - - cut here - - - - - - - - - - - - - - - - -
so it would appear that the definition of __STDC__ is on or off
depending on the pathname through which the file is located???