glib2/gmacros-Fix-G_-UN-LIKELY-to-not-mask-Wparentheses.patch
2019-09-30 10:40:42 -04:00

37 lines
1.3 KiB
Diff

From 0e7ebf794fdbdeb2a156c2e2aebcd78725793dba Mon Sep 17 00:00:00 2001
From: Mohammed Sadiq <sadiq@sadiqpk.org>
Date: Thu, 4 Oct 2018 17:38:27 +0530
Subject: [PATCH 139/682] gmacros: Fix G_[UN]LIKELY to not mask -Wparentheses
A double paren forces the compiler to assume that the
statement is right. That may not be the case.
This is essentially reverting b44fba25fbad89c105795a10a569fe422e4d1c44.
See https://bugzilla.gnome.org/show_bug.cgi?id=760215.
It's more morth to allow find common mistakes (= instead of ==
in conditionals) than masking them to make some rarely used
code work.
---
glib/gmacros.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/glib/gmacros.h b/glib/gmacros.h
index 0432d9cad..8ef65dad2 100644
--- a/glib/gmacros.h
+++ b/glib/gmacros.h
@@ -427,8 +427,8 @@
_g_boolean_var_ = 0; \
_g_boolean_var_; \
})
-#define G_LIKELY(expr) (__builtin_expect (_G_BOOLEAN_EXPR((expr)), 1))
-#define G_UNLIKELY(expr) (__builtin_expect (_G_BOOLEAN_EXPR((expr)), 0))
+#define G_LIKELY(expr) (__builtin_expect (_G_BOOLEAN_EXPR(expr), 1))
+#define G_UNLIKELY(expr) (__builtin_expect (_G_BOOLEAN_EXPR(expr), 0))
#else
#define G_LIKELY(expr) (expr)
#define G_UNLIKELY(expr) (expr)
--
2.19.1