ImportProject: Improve cppcheckDefines()

This commit is contained in:
Daniel Marjamäki 2017-08-08 22:57:11 +02:00
parent 9861240e79
commit c0890b5255
2 changed files with 5 additions and 3 deletions

View File

@ -495,6 +495,8 @@ void ImportProject::importVcxproj(const std::string &filename, std::map<std::str
FileSettings fs;
fs.filename = Path::simplifyPath(Path::isAbsolute(*c) ? *c : Path::getPathFromFilename(filename) + *c);
fs.cfg = p->name;
fs.msc = true;
fs.useMfc = useOfMfc;
fs.defines = "_WIN32=1";
if (p->platform == ProjectConfiguration::Win32)
fs.platformType = cppcheck::Platform::Win32W;
@ -502,7 +504,6 @@ void ImportProject::importVcxproj(const std::string &filename, std::map<std::str
fs.platformType = cppcheck::Platform::Win64;
fs.defines += ";_WIN64=1";
}
fs.useMfc = useOfMfc;
std::string additionalIncludePaths;
for (std::list<ItemDefinitionGroup>::const_iterator i = itemDefinitionGroupList.begin(); i != itemDefinitionGroupList.end(); ++i) {
if (!i->conditionIsTrue(*p))

View File

@ -40,18 +40,19 @@ class CPPCHECKLIB ImportProject {
public:
/** File settings. Multiple configurations for a file is allowed. */
struct FileSettings {
FileSettings() : platformType(cppcheck::Platform::Unspecified), useMfc(false) {}
FileSettings() : platformType(cppcheck::Platform::Unspecified), msc(false), useMfc(false) {}
std::string cfg;
std::string filename;
std::string defines;
std::string cppcheckDefines() const {
return useMfc ? (defines + ";_MSC_VER=1900;__AFXWIN_H__=1") : defines;
return defines + (msc ? ";_MSC_VER=1900" : "") + (useMfc ? ";__AFXWIN_H__=1" : "");
}
std::set<std::string> undefs;
std::list<std::string> includePaths;
std::list<std::string> systemIncludePaths;
std::string standard;
cppcheck::Platform::PlatformType platformType;
bool msc;
bool useMfc;
void setDefines(std::string defs);