summaryrefslogtreecommitdiff
path: root/src/support
diff options
context:
space:
mode:
authorJF Bastien <jfb@chromium.org>2016-03-18 12:40:10 -0700
committerJF Bastien <jfb@chromium.org>2016-03-18 12:40:10 -0700
commit72c5e955d27436d9a6dae4191f6cc6a52676438e (patch)
tree637d16a2bb12996034f6ba25f3f9f1430fa4486f /src/support
parenta3312f5f2390bf3fe515c99d29d22dff201eeaf9 (diff)
downloadbinaryen-72c5e955d27436d9a6dae4191f6cc6a52676438e.tar.gz
binaryen-72c5e955d27436d9a6dae4191f6cc6a52676438e.tar.bz2
binaryen-72c5e955d27436d9a6dae4191f6cc6a52676438e.zip
Make --debug a boolean
As discussed in #248.
Diffstat (limited to 'src/support')
-rw-r--r--src/support/command-line.cpp8
-rw-r--r--src/support/command-line.h2
2 files changed, 4 insertions, 6 deletions
diff --git a/src/support/command-line.cpp b/src/support/command-line.cpp
index b4f8a4d62..f3aa4dc08 100644
--- a/src/support/command-line.cpp
+++ b/src/support/command-line.cpp
@@ -19,7 +19,7 @@
using namespace wasm;
Options::Options(const std::string &command, const std::string &description)
- : debug(0), positional(Arguments::Zero) {
+ : debug(false), positional(Arguments::Zero) {
add("--help", "-h", "Show this help message and exit", Arguments::Zero,
[this, command, description](Options *o, const std::string &) {
std::cerr << command;
@@ -41,10 +41,8 @@ Options::Options(const std::string &command, const std::string &description)
std::cerr << '\n';
exit(EXIT_SUCCESS);
});
- add("--debug", "-d", "Print debug information to stderr", Arguments::Optional,
- [](Options *o, const std::string &arguments) {
- o->debug = arguments.size() ? std::stoi(arguments) : 1;
- });
+ add("--debug", "-d", "Print debug information to stderr", Arguments::Zero,
+ [](Options *o, const std::string &arguments) {});
}
Options::~Options() {}
diff --git a/src/support/command-line.h b/src/support/command-line.h
index 6e0af846e..7c3ae528f 100644
--- a/src/support/command-line.h
+++ b/src/support/command-line.h
@@ -37,7 +37,7 @@ class Options {
typedef std::function<void(Options *, const std::string &)> Action;
enum class Arguments { Zero, One, N, Optional };
- int debug;
+ bool debug;
std::map<std::string, std::string> extra;
Options(const std::string &command, const std::string &description);