diff mbox series

[6/7] compiler: fix compilation with clang + std=c++98 + glibcxx

Message ID 20200429040627.27859-6-rosenp@gmail.com (mailing list archive)
State New, archived
Headers show
Series [1/7] utils: replace strchr with std variant | expand

Commit Message

Rosen Penev April 29, 2020, 4:06 a.m. UTC
It seems clang does not like these attributes in c++98 mode.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
 include/compiler.h | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)
diff mbox series

Patch

diff --git a/include/compiler.h b/include/compiler.h
index 53d9b7ec..5ad54f41 100644
--- a/include/compiler.h
+++ b/include/compiler.h
@@ -1,14 +1,17 @@ 
-#ifdef __cplusplus
-
 #ifdef _LIBCPP_VERSION
 #define fallthrough _LIBCPP_FALLTHROUGH()
 #else
 
+#if __cplusplus >= 201103L
+
 #ifdef __clang__
 #define fallthrough [[clang::fallthrough]]
 #else
 #define fallthrough [[gnu::fallthrough]]
-#endif
+#endif // __clang__
+
+#else
+#define fallthrough ((void)0)
 
-#endif
-#endif
+#endif // __cplusplus
+#endif // _LIBCPP_VERSION