Commit 0cc3a7fd authored by yangguo@chromium.org's avatar yangguo@chromium.org

Allow both "--no<flag>" and "--no-<flag>" to disable <flag>.

We shouldn't need to know whether to use --no or --no- as prefix.
The latter is more intuitive and also what chromium uses.

R=machenbach@chromium.org
BUG=

Review URL: https://codereview.chromium.org/22851009

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@16261 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 63372812
......@@ -268,6 +268,11 @@ List<const char*>* FlagList::argv() {
}
inline char NormalizeChar(char ch) {
return ch == '_' ? '-' : ch;
}
// Helper function to parse flags: Takes an argument arg and splits it into
// a flag name and flag value (or NULL if they are missing). is_bool is set
// if the arg started with "-no" or "--no". The buffer may be used to NUL-
......@@ -295,6 +300,7 @@ static void SplitArgument(const char* arg,
}
if (arg[0] == 'n' && arg[1] == 'o') {
arg += 2; // remove "no"
if (NormalizeChar(arg[0]) == '-') arg++; // remove dash after "no".
*is_bool = true;
}
*name = arg;
......@@ -318,11 +324,6 @@ static void SplitArgument(const char* arg,
}
inline char NormalizeChar(char ch) {
return ch == '_' ? '-' : ch;
}
static bool EqualNames(const char* a, const char* b) {
for (int i = 0; NormalizeChar(a[i]) == NormalizeChar(b[i]); i++) {
if (a[i] == '\0') {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment