From 9eac4489ac408c8b878f22de1f92fa263220bb88 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Thu, 6 Jun 2013 12:44:19 +0200 Subject: [PATCH] Fixed #4838 (False positive for ... seems to be invalid) --- lib/preprocessor.cpp | 8 ++++---- lib/preprocessor.h | 2 +- test/testpreprocessor.cpp | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/preprocessor.cpp b/lib/preprocessor.cpp index 7c369fe20..2a9d13132 100644 --- a/lib/preprocessor.cpp +++ b/lib/preprocessor.cpp @@ -2741,7 +2741,7 @@ bool Preprocessor::validateCfg(const std::string &code, const std::string &cfg) continue; // macro is used in code, return false if (_settings->isEnabled("information")) - validateCfgError(cfg); + validateCfgError(cfg, macro); return false; } } @@ -2750,7 +2750,7 @@ bool Preprocessor::validateCfg(const std::string &code, const std::string &cfg) return true; } -void Preprocessor::validateCfgError(const std::string &cfg) +void Preprocessor::validateCfgError(const std::string &cfg, const std::string ¯o) { const std::string id = "ConfigurationNotChecked"; std::list locationList; @@ -2758,7 +2758,7 @@ void Preprocessor::validateCfgError(const std::string &cfg) loc.line = 1; loc.setfile(file0); locationList.push_back(loc); - ErrorLogger::ErrorMessage errmsg(locationList, Severity::information, "Skipping configuration '" + cfg + "' because it seems to be invalid. Use -D if you want to check it.", id, false); + ErrorLogger::ErrorMessage errmsg(locationList, Severity::information, "Skipping configuration '" + cfg + "' since the value of '" + macro + "' is unknown. Use -D if you want to check it.", id, false); _errorLogger->reportInfo(errmsg); } @@ -3041,6 +3041,6 @@ void Preprocessor::getErrorMessages(ErrorLogger *errorLogger, const Settings *se settings2.checkConfiguration=true; preprocessor.missingInclude("", 1, "", UserHeader); preprocessor.missingInclude("", 1, "", SystemHeader); - preprocessor.validateCfgError("X"); + preprocessor.validateCfgError("X", "X"); preprocessor.error("", 1, "#error message"); // #error .. } diff --git a/lib/preprocessor.h b/lib/preprocessor.h index 656eda403..96223cbb0 100644 --- a/lib/preprocessor.h +++ b/lib/preprocessor.h @@ -122,7 +122,7 @@ public: * @return true => configuration is valid */ bool validateCfg(const std::string &code, const std::string &cfg); - void validateCfgError(const std::string &cfg); + void validateCfgError(const std::string &cfg, const std::string ¯o); void handleUndef(std::list &configurations) const; diff --git a/test/testpreprocessor.cpp b/test/testpreprocessor.cpp index 9342bf337..f9f71042e 100644 --- a/test/testpreprocessor.cpp +++ b/test/testpreprocessor.cpp @@ -3766,7 +3766,7 @@ private: settings.addEnabled("all"); preprocessor.setFile0("test.c"); ASSERT_EQUALS(false, preprocessor.validateCfg("int a=A;", "A")); - ASSERT_EQUALS("[test.c:1]: (information) Skipping configuration 'A' because it seems to be invalid. Use -D if you want to check it.\n", errout.str()); + ASSERT_EQUALS("[test.c:1]: (information) Skipping configuration 'A' since the value of 'A' is unknown. Use -D if you want to check it.\n", errout.str()); } void if_sizeof() { // #4071