]> git.ipfire.org Git - thirdparty/xz.git/commitdiff
sysdefs.h: Add FALLTHROUGH macro
authorLasse Collin <lasse.collin@tukaani.org>
Wed, 1 Jan 2025 13:08:51 +0000 (15:08 +0200)
committerLasse Collin <lasse.collin@tukaani.org>
Thu, 2 Jan 2025 13:43:37 +0000 (15:43 +0200)
src/common/sysdefs.h

index 0d08fc9f2109970d64719ae70532db385b197d93..7676009e54955cb9bb3133d736cb633a3dd7d0ce 100644 (file)
@@ -203,4 +203,13 @@ typedef unsigned char _Bool;
 #      define lzma_attr_alloc_size(x)
 #endif
 
+#if __STDC_VERSION__ >= 202311
+#      define FALLTHROUGH [[__fallthrough__]]
+#elif (defined(__GNUC__) && __GNUC__ >= 7) \
+               || (defined(__clang_major__) && __clang_major__ >= 10)
+#      define FALLTHROUGH __attribute__((__fallthrough__))
+#else
+#      define FALLTHROUGH ((void)0)
+#endif
+
 #endif