From c523a247c215dcad9a8cfdbeef84c2b330643dd8 Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Tue, 8 Oct 2013 17:35:15 -0400 Subject: [PATCH] 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 --- include/lttng/bitfield.h | 2 +- include/lttng/ust-tracer.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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 */ -- 2.34.1