summaryrefslogtreecommitdiff
path: root/src/nm-logging.h
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2017-10-30 14:41:01 +0100
committerThomas Haller <thaller@redhat.com>2017-10-30 14:41:41 +0100
commit66e1fdb7ec5132b7afe59515131b32fe1a550a9c (patch)
tree57801e9e16bff14ae5ddffd3dd51c186818c51b9 /src/nm-logging.h
parentf088afe7e974096cb6b952747b6d08b1263b3d88 (diff)
downloadNetworkManager-66e1fdb7ec5132b7afe59515131b32fe1a550a9c.tar.gz
core: workaround coverity/compiler warning about tautological compare in nm_log_ptr()
Coverity claims: 1. NetworkManager-1.9.2/src/devices/team/nm-device-team.c:303: unsigned_compare: This greater-than-or-equal-to-zero comparison of an unsigned value is always true. "0U <= LOGL_DEBUG".
Diffstat (limited to 'src/nm-logging.h')
-rw-r--r--src/nm-logging.h10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/nm-logging.h b/src/nm-logging.h
index 045804950f..8fcbc8cc41 100644
--- a/src/nm-logging.h
+++ b/src/nm-logging.h
@@ -142,11 +142,16 @@ typedef enum { /*< skip >*/
(prefix) ?: "", \
self _NM_UTILS_MACRO_REST(__VA_ARGS__))
+static inline gboolean
+_nm_log_ptr_is_debug (NMLogLevel level)
+{
+ return level <= LOGL_DEBUG;
+}
+
/* log a message for an object (with providing a generic @self pointer) */
#define nm_log_ptr(level, domain, ifname, con_uuid, self, prefix, ...) \
G_STMT_START { \
- NM_PRAGMA_WARNING_DISABLE("-Wtautological-compare") \
- if ((level) <= LOGL_DEBUG) { \
+ if (_nm_log_ptr_is_debug (level)) { \
_nm_log_ptr ((level), \
(domain), \
(ifname), \
@@ -165,7 +170,6 @@ typedef enum { /*< skip >*/
__prefix ?: "", \
__prefix ? " " : "" _NM_UTILS_MACRO_REST(__VA_ARGS__)); \
} \
- NM_PRAGMA_WARNING_REENABLE \
} G_STMT_END