@@ -1099,22 +1099,24 @@ unsigned int CppCheck::checkFile(const FileWithDetails& file, const std::string
10991099 if (!mSettings .force && ++checkCount > mSettings .maxConfigs )
11001100 break ;
11011101
1102+ std::string currentConfig;
1103+
11021104 if (!mSettings .userDefines .empty ()) {
1103- mCurrentConfig = mSettings .userDefines ;
1105+ currentConfig = mSettings .userDefines ;
11041106 const std::vector<std::string> v1 (split (mSettings .userDefines , " ;" ));
11051107 for (const std::string &cfg: split (currCfg, " ;" )) {
11061108 if (std::find (v1.cbegin (), v1.cend (), cfg) == v1.cend ()) {
1107- mCurrentConfig += " ;" + cfg;
1109+ currentConfig += " ;" + cfg;
11081110 }
11091111 }
11101112 } else {
1111- mCurrentConfig = currCfg;
1113+ currentConfig = currCfg;
11121114 }
11131115
11141116 if (mSettings .preprocessOnly ) {
11151117 std::string codeWithoutCfg;
11161118 Timer::run (" Preprocessor::getcode" , mSettings .showtime , &s_timerResults, [&]() {
1117- codeWithoutCfg = preprocessor.getcode (tokens1, mCurrentConfig , files, true );
1119+ codeWithoutCfg = preprocessor.getcode (tokens1, currentConfig , files, true );
11181120 });
11191121
11201122 if (startsWith (codeWithoutCfg," #file" ))
@@ -1137,7 +1139,7 @@ unsigned int CppCheck::checkFile(const FileWithDetails& file, const std::string
11371139
11381140 // Create tokens, skip rest of iteration if failed
11391141 Timer::run (" Tokenizer::createTokens" , mSettings .showtime , &s_timerResults, [&]() {
1140- simplecpp::TokenList tokensP = preprocessor.preprocess (tokens1, mCurrentConfig , files, true );
1142+ simplecpp::TokenList tokensP = preprocessor.preprocess (tokens1, currentConfig , files, true );
11411143 tokenlist.createTokens (std::move (tokensP));
11421144 });
11431145 hasValidConfig = true ;
@@ -1152,9 +1154,9 @@ unsigned int CppCheck::checkFile(const FileWithDetails& file, const std::string
11521154 mLogger ->setLocationMacros (tokenizer.tokens (), files);
11531155
11541156 // If only errors are printed, print filename after the check
1155- if (!mSettings .quiet && (!mCurrentConfig .empty () || checkCount > 1 )) {
1157+ if (!mSettings .quiet && (!currentConfig .empty () || checkCount > 1 )) {
11561158 std::string fixedpath = Path::toNativeSeparators (file.spath ());
1157- mErrorLogger .reportOut (" Checking " + fixedpath + " : " + mCurrentConfig + " ..." , Color::FgGreen);
1159+ mErrorLogger .reportOut (" Checking " + fixedpath + " : " + currentConfig + " ..." , Color::FgGreen);
11581160 }
11591161
11601162 if (!tokenizer.tokens ())
@@ -1170,12 +1172,12 @@ unsigned int CppCheck::checkFile(const FileWithDetails& file, const std::string
11701172#endif
11711173
11721174 // Simplify tokens into normal form, skip rest of iteration if failed
1173- if (!tokenizer.simplifyTokens1 (mCurrentConfig ))
1175+ if (!tokenizer.simplifyTokens1 (currentConfig ))
11741176 continue ;
11751177
11761178 // dump xml if --dump
11771179 if ((mSettings .dump || !mSettings .addons .empty ()) && fdump.is_open ()) {
1178- fdump << " <dump cfg=\" " << ErrorLogger::toxml (mCurrentConfig ) << " \" >" << std::endl;
1180+ fdump << " <dump cfg=\" " << ErrorLogger::toxml (currentConfig ) << " \" >" << std::endl;
11791181 fdump << " <standards>" << std::endl;
11801182 fdump << " <c version=\" " << mSettings .standards .getC () << " \" />" << std::endl;
11811183 fdump << " <cpp version=\" " << mSettings .standards .getCPP () << " \" />" << std::endl;
@@ -1196,7 +1198,7 @@ unsigned int CppCheck::checkFile(const FileWithDetails& file, const std::string
11961198 const std::size_t hash = tokenizer.list .calculateHash ();
11971199 if (hashes.find (hash) != hashes.end ()) {
11981200 if (mSettings .debugwarnings )
1199- purgedConfigurationMessage (file.spath (), mCurrentConfig );
1201+ purgedConfigurationMessage (file.spath (), currentConfig );
12001202 continue ;
12011203 }
12021204 hashes.insert (hash);
@@ -1210,7 +1212,7 @@ unsigned int CppCheck::checkFile(const FileWithDetails& file, const std::string
12101212 }
12111213 } catch (const simplecpp::Output &o) {
12121214 // #error etc during preprocessing
1213- configurationError.push_back ((mCurrentConfig .empty () ? " \'\' " : mCurrentConfig ) + " : [" + o.location .file () + ' :' + std::to_string (o.location .line ) + " ] " + o.msg );
1215+ configurationError.push_back ((currentConfig .empty () ? " \'\' " : currentConfig ) + " : [" + o.location .file () + ' :' + std::to_string (o.location .line ) + " ] " + o.msg );
12141216 --checkCount; // don't count invalid configurations
12151217
12161218 if (!hasValidConfig && currCfg == *configurations.rbegin ()) {
0 commit comments