Skip to content

Commit 42f39ac

Browse files
committed
Fix the remaining usages of LOG macro.
Add "unused" attribute to public headers. PiperOrigin-RevId: 533217495
1 parent 8d92e26 commit 42f39ac

8 files changed

+23
-22
lines changed

eval/compiler/constant_folding.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ class ConstantFoldingTransform {
359359
}
360360

361361
bool operator()(absl::monostate) {
362-
LOG(ERROR) << "Unsupported Expr kind";
362+
ABSL_LOG(ERROR) << "Unsupported Expr kind";
363363
return false;
364364
}
365365

eval/eval/evaluator_core.cc

+3-3
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ const ExpressionStep* ExecutionFrame::Next() {
5151

5252
if (pc_ < end_pos) return execution_path_[pc_++].get();
5353
if (pc_ > end_pos) {
54-
LOG(ERROR) << "Attempting to step beyond the end of execution path.";
54+
ABSL_LOG(ERROR) << "Attempting to step beyond the end of execution path.";
5555
}
5656
return nullptr;
5757
}
@@ -167,8 +167,8 @@ absl::StatusOr<cel::Handle<cel::Value>> ExecutionFrame::Evaluate(
167167
}
168168

169169
if (value_stack().empty()) {
170-
LOG(ERROR) << "Stack is empty after a ExpressionStep.Evaluate. "
171-
"Try to disable short-circuiting.";
170+
ABSL_LOG(ERROR) << "Stack is empty after a ExpressionStep.Evaluate. "
171+
"Try to disable short-circuiting.";
172172
continue;
173173
}
174174
CEL_RETURN_IF_ERROR(

eval/eval/evaluator_stack.h

+8-8
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ class EvaluatorStack {
4646
// Please note that calls to Push may invalidate returned Span object.
4747
absl::Span<const cel::Handle<cel::Value>> GetSpan(size_t size) const {
4848
if (!HasEnough(size)) {
49-
LOG(ERROR) << "Requested span size (" << size
50-
<< ") exceeds current stack size: " << current_size_;
49+
ABSL_LOG(ERROR) << "Requested span size (" << size
50+
<< ") exceeds current stack size: " << current_size_;
5151
}
5252
return absl::Span<const cel::Handle<cel::Value>>(
5353
stack_.data() + current_size_ - size, size);
@@ -65,7 +65,7 @@ class EvaluatorStack {
6565
// Checking that stack is not empty is caller's responsibility.
6666
const cel::Handle<cel::Value>& Peek() const {
6767
if (empty()) {
68-
LOG(ERROR) << "Peeking on empty EvaluatorStack";
68+
ABSL_LOG(ERROR) << "Peeking on empty EvaluatorStack";
6969
}
7070
return stack_[current_size_ - 1];
7171
}
@@ -74,7 +74,7 @@ class EvaluatorStack {
7474
// Checking that stack is not empty is caller's responsibility.
7575
const AttributeTrail& PeekAttribute() const {
7676
if (empty()) {
77-
LOG(ERROR) << "Peeking on empty EvaluatorStack";
77+
ABSL_LOG(ERROR) << "Peeking on empty EvaluatorStack";
7878
}
7979
return attribute_stack_[current_size_ - 1];
8080
}
@@ -83,8 +83,8 @@ class EvaluatorStack {
8383
// Checking that stack has enough elements is caller's responsibility.
8484
void Pop(size_t size) {
8585
if (!HasEnough(size)) {
86-
LOG(ERROR) << "Trying to pop more elements (" << size
87-
<< ") than the current stack size: " << current_size_;
86+
ABSL_LOG(ERROR) << "Trying to pop more elements (" << size
87+
<< ") than the current stack size: " << current_size_;
8888
}
8989
while (size > 0) {
9090
stack_.pop_back();
@@ -101,7 +101,7 @@ class EvaluatorStack {
101101

102102
void Push(cel::Handle<cel::Value> value, AttributeTrail attribute) {
103103
if (current_size_ >= max_size()) {
104-
LOG(ERROR) << "No room to push more elements on to EvaluatorStack";
104+
ABSL_LOG(ERROR) << "No room to push more elements on to EvaluatorStack";
105105
}
106106
stack_.push_back(std::move(value));
107107
attribute_stack_.push_back(std::move(attribute));
@@ -118,7 +118,7 @@ class EvaluatorStack {
118118
// Checking that stack is not empty is caller's responsibility.
119119
void PopAndPush(cel::Handle<cel::Value> value, AttributeTrail attribute) {
120120
if (empty()) {
121-
LOG(ERROR) << "Cannot PopAndPush on empty stack.";
121+
ABSL_LOG(ERROR) << "Cannot PopAndPush on empty stack.";
122122
}
123123
stack_[current_size_ - 1] = std::move(value);
124124
attribute_stack_[current_size_ - 1] = std::move(attribute);

eval/eval/select_step.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ absl::optional<Handle<Value>> CheckForMarkedAttributes(
116116
}
117117
// Invariant broken (an invalid CEL Attribute shouldn't match anything).
118118
// Log and return a CelError.
119-
LOG(ERROR)
119+
ABSL_LOG(ERROR)
120120
<< "Invalid attribute pattern matched select path: "
121121
<< attribute_string.status().ToString(); // NOLINT: OSS compatibility
122122
return CreateErrorValueFromView(Arena::Create<absl::Status>(

eval/public/cel_expr_builder_factory.cc

+4-4
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,13 @@ std::unique_ptr<CelExpressionBuilder> CreateCelExpressionBuilder(
3939
google::protobuf::MessageFactory* message_factory,
4040
const InterpreterOptions& options) {
4141
if (descriptor_pool == nullptr) {
42-
LOG(ERROR) << "Cannot pass nullptr as descriptor pool to "
43-
"CreateCelExpressionBuilder";
42+
ABSL_LOG(ERROR) << "Cannot pass nullptr as descriptor pool to "
43+
"CreateCelExpressionBuilder";
4444
return nullptr;
4545
}
4646
if (auto s = ValidateStandardMessageTypes(*descriptor_pool); !s.ok()) {
47-
LOG(WARNING) << "Failed to validate standard message types: "
48-
<< s.ToString(); // NOLINT: OSS compatibility
47+
ABSL_LOG(WARNING) << "Failed to validate standard message types: "
48+
<< s.ToString(); // NOLINT: OSS compatibility
4949
return nullptr;
5050
}
5151

eval/public/portable_cel_expr_builder_factory.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ std::unique_ptr<CelExpressionBuilder> CreatePortableExprBuilder(
3434
std::unique_ptr<LegacyTypeProvider> type_provider,
3535
const InterpreterOptions& options) {
3636
if (type_provider == nullptr) {
37-
LOG(ERROR) << "Cannot pass nullptr as type_provider to "
38-
"CreatePortableExprBuilder";
37+
ABSL_LOG(ERROR) << "Cannot pass nullptr as type_provider to "
38+
"CreatePortableExprBuilder";
3939
return nullptr;
4040
}
4141
cel::RuntimeOptions runtime_options = ConvertToRuntimeOptions(options);

eval/public/structs/field_access_impl.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -599,7 +599,7 @@ class ScalarFieldSetter : public FieldSetter<ScalarFieldSetter> {
599599

600600
bool SetMessage(const Message* value) const {
601601
if (!value) {
602-
LOG(ERROR) << "Message is NULL";
602+
ABSL_LOG(ERROR) << "Message is NULL";
603603
return true;
604604
}
605605
if (value->GetDescriptor()->full_name() ==

eval/public/structs/legacy_type_provider.h

+3-2
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class LegacyTypeProvider : public cel::TypeProvider {
4646
// created ones, the TypeInfoApis returned from this method should be the same
4747
// as the ones used in value creation.
4848
virtual absl::optional<const LegacyTypeInfoApis*> ProvideLegacyTypeInfo(
49-
absl::string_view name) const {
49+
ABSL_ATTRIBUTE_UNUSED absl::string_view name) const {
5050
return absl::nullopt;
5151
}
5252

@@ -61,7 +61,8 @@ class LegacyTypeProvider : public cel::TypeProvider {
6161
// TODO(issues/5): Move protobuf-Any API from top level
6262
// [Legacy]TypeProviders.
6363
virtual absl::optional<const LegacyAnyPackingApis*>
64-
ProvideLegacyAnyPackingApis(absl::string_view name) const {
64+
ProvideLegacyAnyPackingApis(
65+
ABSL_ATTRIBUTE_UNUSED absl::string_view name) const {
6566
return absl::nullopt;
6667
}
6768
};

0 commit comments

Comments
 (0)