From: Zifei Tong Date: Tue, 4 Mar 2014 13:27:38 +0000 (+0800) Subject: Fix: clang 'constant-out-of-range-compare' warning X-Git-Tag: v2.4.1~15 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=49f9c814b5e7ea33016bf7e8d481b76893c16397;p=lttng-tools.git 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) {