The following C program compiles, but cppcheck reports a macro expansion problem:
#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; }
The actual error looks like this:
$ cppcheck test.c test.c:2:0: error: failed to expand 'RUN', Wrong number of parameters for macro 'ADDER_S'. [preprocessorErrorDirective] #define ADDER(x) ADDER_S(x)
I'm testing with the latest commit of master (6d56c7fc0d353b010c4ef2892e8d6a1403e7dd98)
Probably should be reported here: https://github.com/danmar/simplecpp/issues
See https://github.com/danmar/simplecpp/issues/374
Thanks for creating the bug report!
Log in to post a comment.
The following C program compiles, but cppcheck reports a macro expansion problem:
The actual error looks like this:
I'm testing with the latest commit of master (6d56c7fc0d353b010c4ef2892e8d6a1403e7dd98)
Last edit: greenfoo 2024-10-01
Probably should be reported here: https://github.com/danmar/simplecpp/issues
See https://github.com/danmar/simplecpp/issues/374
Thanks for creating the bug report!