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/main.cpp | |
parent | 52740ee4a6a5213b9f791fc55d5d69a42b377247 (diff) | |
download | mrust-0442690894f918c9d6caf5f4fc9397888b98dcd7.tar.gz |
cfg - Fix handling of `--cfg foo="bar"`
Diffstat (limited to 'src/main.cpp')
-rw-r--r-- | src/main.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/main.cpp b/src/main.cpp index f5412228..21e06b0d 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -744,11 +744,22 @@ ProgramParams::ProgramParams(int argc, char *argv[]) *p = '\0'; const char* opt = opt_and_val; const char* val = p + 1; + // TODO: Correctly parse the values. + // - Value should be a double-quoted string. if( ::std::strcmp(opt, "feature") == 0 ) { this->features.insert( ::std::string(val) ); } else { - Cfg_SetValue(opt, val); + if( val[0] == '"' ) { + // TODO: Something cleaner than this. + ::std::string s = val+1; + assert(s.back() == '"'); + s.pop_back(); + Cfg_SetValue(opt, s); + } + else { + Cfg_SetValue(opt, val); + } } } else { |