This fixes a crash with following error:
```
Traceback (most recent call last):
File "/usr/local/share/Cppcheck/addons/runaddon.py", line 8, in <module>
runpy.run_path(addon, run_name='__main__')
File "<frozen runpy>", line 291, in run_path
File "<frozen runpy>", line 98, in _run_module_code
File "<frozen runpy>", line 88, in _run_code
File "/usr/local/share/Cppcheck/addons/misra.py", line 4737, in <module>
main()
File "/usr/local/share/Cppcheck/addons/misra.py", line 4679, in main
checker.parseDump(item)
File "/usr/local/share/Cppcheck/addons/misra.py", line 4335, in parseDump
self.executeCheck(902, self.misra_9_2, cfg)
File "/usr/local/share/Cppcheck/addons/misra.py", line 4246, in executeCheck
check_function(*args)
File "/usr/local/share/Cppcheck/addons/misra.py", line 2104, in misra_9_2
misra_9.misra_9_x(self, data, 902)
File "/usr/local/share/Cppcheck/addons/misra_9.py", line 414, in misra_9_x
parser.parseInitializer(ed, eq.astOperand2)
File "/usr/local/share/Cppcheck/addons/misra_9.py", line 320, in parseInitializer
child = self.root.getChildByValueElement(self.ed)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'getChildByValueElement'
```
A minimal example and testcase is added.
The extra check for nextChild seems to fix it, however i did not read
the whole codebase, so maybe this creates other issues.
---------
Co-authored-by: Tim Blume <tbl@sevenstax-intern.de>
I also changed the comment header to run tests on misra-test-avr8.c
because I thought that was the intention to use it like misra-test.c; if
not, I can revert.
* misra: fix misra-3_1 false positive for URIs in block comments
* added unit test, improved new misra 3.1 based on false positives
---------
Co-authored-by: Paul B <unconfigured@null.spigotmc.org>
* donate_cpu_lib.py: use `os.path.join()`
* donate-cpu: removed remaining usage of `os.chdir()`
* donate_cpu_lib.py: moved library includes code into class
* donate_cpu_lib.py: pre-compile library include regular expressions
* donate_cpu_lib.py: pre-compile some more regular expressions
* donate_cpu_lib.py: small unpack_package() cleanup and optimization
* donate_cpu_lib.py: added some information about the extracted files to unpack_package()
* donate_cpu_lib.py: bumped version
* added test_donate_cpu_lib.py
* donate_cpu_lib.py: greatly improved `LibraryIncludes.get_libraries()` performance
only scan each file once for previously undetected libraries only
* test_donate_cpu_lib.py: fix for Python 3.5
* scriptcheck.yml: added `-v` to pytest calls so we get the complete diff on assertions
* fixed `test_arguments_regression()` Python tests with additional pytest arguments
* donate_cpu_lib.py: use `subprocess.check_call()`
* test_donate_cpu_lib.py: sort results to address differences in order with Python 3.5
* Fix misra 8.7 false positives on single function usage
When there is a single usage of a function, we should first check if the
file it is used in, is the same one it was defined in. When this is not the
case, there is no violatior to be reported.
* Fix misra rule 5.9 false positives for exception
The exception for rule 5.9 described in the guidelines allows for
multiple definitions of internal linkage obejcts when these regard a
static inlined function defined in the same header file.
* Fix neglecting of inline keyword flag upon simplifications
When the inline keyword is being "simplified" and the inline flag is
degated to the next token. However, this information might be lost if the next
token itself is simplified/deleted in a futher pass. Therefore, we must
propagated the flag to all the next named tokens, so we can make sure the
function name token itself is tagged with this property.
* add tests for misra addon rules 8.7 and 5.9