arocc icon indicating copy to clipboard operation
arocc copied to clipboard

Preprocessor: Macro expansion halted early

Open ehaas opened this issue 2 years ago • 0 comments

I'm not entirely sure what's going on with this one - I think possibly expanded __VA_ARGS__ should have their hidesets cleared?

GCC and clang produce F_HOOK ()(XXX); arocc produces F_PROGRESS(XX). Expanding that one more time results in the GCC/clang output.

#define F(acc)          F_PROGRESS(acc)
#define F_PROGRESS(acc) CONTINUE(F)(acc##X)
#define F_HOOK()        F
#define UNROLL(...)     __VA_ARGS__
#define DEFER(op)       op EMPTY
#define EMPTY
#define CONTINUE(k)     DEFER(k##_HOOK)()

UNROLL(F_PROGRESS(X))

ehaas avatar Dec 18 '23 05:12 ehaas