Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cppcheck: failed to expand 'ARDUINOJSON_BEGIN_PUBLIC_NAMESPACE' #2120

Open
robsonos opened this issue Aug 16, 2024 · 3 comments
Open

cppcheck: failed to expand 'ARDUINOJSON_BEGIN_PUBLIC_NAMESPACE' #2120

robsonos opened this issue Aug 16, 2024 · 3 comments
Labels
question v7 ArduinoJson 7

Comments

@robsonos
Copy link

Hi,

Just reporting this issue while running cppcheck:

...ArduinoJson/src/ArduinoJson/Polyfills/preprocessor.hpp:7: [high:error] failed to expand 'ARDUINOJSON_BEGIN_PUBLIC_NAMESPACE', Invalid ## usage when expanding 'ARDUINOJSON_CONCAT_': Unexpected token ')' [preprocessorErrorDirective]

Cheers

@robsonos robsonos added the bug label Aug 16, 2024
@marco86to
Copy link

Hi, I have found the same bug.
Cheers

@bblanchon
Copy link
Owner

Hi @robsonos and @marco86to,

Here is line 7 of Polyfills/preprocessor.hpp:

#define ARDUINOJSON_CONCAT_(A, B) A##B

There is no error here!

Also, I ran cppcheck 2.10 on this file and got no error.

Best regards,
Benoit

@bblanchon bblanchon added question v7 ArduinoJson 7 and removed bug labels Aug 21, 2024
@robsonos
Copy link
Author

Hi @bblanchon,

For more context, I am using platformio/tool-cppcheck from PlatformIO.
I did some testing and coundn't find any issues with the macro expansions of ARDUINOJSON_VERSION_NAMESPACE and ARDUINOJSON_CONCAT_. I wonder if the issue is related to cppcheck itself like in https://community.platformio.org/t/wrong-issues-from-cppcheck/18410/7.
In terms of PlatformIO itself, the following will suppress the error:

check_flags =
    cppcheck: --suppress=*:*.pio\* 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question v7 ArduinoJson 7
Projects
None yet
Development

No branches or pull requests

3 participants