]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib: Add static_assert() macro to _Static_assert()
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Fri, 2 Dec 2022 13:49:32 +0000 (15:49 +0200)
committerTimo Sirainen <timo.sirainen@open-xchange.com>
Mon, 12 Dec 2022 09:49:39 +0000 (11:49 +0200)
We require C11 nowadays, so _Static_assert() should be supported.
static_assert() is nicer though, and it seems to be planned for C23.

src/lib/compat.h

index 869732d08e33c65168e3d652b5e43a4a94a57740..22f82d98798ac1019388da11c1fe275c9952c4c0 100644 (file)
   #define __has_extension(x) 0  // Compatibility with non-clang compilers.
 #endif
 
+#ifndef static_assert /* C23 */
+#  define static_assert _Static_assert
+#endif
+
 #if (defined(__GNUC__) && __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5)) || \
     (defined(__clang__) && (__has_extension(attribute_deprecated_with_message)))
 #  define HAVE_ATTR_DEPRECATED