aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAbseil Team <absl-team@google.com>2024-01-19 07:53:03 -0800
committerCopybara-Service <copybara-worker@google.com>2024-01-19 07:53:58 -0800
commit04d8afe7a3b36b57f6497c60dc6184e9dfeb85c1 (patch)
tree8c255c6f2a7690e84fcab8fbf7bc943688630a7e
parentb03cda5ec9b1f5aa3e2d0e5db4e436a11ed193bc (diff)
downloadabseil-04d8afe7a3b36b57f6497c60dc6184e9dfeb85c1.tar.gz
abseil-04d8afe7a3b36b57f6497c60dc6184e9dfeb85c1.tar.bz2
abseil-04d8afe7a3b36b57f6497c60dc6184e9dfeb85c1.zip
Remove code pieces for no longer supported MSVC versions.
The current support policy is `_MSC_VER >= 1920`. PiperOrigin-RevId: 599833619 Change-Id: I9cf7393a5b659d1680765e37e0328539ccb870fa
-rw-r--r--absl/numeric/int128_test.cc6
-rw-r--r--absl/strings/string_view.h2
-rw-r--r--absl/strings/string_view_test.cc4
-rw-r--r--absl/synchronization/lifetime_test.cc5
-rw-r--r--absl/types/optional_test.cc27
5 files changed, 5 insertions, 39 deletions
diff --git a/absl/numeric/int128_test.cc b/absl/numeric/int128_test.cc
index 01e3eb5c..005ff9a4 100644
--- a/absl/numeric/int128_test.cc
+++ b/absl/numeric/int128_test.cc
@@ -26,12 +26,6 @@
#include "absl/hash/hash_testing.h"
#include "absl/meta/type_traits.h"
-#if defined(_MSC_VER) && _MSC_VER == 1900
-// Disable "unary minus operator applied to unsigned type" warnings in Microsoft
-// Visual C++ 14 (2015).
-#pragma warning(disable:4146)
-#endif
-
#define MAKE_INT128(HI, LO) absl::MakeInt128(static_cast<int64_t>(HI), LO)
namespace {
diff --git a/absl/strings/string_view.h b/absl/strings/string_view.h
index 04ca0a38..b393c6fc 100644
--- a/absl/strings/string_view.h
+++ b/absl/strings/string_view.h
@@ -670,7 +670,7 @@ class string_view {
}
static constexpr size_type StrlenInternal(absl::Nonnull<const char*> str) {
-#if defined(_MSC_VER) && _MSC_VER >= 1910 && !defined(__clang__)
+#if defined(_MSC_VER) && !defined(__clang__)
// MSVC 2017+ can evaluate this at compile-time.
const char* begin = str;
while (*str != '\0') ++str;
diff --git a/absl/strings/string_view_test.cc b/absl/strings/string_view_test.cc
index 5b1eb01a..251f1842 100644
--- a/absl/strings/string_view_test.cc
+++ b/absl/strings/string_view_test.cc
@@ -1051,9 +1051,6 @@ TEST(StringViewTest, ConstexprNullSafeStringView) {
EXPECT_EQ(0u, s.size());
EXPECT_EQ(absl::string_view(), s);
}
-#if !defined(_MSC_VER) || _MSC_VER >= 1910
- // MSVC 2017+ is required for good constexpr string_view support.
- // See the implementation of `absl::string_view::StrlenInternal()`.
{
static constexpr char kHi[] = "hi";
absl::string_view s = absl::NullSafeStringView(kHi);
@@ -1066,7 +1063,6 @@ TEST(StringViewTest, ConstexprNullSafeStringView) {
EXPECT_EQ(s.size(), 5u);
EXPECT_EQ("hello", s);
}
-#endif
}
TEST(StringViewTest, ConstexprCompiles) {
diff --git a/absl/synchronization/lifetime_test.cc b/absl/synchronization/lifetime_test.cc
index d5ce35a1..4c4cff64 100644
--- a/absl/synchronization/lifetime_test.cc
+++ b/absl/synchronization/lifetime_test.cc
@@ -123,10 +123,9 @@ class OnDestruction {
};
// These tests require that the compiler correctly supports C++11 constant
-// initialization... but MSVC has a known regression since v19.10 till v19.25:
+// initialization... but MSVC has a known regression (since v19.10) till v19.25:
// https://developercommunity.visualstudio.com/content/problem/336946/class-with-constexpr-constructor-not-using-static.html
-#if defined(__clang__) || \
- !(defined(_MSC_VER) && _MSC_VER > 1900 && _MSC_VER < 1925)
+#if defined(__clang__) || !(defined(_MSC_VER) && _MSC_VER < 1925)
// kConstInit
// Test early usage. (Declaration comes first; definitions must appear after
// the test runner.)
diff --git a/absl/types/optional_test.cc b/absl/types/optional_test.cc
index 5da297b0..a4daa799 100644
--- a/absl/types/optional_test.cc
+++ b/absl/types/optional_test.cc
@@ -994,25 +994,6 @@ TEST(optionalTest, PointerStuff) {
#endif
#endif
-// MSVC has a bug with "cv-qualifiers in class construction", fixed in 2017. See
-// https://docs.microsoft.com/en-us/cpp/cpp-conformance-improvements-2017#bug-fixes
-// The compiler some incorrectly ignores the cv-qualifier when generating a
-// class object via a constructor call. For example:
-//
-// class optional {
-// constexpr T&& value() &&;
-// constexpr const T&& value() const &&;
-// }
-//
-// using COI = const absl::optional<int>;
-// static_assert(2 == COI(2).value(), ""); // const &&
-//
-// This should invoke the "const &&" overload but since it ignores the const
-// qualifier it finds the "&&" overload the best candidate.
-#if defined(_MSC_VER) && _MSC_VER < 1910
-#define ABSL_SKIP_OVERLOAD_TEST_DUE_TO_MSVC_BUG
-#endif
-
TEST(optionalTest, Value) {
using O = absl::optional<std::string>;
using CO = const absl::optional<std::string>;
@@ -1032,8 +1013,7 @@ TEST(optionalTest, Value) {
EXPECT_EQ("c&", TypeQuals(clvalue.value()));
EXPECT_EQ("c&", TypeQuals(lvalue_c.value()));
EXPECT_EQ("&&", TypeQuals(O(absl::in_place, "xvalue").value()));
-#if !defined(ABSL_SKIP_OVERLOAD_TEST_DUE_TO_MSVC_BUG) && \
- !defined(ABSL_SKIP_OVERLOAD_TEST_DUE_TO_GCC_BUG)
+#ifndef ABSL_SKIP_OVERLOAD_TEST_DUE_TO_GCC_BUG
EXPECT_EQ("c&&", TypeQuals(CO(absl::in_place, "cxvalue").value()));
#endif
EXPECT_EQ("c&&", TypeQuals(OC(absl::in_place, "xvalue_c").value()));
@@ -1083,8 +1063,7 @@ TEST(optionalTest, DerefOperator) {
EXPECT_EQ("&", TypeQuals(*lvalue));
EXPECT_EQ("c&", TypeQuals(*clvalue));
EXPECT_EQ("&&", TypeQuals(*O(absl::in_place, "xvalue")));
-#if !defined(ABSL_SKIP_OVERLOAD_TEST_DUE_TO_MSVC_BUG) && \
- !defined(ABSL_SKIP_OVERLOAD_TEST_DUE_TO_GCC_BUG)
+#ifndef ABSL_SKIP_OVERLOAD_TEST_DUE_TO_GCC_BUG
EXPECT_EQ("c&&", TypeQuals(*CO(absl::in_place, "cxvalue")));
#endif
EXPECT_EQ("c&&", TypeQuals(*OC(absl::in_place, "xvalue_c")));
@@ -1117,11 +1096,9 @@ TEST(optionalTest, ValueOr) {
constexpr absl::optional<double> copt_empty, copt_set = {1.2};
static_assert(42.0 == copt_empty.value_or(42), "");
static_assert(1.2 == copt_set.value_or(42), "");
-#ifndef ABSL_SKIP_OVERLOAD_TEST_DUE_TO_MSVC_BUG
using COD = const absl::optional<double>;
static_assert(42.0 == COD().value_or(42), "");
static_assert(1.2 == COD(1.2).value_or(42), "");
-#endif
}
// make_optional cannot be constexpr until C++17