Commit Graph

22122 Commits

Author SHA1 Message Date
Georgy Komarov 583d5e5958
misra.py: Add standard library functions for C90 and C99 (#2524)
This is required to add additional analysis for some MISRA rules.

This commit improve R21.1 check and close trac ticket 9603.
2020-02-11 11:10:54 +01:00
Daniel Marjamäki 07a251d783 remove BUG_HUNTING_UNINIT conditionals 2020-02-10 21:43:06 +01:00
Daniel Marjamäki a7f57c2cb5 GUI: Improved 'Safe functions' 2020-02-10 21:07:14 +01:00
Daniel Marjamäki f31447943c CLI: Remove experimental --safe-classes, --safe-functions, --bug-hunting, --debug-bug-hunting 2020-02-10 20:27:25 +01:00
Daniel Marjamäki e4250f890e GUI: Show bughunting report 2020-02-10 20:24:36 +01:00
Daniel Marjamäki 4e2e944eb9 GUI: ProjectFileDialog, first tab should be activated first 2020-02-10 18:22:52 +01:00
Paul Fultz II 8fa7dd0fe0
Fix issue 9595: False positive: Using pointer to temporary doesn't account for const ref extended temporary lifetimes (#2525) 2020-02-10 18:01:11 +01:00
Daniel Marjamäki 125c4832cd appveyor: download and install z3 so the gui can be built 2020-02-10 11:19:18 +01:00
Georgy Komarov 0ff23dbd0b misra.py: Handle more cases in Rule 20.3 check (#2529)
This commit add two additional cases for rule 20.3:

1. Support violations in the following format: `#include file.h`
2. Better multiline include directives and inline comments support.

See added test cases for examples.
2020-02-10 08:56:26 +01:00
Daniel Marjamäki bb701fd8be GUI: Tweak ProjectFileDialog: Bug hunting, safe class checking 2020-02-09 21:02:28 +01:00
Georgy Komarov f438cc6105
misra.py: Fix rule 21.1 false positives (#2526)
According MISRA standard, rule 21.1 should hanlde define/undef
directives only. There are no mentions of other C identifiers in the
standard document.
2020-02-09 16:22:26 +01:00
Daniel Marjamäki 58465e6254 AppVeyor: Do not build gui for now because of missing z3 library 2020-02-09 11:22:49 +01:00
IOBYTE 4d58d9fc87
fix daca chromium crash (#2527) 2020-02-09 11:19:36 +01:00
Rikard Falkeborn b1c6f2946a
Fix redundant FP assignment with unsigned zero (#2521)
* Refactor isNullOperand out of FwdAnalysis

* Improve isNullOperand

* Fix redundantAssignment FP with unsigned zero

* isNullValue check number

* Enhance isNullOperand to handle c++ casts

Also handle cast of NULL.
2020-02-09 11:16:08 +01:00
Mathias Buhr 60ada656a0
Allow filtering when using --project (#2522) 2020-02-09 10:51:29 +01:00
Georgy Komarov 6d4eff46be
misra.py: Fix false negative for rule 20.4 (#2528)
Define different sets of reserved keywords for C90 and C99.
This will fix false negative for compliant example, defined in MISRA
document, and close trac 9506.
2020-02-09 10:46:13 +01:00
Dmitry-Me e9b7e7811b Remove unreachable code and repeated computation 2020-02-05 18:20:43 +03:00
Daniel Marjamäki 59635e2706 Travis: install z3 library 2020-02-05 15:53:50 +01:00
Daniel Marjamäki 359cbdc1eb GUI: Tweak ProjectFileDialog 2020-02-05 14:45:29 +01:00
Daniel Marjamäki 25b5304efc GUI: Simple first hack to allow bughunting in the GUI 2020-02-04 21:20:43 +01:00
Daniel Marjamäki ca3095746c Fixed #9594 (False positive: Using argument that points at uninitialized variable when write only) 2020-02-04 18:56:18 +01:00
Dmitry-Me c8df734c07 Merge overlapping patterns 2020-02-04 18:35:30 +03:00
Dmitry-Me 84f65c40a7 Improve test coverage for templates with comparison in default value 2020-02-03 18:36:51 +03:00
Rikard Falkeborn b13ae83845
donate_cpu: Use with ... as (#2520) 2020-02-03 10:27:32 +01:00
Rikard Falkeborn 488bc9997c
Improve isSameExpression for same valued literals with followvar (#2519)
It allows (for example) cppcheck to detect that the lhs and the rhs are
the same in the following example:

	double g()
	{
        	double a = 1e1
	        return a & 10.0;
	}
2020-02-03 09:35:24 +01:00
Rikard Falkeborn 0d361f8a2e
test-my-pr: Retry if failed to get package (#2515) 2020-02-02 18:00:36 +01:00
Rikard Falkeborn bbfd10a69f
Bugfix Mathlib::isNullValue for hexadecimal numbers (#2517) 2020-02-02 16:40:36 +01:00
orbitcowboy cef06741e5 Merge branch 'master' of https://www.github.com/danmar/cppcheck 2020-02-02 16:37:05 +01:00
orbitcowboy 4ac3f3172c wxwidgets.cfg: Added support for more interfaces. 2020-02-02 16:36:44 +01:00
Rikard Falkeborn 60c3d4c482
daca@home: Add links to packages on time page (#2518)
Also, increase the size of the package field to match the setting for
the other pages (some packages are too small to fit at the moment).
2020-02-02 16:36:19 +01:00
Daniel Marjamäki a9f55f4985 CLI: add -isystem include paths when running Clang 2020-02-02 16:35:42 +01:00
Daniel Marjamäki 894497e704 CLI: Checking imported project with clang 2020-02-02 14:36:33 +01:00
Daniel Marjamäki 216698c164 Fix cppcheck project import for Clang parser setting 2020-02-02 12:15:23 +01:00
Daniel Marjamäki 6a2312087c Clang import; Fix crash 2020-02-02 12:13:19 +01:00
Daniel Marjamäki d2dd3930ae GUI: Generate Clang files 2020-02-02 11:05:30 +01:00
Daniel Marjamäki 632dc0f141 GUI: Select parser; Cppcheck or Clang 2020-02-02 10:45:42 +01:00
Daniel Marjamäki 103ecb0257 Refactoring; Avoid templates 2020-02-01 08:52:34 +01:00
Daniel Marjamäki 0e0d88f65e Refactoring; Avoid template<> 2020-02-01 08:39:58 +01:00
Daniel Marjamäki e515f4ab3e Refactoring; Remove unused function 2020-02-01 08:34:36 +01:00
Daniel Marjamäki 0de19acd43 Refactoring; Avoid template<> 2020-02-01 08:32:14 +01:00
Daniel Marjamäki 2b336ac147 Refactoring; stricter lambda capture 2020-02-01 08:28:18 +01:00
Daniel Marjamäki 6c1cc54671 Refactoring; Avoid template<> 2020-02-01 08:24:31 +01:00
Daniel Marjamäki 9eb6925976 Refactoring; Avoid template<> 2020-02-01 08:20:20 +01:00
Rikard Falkeborn ff9c04dc28
Improve isSameExpression for literals (#2514)
Improve isSameExpression() for literals with same value but different
representation, for example  the following different ways of
representing 9 as double: 9.0, 0.9e1 and 0x1.2p3.

With this change, cppcheck can (for example) correctly detect that the
else if statements are always false in the following example:

	void f(double x) {
		if (x < 9.0) {}
		else if (x < 0x1.2p3) {}
		else if (x < 0.9e1) {}
	}
2020-02-01 07:22:41 +01: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
Daniel Marjamäki fb38e87bf4 astyle formatting
[ci skip]
2020-01-31 14:13:52 +01:00
fuzzelhjb b0ce3e4c0c
Support clang tidy (#2512) 2020-01-31 14:10:27 +01:00
fuzzelhjb 4690a9a25d
Check specific vs config (#2513)
* add support for selected Visual Studio configurations in the UI and the project file

* skip VS configurations that don't match the one in the project file

* rename xml tags

* disable selected VS config textbox if all VS configs should be analyzed

* on importing a VS project/solution also read all configurations

* add QListWidget for VS configurations

* auto select these configs that were loaded from the cppcheck file

* fine tune UI and handling if no VS solution/project is used

Co-authored-by: Daniel Marjamäki <daniel.marjamaki@gmail.com>
2020-01-31 14:08:38 +01:00
fuzzelhjb 074d08e39e
Check specific Visual Studio configurations (#2503) 2020-01-31 07:08:38 +01:00
Dmitry-Me 589b497ead Improve test coverage for simplification of bitwise operations 2020-01-30 18:21:22 +03:00