- typedef std::map<std::string, std::string> DefineMap;
- typedef std::list<Msp::FS::Path> PathList;
- typedef std::list<std::string> WordList;
-
- DefineMap defines;
- PathList incpath;
- PathList libpath;
- WordList libs;
- LibraryMode libmode;
- bool threads;
- bool debug;
- int optimize;
- bool strip;
- unsigned warning_level;
- bool fatal_warnings;
+ 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
+ set. Assigning from a raw value flags the Tracked object as set. Assigning
+ from another Tracked object will only change the value of the target if the
+ source is set.
+ */
+ template<typename T>
+ class Tracked
+ {
+ public:
+ using LoadType = T;
+
+ private:
+ T value;
+ bool set;
+
+ public:
+ Tracked(): value(T()), set(false) { }
+ Tracked(T v): value(v), set(false) { }
+ Tracked(const Tracked &t): value(t.value), set(t.set) { }
+ Tracked &operator=(const Tracked &v) { if(v.set) { value = v.value; set = true; } return *this; }
+
+ Tracked &operator=(const T &v) { value = v; set = true; return *this; }
+ operator const T &() const { return value; }
+ };
+
+ Tracked<Msp::FS::Path> sysroot;
+ std::map<std::string, std::string> defines;
+ std::list<Msp::FS::Path> incpath;
+ std::list<Msp::FS::Path> local_incpath;
+ std::list<Msp::FS::Path> libpath;
+ std::list<std::string> libs;
+ Tracked<LibraryMode> libmode;
+ Tracked<RuntimePathMode> rpath_mode;
+ std::map<std::string, LibraryMode> libmodes;
+ std::list<std::string> keep_symbols;
+ std::map<std::string, LanguageStandard> standards;
+ Tracked<bool> threads;
+ Tracked<bool> debug;
+ Tracked<int> optimize;
+ Tracked<bool> strip;
+ Tracked<unsigned> warning_level;
+ Tracked<bool> fatal_warnings;