diff options
author | John Hodge <tpg@ucc.asn.au> | 2017-09-09 10:34:32 +0800 |
---|---|---|
committer | John Hodge <tpg@ucc.asn.au> | 2017-09-09 10:34:32 +0800 |
commit | 0442690894f918c9d6caf5f4fc9397888b98dcd7 (patch) | |
tree | b01f9fa0cd884434fa90fb9369b71c6f167f123d /src/expand | |
parent | 52740ee4a6a5213b9f791fc55d5d69a42b377247 (diff) | |
download | mrust-0442690894f918c9d6caf5f4fc9397888b98dcd7.tar.gz |
cfg - Fix handling of `--cfg foo="bar"`
Diffstat (limited to 'src/expand')
-rw-r--r-- | src/expand/cfg.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/expand/cfg.cpp b/src/expand/cfg.cpp index 64e8a58e..8572b2e5 100644 --- a/src/expand/cfg.cpp +++ b/src/expand/cfg.cpp @@ -16,7 +16,7 @@ #include <map> #include <set> -::std::map< ::std::string, ::std::string> g_cfg_values; +::std::multimap< ::std::string, ::std::string> g_cfg_values; ::std::map< ::std::string, ::std::function<bool(const ::std::string&)> > g_cfg_value_fcns; ::std::set< ::std::string > g_cfg_flags; @@ -60,12 +60,15 @@ bool check_cfg(Span sp, const ::AST::MetaItem& mi) { } else if( mi.has_string() ) { // Equaliy - auto it = g_cfg_values.find(mi.name()); - if( it != g_cfg_values.end() ) + auto its = g_cfg_values.equal_range(mi.name()); + for(auto it = its.first; it != its.second; ++it) { DEBUG(""<<mi.name()<<": '"<<it->second<<"' == '"<<mi.string()<<"'"); - return it->second == mi.string(); + if( it->second == mi.string() ) + return true; } + if( its.first != its.second ) + return false; auto it2 = g_cfg_value_fcns.find(mi.name()); if(it2 != g_cfg_value_fcns.end() ) |