cppcheck/test
Rikard Falkeborn 1fcbd696be Token::ConcatStr(): Handle mixed string literals (#2337)
Improve handling of adjacent string literals of different types.

Example of adjacent string literals: "ab" L"cd".

In C89, C++98 and C++03, this is undefined. As of C99 and C++11, this is
well defined and the two string literals are concatenated to L"abcd".
C11 and C++11 introduces the utf16, utf32 and (C++ only) utf8 string
types. Concatenating any of these with a regular c-string works exactely
as the wide string example above. The result of having two adjacent
string literals with different prefix is implementation defined, unless
one is an UTF-8 string literal and the other is a wide string literal.
In this case the behaviour is undefined.

Ignore the undefined and ill-formed programs (this behaviour is unchanged)
and make sure that concatenating a plain c string literal with a prefixed
one works correct (in C99 and C++11 and later versions). It also makes the
behaviour consistent since previously, "ab" L"cd" would result in "abcd"
while L"ab" "cd" would result in L"abcd".

It also means the somewhat awkward updatePropertiesConcatStr() test can
be removed since the added tests would not work if update_properties()
was not called in concatStr().

Since the prefix is stored in the token, testing the type of the string
is not relevant in TestSimplifyTokens. It is tested extensively in
TestToken::stringTypes().
2019-11-08 08:03:45 +01:00
..
cfg Formatted code. There are no functional changes. [ci skip] 2019-11-07 11:29:37 +01:00
cli Import project: Ignoring paths better 2019-09-12 09:32:24 +02:00
synthetic Improve Python code 2017-06-05 13:23:00 +02:00
testsuites Typos found by running "codespell" (#1804) 2019-04-23 13:26:48 +02:00
verify Verify: Fix a false negative in the itc test suite 2019-10-25 21:46:02 +02:00
CMakeLists.txt Enhance handling of assertion from googletest (#2331) 2019-11-06 21:38:01 +01:00
options.cpp Update Copyright 2019-06-29 07:49:14 +02:00
options.h Update Copyright 2019-06-29 07:49:14 +02:00
redirect.h Updated copyright year 2018-01-14 15:37:52 +01:00
test.cxx
test64bit.cpp Update copyright year 2019-02-09 07:24:06 +01:00
testassert.cpp Moved CheckAssert::assertWithSideEffects to normal checking 2019-03-09 16:50:50 +01:00
testastutils.cpp Fix issue 9305: False positive uninitvar - struct initialized via function (#2123) 2019-08-30 18:32:45 +02:00
testautovariables.cpp Improve librarys config of substr to improve checking cases in issue 8021 (#2338) 2019-11-08 08:02:33 +01:00
testbool.cpp Fix false negatives in checkBitwiseOnBoolean (#2220) 2019-10-06 09:57:31 +02:00
testboost.cpp CheckBoost: Use 'normal' checking 2019-03-09 20:00:31 +01:00
testbufferoverrun.cpp TestBufferOverRun: Handle string literals (#2287) 2019-10-21 07:11:22 +02:00
testcharvar.cpp Remove test case, ValueFlow will truncate and sign-extend values 2019-05-01 19:33:47 +02:00
testclass.cpp Fixed #9373 (False Positive - missingOverride) 2019-11-03 18:42:04 +01:00
testcmdlineparser.cpp Convert SHOWTIME_MODES to enum class 2019-07-31 22:35:51 +02:00
testcondition.cpp Add test for #9326 (FP knownConditionTrueFalse - Returning bool variable treated as condition) 2019-11-03 08:49:39 +01:00
testconstructors.cpp Revert "#9391 Detecting uninited member variables with default ctor (#2249)" 2019-10-09 08:17:47 +02:00
testcppcheck.cpp added missing OVERRIDE usage and removed redundant virtual (#2190) 2019-09-20 21:57:16 +02:00
testerrorlogger.cpp Fixed #9260 (--template=gcc does not work correctly with -j) 2019-08-18 16:33:32 +02:00
testexceptionsafety.cpp Use 'normal' checking instead of 'simplified' 2019-03-16 07:19:48 +01:00
testexprengine.cpp ExprEngine: Improved handling of struct member assignments in loop 2019-10-14 19:41:32 +02:00
testfilelister.cpp Update copyright year 2019-02-09 07:24:06 +01:00
testfunctions.cpp Various clang-tidy fixes (#2192) 2019-09-25 15:25:19 +02:00
testgarbage.cpp AST: non-standard handling of ; in argument list for unknown macro 2019-11-01 09:05:45 +01:00
testimportproject.cpp testrunner: Fix assertion error 2019-08-17 15:12:49 +02:00
testincompletestatement.cpp astyle formatting 2019-05-21 10:43:33 +02:00
testinternal.cpp fix #8965 ("(debug) Executable scope 'x' with unknown function." with rvalue parameter in method) (#2237) 2019-10-04 12:30:11 +02:00
testio.cpp Allow SSIZE_T in addition to ssize_t (#2263) 2019-10-24 21:51:20 +02:00
testleakautovar.cpp Fix #7031 (improve error message for memory related warnings) (#2204) 2019-09-22 21:50:02 +02:00
testlibrary.cpp Refactoring: Convert enum Direction to enum class 2019-08-01 20:56:02 +02:00
testmathlib.cpp Keep prefix in string and char literals (#2272) 2019-10-16 11:41:33 +02:00
testmemleak.cpp Fix #9438 (Don't warn for return (void*) malloc(1)) (#2307) 2019-10-30 17:55:47 +01:00
testnullpointer.cpp Fix issue 9395 and 9423: False positive: nullPointerRedundantCheck (#2323) 2019-11-04 07:02:25 +01:00
testoptions.cpp Allow multiple test case arguments to testrunner (#1755) 2019-03-26 20:28:40 +01:00
testother.cpp Improve test coverage 2019-11-01 18:41:10 +03:00
testpath.cpp Update copyright year 2019-02-09 07:24:06 +01:00
testpathmatch.cpp Update copyright year 2019-02-09 07:24:06 +01:00
testplatform.cpp Update copyright year 2019-02-09 07:24:06 +01:00
testpostfixoperator.cpp Fixed #9042 (Another `using BOOL` type breach) (#1765) 2019-03-27 21:42:50 +01:00
testpreprocessor.cpp use range loops / constness (#2181) 2019-09-19 20:29:33 +02:00
testrunner.cpp Update Copyright 2019-06-29 07:49:14 +02:00
testrunner.vcxproj Windows testrunner: Add testexprengine.cpp (#2184) 2019-09-19 19:40:00 +02:00
testrunner.vcxproj.filters Windows testrunner: Add testexprengine.cpp (#2184) 2019-09-19 19:40:00 +02:00
testsamples.cpp Update copyright year 2019-02-09 07:24:06 +01:00
testsimplifytemplate.cpp Fix template templates where the template template parameter is not the first parameter. (#2309) 2019-10-30 12:12:47 +01:00
testsimplifytokens.cpp Token::ConcatStr(): Handle mixed string literals (#2337) 2019-11-08 08:03:45 +01:00
testsimplifytypedef.cpp Fix #9446 (Syntax error on valid C++ code) (#2316) 2019-11-01 09:11:29 +01:00
testsimplifyusing.cpp fix using type aliases in out of class destructors (#2250) 2019-10-08 19:30:41 +02:00
testsizeof.cpp Improve test coverage 2019-11-01 18:41:10 +03:00
teststl.cpp Track lifetime across multiple returns 2019-09-11 19:25:09 +02:00
teststring.cpp Set correct type and size of string and char literals (#2275) 2019-10-20 07:11:57 +02:00
testsuite.cpp use range loops / constness (#2181) 2019-09-19 20:29:33 +02:00
testsuite.h Warn about unknown macro causing template syntax error (#2222) 2019-09-26 16:01:01 +02:00
testsuppressions.cpp Various clang-tidy fixes (#2192) 2019-09-25 15:25:19 +02:00
testsymboldatabase.cpp Fixed #9449 (SymbolDatabase: Function lookup fails when string literal is converted to bool) 2019-10-30 21:05:42 +01:00
testthreadexecutor.cpp Update copyright year 2019-02-09 07:24:06 +01:00
testtimer.cpp Update copyright year 2019-02-09 07:24:06 +01:00
testtoken.cpp Token::ConcatStr(): Handle mixed string literals (#2337) 2019-11-08 08:03:45 +01:00
testtokenize.cpp Fixed #9324 (FP compareBoolExpressionWithInt - when using C++ and/or operator synonyms) 2019-11-03 12:53:30 +01:00
testtokenlist.cpp Update copyright year 2019-02-09 07:24:06 +01:00
testtype.cpp Fix severity of c++14 shifts with too many bits (#2213) 2019-09-25 20:16:04 +02:00
testuninitvar.cpp Fixed #8617 (False positive: uninitdata for memory allocated and initialized in function called new (C code)) 2019-11-03 17:08:28 +01:00
testunusedfunctions.cpp TestSuite: The ASSERT and ASSERT_EQUALS will now stop executing the test case upon failure. This can be used to avoid extra guard logic in tests. 2019-09-16 06:34:45 +02:00
testunusedprivfunc.cpp Run more tests on full token list (#2020) 2019-07-22 10:26:55 +02:00
testunusedvar.cpp Fixed #9312 (FP : variable is assigned a value that is never used (static)) 2019-11-04 17:59:16 +01:00
testutils.h added missing OVERRIDE usage and removed redundant virtual (#2190) 2019-09-20 21:57:16 +02:00
testvaarg.cpp Disable all simplified checks 2019-03-16 09:17:50 +01:00
testvalueflow.cpp ValueFlow: sizeof string and char literals (#2285) 2019-10-20 21:02:28 +02:00
testvarid.cpp Fix #9383 ("debug: Function::addArguments found argument 'x' with varid 0." with variadic templates) (#2238) 2019-10-06 12:45:42 +02:00