Add support for simple c++ 11 type ailases like: using INT = int;#1024
Add support for simple c++ 11 type ailases like: using INT = int;#1024danmar merged 2 commits intocppcheck-opensource:masterfrom IOBYTE:master
Conversation
Only types supported by ValueType are supported. Complex types like function pointers are not supported. Template type aliases are not supported.
|
I'm able to reproduce the travis crash and am looking into it now. |
|
This is the code that is causing the crash: Please don't apply this pull request until I figure out how to fix this case. |
|
thanks for looking at this. My plan is to release cppcheck in the weekend so if you fix the problem please let me know if you think it can be committed now or if we should wait a few days. |
|
I know what the problem is but I don't have a fix. I would wait till after the release and after I come up with a fix to apply this. Since size_t and other related common typedefs are built into cppcheck, overriding them is proving to be tricky and I want to get it right. |
This fixes a crash when size_t is replaced with unsigned long in: using size_t = unsigned long; by the tokenizer. This does not fix the problem where Tokenizer::simplifyPlatformTypes() simplifies away size_t in other cases. This is only a problem when the new type is different from the platform type.
|
I fixed the crash. The case where size_t is redefined doesn't work. get tokenized to: because all uses of size_t get simplified to the platform type. I could add a symbol database pass to correct this back to: where size_t will have a ValueType of unsigned short. Does DACA-2 automatically get run or is it possible to run it with this change to see if any other unforeseen problems show up? I'm OK with applying this before the next release if no other problems show up. |
It is possible. But I will merge this now and if we see some problem we can revert this change. |
|
Stupid question.. is it necessary to simplify size_t in Tokenizer? Or could we just make sure that a proper valueType() is set? |
|
Daniel Marjamäki wrote:
Stupid question.. is it necessary to simplify size_t in Tokenizer? Or
could we just make sure that a proper valueType() is set?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#1024 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABvDV978D7njYBvClpKXLbGVYOLF4N7Oks5tJSlWgaJpZM4RX91w>.
I don't think we could just remove the simplification yet by adding a
ValueType and a Type to the Token but I would like to see that as a
goal. Some checks still want the canonical type in the token stream.
I also want to also add typedefs as a type alias so we can also remove
that simplification from the tokenizer. The problem is we currently
handle exotic types like function pointers to functions returning
function pointers that ValueType can't represent. Some exotic types can
only be represented with typedefs or type aliases because of limitations
in the language.
It would be really nice if ValueType could represent any type and the
checks used ValueType rather than the token stream.
This pull request is a first step in that direction.
|
Only types supported by ValueType are supported. Complex types like
function pointers are not supported. Template type aliases are not
supported.