diff options
author | Jim Meyering <meyering@redhat.com> | 2011-05-25 12:29:18 +0200 |
---|---|---|
committer | Jim Meyering <meyering@redhat.com> | 2011-05-26 22:13:37 +0200 |
commit | 419b6c9d42ba643265f802cd150d0b232e43186a (patch) | |
tree | 993d42ce541942f5863de308c98ff773cf29ab32 /src/expr.c | |
parent | d7e23652039b5e145ab0d809a7de75ebb3facc24 (diff) | |
download | coreutils-419b6c9d42ba643265f802cd150d0b232e43186a.tar.xz |
maint: accommodate gcc's -Wstrict-overflow option
* src/factor.c (factor_using_pollard_rho): Change type of "i"
to unsigned to avoid warning from gcc's -Wstrict-overflow.
* src/expr.c: Use an unsigned intermediate.
* src/dircolors.c (main): Reorder operations to avoid the risk of
pointer overflow.
* src/tr.c (squeeze_filter): Change NOT_A_CHAR from an anonymous
"enum" to an "int", to avoid this warning:
tr.c:1624:10: error: assuming signed overflow does not occur when
simplifying conditional to constant [-Werror=strict-overflow]
* src/pr.c (main): Make index "i" unsigned.
Diffstat (limited to 'src/expr.c')
-rw-r--r-- | src/expr.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/expr.c b/src/expr.c index ce65ecf46..2331f64fe 100644 --- a/src/expr.c +++ b/src/expr.c @@ -312,15 +312,17 @@ main (int argc, char **argv) parse_long_options (argc, argv, PROGRAM_NAME, PACKAGE_NAME, VERSION, usage, AUTHORS, (char const *) NULL); + /* The above handles --help and --version. Since there is no other invocation of getopt, handle `--' here. */ - if (argc > 1 && STREQ (argv[1], "--")) + unsigned int u_argc = argc; + if (1 < u_argc && STREQ (argv[1], "--")) { - --argc; + --u_argc; ++argv; } - if (argc <= 1) + if (u_argc <= 1) { error (0, 0, _("missing operand")); usage (EXPR_INVALID); |