gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnunet] branch master updated: add GNUNET_static_assert()


From: gnunet
Subject: [gnunet] branch master updated: add GNUNET_static_assert()
Date: Wed, 08 Apr 2020 14:51:38 +0200

This is an automated email from the git hooks/post-receive script.

grothoff pushed a commit to branch master
in repository gnunet.

The following commit(s) were added to refs/heads/master by this push:
     new 17113fc2f add GNUNET_static_assert()
17113fc2f is described below

commit 17113fc2fd9d8607151dc4fecdbc161abb3b32fa
Author: Christian Grothoff <address@hidden>
AuthorDate: Wed Apr 8 14:47:01 2020 +0200

    add GNUNET_static_assert()
---
 src/include/gnunet_common.h | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/src/include/gnunet_common.h b/src/include/gnunet_common.h
index 86d1a9f37..d84f9d77e 100644
--- a/src/include/gnunet_common.h
+++ b/src/include/gnunet_common.h
@@ -888,6 +888,28 @@ GNUNET_error_type_to_string (enum GNUNET_ErrorType kind);
   } while (0)
 
 
+#if HAVE_STATIC_ASSERT
+/**
+ * Assertion to be checked (if supported by C compiler) at
+ * compile time, otherwise checked at runtime and resulting
+ * in an abort() on failure.
+ *
+ * @param cond condition to test, 0 implies failure
+ */
+#define GNUNET_static_assert(cond) _Static_assert (cond)
+#else
+/**
+ * Assertion to be checked (if supported by C compiler) at
+ * compile time, otherwise checked at runtime and resulting
+ * in an abort() on failure.  This is the case where the
+ * compiler does not support static assertions.
+ *
+ * @param cond condition to test, 0 implies failure
+ */
+#define GNUNET_static_assert(cond) GNUNET_assert (cond)
+#endif
+
+
 /**
  * @ingroup logging
  * Use this for internal assertion violations that are

-- 
To stop receiving notification emails like this one, please contact
address@hidden.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]