cppcheck/lib
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
..
CMakeLists.txt
analyzerinfo.cpp Update Copyright 2019-06-29 07:49:14 +02:00
analyzerinfo.h
astutils.cpp Fix issue 9201: FP: returnDanglingLifetime on pointer to variable of static struct (#2303) 2019-11-05 07:10:32 +01:00
astutils.h Fix issue 9201: FP: returnDanglingLifetime on pointer to variable of static struct (#2303) 2019-11-05 07:10:32 +01:00
check.cpp Updated copyright year 2019-09-01 11:49:43 +02:00
check.h deleted methods should be public (#2193) 2019-09-20 21:58:09 +02:00
check64bit.cpp
check64bit.h
checkassert.cpp
checkassert.h added missing OVERRIDE usage and removed redundant virtual (#2190) 2019-09-20 21:57:16 +02:00
checkautovariables.cpp Fix issue 9201: FP: returnDanglingLifetime on pointer to variable of static struct (#2303) 2019-11-05 07:10:32 +01:00
checkautovariables.h Extend lifetime checking to temporaries (#2242) 2019-10-08 09:28:39 +02:00
checkbool.cpp Fix false negatives in checkBitwiseOnBoolean (#2220) 2019-10-06 09:57:31 +02:00
checkbool.h Fix false negatives in checkBitwiseOnBoolean (#2220) 2019-10-06 09:57:31 +02:00
checkboost.cpp
checkboost.h
checkbufferoverrun.cpp TestBufferOverRun: Handle string literals (#2287) 2019-10-21 07:11:22 +02:00
checkbufferoverrun.h Fix Cppcheck warnings 2019-06-15 13:01:45 +02:00
checkclass.cpp Fix typo 2019-11-01 18:39:53 +03:00
checkclass.h Renamed safeClassRefMember => unsafeClassRefMember 2019-08-13 20:58:31 +02:00
checkcondition.cpp Fixed #9363 (knownConditionTrueFalse: False positive about function parameter) 2019-10-31 08:34:09 +01:00
checkcondition.h Add impossible values to ValueFlow (#2186) 2019-09-20 15:06:37 +02:00
checkexceptionsafety.cpp
checkexceptionsafety.h
checkfunctions.cpp Replace 'unsigned' with 'nonneg' in checkfunctions 2019-07-16 08:49:02 +02:00
checkfunctions.h Replace 'unsigned' with 'nonneg' in checkfunctions 2019-07-16 08:49:02 +02:00
checkinternal.cpp
checkinternal.h
checkio.cpp Allow SSIZE_T in addition to ssize_t (#2263) 2019-10-24 21:51:20 +02:00
checkio.h replace 'unsigned' with 'nonneg' in checkio 2019-07-16 08:37:26 +02:00
checkleakautovar.cpp Fix #7031 (improve error message for memory related warnings) (#2204) 2019-09-22 21:50:02 +02:00
checkleakautovar.h Fix #7031 (improve error message for memory related warnings) (#2204) 2019-09-22 21:50:02 +02:00
checkmemoryleak.cpp Fix #9438 (Don't warn for return (void*) malloc(1)) (#2307) 2019-10-30 17:55:47 +01:00
checkmemoryleak.h Memleak: Refactor check to separate function (#2079) 2019-08-13 13:00:59 +02:00
checknullpointer.cpp Move necessary code into valuetype (#2265) 2019-10-12 11:40:02 +02:00
checknullpointer.h
checkother.cpp Fixed #9261 (Inconsistent violation report between using global enum and namespaced enum.) 2019-10-20 07:07:38 +02:00
checkother.h Created redundantInitialization id 2019-08-25 09:45:39 +02:00
checkpostfixoperator.cpp
checkpostfixoperator.h
checksizeof.cpp Update Copyright 2019-06-29 07:49:14 +02:00
checksizeof.h
checkstl.cpp Refactor ProgramMemory and PathAnalysis (#2311) 2019-10-30 17:57:46 +01:00
checkstl.h added missing OVERRIDE usage and removed redundant virtual (#2190) 2019-09-20 21:57:16 +02:00
checkstring.cpp Set correct type and size of string and char literals (#2275) 2019-10-20 07:11:57 +02:00
checkstring.h
checktype.cpp Fix severity of c++14 shifts with too many bits (#2213) 2019-09-25 20:16:04 +02:00
checktype.h Clarify signConversion warning message 2019-08-05 12:41:08 +02:00
checkuninitvar.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
checkuninitvar.h Fix issue 8785: ValueFlow: Track pointer alias 2019-09-03 17:16:15 +02:00
checkunusedfunctions.cpp
checkunusedfunctions.h Silence unused variable warning (#2223) 2019-09-27 08:19:45 +02:00
checkunusedvar.cpp Fixed #9312 (FP : variable is assigned a value that is never used (static)) 2019-11-04 17:59:16 +01:00
checkunusedvar.h
checkvaarg.cpp
checkvaarg.h added missing OVERRIDE usage and removed redundant virtual (#2190) 2019-09-20 21:57:16 +02:00
config.h sync (#1835) 2019-05-17 09:31:41 +02:00
cppcheck.cpp do not access static methods through instance (#2189) 2019-09-20 21:54:30 +02:00
cppcheck.h added missing OVERRIDE usage and removed redundant virtual (#2190) 2019-09-20 21:57:16 +02:00
cppcheck.natvis
cppcheck.vcxproj lib/cppcheck.vcxproj: Fix Visual Studio build, add new files. 2019-10-31 08:29:19 +01:00
cppcheck.vcxproj.filters cppcheck.vcxproj.filters: Also update this Visual Studio file 2019-10-31 09:05:58 +01:00
ctu.cpp Add impossible values to ValueFlow (#2186) 2019-09-20 15:06:37 +02:00
ctu.h CTU: Add 'column' 2019-09-12 10:46:33 +02:00
errorlogger.cpp use range loops / constness (#2181) 2019-09-19 20:29:33 +02:00
errorlogger.h Fixed #9260 (--template=gcc does not work correctly with -j) 2019-08-18 16:33:32 +02:00
exprengine.cpp Fix Cppcheck warning 2019-10-27 18:22:47 +01:00
exprengine.h add override (#2305) 2019-10-29 20:06:40 +01:00
importproject.cpp Various clang-tidy fixes (#2192) 2019-09-25 15:25:19 +02:00
importproject.h astyle formatting 2019-08-12 12:54:25 +02:00
lib.pri Run dmake 2019-10-30 18:38:37 +01:00
library.cpp Search relative path first before install path (#2328) 2019-11-05 07:09:59 +01:00
library.h Library: added 'stdtype' attribute in <podtype> element so we can configure standard types better 2019-09-29 16:48:25 +02:00
matchcompiler.h Update copyright year to 2007-2016. 2016-01-01 15:34:45 +02:00
mathlib.cpp Keep prefix in string and char literals (#2272) 2019-10-16 11:41:33 +02:00
mathlib.h
path.cpp Various clang-tidy fixes (#2192) 2019-09-25 15:25:19 +02:00
path.h
pathanalysis.cpp Refactor ProgramMemory and PathAnalysis (#2311) 2019-10-30 17:57:46 +01:00
pathanalysis.h Refactor ProgramMemory and PathAnalysis (#2311) 2019-10-30 17:57:46 +01:00
pathmatch.cpp
pathmatch.h
pcrerules.pri pro and pri files: remove unneeded empty lines, use spaces for consistency 2012-10-12 17:46:57 +02:00
platform.cpp use range loops / constness (#2181) 2019-09-19 20:29:33 +02:00
platform.h Updated copyright year 2019-09-01 11:49:43 +02:00
preprocessor.cpp Various clang-tidy fixes (#2192) 2019-09-25 15:25:19 +02:00
preprocessor.h
programmemory.cpp Fix issue 9395 and 9423: False positive: nullPointerRedundantCheck (#2323) 2019-11-04 07:02:25 +01:00
programmemory.h astyle formatting 2019-10-30 18:19:45 +01:00
settings.cpp ExprEngine: Add --debug-verify, fixed handling of global arrays 2019-09-29 15:00:54 +02:00
settings.h ExprEngine: Add --debug-verify, fixed handling of global arrays 2019-09-29 15:00:54 +02:00
standards.h Various clang-tidy fixes (#2192) 2019-09-25 15:25:19 +02:00
suppressions.cpp Fix Cppcheck warning: Suppressions::dump can be const 2019-06-29 07:53:32 +02:00
suppressions.h Fix Cppcheck warning: Suppressions::dump can be const 2019-06-29 07:53:32 +02:00
symboldatabase.cpp Fixed #9373 (False Positive - missingOverride) 2019-11-03 18:42:04 +01:00
symboldatabase.h Extend lifetime checking to temporaries (#2242) 2019-10-08 09:28:39 +02:00
templatesimplifier.cpp Fix template templates where the template template parameter is not the first parameter. (#2309) 2019-10-30 12:12:47 +01:00
templatesimplifier.h template simplifier: ignore friend templates (#2122) 2019-09-01 09:56:33 +02:00
timer.cpp Updated copyright year 2019-09-01 11:49:43 +02:00
timer.h Convert SHOWTIME_MODES to enum class 2019-07-31 22:35:51 +02:00
token.cpp Token::ConcatStr(): Handle mixed string literals (#2337) 2019-11-08 08:03:45 +01:00
token.h Set correct type and size of string and char literals (#2275) 2019-10-20 07:11:57 +02:00
tokenize.cpp Fixed #9324 (FP compareBoolExpressionWithInt - when using C++ and/or operator synonyms) 2019-11-03 12:53:30 +01:00
tokenize.h Fixed #6975 and #9376 (Tokenizer: unknown macro without semicolon) 2019-11-02 19:34:19 +01:00
tokenlist.cpp AST: Do not hang for code 'foo({ for (a;b;c) {} });' 2019-11-03 11:02:59 +01:00
tokenlist.h template simplifier: fix new daca crashes (#2093) 2019-08-17 07:38:07 +02:00
utils.h Keep prefix in string and char literals (#2272) 2019-10-16 11:41:33 +02:00
valueflow.cpp Fix issue 9453: False positive: danglingLifetime, address of array argument (#2335) 2019-11-07 09:33:17 +01:00
valueflow.h Refactor ProgramMemory and PathAnalysis (#2311) 2019-10-30 17:57:46 +01:00
version.h Set version to 1.89.99/1.90 dev 2019-09-02 15:44:40 +02:00
version.rc