-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Fix #14317 Syntax error using macro inside ifdef block #8123
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
base: main
Are you sure you want to change the base?
Conversation
|
I would expect that we test this in some way. |
|
This needs to be fixed in simplecpp, probably here: |
I am not sure. Then what happens if user executes cppcheck like this:
|
05b5536 to
eb9075c
Compare
|
hmm.. the fix seems to work when I test it quickly. but is in wrong repo. |
eb9075c to
8321b48
Compare
The solution did not work, so I'm working on a new solution. |
852d363 to
ca9df18
Compare
* Updated so that getConfig extracts ifdefs and if defined as itself, example X=X, and for all else just X * Updated hasDefine checker to detect configs even in pattern X=X
1d0fb64 to
2ec411a
Compare
* Updated expected results from getConfigs according to defines X=X, else X * Added two TestPreprocessor tests, getConfigsIssue14317 & getCodeIssue1431, verifying issue 14317 fixed.
…Config. * Added checks that makes sure that no duplicated of a configuration (like X & X=X, in that case only X is kept) ends up in getConfig ret.
2ec411a to
52f76ef
Compare
|
| "#error abcd\n" | ||
| "#endif\n"; | ||
| ASSERT_EQUALS("\nA\n", getConfigsStr(filedata)); | ||
| ASSERT_EQUALS("\nA=A\n", getConfigsStr(filedata)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This raises the question, do we want to print A=A when it was just A before? @danmar
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes that is a question. I think it's good to explicitly show that A=A expansion is used. And the "=1" is not wrong to show but it's redundant.
When configuring the defines in the GUI project file dialog, "A;B" means that A and B will be 1. While "A=A;B" would mean that A macro will get value "A" and B macro would get value "1". As far as I know this is how it worked from the beginning.



Changed so that auto-configured values (without specified values) are set to itself instead of 1.
From issue 14317
isless=islesss
instead of
isless=1