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:14:46 +0000 (16:14 -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 3cd00f3d3411ac2e9b0801c3c8d421cc5feb8744..6483c9891d83038e929b3a1b96fd3f5cd6ab07c4 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 c4bbc1170f30b17b5ed0935aa2348db43b8e986c..55fbae644abc0b6dc4813988a7913e7fa169759e 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.029981 seconds and 5 git commands to generate.