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: https://git.lttng.org./?a=commitdiff_plain;h=222e461a4e629eb1a1628a6d1a3e28489a2e5347;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 6286ed8a0..390b53827 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 10c1d3d57..10645f685 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) {