From 4f5fd7a5da8bb8168815d31e9e0e2d0599f5b8ca Mon Sep 17 00:00:00 2001 From: Paul Wankadia Date: Fri, 17 May 2024 19:12:40 +0000 Subject: [PATCH] Switch to Abseil logging. Fixes #494. Change-Id: Ie8bd23d44a6f2609b72f115c3b2344a2a91637be Reviewed-on: https://code-review.googlesource.com/c/re2/+/63091 Reviewed-by: Alex Chernyakhovsky Reviewed-by: Paul Wankadia --- BUILD.bazel | 32 +++++++- CMakeLists.txt | 2 + Makefile | 3 +- re2/bitmap256.cc | 3 +- re2/bitmap256.h | 3 +- re2/bitstate.cc | 3 +- re2/compile.cc | 3 +- re2/dfa.cc | 3 +- re2/filtered_re2.cc | 3 +- re2/mimics_pcre.cc | 3 +- re2/nfa.cc | 3 +- re2/onepass.cc | 3 +- re2/parse.cc | 3 +- re2/prefilter.cc | 3 +- re2/prefilter.h | 3 +- re2/prefilter_tree.cc | 3 +- re2/prefilter_tree.h | 3 +- re2/prog.cc | 3 +- re2/prog.h | 3 +- re2/re2.cc | 3 +- re2/regexp.cc | 3 +- re2/regexp.h | 3 +- re2/set.cc | 3 +- re2/simplify.cc | 3 +- re2/testing/backtrack.cc | 3 +- re2/testing/compile_test.cc | 3 +- re2/testing/dfa_test.cc | 3 +- re2/testing/dump.cc | 3 +- re2/testing/exhaustive_tester.cc | 3 +- re2/testing/filtered_re2_test.cc | 3 +- re2/testing/mimics_pcre_test.cc | 3 +- re2/testing/null_walker.cc | 3 +- re2/testing/parse_test.cc | 3 +- re2/testing/possible_match_test.cc | 3 +- re2/testing/re2_arg_test.cc | 3 +- re2/testing/re2_test.cc | 3 +- re2/testing/regexp_benchmark.cc | 3 +- re2/testing/regexp_generator.cc | 3 +- re2/testing/regexp_test.cc | 3 +- re2/testing/required_prefix_test.cc | 3 +- re2/testing/set_test.cc | 3 +- re2/testing/simplify_test.cc | 3 +- re2/testing/string_generator.cc | 3 +- re2/testing/tester.cc | 3 +- re2/tostring.cc | 3 +- re2/walker-inl.h | 3 +- util/logging.h | 109 ---------------------------- util/pcre.cc | 3 +- 48 files changed, 122 insertions(+), 156 deletions(-) delete mode 100644 util/logging.h diff --git a/BUILD.bazel b/BUILD.bazel index a1664761f..dcb096953 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -42,7 +42,6 @@ cc_library( "re2/unicode_groups.cc", "re2/unicode_groups.h", "re2/walker-inl.h", - "util/logging.h", "util/rune.cc", "util/strutil.cc", "util/strutil.h", @@ -84,6 +83,8 @@ cc_library( "@abseil-cpp//absl/container:flat_hash_map", "@abseil-cpp//absl/container:flat_hash_set", "@abseil-cpp//absl/container:inlined_vector", + "@abseil-cpp//absl/log", + "@abseil-cpp//absl/log:check", "@abseil-cpp//absl/strings", "@abseil-cpp//absl/strings:str_format", "@abseil-cpp//absl/synchronization", @@ -125,7 +126,6 @@ cc_library( "re2/unicode_casefold.h", "re2/unicode_groups.h", "re2/walker-inl.h", - "util/logging.h", "util/strutil.h", "util/utf.h", ], @@ -135,6 +135,8 @@ cc_library( "@abseil-cpp//absl/base", "@abseil-cpp//absl/base:core_headers", "@abseil-cpp//absl/flags:flag", + "@abseil-cpp//absl/log", + "@abseil-cpp//absl/log:check", "@abseil-cpp//absl/strings", "@abseil-cpp//absl/strings:str_format", "@googletest//:gtest", @@ -161,6 +163,8 @@ cc_test( deps = [ ":testing", "@abseil-cpp//absl/base:core_headers", + "@abseil-cpp//absl/log", + "@abseil-cpp//absl/log:check", "@googletest//:gtest", "@googletest//:gtest_main", ], @@ -174,6 +178,8 @@ cc_test( ":re2", ":testing", "@abseil-cpp//absl/base:core_headers", + "@abseil-cpp//absl/log", + "@abseil-cpp//absl/log:check", "@googletest//:gtest", "@googletest//:gtest_main", ], @@ -186,6 +192,8 @@ cc_test( deps = [ ":testing", "@abseil-cpp//absl/base:core_headers", + "@abseil-cpp//absl/log", + "@abseil-cpp//absl/log:check", "@googletest//:gtest", "@googletest//:gtest_main", ], @@ -198,6 +206,8 @@ cc_test( deps = [ ":testing", "@abseil-cpp//absl/base:core_headers", + "@abseil-cpp//absl/log", + "@abseil-cpp//absl/log:check", "@googletest//:gtest", "@googletest//:gtest_main", ], @@ -211,6 +221,8 @@ cc_test( ":re2", ":testing", "@abseil-cpp//absl/base:core_headers", + "@abseil-cpp//absl/log", + "@abseil-cpp//absl/log:check", "@abseil-cpp//absl/strings", "@googletest//:gtest", "@googletest//:gtest_main", @@ -225,6 +237,8 @@ cc_test( ":re2", ":testing", "@abseil-cpp//absl/base:core_headers", + "@abseil-cpp//absl/log", + "@abseil-cpp//absl/log:check", "@googletest//:gtest", "@googletest//:gtest_main", ], @@ -238,6 +252,8 @@ cc_test( ":re2", ":testing", "@abseil-cpp//absl/base:core_headers", + "@abseil-cpp//absl/log", + "@abseil-cpp//absl/log:check", "@abseil-cpp//absl/strings:str_format", "@googletest//:gtest", "@googletest//:gtest_main", @@ -250,6 +266,8 @@ cc_test( srcs = ["re2/testing/regexp_test.cc"], deps = [ ":testing", + "@abseil-cpp//absl/log", + "@abseil-cpp//absl/log:check", "@googletest//:gtest", "@googletest//:gtest_main", ], @@ -262,6 +280,8 @@ cc_test( deps = [ ":testing", "@abseil-cpp//absl/base:core_headers", + "@abseil-cpp//absl/log", + "@abseil-cpp//absl/log:check", "@googletest//:gtest", "@googletest//:gtest_main", ], @@ -286,6 +306,8 @@ cc_test( deps = [ ":re2", ":testing", + "@abseil-cpp//absl/log", + "@abseil-cpp//absl/log:check", "@googletest//:gtest", "@googletest//:gtest_main", ], @@ -298,6 +320,8 @@ cc_test( deps = [ ":testing", "@abseil-cpp//absl/base:core_headers", + "@abseil-cpp//absl/log", + "@abseil-cpp//absl/log:check", "@googletest//:gtest", "@googletest//:gtest_main", ], @@ -323,6 +347,8 @@ cc_test( ":testing", "@abseil-cpp//absl/base:core_headers", "@abseil-cpp//absl/flags:flag", + "@abseil-cpp//absl/log", + "@abseil-cpp//absl/log:check", "@abseil-cpp//absl/strings:str_format", "@googletest//:gtest", "@googletest//:gtest_main", @@ -395,6 +421,8 @@ cc_binary( ":testing", "@abseil-cpp//absl/container:flat_hash_map", "@abseil-cpp//absl/flags:flag", + "@abseil-cpp//absl/log", + "@abseil-cpp//absl/log:check", "@abseil-cpp//absl/strings:str_format", "@abseil-cpp//absl/synchronization", "@google_benchmark//:benchmark_main", diff --git a/CMakeLists.txt b/CMakeLists.txt index bdac5afd6..36e7e7156 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -61,12 +61,14 @@ endif() set(ABSL_DEPS absl_base + absl_check absl_core_headers absl_fixed_array absl_flags absl_flat_hash_map absl_flat_hash_set absl_inlined_vector + absl_log absl_optional absl_span absl_str_format diff --git a/Makefile b/Makefile index 5d6d6c072..51a1034d0 100644 --- a/Makefile +++ b/Makefile @@ -5,12 +5,14 @@ # Build against Abseil. ABSL_DEPS=\ absl_base\ + absl_check\ absl_core_headers\ absl_fixed_array\ absl_flags\ absl_flat_hash_map\ absl_flat_hash_set\ absl_inlined_vector\ + absl_log\ absl_optional\ absl_span\ absl_str_format\ @@ -113,7 +115,6 @@ INSTALL_HFILES=\ re2/stringpiece.h\ HFILES=\ - util/logging.h\ util/malloc_counter.h\ util/pcre.h\ util/strutil.h\ diff --git a/re2/bitmap256.cc b/re2/bitmap256.cc index f6fbca304..e455fde76 100644 --- a/re2/bitmap256.cc +++ b/re2/bitmap256.cc @@ -7,7 +7,8 @@ #include #include "absl/base/macros.h" -#include "util/logging.h" +#include "absl/log/check.h" +#include "absl/log/log.h" namespace re2 { diff --git a/re2/bitmap256.h b/re2/bitmap256.h index 293b31d85..29e2984a0 100644 --- a/re2/bitmap256.h +++ b/re2/bitmap256.h @@ -11,7 +11,8 @@ #include #include -#include "util/logging.h" +#include "absl/log/check.h" +#include "absl/log/log.h" namespace re2 { diff --git a/re2/bitstate.cc b/re2/bitstate.cc index 38a0b87cc..cac8aa0af 100644 --- a/re2/bitstate.cc +++ b/re2/bitstate.cc @@ -23,7 +23,8 @@ #include #include -#include "util/logging.h" +#include "absl/log/check.h" +#include "absl/log/log.h" #include "re2/pod_array.h" #include "re2/prog.h" #include "re2/regexp.h" diff --git a/re2/compile.cc b/re2/compile.cc index aa798872e..17e31481b 100644 --- a/re2/compile.cc +++ b/re2/compile.cc @@ -14,7 +14,8 @@ #include "absl/base/macros.h" #include "absl/container/flat_hash_map.h" -#include "util/logging.h" +#include "absl/log/check.h" +#include "absl/log/log.h" #include "util/utf.h" #include "re2/pod_array.h" #include "re2/prog.h" diff --git a/re2/dfa.cc b/re2/dfa.cc index e35fcb281..9b8a43758 100644 --- a/re2/dfa.cc +++ b/re2/dfa.cc @@ -38,10 +38,11 @@ #include "absl/base/thread_annotations.h" #include "absl/container/flat_hash_map.h" #include "absl/container/flat_hash_set.h" +#include "absl/log/check.h" +#include "absl/log/log.h" #include "absl/strings/str_format.h" #include "absl/synchronization/mutex.h" #include "absl/types/span.h" -#include "util/logging.h" #include "util/strutil.h" #include "re2/pod_array.h" #include "re2/prog.h" diff --git a/re2/filtered_re2.cc b/re2/filtered_re2.cc index 1ce26a38e..1ef675856 100644 --- a/re2/filtered_re2.cc +++ b/re2/filtered_re2.cc @@ -8,7 +8,8 @@ #include #include -#include "util/logging.h" +#include "absl/log/check.h" +#include "absl/log/log.h" #include "re2/prefilter.h" #include "re2/prefilter_tree.h" diff --git a/re2/mimics_pcre.cc b/re2/mimics_pcre.cc index ac0c69d7e..1e4d0d751 100644 --- a/re2/mimics_pcre.cc +++ b/re2/mimics_pcre.cc @@ -22,7 +22,8 @@ // // Regexp::MimicsPCRE checks for any of these conditions. -#include "util/logging.h" +#include "absl/log/check.h" +#include "absl/log/log.h" #include "re2/regexp.h" #include "re2/walker-inl.h" diff --git a/re2/nfa.cc b/re2/nfa.cc index a655884d7..3ef8287c6 100644 --- a/re2/nfa.cc +++ b/re2/nfa.cc @@ -32,8 +32,9 @@ #include #include +#include "absl/log/check.h" +#include "absl/log/log.h" #include "absl/strings/str_format.h" -#include "util/logging.h" #include "re2/pod_array.h" #include "re2/prog.h" #include "re2/regexp.h" diff --git a/re2/onepass.cc b/re2/onepass.cc index 7931cf911..9831cc828 100644 --- a/re2/onepass.cc +++ b/re2/onepass.cc @@ -59,8 +59,9 @@ #include "absl/container/fixed_array.h" #include "absl/container/inlined_vector.h" +#include "absl/log/check.h" +#include "absl/log/log.h" #include "absl/strings/str_format.h" -#include "util/logging.h" #include "util/utf.h" #include "re2/pod_array.h" #include "re2/prog.h" diff --git a/re2/parse.cc b/re2/parse.cc index 2558b2a2e..003b14c86 100644 --- a/re2/parse.cc +++ b/re2/parse.cc @@ -26,8 +26,9 @@ #include #include "absl/base/macros.h" +#include "absl/log/check.h" +#include "absl/log/log.h" #include "absl/strings/ascii.h" -#include "util/logging.h" #include "util/utf.h" #include "re2/pod_array.h" #include "re2/regexp.h" diff --git a/re2/prefilter.cc b/re2/prefilter.cc index 3c7886f83..53290b02f 100644 --- a/re2/prefilter.cc +++ b/re2/prefilter.cc @@ -10,8 +10,9 @@ #include #include +#include "absl/log/check.h" +#include "absl/log/log.h" #include "absl/strings/str_format.h" -#include "util/logging.h" #include "util/utf.h" #include "re2/re2.h" #include "re2/unicode_casefold.h" diff --git a/re2/prefilter.h b/re2/prefilter.h index 018691dcd..cf32bd674 100644 --- a/re2/prefilter.h +++ b/re2/prefilter.h @@ -13,7 +13,8 @@ #include #include -#include "util/logging.h" +#include "absl/log/check.h" +#include "absl/log/log.h" namespace re2 { diff --git a/re2/prefilter_tree.cc b/re2/prefilter_tree.cc index 299a680fb..b7a7408f4 100644 --- a/re2/prefilter_tree.cc +++ b/re2/prefilter_tree.cc @@ -12,8 +12,9 @@ #include #include +#include "absl/log/check.h" +#include "absl/log/log.h" #include "absl/strings/str_format.h" -#include "util/logging.h" #include "re2/prefilter.h" #include "re2/re2.h" diff --git a/re2/prefilter_tree.h b/re2/prefilter_tree.h index 71e7a294f..ba23282d4 100644 --- a/re2/prefilter_tree.h +++ b/re2/prefilter_tree.h @@ -20,9 +20,10 @@ #include #include "absl/container/flat_hash_set.h" +#include "absl/log/check.h" +#include "absl/log/log.h" #include "re2/prefilter.h" #include "re2/sparse_array.h" -#include "util/logging.h" namespace re2 { diff --git a/re2/prog.cc b/re2/prog.cc index 6cadcfa83..423e1769e 100644 --- a/re2/prog.cc +++ b/re2/prog.cc @@ -20,8 +20,9 @@ #include #include "absl/base/macros.h" +#include "absl/log/check.h" +#include "absl/log/log.h" #include "absl/strings/str_format.h" -#include "util/logging.h" #include "re2/bitmap256.h" namespace re2 { diff --git a/re2/prog.h b/re2/prog.h index 41923f314..5db21c45f 100644 --- a/re2/prog.h +++ b/re2/prog.h @@ -16,8 +16,9 @@ #include #include "absl/base/call_once.h" +#include "absl/log/check.h" +#include "absl/log/log.h" #include "absl/strings/string_view.h" -#include "util/logging.h" #include "re2/pod_array.h" #include "re2/re2.h" #include "re2/sparse_array.h" diff --git a/re2/re2.cc b/re2/re2.cc index 61d9d1f0c..332157ebc 100644 --- a/re2/re2.cc +++ b/re2/re2.cc @@ -26,9 +26,10 @@ #include "absl/base/macros.h" #include "absl/container/fixed_array.h" +#include "absl/log/check.h" +#include "absl/log/log.h" #include "absl/strings/ascii.h" #include "absl/strings/str_format.h" -#include "util/logging.h" #include "util/strutil.h" #include "util/utf.h" #include "re2/prog.h" diff --git a/re2/regexp.cc b/re2/regexp.cc index 4ea81cfcd..f374c1546 100644 --- a/re2/regexp.cc +++ b/re2/regexp.cc @@ -18,8 +18,9 @@ #include "absl/base/call_once.h" #include "absl/base/macros.h" #include "absl/container/flat_hash_map.h" +#include "absl/log/check.h" +#include "absl/log/log.h" #include "absl/synchronization/mutex.h" -#include "util/logging.h" #include "util/utf.h" #include "re2/pod_array.h" #include "re2/walker-inl.h" diff --git a/re2/regexp.h b/re2/regexp.h index df4989479..9c05cc855 100644 --- a/re2/regexp.h +++ b/re2/regexp.h @@ -92,8 +92,9 @@ #include #include +#include "absl/log/check.h" +#include "absl/log/log.h" #include "absl/strings/string_view.h" -#include "util/logging.h" #include "util/utf.h" namespace re2 { diff --git a/re2/set.cc b/re2/set.cc index b9c918e07..4f269075e 100644 --- a/re2/set.cc +++ b/re2/set.cc @@ -9,7 +9,8 @@ #include #include -#include "util/logging.h" +#include "absl/log/check.h" +#include "absl/log/log.h" #include "re2/pod_array.h" #include "re2/prog.h" #include "re2/re2.h" diff --git a/re2/simplify.cc b/re2/simplify.cc index cea100b08..06966128d 100644 --- a/re2/simplify.cc +++ b/re2/simplify.cc @@ -9,7 +9,8 @@ #include #include -#include "util/logging.h" +#include "absl/log/check.h" +#include "absl/log/log.h" #include "util/utf.h" #include "re2/pod_array.h" #include "re2/regexp.h" diff --git a/re2/testing/backtrack.cc b/re2/testing/backtrack.cc index 90071bb0f..2ea98e8e6 100644 --- a/re2/testing/backtrack.cc +++ b/re2/testing/backtrack.cc @@ -28,7 +28,8 @@ #include #include "absl/base/macros.h" -#include "util/logging.h" +#include "absl/log/check.h" +#include "absl/log/log.h" #include "re2/pod_array.h" #include "re2/prog.h" #include "re2/regexp.h" diff --git a/re2/testing/compile_test.cc b/re2/testing/compile_test.cc index f6899d3d2..532f8965b 100644 --- a/re2/testing/compile_test.cc +++ b/re2/testing/compile_test.cc @@ -7,8 +7,9 @@ #include #include "absl/base/macros.h" +#include "absl/log/check.h" +#include "absl/log/log.h" #include "gtest/gtest.h" -#include "util/logging.h" #include "re2/regexp.h" #include "re2/prog.h" diff --git a/re2/testing/dfa_test.cc b/re2/testing/dfa_test.cc index b0759f7c7..aa9546569 100644 --- a/re2/testing/dfa_test.cc +++ b/re2/testing/dfa_test.cc @@ -9,9 +9,10 @@ #include "absl/base/macros.h" #include "absl/flags/flag.h" +#include "absl/log/check.h" +#include "absl/log/log.h" #include "absl/strings/str_format.h" #include "gtest/gtest.h" -#include "util/logging.h" #include "util/malloc_counter.h" #include "re2/prog.h" #include "re2/re2.h" diff --git a/re2/testing/dump.cc b/re2/testing/dump.cc index 9e3c94a69..074c6a20a 100644 --- a/re2/testing/dump.cc +++ b/re2/testing/dump.cc @@ -19,9 +19,10 @@ #include #include "absl/base/macros.h" +#include "absl/log/check.h" +#include "absl/log/log.h" #include "absl/strings/str_format.h" #include "gtest/gtest.h" -#include "util/logging.h" #include "util/utf.h" #include "re2/regexp.h" diff --git a/re2/testing/exhaustive_tester.cc b/re2/testing/exhaustive_tester.cc index a57f700bc..4d1ff0f02 100644 --- a/re2/testing/exhaustive_tester.cc +++ b/re2/testing/exhaustive_tester.cc @@ -15,9 +15,10 @@ #include "absl/base/macros.h" #include "absl/flags/flag.h" +#include "absl/log/check.h" +#include "absl/log/log.h" #include "absl/strings/str_format.h" #include "gtest/gtest.h" -#include "util/logging.h" #include "re2/testing/exhaustive_tester.h" #include "re2/testing/tester.h" diff --git a/re2/testing/filtered_re2_test.cc b/re2/testing/filtered_re2_test.cc index a8d2dfc72..aea311b58 100644 --- a/re2/testing/filtered_re2_test.cc +++ b/re2/testing/filtered_re2_test.cc @@ -10,8 +10,9 @@ #include #include "absl/base/macros.h" +#include "absl/log/check.h" +#include "absl/log/log.h" #include "gtest/gtest.h" -#include "util/logging.h" #include "re2/filtered_re2.h" #include "re2/re2.h" diff --git a/re2/testing/mimics_pcre_test.cc b/re2/testing/mimics_pcre_test.cc index 829659d67..d12e511c7 100644 --- a/re2/testing/mimics_pcre_test.cc +++ b/re2/testing/mimics_pcre_test.cc @@ -3,8 +3,9 @@ // license that can be found in the LICENSE file. #include "absl/base/macros.h" +#include "absl/log/check.h" +#include "absl/log/log.h" #include "gtest/gtest.h" -#include "util/logging.h" #include "re2/prog.h" #include "re2/regexp.h" diff --git a/re2/testing/null_walker.cc b/re2/testing/null_walker.cc index 745364b3c..4e64f823c 100644 --- a/re2/testing/null_walker.cc +++ b/re2/testing/null_walker.cc @@ -2,8 +2,9 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +#include "absl/log/check.h" +#include "absl/log/log.h" #include "gtest/gtest.h" -#include "util/logging.h" #include "re2/regexp.h" #include "re2/walker-inl.h" diff --git a/re2/testing/parse_test.cc b/re2/testing/parse_test.cc index 95294d5ff..350720081 100644 --- a/re2/testing/parse_test.cc +++ b/re2/testing/parse_test.cc @@ -7,8 +7,9 @@ #include #include "absl/base/macros.h" +#include "absl/log/check.h" +#include "absl/log/log.h" #include "gtest/gtest.h" -#include "util/logging.h" #include "re2/regexp.h" namespace re2 { diff --git a/re2/testing/possible_match_test.cc b/re2/testing/possible_match_test.cc index fe199c662..16e169d04 100644 --- a/re2/testing/possible_match_test.cc +++ b/re2/testing/possible_match_test.cc @@ -7,9 +7,10 @@ #include #include "absl/base/macros.h" +#include "absl/log/check.h" +#include "absl/log/log.h" #include "absl/strings/escaping.h" #include "gtest/gtest.h" -#include "util/logging.h" #include "re2/prog.h" #include "re2/re2.h" #include "re2/regexp.h" diff --git a/re2/testing/re2_arg_test.cc b/re2/testing/re2_arg_test.cc index 78d4aee43..a9b044d73 100644 --- a/re2/testing/re2_arg_test.cc +++ b/re2/testing/re2_arg_test.cc @@ -11,8 +11,9 @@ #include #include "absl/base/macros.h" +#include "absl/log/check.h" +#include "absl/log/log.h" #include "gtest/gtest.h" -#include "util/logging.h" #include "re2/re2.h" namespace re2 { diff --git a/re2/testing/re2_test.cc b/re2/testing/re2_test.cc index ddf8dbf8f..95bf461fb 100644 --- a/re2/testing/re2_test.cc +++ b/re2/testing/re2_test.cc @@ -19,9 +19,10 @@ #endif #include "absl/base/macros.h" +#include "absl/log/check.h" +#include "absl/log/log.h" #include "absl/strings/str_format.h" #include "gtest/gtest.h" -#include "util/logging.h" #include "re2/re2.h" #include "re2/regexp.h" diff --git a/re2/testing/regexp_benchmark.cc b/re2/testing/regexp_benchmark.cc index 5352b3101..319289558 100644 --- a/re2/testing/regexp_benchmark.cc +++ b/re2/testing/regexp_benchmark.cc @@ -13,10 +13,11 @@ #include "absl/container/flat_hash_map.h" #include "absl/flags/flag.h" +#include "absl/log/check.h" +#include "absl/log/log.h" #include "absl/strings/str_format.h" #include "absl/synchronization/mutex.h" #include "benchmark/benchmark.h" -#include "util/logging.h" #include "util/malloc_counter.h" #include "re2/prog.h" #include "re2/re2.h" diff --git a/re2/testing/regexp_generator.cc b/re2/testing/regexp_generator.cc index b1761ed93..4d9346fb6 100644 --- a/re2/testing/regexp_generator.cc +++ b/re2/testing/regexp_generator.cc @@ -30,10 +30,11 @@ #include #include "absl/base/macros.h" +#include "absl/log/check.h" +#include "absl/log/log.h" #include "absl/strings/escaping.h" #include "absl/strings/str_format.h" #include "gtest/gtest.h" -#include "util/logging.h" #include "util/utf.h" #include "re2/testing/regexp_generator.h" diff --git a/re2/testing/regexp_test.cc b/re2/testing/regexp_test.cc index ef8f59d36..54aa8ada9 100644 --- a/re2/testing/regexp_test.cc +++ b/re2/testing/regexp_test.cc @@ -9,8 +9,9 @@ #include #include +#include "absl/log/check.h" +#include "absl/log/log.h" #include "gtest/gtest.h" -#include "util/logging.h" #include "re2/regexp.h" namespace re2 { diff --git a/re2/testing/required_prefix_test.cc b/re2/testing/required_prefix_test.cc index 231fd3485..83e2c3e8e 100644 --- a/re2/testing/required_prefix_test.cc +++ b/re2/testing/required_prefix_test.cc @@ -5,8 +5,9 @@ #include #include "absl/base/macros.h" +#include "absl/log/check.h" +#include "absl/log/log.h" #include "gtest/gtest.h" -#include "util/logging.h" #include "re2/prog.h" #include "re2/regexp.h" diff --git a/re2/testing/set_test.cc b/re2/testing/set_test.cc index fdbc0b2c7..abd0fa48b 100644 --- a/re2/testing/set_test.cc +++ b/re2/testing/set_test.cc @@ -7,8 +7,9 @@ #include #include +#include "absl/log/check.h" +#include "absl/log/log.h" #include "gtest/gtest.h" -#include "util/logging.h" #include "re2/re2.h" #include "re2/set.h" diff --git a/re2/testing/simplify_test.cc b/re2/testing/simplify_test.cc index 5b683f580..4a182d1a0 100644 --- a/re2/testing/simplify_test.cc +++ b/re2/testing/simplify_test.cc @@ -8,8 +8,9 @@ #include #include "absl/base/macros.h" +#include "absl/log/check.h" +#include "absl/log/log.h" #include "gtest/gtest.h" -#include "util/logging.h" #include "re2/regexp.h" namespace re2 { diff --git a/re2/testing/string_generator.cc b/re2/testing/string_generator.cc index 1891b14a7..90ec46f1d 100644 --- a/re2/testing/string_generator.cc +++ b/re2/testing/string_generator.cc @@ -11,8 +11,9 @@ #include #include +#include "absl/log/check.h" +#include "absl/log/log.h" #include "gtest/gtest.h" -#include "util/logging.h" #include "re2/testing/string_generator.h" namespace re2 { diff --git a/re2/testing/tester.cc b/re2/testing/tester.cc index a094cb4ff..e0161be09 100644 --- a/re2/testing/tester.cc +++ b/re2/testing/tester.cc @@ -11,9 +11,10 @@ #include "absl/base/macros.h" #include "absl/flags/flag.h" +#include "absl/log/check.h" +#include "absl/log/log.h" #include "absl/strings/escaping.h" #include "absl/strings/str_format.h" -#include "util/logging.h" #include "re2/testing/tester.h" #include "re2/prog.h" #include "re2/re2.h" diff --git a/re2/tostring.cc b/re2/tostring.cc index 33179fdeb..e1e870ba7 100644 --- a/re2/tostring.cc +++ b/re2/tostring.cc @@ -8,8 +8,9 @@ #include #include +#include "absl/log/check.h" +#include "absl/log/log.h" #include "absl/strings/str_format.h" -#include "util/logging.h" #include "util/utf.h" #include "re2/regexp.h" #include "re2/walker-inl.h" diff --git a/re2/walker-inl.h b/re2/walker-inl.h index 45763a7b2..fe0dc8c7b 100644 --- a/re2/walker-inl.h +++ b/re2/walker-inl.h @@ -16,7 +16,8 @@ #include #include "absl/base/macros.h" -#include "util/logging.h" +#include "absl/log/check.h" +#include "absl/log/log.h" #include "re2/regexp.h" namespace re2 { diff --git a/util/logging.h b/util/logging.h deleted file mode 100644 index 946962b39..000000000 --- a/util/logging.h +++ /dev/null @@ -1,109 +0,0 @@ -// Copyright 2009 The RE2 Authors. All Rights Reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -#ifndef UTIL_LOGGING_H_ -#define UTIL_LOGGING_H_ - -// Simplified version of Google's logging. - -#include -#include -#include -#include -#include - -#include "absl/base/attributes.h" - -// Debug-only checking. -#define DCHECK(condition) assert(condition) -#define DCHECK_EQ(val1, val2) assert((val1) == (val2)) -#define DCHECK_NE(val1, val2) assert((val1) != (val2)) -#define DCHECK_LE(val1, val2) assert((val1) <= (val2)) -#define DCHECK_LT(val1, val2) assert((val1) < (val2)) -#define DCHECK_GE(val1, val2) assert((val1) >= (val2)) -#define DCHECK_GT(val1, val2) assert((val1) > (val2)) - -// Always-on checking -#define CHECK(x) if(x){}else LogMessageFatal(__FILE__, __LINE__).stream() << "Check failed: " #x -#define CHECK_LT(x, y) CHECK((x) < (y)) -#define CHECK_GT(x, y) CHECK((x) > (y)) -#define CHECK_LE(x, y) CHECK((x) <= (y)) -#define CHECK_GE(x, y) CHECK((x) >= (y)) -#define CHECK_EQ(x, y) CHECK((x) == (y)) -#define CHECK_NE(x, y) CHECK((x) != (y)) - -#define LOG_INFO LogMessage(__FILE__, __LINE__) -#define LOG_WARNING LogMessage(__FILE__, __LINE__) -#define LOG_ERROR LogMessage(__FILE__, __LINE__) -#define LOG_FATAL LogMessageFatal(__FILE__, __LINE__) -#define LOG_QFATAL LOG_FATAL - -// It seems that one of the Windows header files defines ERROR as 0. -#ifdef _WIN32 -#define LOG_0 LOG_INFO -#endif - -#ifdef NDEBUG -#define LOG_DFATAL LOG_ERROR -#else -#define LOG_DFATAL LOG_FATAL -#endif - -#define LOG(severity) LOG_ ## severity.stream() - -#define VLOG(x) if((x)>0){}else LOG_INFO.stream() - -class LogMessage { - public: - LogMessage(const char* file, int line) - : flushed_(false) { - stream() << file << ":" << line << ": "; - } - void Flush() { - stream() << "\n"; - std::string s = str_.str(); - size_t n = s.size(); - if (fwrite(s.data(), 1, n, stderr) < n) {} // shut up gcc - flushed_ = true; - } - ~LogMessage() { - if (!flushed_) { - Flush(); - } - } - std::ostream& stream() { return str_; } - - private: - bool flushed_; - std::ostringstream str_; - - LogMessage(const LogMessage&) = delete; - LogMessage& operator=(const LogMessage&) = delete; -}; - -// Silence "destructor never returns" warning for ~LogMessageFatal(). -// Since this is a header file, push and then pop to limit the scope. -#ifdef _MSC_VER -#pragma warning(push) -#pragma warning(disable: 4722) -#endif - -class LogMessageFatal : public LogMessage { - public: - LogMessageFatal(const char* file, int line) - : LogMessage(file, line) {} - ABSL_ATTRIBUTE_NORETURN ~LogMessageFatal() { - Flush(); - abort(); - } - private: - LogMessageFatal(const LogMessageFatal&) = delete; - LogMessageFatal& operator=(const LogMessageFatal&) = delete; -}; - -#ifdef _MSC_VER -#pragma warning(pop) -#endif - -#endif // UTIL_LOGGING_H_ diff --git a/util/pcre.cc b/util/pcre.cc index 27aee3dc4..71e5329a4 100644 --- a/util/pcre.cc +++ b/util/pcre.cc @@ -16,8 +16,9 @@ #include #include "absl/flags/flag.h" +#include "absl/log/check.h" +#include "absl/log/log.h" #include "absl/strings/str_format.h" -#include "util/logging.h" #include "util/pcre.h" // Silence warnings about the wacky formatting in the operator() functions.