Preprocessor; Set proper __cplusplus define value

This commit is contained in:
Daniel Marjamäki 2021-04-25 21:16:04 +02:00
parent 28a7bb63ec
commit d6842007a8
1 changed files with 12 additions and 2 deletions

View File

@ -645,8 +645,18 @@ static simplecpp::DUI createDUI(const Settings &mSettings, const std::string &cf
dui.defines.push_back(s); dui.defines.push_back(s);
} }
if (Path::isCPP(filename)) if (Path::isCPP(filename)) {
dui.defines.emplace_back("__cplusplus"); if (mSettings.standards.cpp == Standards::CPP11)
dui.defines.emplace_back("__cplusplus=201103L");
else if (mSettings.standards.cpp == Standards::CPP14)
dui.defines.emplace_back("__cplusplus=201402L");
else if (mSettings.standards.cpp == Standards::CPP17)
dui.defines.emplace_back("__cplusplus=201703L");
else if (mSettings.standards.cpp == Standards::CPP20)
dui.defines.emplace_back("__cplusplus=202002L");
else
dui.defines.emplace_back("__cplusplus");
}
dui.undefined = mSettings.userUndefs; // -U dui.undefined = mSettings.userUndefs; // -U
dui.includePaths = mSettings.includePaths; // -I dui.includePaths = mSettings.includePaths; // -I