Fix: clang 'constant-out-of-range-compare' warning
authorZifei Tong <zifeitong@gmail.com>
Tue, 4 Mar 2014 13:27:38 +0000 (21:27 +0800)
committerDavid Goulet <dgoulet@efficios.com>
Mon, 10 Mar 2014 20:21:56 +0000 (16:21 -0400)
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 <zifeitong@gmail.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
src/bin/lttng/commands/add_context.c
src/bin/lttng/commands/enable_channels.c

index 6286ed8a0a1838e49c4592e5770e02c4ab7f16df..390b53827572ec802cf5e57f3bbd6f72b1909693 100644 (file)
@@ -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;
index 10c1d3d57400c98f6fd61d75f9aa69a2a936734f..10645f685ad3f4f1571a56df42f504833e4067fe 100644 (file)
@@ -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) {
This page took 0.026807 seconds and 4 git commands to generate.