cpp problem found by imake

Zack Weinberg zack@wolery.cumb.org
Tue May 2 09:06:00 GMT 2000


On Tue, May 02, 2000 at 06:02:58PM +0200, Jakub Jelinek wrote:
> Hi!
> 
> Current cpp does not also like the following snippet
> (distilled from XF4.0 cf/ stuff):
> 
> #define Concat3(a,b,c) a##b##c
> #define Header /usr/include/stdio
> #define Include Concat3(<,Header,.h>)
> #include Include

This came up before.  It's undefined behavior - token paste produces
an illegal token.  They should do something like

#define Header /usr/include/stdio
#define HNAME(x) _HNAME(x.h)
#define _HNAME(x) #x
#define Include HNAME(Header)
#include Include

Note that the HP/UX and Irix cc are reported to reject this construct too.

[I know there is a bug in that the special treatment of <...> extends
to macros expanded on the #include line, but this particular example
is still undefiend behavior.]

zw


More information about the Gcc-bugs mailing list