From 8878c4ef1b88fd07a48ccd7df6bff7ba0929dad7 Mon Sep 17 00:00:00 2001 From: Pádraig Brady Date: Wed, 22 Apr 2015 01:07:01 +0100 Subject: maint: avoid -Werror=strict-overflow warnings with GCC 5 All warnings were of the form: "assuming signed overflow does not occur when simplifying conditional to constant [-Werror=strict-overflow]" * src/dd.c (cache_round): Use an appropriately sized unsigned type, to avoid possibility of undefined signed overflow. * src/mknod.c (main): Likewise. * src/pr.c (pad_down): Likewise. * src/wc.c (main): Likewise. * src/tail.c (main): Assert that argc >= 0 thus allowing the compiler to assume without implication that argc - optind is positive. --- src/tail.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/tail.c') diff --git a/src/tail.c b/src/tail.c index f75d7a9ee..b29dab1c9 100644 --- a/src/tail.c +++ b/src/tail.c @@ -2180,6 +2180,8 @@ main (int argc, char **argv) --n_units; } + IF_LINT (assert (0 <= argc)); + if (optind < argc) { n_files = argc - optind; -- cgit v1.2.3-54-g00ecf