Open chrchr-github opened 1 year ago
This code is undefined behavior.
https://www.open-std.org/jtc1/sc22/wg14/www/docs/n1256.pdf
page 152
If there are sequences of preprocessing tokens within the list of arguments that would otherwise act as preprocessing directives,150) the behavior is undefined
@danmar Agreed that the code is bad, the linter should flag it and carry on, rather than grind to a halt and stop checking the rest of the code. As a side note this code was created to evaluate linters. Out of five linters Cppcheck was the only one that stopped checking after encountering this error.
@parrotrueper I would hope you can consider to fix the evaluation code somehow then. And evaluate cppcheck using that. A user would fix the code and then recheck..
alright I guess we can reopen this. Fixing this doesn't mean we have to remove the error message...
From https://trac.cppcheck.net/ticket/12105
foo.cpp:5: syntax error: failed to expand 'HASH_TOKEN_IN_MACRO', it is invalid to use a preprocessor directive as macro parameter