[pulseaudio-commits] [SCM] PulseAudio Sound Server branch, master, updated. v0.9.15-test5-47-g52dcb95

Lennart Poettering gitmailer-noreply at 0pointer.de
Mon Mar 23 13:04:13 PDT 2009


This is an automated email from the git hooks/post-receive script. It was
generated because of a push to the "PulseAudio Sound Server" repository.

The master branch has been updated
      from  a467bec42352c8e86cbc4c680a19a376405946ba (commit)

- Log -----------------------------------------------------------------
52dcb95 add pa_assert_cc() for compile time assertions
-----------------------------------------------------------------------

Summary of changes:
 src/pulse/fork-detect.c |    2 +-
 src/pulsecore/macro.h   |   14 ++++++++++++++
 2 files changed, 15 insertions(+), 1 deletions(-)

-----------------------------------------------------------------------

commit 52dcb950efead46a398da977bc28e560f8564b62
Author: Lennart Poettering <lennart at poettering.net>
Date:   Mon Mar 23 21:03:52 2009 +0100

    add pa_assert_cc() for compile time assertions

diff --git a/src/pulse/fork-detect.c b/src/pulse/fork-detect.c
index f10fc02..a4e0dd1 100644
--- a/src/pulse/fork-detect.c
+++ b/src/pulse/fork-detect.c
@@ -39,7 +39,7 @@ int pa_detect_fork(void) {
      * however have to deal with this cleanly, so we try to detect the
      * forks making sure all our calls fail cleanly after the fork. */
 
-    pa_assert(sizeof(pa_atomic_t) >= sizeof(pid_t));
+    pa_assert_cc(sizeof(pa_atomic_t) >= sizeof(pid_t));
 
     for (;;) {
         pid_t stored_pid = (pid_t) pa_atomic_load(&pid);
diff --git a/src/pulsecore/macro.h b/src/pulsecore/macro.h
index 309f1a0..a5ca696 100644
--- a/src/pulsecore/macro.h
+++ b/src/pulsecore/macro.h
@@ -193,11 +193,25 @@ typedef int pa_bool_t;
 #define pa_assert_fp(expr) pa_assert_se(expr)
 #endif
 
+#ifdef NDEBUG
+#define pa_assert_not_reached() pa_nop()
+#else
 #define pa_assert_not_reached()                                         \
     do {                                                                \
         pa_log_error("Code should not be reached at %s:%u, function %s(). Aborting.", __FILE__, __LINE__, PA_PRETTY_FUNCTION); \
         abort();                                                        \
     } while (FALSE)
+#endif
+
+/* A compile time assertion */
+#define pa_assert_cc(expr)                         \
+    do {                                           \
+        switch (0) {                               \
+            case 0:                                \
+            case !!(expr):                         \
+                ;                                  \
+        }                                          \
+    } while (FALSE)
 
 #define PA_PTR_TO_UINT(p) ((unsigned int) ((uintptr_t) (p)))
 #define PA_UINT_TO_PTR(u) ((void*) ((uintptr_t) (u)))

-- 
hooks/post-receive
PulseAudio Sound Server



More information about the pulseaudio-commits mailing list