From: Zifei Tong Date: Tue, 4 Mar 2014 13:27:38 +0000 (+0800) Subject: Fix: clang 'constant-out-of-range-compare' warning X-Git-Url: http://git.efficios.com/?p=lttng-tools.git;a=commitdiff_plain;h=109be0da5a46c0280f05e4a31f3ba9aa9183ad36 Fix: clang 'constant-out-of-range-compare' warning This patch fixes two 'autological-constant-out-of-range-compare' clang warnings caused by comparing enum type variables with -1. It's possible that compilers optimize these two comparisons away. Signed-off-by: Zifei Tong Signed-off-by: David Goulet --- diff --git a/src/bin/lttng/commands/add_context.c b/src/bin/lttng/commands/add_context.c index 3cd00f3d3..6483c9891 100644 --- a/src/bin/lttng/commands/add_context.c +++ b/src/bin/lttng/commands/add_context.c @@ -474,7 +474,7 @@ int cmd_add_context(int argc, const char **argv) } type->opt = &ctx_opts[index]; - if (type->opt->ctx_type == -1) { + if (type->opt->symbol == NULL) { ERR("Unknown context type %s", opt_type); free(type); ret = CMD_ERROR; diff --git a/src/bin/lttng/commands/enable_channels.c b/src/bin/lttng/commands/enable_channels.c index c4bbc1170..55fbae644 100644 --- a/src/bin/lttng/commands/enable_channels.c +++ b/src/bin/lttng/commands/enable_channels.c @@ -169,7 +169,7 @@ static void set_default_attr(struct lttng_domain *dom) if (chan.attr.read_timer_interval == -1) { chan.attr.read_timer_interval = default_attr.read_timer_interval; } - if (chan.attr.output == -1) { + if ((int) chan.attr.output == -1) { chan.attr.output = default_attr.output; } if (chan.attr.tracefile_count == -1) {