Commit Graph

53 Commits

Author SHA1 Message Date
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
IOBYTE ce50df8047 Fix override warnings. (#1234) 2018-05-15 16:37:40 +02:00
Daniel Marjamäki 7e4dba6a7e Updated copyright year 2018-03-31 20:59:09 +02:00
orbitcowboy 782ebdc8e8 testlibrary: Minor improvements, take into account the return values from readLibrary in unit-tests. 2018-02-17 23:33:24 +01:00
Daniel Marjamäki c4caee6b18 Updated copyright year 2018-01-14 15:37:52 +01:00
Ayaz Salikhov 28aa939d69 iwyu - include what you use 2017-05-27 04:33:47 +02:00
Alexander Mai 6db9c78fb6 Address some warnings on test code 2017-05-03 14:39:21 +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 cfac3b457d Several small refactorizations 2016-12-06 22:12:02 +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
Daniel Marjamäki 03a6282ab3 Fixed #7338 (Library: method in base class) 2016-09-04 14:14:21 +02:00
Daniel Marjamäki 497b3c38e2 astyle formatting
[ci skip]
2016-08-19 17:34:30 +02:00
Daniel Marjamäki e7c1e8b82e TestLibrary: Added tests for method calls 2016-08-19 10:47:44 +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 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
PKEuS 57d1196386 Replaced CheckNonReentrantFunctions and CheckObsoleteFunctions by generic CheckFunctions which is based on Library (#6529) 2015-11-22 09:18:07 +01:00
PKEuS 53b2eca983 Reimplemented CheckStl::stlBoundaries() based on Libraries; Added support for iterators to libraries 2015-11-20 15:53:14 +01:00
Daniel Marjamäki 0f9d90d2be Changed Copyrights. Removed my name. 2015-11-18 20:04:50 +01:00
Philipp Kloke 7060c7c87d Refactorization: Reduced code duplication in testlibrary.cpp 2015-10-19 09:01:20 +02:00
Daniel Marjamäki 5b287fc849 Library: The <function> name attribute can now have a comma separated list of names 2015-08-09 21:27:57 +02:00
Daniel Marjamäki b70fe4c609 Fixed #6711 (Add namespace support to library files) 2015-08-09 19:55:33 +02:00
amai2012 649a89d308 Refactoring: Expose some previously local functions to public and add Tokenizer as argument to distinguish between C and C++ code (e.g. in isSameExpression).
Refactoring: Improve type-safety for TestFixture::assertEquals to allow tests with types which were not handled correctly (e.g. unsigned long long)
2015-06-28 12:08:36 +02:00
PKEuS bc5132e0ac Refactorization: Moved declaration of errout, ... to testsuite.h, uniformized style 2015-03-11 22:54:43 +01:00
Daniel Marjamäki 830f656a25 Library: variables are not library functions (variable declarations can look like function calls) 2015-03-01 11:46:43 +01:00
Daniel Marjamäki 73113c67e7 Fixed #6480 (False positive unreachableCode - member function exit called instead of ::exit()) 2015-01-31 16:55:55 +01:00
PKEuS 98e33a189f Enhanced CheckBufferOverrun:
- Fixed bug in library: manual and existing libraries use "size", but library.cpp reads "sizeof" as podtype attribute
- Fixed a couple of bugs in handling unknown size in checkbufferoverrun.cpp, get size from library if available.
2015-01-30 20:27:48 +01:00
Daniel Marjamäki 3285f85ebf Fixed #6460 (Library: better function/type matching) 2015-01-27 17:55:18 +01:00
Daniel Marjamäki 6a8293a8b7 Library: More strict matching of functions 2015-01-08 19:31:41 +01:00
PKEuS e06a4cdf00 Refactorized CheckStl::if_find():
- Added support for find()-like functions to Library::Container
- Use <container> information from library
- Fixed false positive #6402
2015-01-04 12:43:50 +01:00
PKEuS e39729ffcc Library: Add <container> tag to Libraries, provide configuration for std::vector, std::deque, std::array and STL strings
Token: Added function to jump to the next template argument
2015-01-03 22:18:33 +01:00
Daniel Marjamäki ff11ba9847 Updated copyright year to 2015 2015-01-03 12:14:58 +01:00
Daniel Marjamäki 051d42ae6b astyle formatting 2014-11-20 14:20:09 +01:00
orbitcowboy f5d804f71a running astyle 2014-11-20 10:13:03 +01:00
PKEuS cbb8360b30 Added version attribute to .cfg files (#5928) 2014-09-29 16:26:17 +02:00
amai2012 f1bf38004b Fix MSVC compiler warnings 2014-07-06 13:08:22 +02:00
Daniel Marjamäki a3acc3241e Library: Added <minsize> element used for buffer overrun checking 2014-07-05 20:31:43 +02:00
Daniel Marjamäki 42c3b3c89d Library: Change range operator in validation pattern to ':' 2014-06-08 18:12:11 +02:00
Daniel Marjamäki 9e81fa04b2 Library: Added 'podtype' element. Partial fix for #5623 2014-06-08 12:09:00 +02:00
Daniel Marjamäki 4c7b0806aa Library: handle validation expression '-1000-0'. Ticket #5847 2014-06-07 16:28:29 +02:00
Daniel Marjamäki 0c5707ebf1 Fixed #5512 (library (memory): extending standard free deallocator with allocators in custom cppcheck configuration file) 2014-04-19 13:15:06 +02:00
PKEuS a01bfcb62d Fixed a few cppcheck messages 2014-03-28 18:55:16 +01:00
Alexander Mai 1d4839b8a6 Fixed #1374 (false negative: using uninitialized variable in printf) 2014-03-06 06:16:14 +01:00
Daniel Marjamäki fd3a8a2a18 Update copyright 2014-02-15 07:45:39 +01:00
PKEuS 6f76dfcb22 Forward declare tinyxml type used in library.h to avoid problems with dynamic linked configuration. 2013-12-31 12:30:17 +01:00
Daniel Marjamäki 76b907fe65 Fixed #5252 (Improve check: use Library to validate function arguments in invalidFunctionUsage) 2013-12-23 10:06:45 +01:00
Daniel Marjamäki be03d4718a Library: Added <valid> element that is used to define valid input values for functions 2013-12-22 19:10:14 +01:00