summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@gmail.com>2011-01-30 03:33:05 -0500
committerTavian Barnes <tavianator@gmail.com>2011-01-30 03:33:05 -0500
commit20af6f3fe1921987c236a1b6662ee16efaae7be0 (patch)
treec76fcedd39810bdc1a1ec8b44506bb6c65c21882
parentb2ffd0909e3f5ff6c86ba7d0b37f4c8cf0af8143 (diff)
downloaddimension-20af6f3fe1921987c236a1b6662ee16efaae7be0.tar.xz
Use the DMNSN_PROFILE macro to turn on profiling per-file.
-rw-r--r--configure.ac5
-rw-r--r--libdimension/compiler.h6
2 files changed, 3 insertions, 8 deletions
diff --git a/configure.ac b/configure.ac
index 8b6e363..3973a6a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -61,11 +61,6 @@ AC_ARG_ENABLE([profile],
[],
[enable_profile=no])
AM_CONDITIONAL([PROFILE], [test "$enable_profile" = "yes"])
-if test "$enable_profile" = "yes"; then
- AC_DEFINE([DMNSN_PROFILE], [1])
-else
- AC_DEFINE([DMNSN_PROFILE], [0])
-fi
dnl Timing library for benchmarks
PKG_CHECK_MODULES([libsandglass], [libsandglass >= 0.2],
diff --git a/libdimension/compiler.h b/libdimension/compiler.h
index b1cf60c..d05d775 100644
--- a/libdimension/compiler.h
+++ b/libdimension/compiler.h
@@ -28,11 +28,11 @@
#include <stdbool.h>
-#if DMNSN_PROFILE
+#ifdef DMNSN_PROFILE
#define dmnsn_likely(test) \
- dmnsn_expect((test), true, DMNSN_FUNC, __FILE__, __LINE__)
+ dmnsn_expect(!!(test), true, DMNSN_FUNC, __FILE__, __LINE__)
#define dmnsn_unlikely(test) \
- dmnsn_expect((test), false, DMNSN_FUNC, __FILE__, __LINE__)
+ dmnsn_expect(!!(test), false, DMNSN_FUNC, __FILE__, __LINE__)
#elif defined(__GNUC__)
#define dmnsn_likely(test) __builtin_expect(!!(test), true)
#define dmnsn_unlikely(test) __builtin_expect(!!(test), false)