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: gcc 3.0.1 preprocessor bug


If you put a space before the dot in m(a)
so it will become:
#define m(a) x_##a##0_x .x
This is not a work around; this is the solution.

The error message is correct pasting the two will not give a valid preprocessing token.


Thanks,
Andrew Pinski
Student of Computer Science
University of Cincinnati

On Monday, August 20, 2001, at 11:20 PM, Andy Tai wrote:

Hi, this seems a bug in the preprocessor of gcc 3.0.1
but I am not sure so I post here first.

sample code:
---t.cc---

struct s
{
int x;
};

#define m(a) x_##a##0_x.x


main()
{
struct s x_10_x;
m(1) = 2;

}

---end of t.cc---

with gcc 2.95.3 on GNU/Linux (Red Hat 7.1), no error.

with gcc 3.0.1 on the same machine, gcc says

% gcc t.cc

t.cc:12:4: warning: pasting "x_1" and "0_x.x" does not
give a valid preprocessing token
t.cc: In function `int main()':
t.cc:12: underscore in number
t.cc:12: `x_1' undeclared (first use this function)
t.cc:12: (Each undeclared identifier is reported only
once for each function it appears in.)
t.cc:12: parse error before numeric constant

% gcc -v
Reading specs from
/share/software/gcc-3/installed/lib/gcc-lib/i686-pc-linux-gnu/3.0.1/specs
Configured with: ../gcc-3.0.1/configure
--prefix=/share/software/gcc-3/installed
--enable-threads
Thread model: posix
gcc version 3.0.1

Thanks for any work arounds on this.




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