[Xfce4-commits] <mousepad:master> * configure.in.in: Make sure __OPTIMIZE__ is enable in normal builds. * mousepad/mousepad-private.h: Tune G_LIKELY macros for pure boolean.

Nick Schermer noreply at xfce.org
Sat May 5 21:30:52 CEST 2012


Updating branch refs/heads/master
         to 0960eed1341ae9789caafcb61500fa2006a12a67 (commit)
       from 765cea4b137c29bbb1abebad9440a4a9534c93d7 (commit)

commit 0960eed1341ae9789caafcb61500fa2006a12a67
Author: Nick Schermer <nick at xfce.org>
Date:   Mon Oct 22 11:16:59 2007 +0000

    	* configure.in.in: Make sure __OPTIMIZE__ is enable in normal builds.
    	* mousepad/mousepad-private.h: Tune G_LIKELY macros for pure boolean.
    
    (Old svn revision: 26175)

 ChangeLog                   |    5 +++++
 configure.in.in             |    3 +++
 mousepad/mousepad-private.h |   12 ++++++++++++
 3 files changed, 20 insertions(+), 0 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index fffb558..8ee2fc6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,9 @@
 2007-10-22	Nick Schermer <nick at xfce.org>
+	* configure.in.in: Make sure __OPTIMIZE__ is enable in normal builds.
+	* mousepad/mousepad-private.h: Tune G_LIKELY macros for pure boolean.
+
+
+2007-10-22	Nick Schermer <nick at xfce.org>
 	* mousepad/mousepad-window.c: Idea of the previous commit was good,
 	  but the implementation wasn't. Fix that.
 
diff --git a/configure.in.in b/configure.in.in
index ece6022..226aa6e 100644
--- a/configure.in.in
+++ b/configure.in.in
@@ -154,6 +154,9 @@ else
   dnl Disable object cast checks
   PLATFORM_CPPFLAGS="$PLATFORM_CPPFLAGS -DG_DISABLE_CAST_CHECKS"
 
+  dnl Make sure optimization is enabled in glib macros
+  PLATFORM_CPPFLAGS="$PLATFORM_CPPFLAGS -D__OPTIMIZE__"
+
   dnl Disable all checks for --enable-debug=no
   if test x"$enable_debug" = x"no"; then
     PLATFORM_CPPFLAGS="$PLATFORM_CPPFLAGS -DG_DISABLE_ASSERT -DG_DISABLE_CHECKS"
diff --git a/mousepad/mousepad-private.h b/mousepad/mousepad-private.h
index ee4da88..20d9eb8 100644
--- a/mousepad/mousepad-private.h
+++ b/mousepad/mousepad-private.h
@@ -72,6 +72,18 @@ G_BEGIN_DECLS
 #define g_value_get_object(v)   (((const GValue *) (v))->data[0].v_pointer)
 #endif
 
+/* properly set guess branch probability for pure booleans */
+#undef G_LIKELY
+#undef G_UNLIKELY
+
+#if defined(NDEBUG) && defined(__GNUC__) && (__GNUC__ > 2)
+#define G_LIKELY(expr) (__builtin_expect (!!(expr), 1))
+#define G_UNLIKELY(expr) (__builtin_expect (!!(expr), 0))
+#else
+#define G_LIKELY(expr) (expr)
+#define G_UNLIKELY(expr) (expr)
+#endif
+
 G_END_DECLS
 
 #endif /* !__MOUSEPAD_PRIVATE_H__ */


More information about the Xfce4-commits mailing list