The attribute movedValue is misspelled with an uppercase V, this leads
to errors when printing token values:
```
$ python3 runaddon.py test.py test.c.dump
Checking test.c.dump...
Checking test.c.dump, config ...
line 2 str=""lala\n""
Traceback (most recent call last):
File "/home/eric/tools/cppcheck/addons/runaddon.py", line 11, in <module>
cppcheck.runcheckers()
File "/home/eric/tools/cppcheck/addons/cppcheck.py", line 39, in runcheckers
c(cfg, data)
File "test.py", line 9, in func
print(f' {value}')
File "/home/eric/tools/cppcheck/addons/cppcheckdata.py", line 907, in __repr__
", ".join(("{}={}".format(a, repr(getattr(self, a))) for a in attrs))
File "/home/eric/tools/cppcheck/addons/cppcheckdata.py", line 907, in <genexpr>
", ".join(("{}={}".format(a, repr(getattr(self, a))) for a in attrs))
AttributeError: 'Value' object has no attribute 'movedValue'
```
* Update cppcheckdata.py
- added links to cpp-file/function that writes this part of the dump-file
- updated documentation (Added list of possible return values for a number of variables)
- added MacroUsage isKnownValue
- added ValueType reference
- added Token isBoolean
- added Token isCast
- added Token externLang
- added Token isComplex
- added Token isRestrict
- added Token isAttributeExport
- added Token originalName
- added Scope functions
- added Scope definedType
- added Function hasVirtualSpecifier
- removed Function isVirtual
- added Function isAttributeNoreturn
- added Function overriddenFunction
- added Variable isVolatile
- class Container added
- added Value movedValue
- added Value uninit
- added Value bufferSize
- removed Value inconclusive and added it to valueKind
* Update cppcheckdata.py
removed encoding from open (needed to make python 2.7 check pass) where python 2.7 should not be used anymore
* Update cppcheckdata.py after feedback
made sure that attributes I added to the class always have a value
added some missing attributes in the print
* misra: Fix 8.2 false positives
Fix false positives in rule 8.2 that occurred in cases when we have a
function definition and declaration in the same file.
For example, the following code generated false positives before this
commit:
```
void f(uint8_t * const x);
void f(uint8_t * const x)
{ (void)x; }
```
We need to distinguish the declaration and the definition, so the dump
file generation routine was extended to keep token where the definition
of the function. The analysis in the addon also been improved.
Closes Trac issue: https://trac.cppcheck.net/ticket/10219
This commit makes CppcheckData class to use instance attributes instead
of class attributes.
Since class attributes are mutable (list), when you append to them, they
don't promote to instance variable which means when you call parsedump()
multiple times data just gets appended to them.
Found by samed on the forum:
https://sourceforge.net/p/cppcheck/discussion/general/thread/c6e1210ec2/