From: Mathieu Desnoyers Date: Tue, 8 Oct 2013 21:35:15 +0000 (-0400) Subject: gcc warning fix: -Wextra X-Git-Tag: v2.4.0-rc1~29 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=72914f82515bb7bb688b0d855921e2c5cf16cc8c;p=lttng-ust.git gcc warning fix: -Wextra For the "ordered comparison of pointer with integer zero" warning, fix this by comparing (type) -1 against (type) 0 instead of just 0, so if "type" is a pointer type, this pointer type will be applied to the right operand too, thus fixing the warning. Signed-off-by: Mathieu Desnoyers --- diff --git a/include/lttng/bitfield.h b/include/lttng/bitfield.h index 391cf509..ef5453c2 100644 --- a/include/lttng/bitfield.h +++ b/include/lttng/bitfield.h @@ -56,7 +56,7 @@ ___v <<= final; \ }) -#define _bt_is_signed_type(type) (((type)(-1)) < 0) +#define _bt_is_signed_type(type) ((type) -1 < (type) 0) #define _bt_unsigned_cast(type, v) \ ({ \ diff --git a/include/lttng/ust-tracer.h b/include/lttng/ust-tracer.h index b4268ac5..ec30db74 100644 --- a/include/lttng/ust-tracer.h +++ b/include/lttng/ust-tracer.h @@ -45,6 +45,6 @@ #define lttng_alignof(type) 1 #endif -#define lttng_is_signed_type(type) (((type)(-1)) < 0) +#define lttng_is_signed_type(type) ((type) -1 < (type) 0) #endif /* _LTTNG_UST_TRACER_H */