Commit Graph

105 Commits

Author SHA1 Message Date
Daniel Marjamäki ca047e57bf Switch from http to https on our sourceforge webpage 2021-08-28 12:46:54 +02:00
Daniel Marjamäki ec301b2447 cppcheckdata.py: fixed Value::tokvalue 2021-08-22 05:56:16 +02:00
Daniel Marjamäki f85f3c28e1 misra; implement rule 21.15 2021-07-30 15:53:10 +02:00
Daniel Marjamäki e08ee3bac7 addons; Add get_function_call_name_args 2021-07-24 19:34:11 +02:00
Daniel Marjamäki 388b7a0fae misra; implemented rule 20.12 2021-07-22 19:51:31 +02:00
Daniel Marjamäki 74ab8f1a48 misra; implemented rule 20.8 2021-07-22 08:46:28 +02:00
Daniel Marjamäki d1fe34e167 misra; implement rule 8.10 2021-07-18 21:18:07 +02:00
Daniel Marjamäki aa910d3c38 misra; implemented rule 8.5 2021-07-17 19:59:21 +02:00
Daniel Marjamäki 9d5c65fcce CI; Improved testing of misra addon 2021-07-11 17:24:14 +02:00
Daniel Marjamäki db58952a33 Addons CTU; pass all filenames for whole program analysis in file instead of through command line 2021-07-09 08:33:07 +02:00
Daniel Marjamäki e05a9d7e65 misra: implement rule 2.5 2021-07-08 22:03:27 +02:00
Daniel Marjamäki 4ecf3ccd17 misra: implement rule 22.5 2021-07-07 23:00:12 +02:00
Daniel Marjamäki 13d55c7060 misra; implement rule 2.3 2021-07-07 15:16:53 +02:00
Daniel Marjamäki 00a9671f46 misra: implement 8.1 2021-07-07 13:34:55 +02:00
Daniel Marjamäki 9172f2ab3b addons; add CTU infrastructure 2021-07-07 10:58:13 +02:00
Georgiy Komarov 6f389014f1
cppcheckdata: Fix crash on an empty union (#3326) 2021-07-06 17:01:58 +02:00
Georgiy Komarov b89f5fbeff
misra: Fix 8.2 false positives (#3309)
* 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
2021-06-27 10:51:32 +02:00
Daniel Marjamäki 22727ee3ab Addons; split up possible/known values and impossible values. This is inconsistent with core Cppcheck, however the addons do not handle impossible values in general. A future improvement might be to clarify this somehow, maybe renaming Token.values. 2021-02-23 22:40:49 +01:00
Georgiy Komarov 35a42cd0fe
cppcheckdata: Make the source files for configuration public (#3030)
Extend CppcheckData class API to make the list of source files public.
This can be used by custom addons.
2021-01-08 22:59:58 +01:00
Georgiy Komarov 13b8ee8871
cppcheckdata: Use instance attributes in Cppcheckdata (#3029)
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/
2021-01-08 10:25:51 +01:00
Daniel Marjamäki a810678b83 Addons: handle inline suppressions internally in cppcheckdata 2020-12-05 11:37:09 +01:00
Daniel Marjamäki 649a754cfd Revert "Addons: handle inline suppressions internally in cppcheckdata"
This reverts commit 1ce78a1086.

There was regressions in handling of suppressions.
2020-12-04 18:05:47 +01:00
Daniel Marjamäki 9a81d17a58 cppcheckdata: Add Scope.varlist 2020-11-13 21:03:02 +01:00
Daniel Marjamäki c7f816f986 Misra refactorings 2020-11-13 07:21:34 +01:00
Daniel Marjamäki 1ce78a1086 Addons: handle inline suppressions internally in cppcheckdata 2020-11-11 20:01:58 +01:00
Daniel Marjamäki 687b44dbb7 Token: add flag for splitted variable declaration with initialization 2020-09-09 16:22:47 +02:00
Daniel Marjamäki 9a943e7616 misra: rewrote rule 12.3 2020-09-06 11:33:37 +02:00
Daniel Marjamäki 7969bf7ae8 Token: Add 'isSplittedVarDecl attribute 2020-09-06 11:02:22 +02:00
Daniel Marjamäki c6d2e0fae1 Fixed #9830 (Addons should return 0 when success) 2020-08-29 07:44:32 +02:00
Daniel Marjamäki 75a369d217 cppcheckdata: Set Function.nestedIn attribute 2020-04-16 12:25:03 +02:00
Georgy Komarov 5eaf437c44
misra.py: Fix R5.4 false positives with C99 (#2516)
* parser: Parse standards node at start event

This required, because we can loose data at the end event.

* misra.py: Fix 5.4 standard-dependent error

By default Cppcheck use C11 standard, so this change fix false positives
for rule 5.4 with C99.

* travis: force --std=c89 for misra.py
2020-01-31 23:38:41 +01:00
Georgy Komarov d977761e76 addons: Reduce memory consumption (#2395)
* addons: Reduce memory consumption

Parse dump files incrementaly using ElementTree.iterparse. Clean unused
resources during parsing.  This method is explained in following
article: https://www.ibm.com/developerworks/xml/library/x-hiperfparse/

Memory consumption was reduced about 30% (measured with mprof),
execution time increased about 5% (measured with time utility).
More description available in PR.

* Switch to lxml and update iterparse routines

Use lxml module instead default xml.etree. Lxml provides convenient
wrappers around iterparse method that accepts `tag` argument. That
easer incremental parsing routines to select specific tags from roottree
like `dump` and `dumps`.

Element.clear() method was replaced by `lxml_clean` because lxml
keeps additional information to nodes that should be removed.

Added note about large consumption RAM on large dump files.
This commit doesn't solve this problem completely, but provides a way
to improve current parser to add incremental Configuration serialization
later.

* Working on iterative parser

* Added iterative Configurations parser

* fix

* Fix varlist iteration

* make sure that standards node was loaded
2019-12-27 08:50:56 +01:00
Georgy Komarov 88a3b4c685 addons: Fix __repr__ methods (#2448)
This commit fixes __repr__ methods introduced in d538315268. Fields that recursively links to other cppcheckdata objects was removed to avoid max recursion depth crash on printing.
2019-12-15 19:46:54 +01:00
Francesc Elies d538315268 [python] classes are missing __repr__ methods (#2437)
* [python] classes don't have a __repr__ method

* [python] removes unused import
2019-12-09 19:08:45 +01:00
Georgy Komarov 3bd126486f addons: Clean up and clarify addons usage. (#2359)
* addons: Add '--recursive' arg. Clean up and clarify errors messages.

This commit introduce '--recursive' option for cppcheck addons.
Iff this option is set addon will recursively traverse directories in
given input files to find files with '.dump' suffix that would be
checked. Otherwise it will treat input directory as error (current
behaviour).

Add additional error handling with more clear error messages, clean up
the code.

* Add regex specifier

* Roll back --recursive option

* Update addons section in manual
2019-11-15 20:14:30 +01:00
Sebastian bd5d82c9bd
cppcheckdata.py: Fix PEP 8 and Inspection warnings (#2350) 2019-11-12 09:30:43 +01:00
Georgy Komarov 72f07c8a33 Add MISRA checks for rules 21.1 and 21.12 (#2284)
* Add MISRA 21.1 check

This also required add static field for functions in symboldatabase.

* Add MISRA R21.12

* Use newer ASSERT macroses in tests
2019-10-26 08:32:46 +02:00
Daniel Marjamäki 2d9a131817 Refactoring: Rename variables. Do not use leading _. Renamed 'col' to 'column' 2019-08-18 12:19:05 +02:00
Daniel Marjamäki f33a8a417f Put 'isExpandedMacro' info in the dump files 2019-08-15 14:24:56 +02:00
Daniel Marjamäki f524bf79ad Misra: Added 17.2 checker 2019-07-13 15:10:07 +02:00
Sebastian d1386112a9
addons/cppcheckdata.py: Fix missing self, and wrong assignment. (#1919)
I am not sure but it looks like "self." is missing here.
And the attribute "inconclusive" is initialized as a "bool", so i guess
"True" should be assigned here?
2019-06-25 19:16:57 +02:00
Daniel Marjamäki c97dc79815 --addon: Use json for addon output 2019-06-24 19:29:43 +02:00
Daniel Marjamäki 63bd29d644 addons/cppcheckdata.py: Add 'cppcheckdata.getArguments' function 2019-06-23 13:54:33 +02:00
eivindt 44670005ea Record C/CPP/Posix Standard used for cppcheck in dump file / use this for misra checking (#1782)
* Add cmd parameter for choosing between C90 and C99

Misra specifies different requirements to the uniqueness of
macros/enums/variables depending on what C standard
that's being used.

* Add standards configuration to each dump file

Read standards config from misra addon to decide what rules to use.

* Posix as standard setting should be deprecated.  Don't include this in the xml

* Rewritten to use a switch
2019-06-14 12:06:57 +02:00
Daniel Marjamäki 1584e62367 cppcheckdata: Added 'simpleMatch' function 2019-06-06 15:38:15 +02:00
Daniel Marjamäki d039c388ec Fixed #8582 (Regression MISRA Rule 5.1) 2019-05-26 18:46:35 +02:00
Daniel Marjamäki 54be0bc3cf Misra: Added checker for misra rule 17.7 2019-05-22 21:39:33 +02:00
Daniel Marjamäki e0da316759 cppcheckdata.py: fix sys.errout 2019-04-16 08:26:58 +02:00
Daniel Marjamäki 97157046f7 addons: /reportErrorCli/reportError/ 2019-04-14 08:54:53 +02:00
Daniel Marjamäki b1b5b27b4e addons: write column in error message(s) 2019-04-13 10:22:13 +02:00