aboutsummaryrefslogtreecommitdiff
path: root/src/include/gnunet_common.h
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2020-04-08 14:47:01 +0200
committerChristian Grothoff <christian@grothoff.org>2020-04-08 14:47:01 +0200
commit17113fc2fd9d8607151dc4fecdbc161abb3b32fa (patch)
tree4328fd28dd838860ad6c515db0789f85f81b9874 /src/include/gnunet_common.h
parent8c9600879334ce68a72cb1f8de7e6bd156a4b2f2 (diff)
downloadgnunet-17113fc2fd9d8607151dc4fecdbc161abb3b32fa.tar.gz
gnunet-17113fc2fd9d8607151dc4fecdbc161abb3b32fa.zip
add GNUNET_static_assert()
Diffstat (limited to 'src/include/gnunet_common.h')
-rw-r--r--src/include/gnunet_common.h22
1 files changed, 22 insertions, 0 deletions
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);
888 } while (0) 888 } while (0)
889 889
890 890
891#if HAVE_STATIC_ASSERT
892/**
893 * Assertion to be checked (if supported by C compiler) at
894 * compile time, otherwise checked at runtime and resulting
895 * in an abort() on failure.
896 *
897 * @param cond condition to test, 0 implies failure
898 */
899#define GNUNET_static_assert(cond) _Static_assert (cond)
900#else
901/**
902 * Assertion to be checked (if supported by C compiler) at
903 * compile time, otherwise checked at runtime and resulting
904 * in an abort() on failure. This is the case where the
905 * compiler does not support static assertions.
906 *
907 * @param cond condition to test, 0 implies failure
908 */
909#define GNUNET_static_assert(cond) GNUNET_assert (cond)
910#endif
911
912
891/** 913/**
892 * @ingroup logging 914 * @ingroup logging
893 * Use this for internal assertion violations that are 915 * Use this for internal assertion violations that are