[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: __CONCAT



Hi,

It seems the problems that prevent libfreebsd from being rebuilt (or built for
first time in amd64), boil down to nested __CONCAT usage in elf headers:

#define __CONCAT(x,y) x ## y
int __CONCAT(__CONCAT(a,b),c);

$ gcc -E test.c
[...]
int __CONCAT(a,b)c;

Anyone has an idea on why gcc only expands __CONCAT once?

I think it is due to http://developer.apple.com/documentation/developertools/gcc-4.0.1/cpp/Argument-Prescan.html

"If an argument is stringified or concatenated, the prescan does not occur."

As original FreeBSD <sys/cdefs.h> have

#define __CONCAT1(x,y)  x ## y
#define __CONCAT(x,y)   __CONCAT1(x,y)

the solution for libfreebsd might be to put at the end of <bsd/cdefs.h>

#undef __CONCAT
#define __CONCAT1(x,y)  x ## y
#define __CONCAT(x,y)   __CONCAT1(x,y)

It will consequently be included via <bsd/bsd.h>.

Petr




Reply to: