[GCC-XML] Preprocessor problem with gccxml

Brad King brad.king at kitware.com
Mon May 4 17:11:04 EDT 2009

Johannes Brunen wrote:
> #define decl_() DECL_
> #define DECL_FUNCTION(lib) decl_()lib
> After preprocessing on msvc9 I got the following code:
> class ENTITY; DECL_KERN logical is_ENTITY (const ENTITY*);
> After preprocessing with gccxml with this command
> class ENTITY; DECL_ KERN logical is_ ENTITY (const ENTITY*);

I do not think the C preprocessor standard guarantees that
your DECL_FUNCTION macro will concatenate the output of
'decl_()' with 'lib' into a single token.  Instead, use the
'##' operator to concatenate:

#define CAT(x,y) CAT_DELAY(x,y)
#define CAT_DELAY(x,y) x##y
#define DECL_FUNCTION(lib) CAT(decl_(),lib)

It should work in any preprocessor.


More information about the gccxml mailing list