G_LIKELY/_UNLIKELY macros need more parentheses

...for cases like

  #include "glib.h"
  #define COMMA ,
  void f(void) { if (G_LIKELY(0 COMMA 1)); }

https://bugzilla.gnome.org/show_bug.cgi?id=760215
This commit is contained in:
Stephan Bergmann 2016-01-06 16:25:49 +01:00 committed by Colin Walters
parent e91e811f02
commit b44fba25fb

View File

@ -354,8 +354,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)