-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
False problem report for C preprocessor macro #9187
Labels
Comments
nordic-krch
added a commit
to nordic-krch/zephyr
that referenced
this issue
Apr 15, 2022
VSCode macro parser was notifying errors in logging macros. The reason was char pointer counting macro that VSCode seen as being called with no enough parameters. There was no issue in the macro so change is rather to cover for VSCode annoyance. Issue reported:github.com/microsoft/vscode-cpptools/issues/9187 Additionally, minor change added to log as CBPRINTF_MUST_RUNTIME_PACKAGE is no longer accepting empty arguments. Signed-off-by: Krzysztof Chruscinski <[email protected]>
bobbrow
added
bug
Language Service
investigate: repro
This issue's repro steps needs to be investigated/confirmed
labels
Apr 19, 2022
The sample code doesn't compile for me with the latest gcc, clang, or cl.exe -- which compiler (and version) and compiler args are you using to compile that? e.g.: error: macro "TEST_MACRO_2" requires 2 arguments, but only 1 given |
sean-mcmanus
added
more info needed
The issue report is not actionable in its current state
and removed
bug
investigate: repro
This issue's repro steps needs to be investigated/confirmed
labels
Apr 22, 2022
This issue has been closed because it needs more information and has not had recent activity. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
Bug type: Language Service
Describe the bug
In zephyr project https:/zephyrproject-rtos/zephyr we are using a macro which is able to paste one of two code snippets based on the flag argument. It is a preprocessor trick derived from Linux
IS_ENABLED
macro. Macro has following syntax:COND_CODE_0(flag, (if_flag_code), (else_code))
, e.g.The problem with VSCode is analyzes the path that is being excluded by this macro and report warning for that. We have a use case where flag is a macro that calculates number of input arguments and calls different macros with different number of arguments. Something like:
In case of
TEST(100)
arguments counting passed toCOND_CODE_0
results in cutting second path (MACRO_2ARGS
). Code compiles fine, there is no misuse of the macro but VSCode notifies about the issue.Steps to reproduce
Here is a code snippet which triggers this error:
error reported:
Expected behavior
Intellisense should figure out that given path is stripped by the preprocessor and do not report the error.
The text was updated successfully, but these errors were encountered: