Commit Graph

228 Commits

Author SHA1 Message Date
Oliver Stöneberg fe8730cf0f
MathLib: renamed `to{U}LongNumber()` to `toBig{U}Number()` (#5503)
The name was misleading as it was actually a `long long` and also if we
ever move to an (optional) 128-bit value it wouldn't even less fitting.
We should name it to match our alias type.
2023-10-05 19:21:42 +02:00
Oliver Stöneberg 3cf9100198
fixed #6316 (Use std::to_string() in place of MathLib::toString() ...) - deleted default implementation of `Mathlib::toString()` (#5341)
It was also used inconsistently and seemed to imply there is some
special handling which wasn't the case. It was just an alias for
`std::to_string()` for non-`double` types. So there was no need for it.

---------

Co-authored-by: Robert Reif <reif@earthlink.net>
2023-08-17 16:46:32 +02:00
chrchr-github eee1221738
Use in-class initializers, default constructors, class -> struct (#4842) 2023-08-08 11:05:02 +02:00
chrchr-github bb962e2bc3
Enable and mitigate readability-else-after-return (#5175) 2023-06-20 18:43:21 +02:00
Carl Morgan 6741f774b1
Support integer Z suffix and user defined literals with _ suffix (#10807, #11438) (#5130)
Co-authored-by: Carl Morgan <no-reply@crown.com>
2023-06-08 20:03:41 +02:00
Oliver Stöneberg f5e51eace7
do not use string-to-integer conversions without error handling (#4906) 2023-04-08 22:29:09 +02:00
Oliver Stöneberg bd1ae69b00
cleaned up includes based on `include-what-you-use` (#4599) 2023-03-02 21:50:14 +01:00
Daniel Marjamäki 464fbe8d53 Update copyright year 2023-01-28 10:16:34 +01:00
Oliver Stöneberg 1cfe49e340
use `const_iterator` where possible (#4662) 2022-12-30 15:13:47 +01:00
Oliver Stöneberg 3c68b9b29f
use `cbegin()` and `cend()` with `const_ierator` loops (#4658) 2022-12-20 20:32:16 +01:00
Oliver Stöneberg e01c463ff8
fixed #11428 - improved handling of suffixes in `MathLib::to{Double|ULong|Long}Number()` (#4635)
* fixed #11428 - improved handling of suffices in `MathLib::to{Double|ULong|Long}Number()`

* testmathlib.cpp: adjustments for `libc++`

* mathlib.cpp: added TODO
2022-12-13 07:52:45 +01:00
Oliver Stöneberg 8bb5ac0efd
improved `MathLib::to{ULong|Long|Double}Number()` and increased test coverage / added CMake option `USE_LIBCXX` / fixed #10695 (#4611) 2022-12-07 09:20:09 +01:00
chrchr-github cf8051b7e2
Fix #11368 FP "Same value in both branches of ternary operator" on plus and minus zero (#4569)
Fix #11368 FP "Same value in both branches of ternary operator" on plus and minus zero
2022-10-31 15:18:25 +01:00
chrchr-github 3273e51fd5
Fix #10412 FN useStlAlgorithm with iterators (#4157) 2022-10-16 13:46:26 +02:00
Oliver Stöneberg cff1cd9cda
applied clang-tidy `misc-const-correctness` fixes for POD types, iterators and references (#4529)
* applied `misc-const-correctness` fixes for POD types and iterators

* applied `misc-const-correctness` fixes for references
2022-10-02 07:12:40 +02:00
Oliver Stöneberg 16f598c409
added missing `sstream` includes (#4381) 2022-08-19 10:16:23 +02:00
chrchr-github 63e567eb50
Remove simplifyKnownVariables() (#4232)
* Remove simplifyKnownVariables()

* Add some test cases back

* Remove unused functions

* Format
2022-06-25 08:38:17 +02:00
PKEuS d20ea41325
Refactorization: Removed compatibility hacks for outdated or non-conformant compilers (#4186)
Merged from LCppC.
2022-06-08 15:16:01 +02:00
orbitcowboy e02182bd88 Cleanup redundant parentheses 2022-05-15 07:53:32 +02:00
Daniel Marjamäki 3989408738 Update copyright year 2022-02-05 11:45:17 +01:00
Oliver Stöneberg 171da2e6f9
avoid dependency on transitive includes - based on include-what-you-use (#3757) 2022-01-27 19:03:20 +01:00
Oliver Stöneberg 55ff684f34
added unusedFunction self check to CI / cleanups (#3526) 2022-01-18 22:02:25 +01:00
Oliver Stöneberg 6739995e79
removed or annotated some code which is only used in test code (#3656) 2022-01-03 12:40:20 +01:00
Paul Fultz II 7f358b2bed
Format with uncrustify (#3388) 2021-08-07 20:51:18 +02:00
Daniel Marjamäki abb4200316 Fixed #10196 ("Unhandled char constant 'x'" with non-standard escape character) 2021-05-08 12:54:18 +02:00
Daniel Marjamäki f7d0bf7a59 Refactoring; Reuse simplecpp::characterLiteralToLL 2021-05-02 13:44:37 +02:00
Daniel Marjamäki 6f60c6d965 Revert "Refactoring; Reuse function in simplecpp"
This reverts commit dbe9eb2a27.
2021-05-01 19:54:14 +02:00
Daniel Marjamäki dbe9eb2a27 Refactoring; Reuse function in simplecpp 2021-05-01 18:13:40 +02:00
Yichen 8034a70bd3
Check for libc++ instead of clang to workaround a libc++ bug. (#3194) 2021-04-05 05:24:46 +02:00
Daniel Marjamäki 42437277dc Update Copyright year 2021-03-21 20:58:32 +01:00
Oliver Stöneberg 3814163373
some MathLib adjustments for out-of-range numbers after std::stringstream removal (#3100) 2021-02-13 19:10:45 +01:00
IOBYTE fde5994cc3
fix #10061 (debug: Executable scope 'x' with unknown function.) (#3062) 2021-01-18 19:01:04 +01:00
Oliver Stöneberg 9f9a652ae1
refs issue #9089: avoid usage of expensive std::stringstream (#2996) 2021-01-16 19:03:28 +01:00
Paul Fultz II bc3f5554a4
Fix issue 8871: improve check: mismatching container size conditions (#2988) 2021-01-10 13:30:00 +01:00
Rikard Falkeborn bd4dc364a7
mathlib: Refactor to use enum class (#2872) 2020-11-01 11:47:34 +01:00
Oliver Stöneberg 37bc0483a4
made check.h less heavy (#2633) 2020-05-23 07:16:49 +02:00
Daniel Marjamäki 08ddd84780 Update copyright year 2020-05-10 11:16:32 +02:00
Daniel Marjamäki 3e0218299b Revert "Update copyright year"
This reverts commit 6eec6c4bd5.
2020-05-10 11:13:05 +02:00
Daniel Marjamäki 6eec6c4bd5 Update copyright year 2020-05-10 11:11:34 +02:00
Rikard Falkeborn f6e7fb4bd9
Bugfix valuetype for some integer constants (#2545) 2020-02-19 07:51:39 +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
Rikard Falkeborn bbfd10a69f
Bugfix Mathlib::isNullValue for hexadecimal numbers (#2517) 2020-02-02 16:40:36 +01:00
Rikard Falkeborn c6e74f4c10 Mathlib: Fix value of suffixed binary integer literal (#2487) 2020-01-12 08:11:12 +01:00
Sebastian c990d10ffa
Check for JSON error when parsing addon .json files + fixes (#2374)
* cppcheck.cpp: Check for JSON error when parsing addon .json files

This fixes that errors in JSON files given via `--addon=*.json` are
silently ignored and maybe only a part of the JSON file is used.
Now the error message which picojson can return is checked and a
corresponding error message is returned again by getAddonInfo().

* naming.json: Fix missing comma

* CLI: Fix naming violations detected by addon naming.py via naming.json

* Addon naming: Add argument for validating names of constants

* LIB: Rename functions/variables so they are valid, loosen naming rules

* GUI: Fix naming violations
2019-11-20 15:37:09 +01:00
Rikard Falkeborn 297360920a Keep prefix in string and char literals (#2272)
Keeping the prefix in the token allows cppcheck to print the correct
string and char literals in debug and error messages.

To achieve this, move some of the helper functions from token.cpp to
utils.h so that checks that look at string and char literals can reuse
them. This is a large part of this commit.

Note that the only user visible change is that when string and char
literals are printed in error messages, the prefix is now included.

For example:

	int f() {
		return test.substr( 0 , 4 ) == U"Hello" ? 0 : 1 ;
	};

now prints U"Hello" instead of "Hello" in the error message.
2019-10-16 11:41:33 +02:00
Oliver Stöneberg de9f489b08 use range loops / constness (#2181)
* use range loops / constness

* platform.cpp: avoid shadowed variable
2019-09-19 20:29:33 +02:00
Daniel Marjamäki ec4d68e231 Modernize: use enum class 2019-07-17 10:43:18 +02:00
Scott Furry a195477470 Correct Zero/Null as pointer constant (#1938)
Building with enhanced clang warnings indicated a large number of
instances with the warning:

`warning: zero as null pointer constant`

Recommended practice in C++11 is to use `nullptr` as value for
a NULL or empty pointer value. All instances where this warning
was encountered were corrected in this commit.

Where warning was encountered in dependency code (i.e. external library)
no chnages were made. Patching will be offered upstream.
2019-06-30 21:39:22 +02:00
orbitcowboy f54c60c13d Running astyle [ci skip] 2019-05-28 08:49:59 +02:00
orbitcowboy b3c3ecf926 MathLib: Removed condition that is evaluates always to 'false'. 2019-05-26 10:46:12 +02:00