about summary refs log tree commit diff
path: root/absl/types
diff options
context:
space:
mode:
Diffstat (limited to 'absl/types')
-rw-r--r--absl/types/BUILD.bazel71
-rw-r--r--absl/types/CMakeLists.txt30
-rw-r--r--absl/types/variant_test.cc6
3 files changed, 20 insertions, 87 deletions
diff --git a/absl/types/BUILD.bazel b/absl/types/BUILD.bazel
index 037d499a604b..236c24bc34d6 100644
--- a/absl/types/BUILD.bazel
+++ b/absl/types/BUILD.bazel
@@ -19,8 +19,6 @@ load(
     "//absl:copts/configure_copts.bzl",
     "ABSL_DEFAULT_COPTS",
     "ABSL_DEFAULT_LINKOPTS",
-    "ABSL_EXCEPTIONS_FLAG",
-    "ABSL_EXCEPTIONS_FLAG_LINKOPTS",
     "ABSL_TEST_COPTS",
 )
 
@@ -59,8 +57,8 @@ cc_library(
         "bad_any_cast.cc",
         "bad_any_cast.h",
     ],
-    copts = ABSL_EXCEPTIONS_FLAG + ABSL_DEFAULT_COPTS,
-    linkopts = ABSL_EXCEPTIONS_FLAG_LINKOPTS + ABSL_DEFAULT_LINKOPTS,
+    copts = ABSL_DEFAULT_COPTS,
+    linkopts = ABSL_DEFAULT_LINKOPTS,
     visibility = ["//visibility:private"],
     deps = [
         "//absl/base:config",
@@ -74,24 +72,6 @@ cc_test(
     srcs = [
         "any_test.cc",
     ],
-    copts = ABSL_TEST_COPTS + ABSL_EXCEPTIONS_FLAG,
-    linkopts = ABSL_EXCEPTIONS_FLAG_LINKOPTS + ABSL_DEFAULT_LINKOPTS,
-    deps = [
-        ":any",
-        "//absl/base:config",
-        "//absl/base:exception_testing",
-        "//absl/base:raw_logging_internal",
-        "//absl/container:test_instance_tracker",
-        "@com_google_googletest//:gtest_main",
-    ],
-)
-
-cc_test(
-    name = "any_test_noexceptions",
-    size = "small",
-    srcs = [
-        "any_test.cc",
-    ],
     copts = ABSL_TEST_COPTS,
     linkopts = ABSL_DEFAULT_LINKOPTS,
     deps = [
@@ -107,8 +87,8 @@ cc_test(
 cc_test(
     name = "any_exception_safety_test",
     srcs = ["any_exception_safety_test.cc"],
-    copts = ABSL_TEST_COPTS + ABSL_EXCEPTIONS_FLAG,
-    linkopts = ABSL_EXCEPTIONS_FLAG_LINKOPTS + ABSL_DEFAULT_LINKOPTS,
+    copts = ABSL_TEST_COPTS,
+    linkopts = ABSL_DEFAULT_LINKOPTS,
     deps = [
         ":any",
         "//absl/base:config",
@@ -139,25 +119,6 @@ cc_test(
     name = "span_test",
     size = "small",
     srcs = ["span_test.cc"],
-    copts = ABSL_TEST_COPTS + ABSL_EXCEPTIONS_FLAG,
-    linkopts = ABSL_EXCEPTIONS_FLAG_LINKOPTS + ABSL_DEFAULT_LINKOPTS,
-    deps = [
-        ":span",
-        "//absl/base:config",
-        "//absl/base:core_headers",
-        "//absl/base:exception_testing",
-        "//absl/container:fixed_array",
-        "//absl/container:inlined_vector",
-        "//absl/hash:hash_testing",
-        "//absl/strings",
-        "@com_google_googletest//:gtest_main",
-    ],
-)
-
-cc_test(
-    name = "span_test_noexceptions",
-    size = "small",
-    srcs = ["span_test.cc"],
     copts = ABSL_TEST_COPTS,
     linkopts = ABSL_DEFAULT_LINKOPTS,
     deps = [
@@ -194,8 +155,8 @@ cc_library(
     name = "bad_optional_access",
     srcs = ["bad_optional_access.cc"],
     hdrs = ["bad_optional_access.h"],
-    copts = ABSL_DEFAULT_COPTS + ABSL_EXCEPTIONS_FLAG,
-    linkopts = ABSL_EXCEPTIONS_FLAG_LINKOPTS + ABSL_DEFAULT_LINKOPTS,
+    copts = ABSL_DEFAULT_COPTS,
+    linkopts = ABSL_DEFAULT_LINKOPTS,
     deps = [
         "//absl/base:config",
         "//absl/base:raw_logging_internal",
@@ -206,8 +167,8 @@ cc_library(
     name = "bad_variant_access",
     srcs = ["bad_variant_access.cc"],
     hdrs = ["bad_variant_access.h"],
-    copts = ABSL_EXCEPTIONS_FLAG + ABSL_DEFAULT_COPTS,
-    linkopts = ABSL_EXCEPTIONS_FLAG_LINKOPTS + ABSL_DEFAULT_LINKOPTS,
+    copts = ABSL_DEFAULT_COPTS,
+    linkopts = ABSL_DEFAULT_LINKOPTS,
     deps = [
         "//absl/base:config",
         "//absl/base:raw_logging_internal",
@@ -220,8 +181,8 @@ cc_test(
     srcs = [
         "optional_test.cc",
     ],
-    copts = ABSL_TEST_COPTS + ABSL_EXCEPTIONS_FLAG,
-    linkopts = ABSL_EXCEPTIONS_FLAG_LINKOPTS + ABSL_DEFAULT_LINKOPTS,
+    copts = ABSL_TEST_COPTS,
+    linkopts = ABSL_DEFAULT_LINKOPTS,
     deps = [
         ":optional",
         "//absl/base:config",
@@ -237,8 +198,8 @@ cc_test(
     srcs = [
         "optional_exception_safety_test.cc",
     ],
-    copts = ABSL_TEST_COPTS + ABSL_EXCEPTIONS_FLAG,
-    linkopts = ABSL_EXCEPTIONS_FLAG_LINKOPTS + ABSL_DEFAULT_LINKOPTS,
+    copts = ABSL_TEST_COPTS,
+    linkopts = ABSL_DEFAULT_LINKOPTS,
     deps = [
         ":optional",
         "//absl/base:config",
@@ -267,8 +228,8 @@ cc_test(
     name = "variant_test",
     size = "small",
     srcs = ["variant_test.cc"],
-    copts = ABSL_TEST_COPTS + ABSL_EXCEPTIONS_FLAG,
-    linkopts = ABSL_EXCEPTIONS_FLAG_LINKOPTS + ABSL_DEFAULT_LINKOPTS,
+    copts = ABSL_TEST_COPTS,
+    linkopts = ABSL_DEFAULT_LINKOPTS,
     deps = [
         ":variant",
         "//absl/base:config",
@@ -301,8 +262,8 @@ cc_test(
     srcs = [
         "variant_exception_safety_test.cc",
     ],
-    copts = ABSL_TEST_COPTS + ABSL_EXCEPTIONS_FLAG,
-    linkopts = ABSL_EXCEPTIONS_FLAG_LINKOPTS + ABSL_DEFAULT_LINKOPTS,
+    copts = ABSL_TEST_COPTS,
+    linkopts = ABSL_DEFAULT_LINKOPTS,
     deps = [
         ":variant",
         "//absl/base:config",
diff --git a/absl/types/CMakeLists.txt b/absl/types/CMakeLists.txt
index 1f7fde09694a..952efc34f634 100644
--- a/absl/types/CMakeLists.txt
+++ b/absl/types/CMakeLists.txt
@@ -50,9 +50,6 @@ absl_cc_library(
    "bad_any_cast.cc"
   COPTS
     ${ABSL_DEFAULT_COPTS}
-    ${ABSL_EXCEPTIONS_FLAG}
-  LINKOPTS
-    ${ABSL_EXCEPTIONS_FLAG_LINKOPTS}
   DEPS
     absl::config
     absl::raw_logging_internal
@@ -65,9 +62,6 @@ absl_cc_test(
     "any_test.cc"
   COPTS
     ${ABSL_TEST_COPTS}
-    ${ABSL_EXCEPTIONS_FLAG}
-  LINKOPTS
-    ${ABSL_EXCEPTIONS_FLAG_LINKOPTS}
   DEPS
     absl::any
     absl::config
@@ -100,9 +94,6 @@ absl_cc_test(
     "any_exception_safety_test.cc"
   COPTS
     ${ABSL_TEST_COPTS}
-    ${ABSL_EXCEPTIONS_FLAG}
-  LINKOPTS
-    ${ABSL_EXCEPTIONS_FLAG_LINKOPTS}
   DEPS
     absl::any
     absl::config
@@ -134,9 +125,6 @@ absl_cc_test(
     "span_test.cc"
   COPTS
     ${ABSL_TEST_COPTS}
-    ${ABSL_EXCEPTIONS_FLAG}
-  LINKOPTS
-    ${ABSL_EXCEPTIONS_FLAG_LINKOPTS}
   DEPS
     absl::span
     absl::base
@@ -199,9 +187,6 @@ absl_cc_library(
     "bad_optional_access.cc"
   COPTS
     ${ABSL_DEFAULT_COPTS}
-    ${ABSL_EXCEPTIONS_FLAG}
-  LINKOPTS
-    ${ABSL_EXCEPTIONS_FLAG_LINKOPTS}
   DEPS
     absl::config
     absl::raw_logging_internal
@@ -217,9 +202,6 @@ absl_cc_library(
     "bad_variant_access.cc"
   COPTS
     ${ABSL_DEFAULT_COPTS}
-    ${ABSL_EXCEPTIONS_FLAG}
-  LINKOPTS
-    ${ABSL_EXCEPTIONS_FLAG_LINKOPTS}
   DEPS
     absl::config
     absl::raw_logging_internal
@@ -233,9 +215,6 @@ absl_cc_test(
     "optional_test.cc"
   COPTS
     ${ABSL_TEST_COPTS}
-    ${ABSL_EXCEPTIONS_FLAG}
-  LINKOPTS
-    ${ABSL_EXCEPTIONS_FLAG_LINKOPTS}
   DEPS
     absl::optional
     absl::config
@@ -252,9 +231,6 @@ absl_cc_test(
     "optional_exception_safety_test.cc"
   COPTS
     ${ABSL_TEST_COPTS}
-    ${ABSL_EXCEPTIONS_FLAG}
-  LINKOPTS
-    ${ABSL_EXCEPTIONS_FLAG_LINKOPTS}
   DEPS
     absl::optional
     absl::config
@@ -288,9 +264,6 @@ absl_cc_test(
     "variant_test.cc"
   COPTS
     ${ABSL_TEST_COPTS}
-    ${ABSL_EXCEPTIONS_FLAG}
-  LINKOPTS
-    ${ABSL_EXCEPTIONS_FLAG_LINKOPTS}
   DEPS
     absl::variant
     absl::config
@@ -337,9 +310,6 @@ absl_cc_test(
     "variant_exception_safety_test.cc"
   COPTS
     ${ABSL_TEST_COPTS}
-    ${ABSL_EXCEPTIONS_FLAG}
-  LINKOPTS
-    ${ABSL_EXCEPTIONS_FLAG_LINKOPTS}
   DEPS
     absl::variant
     absl::config
diff --git a/absl/types/variant_test.cc b/absl/types/variant_test.cc
index 56a6e01c6100..b59127457148 100644
--- a/absl/types/variant_test.cc
+++ b/absl/types/variant_test.cc
@@ -1042,8 +1042,6 @@ TEST(VariantTest, MemberSwap) {
   using V = variant<MoveCanThrow, std::string, int>;
   int i = 33;
   std::string s = "abc";
-  V valueless(in_place_index<0>);
-  ToValuelessByException(valueless);
   {
     // lhs and rhs holds different alternative
     V lhs(i), rhs(s);
@@ -1051,6 +1049,9 @@ TEST(VariantTest, MemberSwap) {
     EXPECT_THAT(lhs, VariantWith<std::string>(s));
     EXPECT_THAT(rhs, VariantWith<int>(i));
   }
+#ifdef ABSL_HAVE_EXCEPTIONS
+  V valueless(in_place_index<0>);
+  ToValuelessByException(valueless);
   {
     // lhs is valueless
     V lhs(valueless), rhs(i);
@@ -1072,6 +1073,7 @@ TEST(VariantTest, MemberSwap) {
     EXPECT_TRUE(lhs.valueless_by_exception());
     EXPECT_TRUE(rhs.valueless_by_exception());
   }
+#endif  // ABSL_HAVE_EXCEPTIONS
 }
 
 //////////////////////