}
+BuildInfo::LanguageStandard::LanguageStandard(const string &std)
+{
+ string::size_type num = string::npos;
+ for(string::size_type i=0; (num==string::npos && i<std.size()); ++i)
+ if(isdigit(static_cast<unsigned char>(std[i])))
+ num = i;
+ type = std.substr(0, num);
+ year = lexical_cast<unsigned>(std.substr(num));
+ year += (year<70 ? 2000 : 1900);
+}
+
+string BuildInfo::LanguageStandard::str() const
+{
+ return format("%s%02d", type, year%100);
+}
+
+
BuildInfo::Loader::Loader(BuildInfo &bi):
DataFile::ObjectLoader<BuildInfo>(bi)
{
CHAINED //< Include only compilation options
};
+ struct LanguageStandard
+ {
+ std::string type;
+ unsigned year;
+
+ LanguageStandard(): year(0) { }
+ LanguageStandard(const std::string &);
+
+ std::string str() const;
+ };
+
/**
A wrapper which tracks the set status of the wrapped variable. A default
value may be provided in initialization without causing it to be treated as
typedef std::list<Msp::FS::Path> PathList;
typedef std::list<std::string> WordList;
typedef std::map<std::string, LibraryMode> LibModeMap;
- typedef std::map<std::string, std::string> StandardMap;
+ typedef std::map<std::string, LanguageStandard> StandardMap;
Tracked<Msp::FS::Path> sysroot;
DefineMap defines;
string tag_for_std = (tag=="OBJC" ? "CC" : tag);
if(binfo.standards.count(tag_for_std))
- argv.push_back("-std="+get_item(binfo.standards, tag_for_std));
+ argv.push_back("-std="+get_item(binfo.standards, tag_for_std).str());
if(tag=="OBJC" && binfo.standards.count(tag))
- argv.push_back("-fobjc-std="+get_item(binfo.standards, tag));
+ argv.push_back("-fobjc-std="+get_item(binfo.standards, tag).str());
if(binfo.warning_level>=1)
{
if(binfo.standards.count(tag))
{
- string std = get_item(binfo.standards, tag);
- if(std!="c++11" && std!="c99")
- argv.push_back("/std:"+std);
+ const BuildInfo::LanguageStandard &std = get_item(binfo.standards, tag);
+ if((tag=="CXX" && std.year>2011) || (tag=="CC" && std.year>1999))
+ argv.push_back("/std:"+std.str());
}
if(binfo.warning_level>=1)