ladybird icon indicating copy to clipboard operation
ladybird copied to clipboard

AK: Add optional `message` argument to VERIFY and friends

Open stasoid opened this issue 2 months ago • 2 comments

This PR effectively reverts 079edff.


This works only in clang-cl, doesn't work in clang/gcc by default:

#define VERIFY(expr, msg...) func(#expr, msg)

This works in 2 CIs, fails in other two with expected primary-expression before ‘)’ token:

#define VERIFY(expr, msg...) func(#expr ,##msg)

This produces warning: __VA_OPT__ can only appear in the expansion of a C++2a variadic macro:

#define VERIFY(expr, msg...) func(#expr __VA_OPT__(,) msg)

That's how I arrived at this abomination:

#define VERIFY(expr, ...) func(#expr __VA_OPT__(,) __VA_ARGS__)

stasoid avatar Jan 04 '25 04:01 stasoid