I moved the issue here to the simplecpp github repo as requested. I've made a very hacky workaround where I first apply a patch to the code in the third-party library replacing each instance of the offending macro with equivalent code. Then I run cppcheck. When it completes I reverse the patch to get things back to where they were. Hopefully this is not the permanent solution, but it may be.
I can't seem to get cppcheck (v1.90) to recognize my build macro that uses token pasting, though gcc has no problem with it. Here is some test code: #include <cstdio> // Offending macro with token pasting: #define IS_DEFINED(name) (defined(__ ## name ## __)) #define __FOO__ 1 #if IS_DEFINED(FOO) int function1() { int inside_function1 = 0; return 0; } #endif #if defined(__FOO__) int function2() { int inside_function2 = 0; return 1; } #endif int main() { printf("test_token_parsing: function1() = %d\n",...
From inspection of the master branch, it looks like this issue has already been addressed and only exists in v0.10.0. In the current master I can see that semihosting has (again) been completely refactored/restructured since 0.10.0. In semihosting_common() the SEMIHOSTING_SYS_EXIT op handler now includes some careful logic to ensure the target is resumed only when it is configured to do so (nice!). So I guess you can close this unless you are stil patching release v0.10.0? Anyway the patch is above...
arm semihosting: target resumes after application exit
stlink_usb: Return ERROR_OK instead of ERROR_FA...