Fix including macros with '<file>' definition#116
Fix including macros with '<file>' definition#116baltth wants to merge 2 commits intocppcheck-opensource:masterfrom
Conversation
|
I don't think you should assume that such macro when the expansion list starts with "<" is always only used in #include. I think it's ugly.. but how about: |
|
Yes, you're right about this, I have noticed that but I have no idea how to differentiate. Actually both use cases are ugly. Whether you accept the mod or not, one of these use cases will be interpreted wrongly. I think the one you wrote is rarer as most programmers would prefer to use a function style macro. On the other hand, I don't know the consequences of the false interpretation of your macro - but with my case, the cppcheck analysis of the whole compile unit fails silently because of this, producing an output like a perfect code. |
|
At least when the macro value is simply: I think that we can easily put together the tokens in the #include handling. I don't know if there is some possible filename character that would cause problems. |
|
If the mod should be accepted I suggest to add test case like #116 (comment) (for demonstration purposes as well as for regression test). |
I think we could look at a modified daca. To start with if we just grep for |
|
|
I see ~15000 such macros in daca2. The majority of these macros (replacement list starts with < and macro has no parameters) look like: There are ~500 macros that does not match that pattern.. examples: |
|
With this code: gcc will try to include the file "10.h". When simplecpp see |
|
I closed this pull request as the approach is wrong. But feel free to create a new pull request with the right approach. |
There's a bug when including definitions with '<>':
becomes
#include < foo / bar.h >This PR fixes this issue.