From: Gary Lockyer Date: Mon, 4 May 2020 23:42:28 +0000 (+1200) Subject: Fix clang 9 for-loop-analysis warnings X-Git-Tag: ldb-2.2.0~562 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e907f002a7f3184d09135066c3ffb12d95007769;p=thirdparty%2Fsamba.git Fix clang 9 for-loop-analysis warnings Review-note: The for loop increment operation was changed and the trailing i++ was removed from the loop body. The resulting for statement is equivalent to the original Signed-off-by: Gary Lockyer Reviewed-by: Andreas Schneider Autobuild-User(master): Andreas Schneider Autobuild-Date(master): Fri May 8 11:16:18 UTC 2020 on sn-devel-184 --- diff --git a/buildtools/wafsamba/samba_autoconf.py b/buildtools/wafsamba/samba_autoconf.py index 875fb394d51..276b88780b8 100644 --- a/buildtools/wafsamba/samba_autoconf.py +++ b/buildtools/wafsamba/samba_autoconf.py @@ -791,7 +791,6 @@ int main(void) { conf.ADD_NAMED_CFLAGS('PICKY_CFLAGS', '-Werror -Wno-error=deprecated-declarations', testflags=True) conf.ADD_NAMED_CFLAGS('PICKY_CFLAGS', '-Wno-error=tautological-compare', testflags=True) conf.ADD_NAMED_CFLAGS('PICKY_CFLAGS', '-Wno-error=cast-align', testflags=True) - conf.ADD_NAMED_CFLAGS('PICKY_CFLAGS', '-Wno-error=for-loop-analysis', testflags=True) if Options.options.fatal_errors: conf.ADD_CFLAGS('-Wfatal-errors', testflags=True) diff --git a/source4/libcli/resolve/lmhosts.c b/source4/libcli/resolve/lmhosts.c index 400cf79f68b..10e1f3d2a9d 100644 --- a/source4/libcli/resolve/lmhosts.c +++ b/source4/libcli/resolve/lmhosts.c @@ -72,7 +72,7 @@ static struct composite_context *resolve_name_lmhosts_send( state, &resolved_iplist, &resolved_count); if (!composite_is_ok(c)) return c; - for (i=0; i < resolved_count; i++) { + for (i=0; i < resolved_count; i += 2) { state->addrs = talloc_realloc(state, state->addrs, struct socket_address *, i+2); if (composite_nomem(state->addrs, c)) return c; @@ -92,7 +92,6 @@ static struct composite_context *resolve_name_lmhosts_send( state->names[i+1] = NULL; - i++; } composite_done(c);