diff options
| author | Brian Gaeke <gaeke@uiuc.edu> | 2003-10-10 17:01:36 +0000 |
|---|---|---|
| committer | Brian Gaeke <gaeke@uiuc.edu> | 2003-10-10 17:01:36 +0000 |
| commit | e5e53229fc0a285b9fa62a97de4da7c11bea90d6 (patch) | |
| tree | 73b0847e37e2077525ea568bb948c6549bdbd531 | |
| parent | b3acb4027e58f399cccf8180fe05e1cc92e6ef56 (diff) | |
| download | bcm5719-llvm-e5e53229fc0a285b9fa62a97de4da7c11bea90d6.tar.gz bcm5719-llvm-e5e53229fc0a285b9fa62a97de4da7c11bea90d6.zip | |
Change to use strtoul instead of strtoll.
llvm-svn: 9010
| -rw-r--r-- | llvm/lib/Support/CommandLine.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/llvm/lib/Support/CommandLine.cpp b/llvm/lib/Support/CommandLine.cpp index c0be0ecb34e..807ff165b09 100644 --- a/llvm/lib/Support/CommandLine.cpp +++ b/llvm/lib/Support/CommandLine.cpp @@ -14,6 +14,8 @@ #include <map> #include <set> #include <iostream> +#include <cstdlib> +#include <cerrno> using namespace cl; @@ -682,9 +684,12 @@ bool parser<int>::parse(Option &O, const char *ArgName, bool parser<unsigned>::parse(Option &O, const char *ArgName, const std::string &Arg, unsigned &Value) { char *End; - long long int V = strtoll(Arg.c_str(), &End, 0); + errno = 0; + unsigned long V = strtoul(Arg.c_str(), &End, 0); Value = (unsigned)V; - if (*End != 0 || V < 0 || Value != V) + if (((V == ULONG_MAX) && (errno == ERANGE)) + || (*End != 0) + || (Value != V)) return O.error(": '" + Arg + "' value invalid for uint argument!"); return false; } |

