about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--absl/container/inlined_vector_test.cc4
-rw-r--r--absl/flags/BUILD.bazel61
-rw-r--r--absl/flags/CMakeLists.txt60
3 files changed, 99 insertions, 26 deletions
diff --git a/absl/container/inlined_vector_test.cc b/absl/container/inlined_vector_test.cc
index bada4fec9ccb..080ea95665d5 100644
--- a/absl/container/inlined_vector_test.cc
+++ b/absl/container/inlined_vector_test.cc
@@ -1689,7 +1689,11 @@ TEST(AllocatorSupportTest, ScopedAllocatorWorksInlined) {
   inlined_case.emplace_back();
 
   int64_t absl_responsible_for_count = total_allocated_byte_count;
+
+  // MSVC's allocator preemptively allocates in debug mode
+#if !defined(_MSC_VER)
   EXPECT_EQ(absl_responsible_for_count, 0);
+#endif  // !defined(_MSC_VER)
 
   inlined_case[0].emplace_back();
   EXPECT_GT(total_allocated_byte_count, absl_responsible_for_count);
diff --git a/absl/flags/BUILD.bazel b/absl/flags/BUILD.bazel
index 9e923ffb1e26..2cfd31cbe80a 100644
--- a/absl/flags/BUILD.bazel
+++ b/absl/flags/BUILD.bazel
@@ -29,10 +29,29 @@ licenses(["notice"])  # Apache 2.0
 cc_library(
     name = "internal",
     srcs = [
+        "internal/flag.cc",
+    ],
+    hdrs = [
+        "internal/flag.h",
+    ],
+    copts = ABSL_DEFAULT_COPTS,
+    linkopts = ABSL_DEFAULT_LINKOPTS,
+    visibility = [
+        "//absl/flags:__pkg__",
+    ],
+    deps = [
+        ":handle",
+        ":registry",
+        "//absl/synchronization",
+    ],
+)
+
+cc_library(
+    name = "program_name",
+    srcs = [
         "internal/program_name.cc",
     ],
     hdrs = [
-        "internal/path_util.h",
         "internal/program_name.h",
     ],
     copts = ABSL_DEFAULT_COPTS,
@@ -41,12 +60,28 @@ cc_library(
         "//absl/flags:__pkg__",
     ],
     deps = [
+        ":path_util",
         "//absl/strings",
         "//absl/synchronization",
     ],
 )
 
 cc_library(
+    name = "path_util",
+    hdrs = [
+        "internal/path_util.h",
+    ],
+    copts = ABSL_DEFAULT_COPTS,
+    linkopts = ABSL_DEFAULT_LINKOPTS,
+    visibility = [
+        "//absl/flags:__pkg__",
+    ],
+    deps = [
+        "//absl/strings",
+    ],
+)
+
+cc_library(
     name = "config",
     srcs = [
         "usage_config.cc",
@@ -58,7 +93,8 @@ cc_library(
     copts = ABSL_DEFAULT_COPTS,
     linkopts = ABSL_DEFAULT_LINKOPTS,
     deps = [
-        ":internal",
+        ":path_util",
+        ":program_name",
         "//absl/base:core_headers",
         "//absl/strings",
         "//absl/synchronization",
@@ -136,24 +172,21 @@ cc_library(
     name = "flag",
     srcs = [
         "flag.cc",
-        "internal/flag.cc",
     ],
     hdrs = [
         "declare.h",
         "flag.h",
-        "internal/flag.h",
     ],
     copts = ABSL_DEFAULT_COPTS,
     linkopts = ABSL_DEFAULT_LINKOPTS,
     deps = [
         ":config",
         ":handle",
+        ":internal",
         ":marshalling",
-        ":registry",
         "//absl/base",
         "//absl/base:core_headers",
         "//absl/strings",
-        "//absl/synchronization",
     ],
 )
 
@@ -174,7 +207,8 @@ cc_library(
         ":config",
         ":flag",
         ":handle",
-        ":internal",
+        ":path_util",
+        ":program_name",
         "//absl/strings",
         "//absl/synchronization",
     ],
@@ -209,8 +243,7 @@ cc_library(
     deps = [
         ":config",
         ":flag",
-        ":handle",
-        ":internal",
+        ":program_name",
         ":registry",
         ":usage",
         ":usage_internal",
@@ -295,7 +328,7 @@ cc_test(
     copts = ABSL_TEST_COPTS,
     linkopts = ABSL_DEFAULT_LINKOPTS,
     deps = [
-        ":internal",
+        ":path_util",
         "@com_google_googletest//:gtest_main",
     ],
 )
@@ -328,7 +361,7 @@ cc_test(
     copts = ABSL_TEST_COPTS,
     linkopts = ABSL_DEFAULT_LINKOPTS,
     deps = [
-        ":internal",
+        ":program_name",
         "//absl/strings",
         "@com_google_googletest//:gtest_main",
     ],
@@ -361,7 +394,8 @@ cc_test(
     linkopts = ABSL_DEFAULT_LINKOPTS,
     deps = [
         ":config",
-        ":internal",
+        ":path_util",
+        ":program_name",
         "//absl/strings",
         "@com_google_googletest//:gtest_main",
     ],
@@ -378,8 +412,9 @@ cc_test(
     deps = [
         ":config",
         ":flag",
-        ":internal",
         ":parse",
+        ":path_util",
+        ":program_name",
         ":usage",
         ":usage_internal",
         "//absl/memory",
diff --git a/absl/flags/CMakeLists.txt b/absl/flags/CMakeLists.txt
index 3eac8f0a1972..3a7162f9347b 100644
--- a/absl/flags/CMakeLists.txt
+++ b/absl/flags/CMakeLists.txt
@@ -19,20 +19,54 @@ absl_cc_library(
   NAME
     flags_internal
   SRCS
+    "internal/flag.cc"
+  HDRS
+    "internal/flag.h"
+  COPTS
+    ${ABSL_DEFAULT_COPTS}
+  LINKOPTS
+    ${ABSL_DEFAULT_LINKOPTS}
+  DEPS
+    absl::flags_handle
+    absl::flags_registry
+    absl::synchronization
+  PUBLIC
+)
+
+# Internal-only target, do not depend on directly.
+absl_cc_library(
+  NAME
+    flags_program_name
+  SRCS
     "internal/program_name.cc"
   HDRS
-    "internal/path_util.h"
     "internal/program_name.h"
   COPTS
     ${ABSL_DEFAULT_COPTS}
   LINKOPTS
     ${ABSL_DEFAULT_LINKOPTS}
   DEPS
+    absl::flags_path_util
     absl::strings
     absl::synchronization
   PUBLIC
 )
 
+# Internal-only target, do not depend on directly.
+absl_cc_library(
+  NAME
+    flags_path_util
+  HDRS
+    "internal/path_util.h"
+  COPTS
+    ${ABSL_DEFAULT_COPTS}
+  LINKOPTS
+    ${ABSL_DEFAULT_LINKOPTS}
+  DEPS
+    absl::strings
+  PUBLIC
+)
+
 absl_cc_library(
   NAME
     flags_config
@@ -46,7 +80,8 @@ absl_cc_library(
   LINKOPTS
     ${ABSL_DEFAULT_LINKOPTS}
   DEPS
-    absl::flags_internal
+    absl::flags_path_util
+    absl::flags_program_name
     absl::core_headers
     absl::strings
     absl::synchronization
@@ -120,11 +155,9 @@ absl_cc_library(
     flags
   SRCS
     "flag.cc"
-    "internal/flag.cc"
   HDRS
     "declare.h"
     "flag.h"
-    "internal/flag.h"
   COPTS
     ${ABSL_DEFAULT_COPTS}
   LINKOPTS
@@ -132,12 +165,11 @@ absl_cc_library(
   DEPS
     absl::flags_config
     absl::flags_handle
+    absl::flags_internal
     absl::flags_marshalling
-    absl::flags_registry
     absl::base
     absl::core_headers
     absl::strings
-    absl::synchronization
 )
 
 # Internal-only target, do not depend on directly.
@@ -156,7 +188,8 @@ absl_cc_library(
     absl::flags_config
     absl::flags
     absl::flags_handle
-    absl::flags_internal
+    absl::flags_path_util
+    absl::flags_program_name
     absl::strings
     absl::synchronization
 )
@@ -193,8 +226,7 @@ absl_cc_library(
   DEPS
     absl::flags_config
     absl::flags
-    absl::flags_handle
-    absl::flags_internal
+    absl::flags_program_name
     absl::flags_registry
     absl::flags_usage
     absl::strings
@@ -285,7 +317,7 @@ absl_cc_test(
   COPTS
     ${ABSL_TEST_COPTS}
   DEPS
-    absl::flags_internal
+    absl::flags_path_util
     gtest_main
 )
 
@@ -297,7 +329,7 @@ absl_cc_test(
   COPTS
     ${ABSL_TEST_COPTS}
   DEPS
-    absl::flags_internal
+    absl::flags_program_name
     absl::strings
     gtest_main
 )
@@ -326,7 +358,8 @@ absl_cc_test(
     ${ABSL_TEST_COPTS}
   DEPS
     absl::flags_config
-    absl::flags_internal
+    absl::flags_path_util
+    absl::flags_program_name
     absl::strings
     gtest_main
 )
@@ -341,7 +374,8 @@ absl_cc_test(
   DEPS
     absl::flags_config
     absl::flags
-    absl::flags_internal
+    absl::flags_path_util
+    absl::flags_program_name
     absl::flags_parse
     absl::flags_usage
     absl::memory