152 lines
5.8 KiB
Diff
152 lines
5.8 KiB
Diff
diff --git a/CMake/AbseilHelpers.cmake b/CMake/AbseilHelpers.cmake
|
|
index 624a3c7..8d0493d 100644
|
|
--- a/CMake/AbseilHelpers.cmake
|
|
+++ b/CMake/AbseilHelpers.cmake
|
|
@@ -345,7 +345,7 @@ Cflags: -I\${includedir}${PC_CFLAGS}\n")
|
|
endif()
|
|
endif()
|
|
|
|
- if(ABSL_ENABLE_INSTALL)
|
|
+ if(ABSL_ENABLE_INSTALL AND NOT ABSL_CC_LIB_TESTONLY)
|
|
install(TARGETS ${_NAME} EXPORT ${PROJECT_NAME}Targets
|
|
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
|
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
|
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
|
index 1e7c856..a3c3dae 100644
|
|
--- a/CMakeLists.txt
|
|
+++ b/CMakeLists.txt
|
|
@@ -145,7 +145,7 @@ if((BUILD_TESTING AND ABSL_BUILD_TESTING) OR ABSL_BUILD_TEST_HELPERS)
|
|
add_library(GTest::gmock ALIAS gmock)
|
|
add_library(GTest::gmock_main ALIAS gmock_main)
|
|
else()
|
|
- message(FATAL_ERROR "ABSL_USE_EXTERNAL_GOOGLETEST is ON and ABSL_FIND_GOOGLETEST is OFF, which means that the top-level project must build the Google Test project. However, the target gtest was not found.")
|
|
+ message(WARNING "ABSL_USE_EXTERNAL_GOOGLETEST is ON and ABSL_FIND_GOOGLETEST is OFF, which means that the top-level project must build the Google Test project. However, the target gtest was not found.")
|
|
endif()
|
|
endif()
|
|
else()
|
|
diff --git a/absl/flags/declare.h b/absl/flags/declare.h
|
|
index 8d2a856..a154046 100644
|
|
--- a/absl/flags/declare.h
|
|
+++ b/absl/flags/declare.h
|
|
@@ -59,10 +59,15 @@ ABSL_NAMESPACE_END
|
|
|
|
// Internal implementation of ABSL_DECLARE_FLAG to allow macro expansion of its
|
|
// arguments. Clients must use ABSL_DECLARE_FLAG instead.
|
|
+#if defined(_MSC_VER)
|
|
+#define ABSL_DECLARE_FLAG_INTERNAL(type, name) \
|
|
+ extern absl::Flag<type> FLAGS_##name
|
|
+#else
|
|
#define ABSL_DECLARE_FLAG_INTERNAL(type, name) \
|
|
extern absl::Flag<type> FLAGS_##name; \
|
|
namespace absl /* block flags in namespaces */ {} \
|
|
/* second redeclaration is to allow applying attributes */ \
|
|
extern absl::Flag<type> FLAGS_##name
|
|
+#endif // _MSC_VER
|
|
|
|
#endif // ABSL_FLAGS_DECLARE_H_
|
|
diff --git a/absl/log/CMakeLists.txt b/absl/log/CMakeLists.txt
|
|
index eb19bec..13b2d24 100644
|
|
--- a/absl/log/CMakeLists.txt
|
|
+++ b/absl/log/CMakeLists.txt
|
|
@@ -47,6 +47,7 @@ absl_cc_library(
|
|
absl::base
|
|
absl::config
|
|
absl::core_headers
|
|
+ absl::has_ostream_operator
|
|
absl::leak_check
|
|
absl::log_internal_nullguard
|
|
absl::log_internal_nullstream
|
|
diff --git a/absl/log/check_test_impl.inc b/absl/log/check_test_impl.inc
|
|
index 5a7caf4..7bcedd4 100644
|
|
--- a/absl/log/check_test_impl.inc
|
|
+++ b/absl/log/check_test_impl.inc
|
|
@@ -13,6 +13,8 @@
|
|
// See the License for the specific language governing permissions and
|
|
// limitations under the License.
|
|
|
|
+// SKIP_ABSL_INLINE_NAMESPACE_CHECK
|
|
+
|
|
#ifndef ABSL_LOG_CHECK_TEST_IMPL_H_
|
|
#define ABSL_LOG_CHECK_TEST_IMPL_H_
|
|
|
|
@@ -241,6 +243,18 @@ TEST(CHECKTest, TestBinaryChecksWithPrimitives) {
|
|
ABSL_TEST_CHECK_LT(1, 2);
|
|
}
|
|
|
|
+TEST(CHECKTest, TestBinaryChecksWithStringComparison) {
|
|
+ const std::string a = "a";
|
|
+ ABSL_TEST_CHECK_EQ(a, "a");
|
|
+ ABSL_TEST_CHECK_NE(a, "b");
|
|
+ ABSL_TEST_CHECK_GE(a, a);
|
|
+ ABSL_TEST_CHECK_GE("b", a);
|
|
+ ABSL_TEST_CHECK_LE(a, "a");
|
|
+ ABSL_TEST_CHECK_LE(a, "b");
|
|
+ ABSL_TEST_CHECK_GT("b", a);
|
|
+ ABSL_TEST_CHECK_LT(a, "b");
|
|
+}
|
|
+
|
|
// For testing using CHECK*() on anonymous enums.
|
|
enum { CASE_A, CASE_B };
|
|
|
|
diff --git a/absl/log/internal/BUILD.bazel b/absl/log/internal/BUILD.bazel
|
|
index 1ba9d76..005861f 100644
|
|
--- a/absl/log/internal/BUILD.bazel
|
|
+++ b/absl/log/internal/BUILD.bazel
|
|
@@ -82,6 +82,7 @@ cc_library(
|
|
"//absl/base:nullability",
|
|
"//absl/debugging:leak_check",
|
|
"//absl/strings",
|
|
+ "//absl/strings:has_ostream_operator",
|
|
],
|
|
)
|
|
|
|
diff --git a/absl/log/internal/check_op.h b/absl/log/internal/check_op.h
|
|
index 4554475..c607864 100644
|
|
--- a/absl/log/internal/check_op.h
|
|
+++ b/absl/log/internal/check_op.h
|
|
@@ -40,6 +40,7 @@
|
|
#include "absl/log/internal/nullstream.h"
|
|
#include "absl/log/internal/strip.h"
|
|
#include "absl/strings/has_absl_stringify.h"
|
|
+#include "absl/strings/has_ostream_operator.h"
|
|
#include "absl/strings/string_view.h"
|
|
|
|
// `ABSL_LOG_INTERNAL_STRIP_STRING_LITERAL` wraps string literals that
|
|
@@ -357,21 +358,12 @@ std::enable_if_t<HasAbslStringify<T>::value,
|
|
StringifyToStreamWrapper<T>>
|
|
Detect(...); // Ellipsis has lowest preference when int passed.
|
|
|
|
-// is_streamable is true for types that have an output stream operator<<.
|
|
-template <class T, class = void>
|
|
-struct is_streamable : std::false_type {};
|
|
-
|
|
-template <class T>
|
|
-struct is_streamable<T, std::void_t<decltype(std::declval<std::ostream&>()
|
|
- << std::declval<T>())>>
|
|
- : std::true_type {};
|
|
-
|
|
// This overload triggers when T is neither possible to print nor an enum.
|
|
template <typename T>
|
|
std::enable_if_t<std::negation_v<std::disjunction<
|
|
std::is_convertible<T, int>, std::is_enum<T>,
|
|
std::is_pointer<T>, std::is_same<T, std::nullptr_t>,
|
|
- is_streamable<T>, HasAbslStringify<T>>>,
|
|
+ HasOstreamOperator<T>, HasAbslStringify<T>>>,
|
|
UnprintableWrapper>
|
|
Detect(...);
|
|
|
|
@@ -382,9 +374,10 @@ Detect(...);
|
|
// one backed by another integer is converted to (u)int64_t.
|
|
template <typename T>
|
|
std::enable_if_t<
|
|
- std::conjunction_v<
|
|
- std::is_enum<T>, std::negation<std::is_convertible<T, int>>,
|
|
- std::negation<is_streamable<T>>, std::negation<HasAbslStringify<T>>>,
|
|
+ std::conjunction_v<std::is_enum<T>,
|
|
+ std::negation<std::is_convertible<T, int>>,
|
|
+ std::negation<HasOstreamOperator<T>>,
|
|
+ std::negation<HasAbslStringify<T>>>,
|
|
std::conditional_t<
|
|
std::is_same_v<std::underlying_type_t<T>, bool> ||
|
|
std::is_same_v<std::underlying_type_t<T>, char> ||
|