Skip to content

Commit 4da3647

Browse files
authored
Fixes warnings of ciso646 in C++17 (#3360)
1 parent d976876 commit 4da3647

File tree

1 file changed

+25
-2
lines changed
  • api/include/opentelemetry/nostd/internal/absl/base

1 file changed

+25
-2
lines changed

api/include/opentelemetry/nostd/internal/absl/base/options.h

+25-2
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,31 @@
6969

7070
// Include a standard library header to allow configuration based on the
7171
// standard library in use.
72-
#ifdef __cplusplus
73-
#include <ciso646>
72+
// Using C++20 feature-test macros when possible, otherwise fall back to
73+
// ciso646/iso646.h.There are warnings when including ciso646 in C++17 mode
74+
#ifdef __has_include
75+
# if __has_include(<version>)
76+
# include <version>
77+
# endif
78+
#elif defined(_MSC_VER) && \
79+
((defined(__cplusplus) && __cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L))
80+
# if _MSC_VER >= 1922
81+
# include <version>
82+
# endif
83+
#else
84+
# if defined(__GNUC__) && !defined(__clang__) && !defined(__apple_build_version__)
85+
# pragma GCC diagnostic push
86+
# pragma GCC diagnostic ignored "-Wcpp"
87+
# elif defined(__clang__) || defined(__apple_build_version__)
88+
# pragma clang diagnostic push
89+
# pragma clang diagnostic ignored "-Wcpp"
90+
# endif
91+
# include <ciso646>
92+
# if defined(__GNUC__) && !defined(__clang__) && !defined(__apple_build_version__)
93+
# pragma GCC diagnostic pop
94+
# elif defined(__clang__) || defined(__apple_build_version__)
95+
# pragma clang diagnostic pop
96+
# endif
7497
#endif
7598

7699
// -----------------------------------------------------------------------------

0 commit comments

Comments
 (0)