From: Timo Sirainen Date: Fri, 2 Dec 2022 13:49:32 +0000 (+0200) Subject: lib: Add static_assert() macro to _Static_assert() X-Git-Tag: 2.4.0~3297 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2ae2d9ad6701073e02e40fae2973fc31360c6302;p=thirdparty%2Fdovecot%2Fcore.git lib: Add static_assert() macro to _Static_assert() We require C11 nowadays, so _Static_assert() should be supported. static_assert() is nicer though, and it seems to be planned for C23. --- diff --git a/src/lib/compat.h b/src/lib/compat.h index 869732d08e..22f82d9879 100644 --- a/src/lib/compat.h +++ b/src/lib/compat.h @@ -18,6 +18,10 @@ #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