xorgproto: Branch 'master'
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Fri May 2 22:28:31 UTC 2025
include/X11/Xfuncproto.h | 21 ++++++++++++++++++---
xproto.pc.in | 2 +-
2 files changed, 19 insertions(+), 4 deletions(-)
New commits:
commit 1914233e662d23ffb3812b80fadd0bbd064ad91c
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date: Mon Apr 21 15:59:24 2025 -0700
Xfuncproto: define _X_FALLTHROUGH for modern compilers
Can be used to tell the compiler that fallthrough between cases in
a switch statement is intentional. Handles gcc >= 7 and clang >= 12
as well as all C23-compliant compilers.
Bumps xproto version to 7.0.34.
Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/proto/xorgproto/-/merge_requests/96>
diff --git a/include/X11/Xfuncproto.h b/include/X11/Xfuncproto.h
index f78415e..da09f84 100644
--- a/include/X11/Xfuncproto.h
+++ b/include/X11/Xfuncproto.h
@@ -78,13 +78,16 @@ in this Software without prior written authorization from The Open Group.
/* http://clang.llvm.org/docs/LanguageExtensions.html#has-attribute */
#ifndef __has_attribute
-# define __has_attribute(x) 0 /* Compatibility with non-clang compilers. */
+# define __has_attribute(x) 0 /* Compatibility with older compilers. */
#endif
#ifndef __has_feature
-# define __has_feature(x) 0 /* Compatibility with non-clang compilers. */
+# define __has_feature(x) 0 /* Compatibility with older compilers. */
#endif
#ifndef __has_extension
-# define __has_extension(x) 0 /* Compatibility with non-clang compilers. */
+# define __has_extension(x) 0 /* Compatibility with older compilers. */
+#endif
+#ifndef __has_c_attribute
+# define __has_c_attribute(x) 0 /* Compatibility with pre-C23 compilers. */
#endif
/* Added in X11R6.9, so available in any version of modular xproto */
@@ -213,4 +216,16 @@ in this Software without prior written authorization from The Open Group.
# define _X_NONSTRING
#endif
+/* Mark a fallthrough in a switch statement as intentional
+ Handles C23 compilers, as well as gcc >= 7 and clang >= 12
+ For older compilers/linters, pair with a fallthrough comment. */
+/* requires xproto >= 7.0.34 */
+#if __has_c_attribute(fallthrough)
+#define _X_FALLTHROUGH [[fallthrough]]
+#elif __has_attribute(fallthrough)
+#define _X_FALLTHROUGH __attribute__((fallthrough))
+#else
+#define _X_FALLTHROUGH (void)0
+#endif
+
#endif /* _XFUNCPROTO_H_ */
diff --git a/xproto.pc.in b/xproto.pc.in
index 9e288c7..0eebc88 100644
--- a/xproto.pc.in
+++ b/xproto.pc.in
@@ -4,5 +4,5 @@ includex11dir=@includedir@/X11
Name: Xproto
Description: Xproto headers
-Version: 7.0.33
+Version: 7.0.34
Cflags: -I${includedir}
More information about the xorg-commit
mailing list