[gnu.gcc.bug] gcc preprocessor bug

rkc@XN.LL.MIT.EDU (Rob Cunningham) (02/26/90)

While trying to use gcc to compile various sunview things (under sunos 4.0.3)
I ran into the recent problem with gcc's preprocessor, and sun's CAT macro.
In condensed form, here's what it looks like:

/* Start of "C" file */
#ifndef	CAT
#undef	IDENT
#define IDENT(x)	x
#define	CAT(a,b)	IDENT(a)b
#endif

main()
{
  int name_data;

  CAT(name,_data) = 5;
  
  printf("%d\n",name_data);
}

Here's the output from pcc -E:
# 1 "temp.c" 










main()
{
  int name_data;

  name_data = 5;
  
  printf("%d\n",name_data);
}

Here's the output from gcc -E:
# 1 "temp.c"
 









main()
{
  int name_data;

  name _data  = 5;
  
  printf("%d\n",name_data);
}
/* End of output */
 NOTE THE name<space>_data line--
the space between the name and data makes it impossible to use this macro with
gcc (and thus to use gcc with sun's include files.)

 	As I'm not a compiler guru, I don't know how to fix the problem, but I
hope someone who does can fix it.
	-Rob