diff options
author | JF Bastien <jfb@chromium.org> | 2015-12-22 13:51:20 -0800 |
---|---|---|
committer | JF Bastien <jfb@chromium.org> | 2015-12-22 13:51:20 -0800 |
commit | e3c5ca02fde4282a3797be6ecea5a473ac8c3a1d (patch) | |
tree | 430845f9b7a4121f876ea5c6e0980a760a597c03 /src/command-line.h | |
parent | 4726dcfd02ca4bea786fe4b6ef4629e3e2a1561d (diff) | |
download | binaryen-e3c5ca02fde4282a3797be6ecea5a473ac8c3a1d.tar.gz binaryen-e3c5ca02fde4282a3797be6ecea5a473ac8c3a1d.tar.bz2 binaryen-e3c5ca02fde4282a3797be6ecea5a473ac8c3a1d.zip |
Fix warnings found by GCC
My previous patch addressed all LLVM warnings, this one addresses all the GCC ones as well (mostly signed / unsigned mix).
The patch also turns on -Wall -Werror.
Diffstat (limited to 'src/command-line.h')
-rw-r--r-- | src/command-line.h | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/command-line.h b/src/command-line.h index 77c10d3e7..28a1aa5b8 100644 --- a/src/command-line.h +++ b/src/command-line.h @@ -35,7 +35,8 @@ bool optionIs(const char *arg, const char *LongOpt, const char *ShortOpt) { // TODO(jfb) Make this configurable: callers should pass in option handlers. void processCommandLine(int argc, const char *argv[], Options *options) { - for (size_t i = 1; i != argc; ++i) { + assert(argc > 0 && "expect at least program name as an argument"); + for (size_t i = 1, e = argc; i != e; ++i) { if (optionIs(argv[i], "--help", "-h")) { std::cerr << "s2wasm INFILE\n\n" "Link .s file into .wast\n\n" @@ -48,7 +49,7 @@ void processCommandLine(int argc, const char *argv[], Options *options) { } else if (optionIs(argv[i], "--debug", "-d")) { options->debug = true; } else if (optionIs(argv[i], "--output", "-o")) { - if (i + 1 == argc) { + if (i + 1 == e) { std::cerr << "No output file" << std::endl; exit(EXIT_FAILURE); } |