Commit Graph

149 Commits

Author SHA1 Message Date
Daniel Marjamäki bd7790fd8c Update copyright year 2019-02-09 07:24:06 +01:00
Sebastian 4b1544d33b
library.cpp: Let tinyxml2 print a helpful error message when XML is bad (#1609)
In case the XML code of a library configuration is invalid Cppcheck now additionally prints out some helpful error description like this:
"Error=XML_ERROR_MISMATCHED_ELEMENT ErrorID=16 (0x10) Line number=304: XMLElement name=noreturn"
2019-01-18 17:10:41 +01:00
Daniel Marjamäki b3e6ecd827 Library: Make loading of cfg files more robust. Saw a problem to use --library=gtk when the current folder has a folder 'gtk' 2018-12-24 08:37:33 +01:00
Daniel Marjamäki 866d198756 Fixed #8697 (noreturn output stream) 2018-08-21 06:32:33 +02:00
Daniel Marjamäki 7c4820e047 Rename Library::isargvalid() 2018-07-15 23:05:48 +02:00
rikardfalkeborn 491ee577c6 Support floats in valid config (#1297)
* Add tests for invalid ranges

* Refactor loadLibErrors

This reduces the amount of code slightly and will simplify adding
more tests.

* Handle empty valid field

Before this change, the sequence <valid></valid> in a config file would
result in a segmentation fault. Now an empty field results in the error
message:

cppcheck: Failed to load library configuration file 'mycfg.cfg'. Bad attribute value '""'

* Add support for valid for floating point arguments

Previously, it was not possible to add valid ranges to floating point
arguments since it only handled integers. This made ranges not work well
for floating point arguments since arguments were cast to integers
before the ranges were handled.

Fix this by using doubles instead of integers if the argument is a float.
Add some tests for this and make sure errors are printed with enough
precision (somewhat arbitrarily chosen).

Note that it is still only possible to add integer ranges (i.e. -1:1).

* Add support for floats in configuration valid range

Now that it is possible to handle decimal arguments, there is no reason
to not allow non-integer ranges. Take care to not allow broken
configurations.

* Move check to within if-clause

* Move asin{,f,l} and acos{,f,l} input checks to config file
2018-07-15 22:47:56 +02:00
Daniel Marjamäki 39857220ce Refactoring: Use range for loops 2018-07-15 15:08:35 +02:00
Daniel Marjamäki 2a8296879c CheckOther: Use Variable::valueType() instead of Variable::typeStartToken 2018-06-23 16:42:36 +02:00
Daniel Marjamäki 610b26bfbc Rename private member _platform_types 2018-06-17 16:58:28 +02:00
Daniel Marjamäki 074177fc6e Rename private member variables 2018-06-17 16:55:02 +02:00
Daniel Marjamäki dbf89856c0 Renamed Library private member variables 2018-06-17 16:39:10 +02:00
Daniel Marjamäki fb8e970419 Rename _alloc 2018-06-17 16:32:08 +02:00
Daniel Marjamäki 78974e9267 Rename _type to mType 2018-06-16 20:25:54 +02:00
Daniel Marjamäki d08b6e02b7 renamed _files to mFiles 2018-06-16 16:23:55 +02:00
Paul Fultz II 2a657cfd08 Check for double frees when using smart pointers (#1172)
* Check for double frees when using smart pointers

* Some updates from feedback

* Add test for mismatch allocation

* Constants

* Check smart pointer deleter

* Switch order

* Use next

* Add owned state

* Fix handling of leaks

* Use ast for checking addressof operator

* Remove stray character

* Add a test for mismatch allocator

* Add another test for deallocating with custom function
2018-04-16 11:11:13 +02:00
PKEuS d2146844dd Refactorizations:
- Replace several push_back-calls by emplace_back
- Replace some x = x.substr(0, y) calls by x.erase(y)
2018-04-11 09:44:35 +02:00
jrp2014 b6504c70ca Improve constness 2018-04-04 21:51:31 +02:00
Daniel Marjamäki 7e4dba6a7e Updated copyright year 2018-03-31 20:59:09 +02:00
Daniel Marjamäki e65a5529ad astyle formatting
[ci skip]
2018-03-24 12:30:11 +01:00
Paul 43be20a824 Check more opposite conditions 2018-03-24 07:58:37 +01:00
Daniel Marjamäki c4caee6b18 Updated copyright year 2018-01-14 15:37:52 +01:00
Daniel Marjamäki 1656ecd73b Revert changes I committed by mistake 2017-10-11 17:15:28 +02:00
Daniel Marjamäki cc82288ff6 Travis: Suppress false positive 2017-10-11 17:14:02 +02:00
Daniel Marjamäki b81b4fcb78 Fixed #8208 (CheckCondition: Use Library to determine if function is const) 2017-09-08 18:08:32 +02:00
Daniel Marjamäki 9eed9adf3c Fixed CID 1361393, logically dead code in return statement 2017-09-02 10:49:29 +02:00
Dmitry-Me 7bd3dc5da6 Simplify array access with references 2017-08-28 18:19:03 +03:00
Ayaz Salikhov b8cd7dbb5c Use nullptr instead of 0 or NULL (#936) 2017-08-09 20:00:26 +02:00
uburuntu f4ce49d883 ENH: perfomance: using clear() and empty() more faster for stl containers 2017-06-02 22:38:00 +04:00
Ayaz Salikhov 28aa939d69 iwyu - include what you use 2017-05-27 04:33:47 +02:00
Daniel Marjamäki 1faca91c1d Added 'endsWith' utility function. This will make compiling the democlient easier. 2017-04-01 18:14:18 +02:00
PKEuS 2938278f00 Refactorization: Store minsizes in vector instead of list which has less overhead 2017-03-27 17:53:43 +02:00
PKEuS 92414b923a Library: Support variadic functions which are not a formatstr-function 2017-03-14 17:41:34 +01:00
PKEuS 2f0db369f0 Refactorization: Avoid construction of empty strings by using emptyString 2017-03-01 10:50:50 +01:00
PKEuS 40401534d7 Refactorized Library 2016-12-06 14:50:27 +01:00
PKEuS 2f6350a0d0 Refactorized Library 2016-12-06 14:09:28 +01:00
PKEuS 6e8ac13325 Refactorization:
- Optimized std::string usage
- Replaced list by vector
- Moved iterator into loop head
- Ran AStyle
2016-12-05 17:45:34 +01:00
PKEuS d665641a76 Refactorizations:
- use std::string::pop_back() and std::string::back()
- pass argument as const std::string&
- Moved iterator into for loop head
2016-12-05 14:50:01 +01:00
Daniel Marjamäki 0e9810b7f6 CheckStl: validation of iterators returned from functions 2016-11-01 14:08:42 +01:00
Daniel Marjamäki 08a618c476 Library: Add <iterator> element in <function> <arg>. Not used by any checks yet. 2016-10-25 23:07:18 +02:00
Daniel Marjamäki f973a9a9d5 SymbolDatabase: Refactoring handling of library-function return type 2016-10-23 23:20:36 +02:00
Daniel Marjamäki c8f831b70d Library: Allow that type of function return is specified. Fixes #7668. 2016-10-23 23:04:15 +02:00
Daniel Marjamäki fae4a4dacf Fixed #7668 (ValueFlow: return value from abs) 2016-10-17 13:05:19 +02:00
Daniel Marjamäki 03a6282ab3 Fixed #7338 (Library: method in base class) 2016-09-04 14:14:21 +02:00
Daniel Marjamäki 789aef7fde Fixed #4920 (Microsoft ATL/MFC CString::Format argument checking) 2016-08-19 17:36:27 +02:00
Daniel Marjamäki 095b2f73f7 Library: look for cfg files in more paths, include exepath even if CFGDIR is used. 2016-08-01 12:58:33 +02:00
PKEuS ded8d80b23 Library: Support arguments with default value. Fixed default value handling for <container> tags broken in last commit. 2016-07-09 12:44:17 +02:00
PKEuS b5d3ecb942 Updated TinyXML, make use of second argument of XMLElement::Attribute() 2016-07-09 11:56:07 +02:00
PKEuS 64d2fd2f57 Added new attribute "arg" to <alloc> and <dealloc> to specify the argument that is allocated/deallocated.
This fixes several issues with allocation functions in windows.cfg, such as HeapAlloc() and VirtualAllocEx() (#7503)
2016-05-22 17:19:14 +02:00
Lauri Nurmi 996c9244d8 Update copyright year to 2007-2016. 2016-01-01 15:34:45 +02:00
Alexander Mai 9d8dffbd79 #6269 false positives in case of overloaded standard library functions. Detect memset() with proper argument cound, using new function numberOfArguments() 2015-12-06 12:50:05 +01:00