Skip to content

Fail to expand macros #293

@danmar

Description

@danmar

Example code:

#define bitmask(name) setbits(name##_START, name##_BITS)
#define field(name, value) (((value) << name##_START) & name##_MASK)
#define FOO_START 54
#define FOO_BITS 1
#define FOO_MASK bitmask(FOO)
#define FOO field(FOO, 0b1)
FOO_MASK; 

simplecpp output:

a.c:1: syntax error: failed to expand 'FOO_MASK', Invalid ## usage when expanding 'bitmask': Unexpected token ')'

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions