simplecpp
simplecpp copied to clipboard
Failure to expand macro with arguments containing comma
https://sourceforge.net/p/cppcheck/discussion/development/thread/73af296865
#define ADDER_S(a,b) a+b
#define ADDER(x) ADDER_S(x)
#define ARGUMENTS 1, 2
#define RUN ADDER(ARGUMENTS)
int test(void) {
//ADDER(ARGUMENTS); // Works
RUN; // Fails!!
return 0;
}
It looks like a token ,, is created somehow.
It looks like a token
,,is created somehow.
That's INNER_COMMA, but it's only reset in one of the Macro::expand() overloads.
INNER_COMMA got removed in https://github.com/danmar/simplecpp/commit/0442161, so it's worth to give it another try.
I think I tested with head already.
I think I tested with head already.
I'm sure I did.
You're correct, it has been fixed. Should we add a test case?