From edf0ab87fdef7f80d4844fb8d8044c369dd41692 Mon Sep 17 00:00:00 2001 From: kuat Date: Thu, 18 May 2023 17:02:45 +0000 Subject: [PATCH] Use ABSL_LOG macros over LOG macros LOG causes macro pollution and conflicts with ProxyWasm SDK (see https://github.com/proxy-wasm/proxy-wasm-cpp-sdk/issues/154). PiperOrigin-RevId: 533164114 --- .../regex_precompilation_optimization_test.cc | 2 +- eval/internal/BUILD | 1 - eval/internal/interop.cc | 1 - eval/public/BUILD | 10 +++++----- eval/public/ast_rewrite.cc | 4 ++-- eval/public/ast_rewrite_native.cc | 4 ++-- eval/public/ast_traverse.cc | 4 ++-- eval/public/ast_traverse_native.cc | 4 ++-- eval/public/cel_value.h | 11 ++++++----- 9 files changed, 20 insertions(+), 21 deletions(-) diff --git a/eval/compiler/regex_precompilation_optimization_test.cc b/eval/compiler/regex_precompilation_optimization_test.cc index 973c28ecd..49af1fd76 100644 --- a/eval/compiler/regex_precompilation_optimization_test.cc +++ b/eval/compiler/regex_precompilation_optimization_test.cc @@ -36,7 +36,7 @@ namespace { using cel::ast::internal::CheckedExpr; using google::api::expr::parser::Parse; -namespace exprpb = google::api::expr::v1alpha1; +namespace exprpb = google::api::expr; class RegexPrecompilationExtensionTest : public testing::Test { public: diff --git a/eval/internal/BUILD b/eval/internal/BUILD index 0abc3ca8e..c91efc0ab 100644 --- a/eval/internal/BUILD +++ b/eval/internal/BUILD @@ -35,7 +35,6 @@ cc_library( "//internal:status_macros", "@com_google_absl//absl/base:core_headers", "@com_google_absl//absl/container:flat_hash_map", - "@com_google_absl//absl/log", "@com_google_absl//absl/status", "@com_google_absl//absl/status:statusor", "@com_google_absl//absl/strings", diff --git a/eval/internal/interop.cc b/eval/internal/interop.cc index c2ae7eb51..c3fb8d082 100644 --- a/eval/internal/interop.cc +++ b/eval/internal/interop.cc @@ -21,7 +21,6 @@ #include "google/protobuf/arena.h" #include "absl/base/attributes.h" #include "absl/container/flat_hash_map.h" -#include "absl/log/log.h" #include "absl/status/status.h" #include "absl/strings/str_cat.h" #include "absl/strings/string_view.h" diff --git a/eval/public/BUILD b/eval/public/BUILD index 85c051fac..65104bc69 100644 --- a/eval/public/BUILD +++ b/eval/public/BUILD @@ -83,7 +83,7 @@ cc_library( "//internal:status_macros", "//internal:utf8", "@com_google_absl//absl/base:core_headers", - "@com_google_absl//absl/log", + "@com_google_absl//absl/log:absl_log", "@com_google_absl//absl/status", "@com_google_absl//absl/status:statusor", "@com_google_absl//absl/strings", @@ -633,7 +633,7 @@ cc_library( deps = [ ":ast_visitor", ":source_position", - "@com_google_absl//absl/log", + "@com_google_absl//absl/log:absl_log", "@com_google_absl//absl/types:variant", "@com_google_googleapis//google/api/expr/v1alpha1:syntax_cc_proto", ], @@ -651,7 +651,7 @@ cc_library( ":ast_visitor_native", ":source_position_native", "//base:ast_internal", - "@com_google_absl//absl/log", + "@com_google_absl//absl/log:absl_log", "@com_google_absl//absl/types:variant", ], ) @@ -835,7 +835,7 @@ cc_library( deps = [ ":ast_visitor", ":source_position", - "@com_google_absl//absl/log", + "@com_google_absl//absl/log:absl_log", "@com_google_absl//absl/types:span", "@com_google_absl//absl/types:variant", "@com_google_googleapis//google/api/expr/v1alpha1:syntax_cc_proto", @@ -870,7 +870,7 @@ cc_library( deps = [ ":ast_visitor_native", ":source_position_native", - "@com_google_absl//absl/log", + "@com_google_absl//absl/log:absl_log", "@com_google_absl//absl/types:span", "@com_google_absl//absl/types:variant", ], diff --git a/eval/public/ast_rewrite.cc b/eval/public/ast_rewrite.cc index c509a3a80..1d4f09393 100644 --- a/eval/public/ast_rewrite.cc +++ b/eval/public/ast_rewrite.cc @@ -18,7 +18,7 @@ #include #include "google/api/expr/v1alpha1/syntax.pb.h" -#include "absl/log/log.h" +#include "absl/log/absl_log.h" #include "absl/types/variant.h" #include "eval/public/ast_visitor.h" #include "eval/public/source_position.h" @@ -196,7 +196,7 @@ struct PostVisitor { case Expr::EXPR_KIND_NOT_SET: break; default: - LOG(ERROR) << "Unsupported Expr kind: " << expr->expr_kind_case(); + ABSL_LOG(ERROR) << "Unsupported Expr kind: " << expr->expr_kind_case(); } visitor->PostVisitExpr(expr, &position); diff --git a/eval/public/ast_rewrite_native.cc b/eval/public/ast_rewrite_native.cc index 3c006d5ab..89248cd3d 100644 --- a/eval/public/ast_rewrite_native.cc +++ b/eval/public/ast_rewrite_native.cc @@ -17,7 +17,7 @@ #include #include -#include "absl/log/log.h" +#include "absl/log/absl_log.h" #include "absl/types/variant.h" #include "eval/public/ast_visitor_native.h" #include "eval/public/source_position_native.h" @@ -199,7 +199,7 @@ struct PostVisitor { visitor->PostVisitComprehension(&comprehension, expr, position); } void operator()(absl::monostate) { - LOG(ERROR) << "Unsupported Expr kind"; + ABSL_LOG(ERROR) << "Unsupported Expr kind"; } } handler{visitor, record.expr, &position}; absl::visit(handler, record.expr->expr_kind()); diff --git a/eval/public/ast_traverse.cc b/eval/public/ast_traverse.cc index 96730841e..ce1a66202 100644 --- a/eval/public/ast_traverse.cc +++ b/eval/public/ast_traverse.cc @@ -17,7 +17,7 @@ #include #include "google/api/expr/v1alpha1/syntax.pb.h" -#include "absl/log/log.h" +#include "absl/log/absl_log.h" #include "absl/types/variant.h" #include "eval/public/ast_visitor.h" #include "eval/public/source_position.h" @@ -197,7 +197,7 @@ struct PostVisitor { &position); break; default: - LOG(ERROR) << "Unsupported Expr kind: " << expr->expr_kind_case(); + ABSL_LOG(ERROR) << "Unsupported Expr kind: " << expr->expr_kind_case(); } visitor->PostVisitExpr(expr, &position); diff --git a/eval/public/ast_traverse_native.cc b/eval/public/ast_traverse_native.cc index 97df453b7..c156a3ee8 100644 --- a/eval/public/ast_traverse_native.cc +++ b/eval/public/ast_traverse_native.cc @@ -16,7 +16,7 @@ #include -#include "absl/log/log.h" +#include "absl/log/absl_log.h" #include "absl/types/variant.h" #include "base/ast_internal.h" #include "eval/public/ast_visitor_native.h" @@ -174,7 +174,7 @@ struct PostVisitor { &position); } void operator()(absl::monostate) { - LOG(ERROR) << "Unsupported Expr kind"; + ABSL_LOG(ERROR) << "Unsupported Expr kind"; } } handler{visitor, record.expr, SourcePosition(expr->id(), record.source_info)}; diff --git a/eval/public/cel_value.h b/eval/public/cel_value.h index 031585652..6bb60beb6 100644 --- a/eval/public/cel_value.h +++ b/eval/public/cel_value.h @@ -25,7 +25,7 @@ #include "absl/base/attributes.h" #include "absl/base/macros.h" #include "absl/base/optimization.h" -#include "absl/log/log.h" +#include "absl/log/absl_log.h" #include "absl/status/status.h" #include "absl/status/statusor.h" #include "absl/strings/str_cat.h" @@ -489,7 +489,8 @@ class CelValue { // Crashes with a null pointer error. static void CrashNullPointer(Type type) ABSL_ATTRIBUTE_COLD { - LOG(FATAL) << "Null pointer supplied for " << TypeName(type); // Crash ok + ABSL_LOG(FATAL) << "Null pointer supplied for " + << TypeName(type); // Crash ok } // Null pointer checker for pointer-based types. @@ -502,9 +503,9 @@ class CelValue { // Crashes with a type mismatch error. static void CrashTypeMismatch(Type requested_type, Type actual_type) ABSL_ATTRIBUTE_COLD { - LOG(FATAL) << "Type mismatch" // Crash ok - << ": expected " << TypeName(requested_type) // Crash ok - << ", encountered " << TypeName(actual_type); // Crash ok + ABSL_LOG(FATAL) << "Type mismatch" // Crash ok + << ": expected " << TypeName(requested_type) // Crash ok + << ", encountered " << TypeName(actual_type); // Crash ok } // Gets value of type specified