Skip to content

Commit 630d011

Browse files
committed
Use the ABSL_-prefixed Abseil logging macros.
This is done primarily for the sake of Chromium, which bans the unprefixed Abseil logging macros. I mostly baked the following slices of Perl pie: ``` 's,//absl/log:check",//absl/log:absl_check",' 's,//absl/log",//absl/log:absl_log",' 's,"absl/log/check.h","absl/log/absl_check.h",' 's,"absl/log/log.h","absl/log/absl_log.h",' 's,D?CHECK(_(EQ|NE|LE|LT|GE|GT))?\(,ABSL_$&,' 's,V?LOG\(,ABSL_$&,' ``` Change-Id: I65493aff42abab6865f8e2b5b769b6a651dbef3a Reviewed-on: https://code-review.googlesource.com/c/re2/+/63092 Reviewed-by: Paul Wankadia <[email protected]> Reviewed-by: Alex Chernyakhovsky <[email protected]>
1 parent 4f5fd7a commit 630d011

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+716
-624
lines changed

BUILD.bazel

+30-30
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,8 @@ cc_library(
8383
"@abseil-cpp//absl/container:flat_hash_map",
8484
"@abseil-cpp//absl/container:flat_hash_set",
8585
"@abseil-cpp//absl/container:inlined_vector",
86-
"@abseil-cpp//absl/log",
87-
"@abseil-cpp//absl/log:check",
86+
"@abseil-cpp//absl/log:absl_check",
87+
"@abseil-cpp//absl/log:absl_log",
8888
"@abseil-cpp//absl/strings",
8989
"@abseil-cpp//absl/strings:str_format",
9090
"@abseil-cpp//absl/synchronization",
@@ -135,8 +135,8 @@ cc_library(
135135
"@abseil-cpp//absl/base",
136136
"@abseil-cpp//absl/base:core_headers",
137137
"@abseil-cpp//absl/flags:flag",
138-
"@abseil-cpp//absl/log",
139-
"@abseil-cpp//absl/log:check",
138+
"@abseil-cpp//absl/log:absl_check",
139+
"@abseil-cpp//absl/log:absl_log",
140140
"@abseil-cpp//absl/strings",
141141
"@abseil-cpp//absl/strings:str_format",
142142
"@googletest//:gtest",
@@ -163,8 +163,8 @@ cc_test(
163163
deps = [
164164
":testing",
165165
"@abseil-cpp//absl/base:core_headers",
166-
"@abseil-cpp//absl/log",
167-
"@abseil-cpp//absl/log:check",
166+
"@abseil-cpp//absl/log:absl_check",
167+
"@abseil-cpp//absl/log:absl_log",
168168
"@googletest//:gtest",
169169
"@googletest//:gtest_main",
170170
],
@@ -178,8 +178,8 @@ cc_test(
178178
":re2",
179179
":testing",
180180
"@abseil-cpp//absl/base:core_headers",
181-
"@abseil-cpp//absl/log",
182-
"@abseil-cpp//absl/log:check",
181+
"@abseil-cpp//absl/log:absl_check",
182+
"@abseil-cpp//absl/log:absl_log",
183183
"@googletest//:gtest",
184184
"@googletest//:gtest_main",
185185
],
@@ -192,8 +192,8 @@ cc_test(
192192
deps = [
193193
":testing",
194194
"@abseil-cpp//absl/base:core_headers",
195-
"@abseil-cpp//absl/log",
196-
"@abseil-cpp//absl/log:check",
195+
"@abseil-cpp//absl/log:absl_check",
196+
"@abseil-cpp//absl/log:absl_log",
197197
"@googletest//:gtest",
198198
"@googletest//:gtest_main",
199199
],
@@ -206,8 +206,8 @@ cc_test(
206206
deps = [
207207
":testing",
208208
"@abseil-cpp//absl/base:core_headers",
209-
"@abseil-cpp//absl/log",
210-
"@abseil-cpp//absl/log:check",
209+
"@abseil-cpp//absl/log:absl_check",
210+
"@abseil-cpp//absl/log:absl_log",
211211
"@googletest//:gtest",
212212
"@googletest//:gtest_main",
213213
],
@@ -221,8 +221,8 @@ cc_test(
221221
":re2",
222222
":testing",
223223
"@abseil-cpp//absl/base:core_headers",
224-
"@abseil-cpp//absl/log",
225-
"@abseil-cpp//absl/log:check",
224+
"@abseil-cpp//absl/log:absl_check",
225+
"@abseil-cpp//absl/log:absl_log",
226226
"@abseil-cpp//absl/strings",
227227
"@googletest//:gtest",
228228
"@googletest//:gtest_main",
@@ -237,8 +237,8 @@ cc_test(
237237
":re2",
238238
":testing",
239239
"@abseil-cpp//absl/base:core_headers",
240-
"@abseil-cpp//absl/log",
241-
"@abseil-cpp//absl/log:check",
240+
"@abseil-cpp//absl/log:absl_check",
241+
"@abseil-cpp//absl/log:absl_log",
242242
"@googletest//:gtest",
243243
"@googletest//:gtest_main",
244244
],
@@ -252,8 +252,8 @@ cc_test(
252252
":re2",
253253
":testing",
254254
"@abseil-cpp//absl/base:core_headers",
255-
"@abseil-cpp//absl/log",
256-
"@abseil-cpp//absl/log:check",
255+
"@abseil-cpp//absl/log:absl_check",
256+
"@abseil-cpp//absl/log:absl_log",
257257
"@abseil-cpp//absl/strings:str_format",
258258
"@googletest//:gtest",
259259
"@googletest//:gtest_main",
@@ -266,8 +266,8 @@ cc_test(
266266
srcs = ["re2/testing/regexp_test.cc"],
267267
deps = [
268268
":testing",
269-
"@abseil-cpp//absl/log",
270-
"@abseil-cpp//absl/log:check",
269+
"@abseil-cpp//absl/log:absl_check",
270+
"@abseil-cpp//absl/log:absl_log",
271271
"@googletest//:gtest",
272272
"@googletest//:gtest_main",
273273
],
@@ -280,8 +280,8 @@ cc_test(
280280
deps = [
281281
":testing",
282282
"@abseil-cpp//absl/base:core_headers",
283-
"@abseil-cpp//absl/log",
284-
"@abseil-cpp//absl/log:check",
283+
"@abseil-cpp//absl/log:absl_check",
284+
"@abseil-cpp//absl/log:absl_log",
285285
"@googletest//:gtest",
286286
"@googletest//:gtest_main",
287287
],
@@ -306,8 +306,8 @@ cc_test(
306306
deps = [
307307
":re2",
308308
":testing",
309-
"@abseil-cpp//absl/log",
310-
"@abseil-cpp//absl/log:check",
309+
"@abseil-cpp//absl/log:absl_check",
310+
"@abseil-cpp//absl/log:absl_log",
311311
"@googletest//:gtest",
312312
"@googletest//:gtest_main",
313313
],
@@ -320,8 +320,8 @@ cc_test(
320320
deps = [
321321
":testing",
322322
"@abseil-cpp//absl/base:core_headers",
323-
"@abseil-cpp//absl/log",
324-
"@abseil-cpp//absl/log:check",
323+
"@abseil-cpp//absl/log:absl_check",
324+
"@abseil-cpp//absl/log:absl_log",
325325
"@googletest//:gtest",
326326
"@googletest//:gtest_main",
327327
],
@@ -347,8 +347,8 @@ cc_test(
347347
":testing",
348348
"@abseil-cpp//absl/base:core_headers",
349349
"@abseil-cpp//absl/flags:flag",
350-
"@abseil-cpp//absl/log",
351-
"@abseil-cpp//absl/log:check",
350+
"@abseil-cpp//absl/log:absl_check",
351+
"@abseil-cpp//absl/log:absl_log",
352352
"@abseil-cpp//absl/strings:str_format",
353353
"@googletest//:gtest",
354354
"@googletest//:gtest_main",
@@ -421,8 +421,8 @@ cc_binary(
421421
":testing",
422422
"@abseil-cpp//absl/container:flat_hash_map",
423423
"@abseil-cpp//absl/flags:flag",
424-
"@abseil-cpp//absl/log",
425-
"@abseil-cpp//absl/log:check",
424+
"@abseil-cpp//absl/log:absl_check",
425+
"@abseil-cpp//absl/log:absl_log",
426426
"@abseil-cpp//absl/strings:str_format",
427427
"@abseil-cpp//absl/synchronization",
428428
"@google_benchmark//:benchmark_main",

CMakeLists.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -60,15 +60,15 @@ if(UNIX)
6060
endif()
6161

6262
set(ABSL_DEPS
63+
absl_absl_check
64+
absl_absl_log
6365
absl_base
64-
absl_check
6566
absl_core_headers
6667
absl_fixed_array
6768
absl_flags
6869
absl_flat_hash_map
6970
absl_flat_hash_set
7071
absl_inlined_vector
71-
absl_log
7272
absl_optional
7373
absl_span
7474
absl_str_format

Makefile

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@
44

55
# Build against Abseil.
66
ABSL_DEPS=\
7+
absl_absl_check\
8+
absl_absl_log\
79
absl_base\
8-
absl_check\
910
absl_core_headers\
1011
absl_fixed_array\
1112
absl_flags\
1213
absl_flat_hash_map\
1314
absl_flat_hash_set\
1415
absl_inlined_vector\
15-
absl_log\
1616
absl_optional\
1717
absl_span\
1818
absl_str_format\

re2/bitmap256.cc

+4-4
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@
77
#include <stdint.h>
88

99
#include "absl/base/macros.h"
10-
#include "absl/log/check.h"
11-
#include "absl/log/log.h"
10+
#include "absl/log/absl_check.h"
11+
#include "absl/log/absl_log.h"
1212

1313
namespace re2 {
1414

1515
int Bitmap256::FindNextSetBit(int c) const {
16-
DCHECK_GE(c, 0);
17-
DCHECK_LE(c, 255);
16+
ABSL_DCHECK_GE(c, 0);
17+
ABSL_DCHECK_LE(c, 255);
1818

1919
// Check the word that contains the bit. Mask out any lower bits.
2020
int i = c / 64;

re2/bitmap256.h

+7-7
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
#include <stdint.h>
1212
#include <string.h>
1313

14-
#include "absl/log/check.h"
15-
#include "absl/log/log.h"
14+
#include "absl/log/absl_check.h"
15+
#include "absl/log/absl_log.h"
1616

1717
namespace re2 {
1818

@@ -29,16 +29,16 @@ class Bitmap256 {
2929

3030
// Tests the bit with index c.
3131
bool Test(int c) const {
32-
DCHECK_GE(c, 0);
33-
DCHECK_LE(c, 255);
32+
ABSL_DCHECK_GE(c, 0);
33+
ABSL_DCHECK_LE(c, 255);
3434

3535
return (words_[c / 64] & (uint64_t{1} << (c % 64))) != 0;
3636
}
3737

3838
// Sets the bit with index c.
3939
void Set(int c) {
40-
DCHECK_GE(c, 0);
41-
DCHECK_LE(c, 255);
40+
ABSL_DCHECK_GE(c, 0);
41+
ABSL_DCHECK_LE(c, 255);
4242

4343
words_[c / 64] |= (uint64_t{1} << (c % 64));
4444
}
@@ -50,7 +50,7 @@ class Bitmap256 {
5050
private:
5151
// Finds the least significant non-zero bit in n.
5252
static int FindLSBSet(uint64_t n) {
53-
DCHECK_NE(n, 0);
53+
ABSL_DCHECK_NE(n, 0);
5454
#if defined(__GNUC__)
5555
return __builtin_ctzll(n);
5656
#elif defined(_MSC_VER) && defined(_M_X64)

re2/bitstate.cc

+7-7
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323
#include <limits>
2424
#include <utility>
2525

26-
#include "absl/log/check.h"
27-
#include "absl/log/log.h"
26+
#include "absl/log/absl_check.h"
27+
#include "absl/log/absl_log.h"
2828
#include "re2/pod_array.h"
2929
#include "re2/prog.h"
3030
#include "re2/regexp.h"
@@ -108,9 +108,9 @@ void BitState::Push(int id, const char* p) {
108108
if (njob_ >= job_.size()) {
109109
GrowStack();
110110
if (njob_ >= job_.size()) {
111-
LOG(DFATAL) << "GrowStack() failed: "
112-
<< "njob_ = " << njob_ << ", "
113-
<< "job_.size() = " << job_.size();
111+
ABSL_LOG(DFATAL) << "GrowStack() failed: "
112+
<< "njob_ = " << njob_ << ", "
113+
<< "job_.size() = " << job_.size();
114114
return;
115115
}
116116
}
@@ -168,7 +168,7 @@ bool BitState::TrySearch(int id0, const char* p0) {
168168
Prog::Inst* ip = prog_->inst(id);
169169
switch (ip->opcode()) {
170170
default:
171-
LOG(DFATAL) << "Unexpected opcode: " << ip->opcode();
171+
ABSL_LOG(DFATAL) << "Unexpected opcode: " << ip->opcode();
172172
return false;
173173

174174
case kInstFail:
@@ -234,7 +234,7 @@ bool BitState::TrySearch(int id0, const char* p0) {
234234
CheckAndLoop:
235235
// Sanity check: id is the head of its list, which must
236236
// be the case if id-1 is the last of *its* list. :)
237-
DCHECK(id == 0 || prog_->inst(id-1)->last());
237+
ABSL_DCHECK(id == 0 || prog_->inst(id-1)->last());
238238
if (ShouldVisit(id, p))
239239
goto Loop;
240240
break;

re2/compile.cc

+10-10
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414

1515
#include "absl/base/macros.h"
1616
#include "absl/container/flat_hash_map.h"
17-
#include "absl/log/check.h"
18-
#include "absl/log/log.h"
17+
#include "absl/log/absl_check.h"
18+
#include "absl/log/absl_log.h"
1919
#include "util/utf.h"
2020
#include "re2/pod_array.h"
2121
#include "re2/prog.h"
@@ -523,8 +523,8 @@ void Compiler::AddSuffix(int id) {
523523
}
524524

525525
int Compiler::AddSuffixRecursive(int root, int id) {
526-
DCHECK(inst_[root].opcode() == kInstAlt ||
527-
inst_[root].opcode() == kInstByteRange);
526+
ABSL_DCHECK(inst_[root].opcode() == kInstAlt ||
527+
inst_[root].opcode() == kInstByteRange);
528528

529529
Frag f = FindByteRange(root, id);
530530
if (IsNoMatch(f)) {
@@ -566,7 +566,7 @@ int Compiler::AddSuffixRecursive(int root, int id) {
566566
if (!IsCachedRuneByteSuffix(id)) {
567567
// The head should be the instruction most recently allocated, so free it
568568
// instead of leaving it unreachable.
569-
DCHECK_EQ(id, ninst_-1);
569+
ABSL_DCHECK_EQ(id, ninst_-1);
570570
inst_[id].out_opcode_ = 0;
571571
inst_[id].out1_ = 0;
572572
ninst_--;
@@ -614,7 +614,7 @@ Frag Compiler::FindByteRange(int root, int id) {
614614
return NoMatch();
615615
}
616616

617-
LOG(DFATAL) << "should never happen";
617+
ABSL_LOG(DFATAL) << "should never happen";
618618
return NoMatch();
619619
}
620620

@@ -739,7 +739,7 @@ void Compiler::AddRuneRangeUTF8(Rune lo, Rune hi, bool foldcase) {
739739
int n = runetochar(reinterpret_cast<char*>(ulo), &lo);
740740
int m = runetochar(reinterpret_cast<char*>(uhi), &hi);
741741
(void)m; // USED(m)
742-
DCHECK_EQ(n, m);
742+
ABSL_DCHECK_EQ(n, m);
743743

744744
// The logic below encodes this thinking:
745745
//
@@ -792,7 +792,7 @@ void Compiler::AddRuneRangeUTF8(Rune lo, Rune hi, bool foldcase) {
792792
Frag Compiler::Copy(Frag arg) {
793793
// We're using WalkExponential; there should be no copying.
794794
failed_ = true;
795-
LOG(DFATAL) << "Compiler::Copy called!";
795+
ABSL_LOG(DFATAL) << "Compiler::Copy called!";
796796
return NoMatch();
797797
}
798798

@@ -919,7 +919,7 @@ Frag Compiler::PostVisit(Regexp* re, Frag, Frag, Frag* child_frags,
919919
if (cc->empty()) {
920920
// This can't happen.
921921
failed_ = true;
922-
LOG(DFATAL) << "No ranges in char class";
922+
ABSL_LOG(DFATAL) << "No ranges in char class";
923923
return NoMatch();
924924
}
925925

@@ -977,7 +977,7 @@ Frag Compiler::PostVisit(Regexp* re, Frag, Frag, Frag* child_frags,
977977
return EmptyWidth(kEmptyNonWordBoundary);
978978
}
979979
failed_ = true;
980-
LOG(DFATAL) << "Missing case in Compiler: " << re->op();
980+
ABSL_LOG(DFATAL) << "Missing case in Compiler: " << re->op();
981981
return NoMatch();
982982
}
983983

0 commit comments

Comments
 (0)