mirror of
https://github.com/abseil/abseil-cpp.git
synced 2026-06-04 12:07:05 +08:00
Remove preprocessors for now unsupported compilers.
PiperOrigin-RevId: 719126950 Change-Id: I0978c295896acdf069175ba99156e8bbf6e1e188
This commit is contained in:
committed by
Copybara-Service
parent
d5bafc01dd
commit
747c9768b5
@@ -210,13 +210,9 @@ TEST(BindTest, ConstExpr) {
|
||||
constexpr auto plus5 = absl::bind_front(Plus, five);
|
||||
EXPECT_EQ(plus5(1), 6);
|
||||
|
||||
// There seems to be a bug in MSVC dealing constexpr construction of
|
||||
// char[]. Notice 'plus5' above; 'int' works just fine.
|
||||
#if !(defined(_MSC_VER) && _MSC_VER < 1910)
|
||||
static constexpr char data[] = "DEF";
|
||||
constexpr auto g = absl::bind_front(CharAt, data);
|
||||
EXPECT_EQ(g(1), 'E');
|
||||
#endif
|
||||
}
|
||||
|
||||
struct ManglingCall {
|
||||
|
||||
@@ -359,16 +359,13 @@ template <typename FloatType>
|
||||
bool HandleEdgeCase(const strings_internal::ParsedFloat& input, bool negative,
|
||||
absl::Nonnull<FloatType*> value) {
|
||||
if (input.type == strings_internal::FloatType::kNan) {
|
||||
// A bug in both clang < 7 and gcc would cause the compiler to optimize
|
||||
// away the buffer we are building below. Declaring the buffer volatile
|
||||
// avoids the issue, and has no measurable performance impact in
|
||||
// microbenchmarks.
|
||||
// A bug in gcc would cause the compiler to optimize away the buffer we are
|
||||
// building below. Declaring the buffer volatile avoids the issue, and has
|
||||
// no measurable performance impact in microbenchmarks.
|
||||
//
|
||||
// https://bugs.llvm.org/show_bug.cgi?id=37778
|
||||
// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86113
|
||||
constexpr ptrdiff_t kNanBufferSize = 128;
|
||||
#if (defined(__GNUC__) && !defined(__clang__)) || \
|
||||
(defined(__clang__) && __clang_major__ < 7)
|
||||
#if (defined(__GNUC__) && !defined(__clang__))
|
||||
volatile char n_char_sequence[kNanBufferSize];
|
||||
#else
|
||||
char n_char_sequence[kNanBufferSize];
|
||||
|
||||
@@ -1123,7 +1123,7 @@ TEST(StringViewTest, ConstexprCompiles) {
|
||||
#endif
|
||||
|
||||
// MSVC 2017+ should be able to construct a constexpr string_view from a cstr.
|
||||
#if defined(_MSC_VER) && _MSC_VER >= 1910
|
||||
#if defined(_MSC_VER)
|
||||
#define ABSL_HAVE_CONSTEXPR_STRING_VIEW_FROM_CSTR 1
|
||||
#endif
|
||||
|
||||
@@ -1159,10 +1159,6 @@ TEST(StringViewTest, ConstexprCompiles) {
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if !defined(__clang__) || 3 < __clang_major__ || \
|
||||
(3 == __clang_major__ && 4 < __clang_minor__)
|
||||
// older clang versions (< 3.5) complain that:
|
||||
// "cannot perform pointer arithmetic on null pointer"
|
||||
constexpr absl::string_view::iterator const_begin_empty = sp.begin();
|
||||
constexpr absl::string_view::iterator const_end_empty = sp.end();
|
||||
EXPECT_EQ(const_begin_empty, const_end_empty);
|
||||
@@ -1172,7 +1168,6 @@ TEST(StringViewTest, ConstexprCompiles) {
|
||||
constexpr absl::string_view::iterator const_end_nullptr = cstr.end();
|
||||
EXPECT_EQ(const_begin_nullptr, const_end_nullptr);
|
||||
#endif // ABSL_HAVE_STRING_VIEW_FROM_NULLPTR
|
||||
#endif // !defined(__clang__) || ...
|
||||
|
||||
constexpr absl::string_view::iterator const_begin = cstr_len.begin();
|
||||
constexpr absl::string_view::iterator const_end = cstr_len.end();
|
||||
|
||||
Reference in New Issue
Block a user