You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
59 lines
1.6 KiB
59 lines
1.6 KiB
4 months ago
|
From c7ef1a55bb6accb708a4e09d71028b904b07e49e Mon Sep 17 00:00:00 2001
|
||
|
From: James Le Cuirot <chewi@gentoo.org>
|
||
|
Date: Wed, 7 Feb 2024 22:48:59 +0000
|
||
|
Subject: [PATCH] v4l2-compliance: Fix building against libc++
|
||
|
|
||
|
v4l2-test-time32-64.cpp included compiler.h, which checks
|
||
|
_LIBCPP_VERSION. This only works against libc++ when a C++ header has
|
||
|
already been included, which wasn't the case here.
|
||
|
|
||
|
The <version> header is the C++20 method of defining _LIBCPP_VERSION,
|
||
|
but for older versions, <ciso646> works as an alternative, so include
|
||
|
that in compiler.h.
|
||
|
|
||
|
compiler.h is for C as well as C++ though, so use __cplusplus to check
|
||
|
for a C++ compiler before including <ciso646>.
|
||
|
|
||
|
Signed-off-by: James Le Cuirot <chewi@gentoo.org>
|
||
|
---
|
||
|
include/compiler.h | 27 ++++++++++++---------------
|
||
|
1 file changed, 12 insertions(+), 15 deletions(-)
|
||
|
|
||
|
diff --git a/include/compiler.h b/include/compiler.h
|
||
|
index 5ad54f41..169247a8 100644
|
||
|
--- a/include/compiler.h
|
||
|
+++ b/include/compiler.h
|
||
|
@@ -1,17 +1,14 @@
|
||
|
-#ifdef _LIBCPP_VERSION
|
||
|
-#define fallthrough _LIBCPP_FALLTHROUGH()
|
||
|
+#if !defined(__cplusplus) || __cplusplus < 201103L
|
||
|
+ #define fallthrough ((void)0)
|
||
|
#else
|
||
|
-
|
||
|
-#if __cplusplus >= 201103L
|
||
|
-
|
||
|
-#ifdef __clang__
|
||
|
-#define fallthrough [[clang::fallthrough]]
|
||
|
-#else
|
||
|
-#define fallthrough [[gnu::fallthrough]]
|
||
|
-#endif // __clang__
|
||
|
-
|
||
|
-#else
|
||
|
-#define fallthrough ((void)0)
|
||
|
-
|
||
|
+ #include <ciso646>
|
||
|
+ #ifdef _LIBCPP_VERSION
|
||
|
+ #define fallthrough _LIBCPP_FALLTHROUGH()
|
||
|
+ #else
|
||
|
+ #ifdef __clang__
|
||
|
+ #define fallthrough [[clang::fallthrough]]
|
||
|
+ #else
|
||
|
+ #define fallthrough [[gnu::fallthrough]]
|
||
|
+ #endif // __clang__
|
||
|
+ #endif // _LIBCPP_VERSION
|
||
|
#endif // __cplusplus
|
||
|
-#endif // _LIBCPP_VERSION
|
||
|
--
|
||
|
2.43.0
|
||
|
|