Skip to content

Commit

Permalink
Fix the remaining usages of LOG macro.
Browse files Browse the repository at this point in the history
Add "unused" attribute to public headers.

PiperOrigin-RevId: 533217495
  • Loading branch information
kyessenov committed May 18, 2023
1 parent 8d92e26 commit 42f39ac
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 22 deletions.
2 changes: 1 addition & 1 deletion eval/compiler/constant_folding.cc
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ class ConstantFoldingTransform {
}

bool operator()(absl::monostate) {
LOG(ERROR) << "Unsupported Expr kind";
ABSL_LOG(ERROR) << "Unsupported Expr kind";
return false;
}

Expand Down
6 changes: 3 additions & 3 deletions eval/eval/evaluator_core.cc
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ const ExpressionStep* ExecutionFrame::Next() {

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

if (value_stack().empty()) {
LOG(ERROR) << "Stack is empty after a ExpressionStep.Evaluate. "
"Try to disable short-circuiting.";
ABSL_LOG(ERROR) << "Stack is empty after a ExpressionStep.Evaluate. "
"Try to disable short-circuiting.";
continue;
}
CEL_RETURN_IF_ERROR(
Expand Down
16 changes: 8 additions & 8 deletions eval/eval/evaluator_stack.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ class EvaluatorStack {
// Please note that calls to Push may invalidate returned Span object.
absl::Span<const cel::Handle<cel::Value>> GetSpan(size_t size) const {
if (!HasEnough(size)) {
LOG(ERROR) << "Requested span size (" << size
<< ") exceeds current stack size: " << current_size_;
ABSL_LOG(ERROR) << "Requested span size (" << size
<< ") exceeds current stack size: " << current_size_;
}
return absl::Span<const cel::Handle<cel::Value>>(
stack_.data() + current_size_ - size, size);
Expand All @@ -65,7 +65,7 @@ class EvaluatorStack {
// Checking that stack is not empty is caller's responsibility.
const cel::Handle<cel::Value>& Peek() const {
if (empty()) {
LOG(ERROR) << "Peeking on empty EvaluatorStack";
ABSL_LOG(ERROR) << "Peeking on empty EvaluatorStack";
}
return stack_[current_size_ - 1];
}
Expand All @@ -74,7 +74,7 @@ class EvaluatorStack {
// Checking that stack is not empty is caller's responsibility.
const AttributeTrail& PeekAttribute() const {
if (empty()) {
LOG(ERROR) << "Peeking on empty EvaluatorStack";
ABSL_LOG(ERROR) << "Peeking on empty EvaluatorStack";
}
return attribute_stack_[current_size_ - 1];
}
Expand All @@ -83,8 +83,8 @@ class EvaluatorStack {
// Checking that stack has enough elements is caller's responsibility.
void Pop(size_t size) {
if (!HasEnough(size)) {
LOG(ERROR) << "Trying to pop more elements (" << size
<< ") than the current stack size: " << current_size_;
ABSL_LOG(ERROR) << "Trying to pop more elements (" << size
<< ") than the current stack size: " << current_size_;
}
while (size > 0) {
stack_.pop_back();
Expand All @@ -101,7 +101,7 @@ class EvaluatorStack {

void Push(cel::Handle<cel::Value> value, AttributeTrail attribute) {
if (current_size_ >= max_size()) {
LOG(ERROR) << "No room to push more elements on to EvaluatorStack";
ABSL_LOG(ERROR) << "No room to push more elements on to EvaluatorStack";
}
stack_.push_back(std::move(value));
attribute_stack_.push_back(std::move(attribute));
Expand All @@ -118,7 +118,7 @@ class EvaluatorStack {
// Checking that stack is not empty is caller's responsibility.
void PopAndPush(cel::Handle<cel::Value> value, AttributeTrail attribute) {
if (empty()) {
LOG(ERROR) << "Cannot PopAndPush on empty stack.";
ABSL_LOG(ERROR) << "Cannot PopAndPush on empty stack.";
}
stack_[current_size_ - 1] = std::move(value);
attribute_stack_[current_size_ - 1] = std::move(attribute);
Expand Down
2 changes: 1 addition & 1 deletion eval/eval/select_step.cc
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ absl::optional<Handle<Value>> CheckForMarkedAttributes(
}
// Invariant broken (an invalid CEL Attribute shouldn't match anything).
// Log and return a CelError.
LOG(ERROR)
ABSL_LOG(ERROR)
<< "Invalid attribute pattern matched select path: "
<< attribute_string.status().ToString(); // NOLINT: OSS compatibility
return CreateErrorValueFromView(Arena::Create<absl::Status>(
Expand Down
8 changes: 4 additions & 4 deletions eval/public/cel_expr_builder_factory.cc
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,13 @@ std::unique_ptr<CelExpressionBuilder> CreateCelExpressionBuilder(
google::protobuf::MessageFactory* message_factory,
const InterpreterOptions& options) {
if (descriptor_pool == nullptr) {
LOG(ERROR) << "Cannot pass nullptr as descriptor pool to "
"CreateCelExpressionBuilder";
ABSL_LOG(ERROR) << "Cannot pass nullptr as descriptor pool to "
"CreateCelExpressionBuilder";
return nullptr;
}
if (auto s = ValidateStandardMessageTypes(*descriptor_pool); !s.ok()) {
LOG(WARNING) << "Failed to validate standard message types: "
<< s.ToString(); // NOLINT: OSS compatibility
ABSL_LOG(WARNING) << "Failed to validate standard message types: "
<< s.ToString(); // NOLINT: OSS compatibility
return nullptr;
}

Expand Down
4 changes: 2 additions & 2 deletions eval/public/portable_cel_expr_builder_factory.cc
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ std::unique_ptr<CelExpressionBuilder> CreatePortableExprBuilder(
std::unique_ptr<LegacyTypeProvider> type_provider,
const InterpreterOptions& options) {
if (type_provider == nullptr) {
LOG(ERROR) << "Cannot pass nullptr as type_provider to "
"CreatePortableExprBuilder";
ABSL_LOG(ERROR) << "Cannot pass nullptr as type_provider to "
"CreatePortableExprBuilder";
return nullptr;
}
cel::RuntimeOptions runtime_options = ConvertToRuntimeOptions(options);
Expand Down
2 changes: 1 addition & 1 deletion eval/public/structs/field_access_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -599,7 +599,7 @@ class ScalarFieldSetter : public FieldSetter<ScalarFieldSetter> {

bool SetMessage(const Message* value) const {
if (!value) {
LOG(ERROR) << "Message is NULL";
ABSL_LOG(ERROR) << "Message is NULL";
return true;
}
if (value->GetDescriptor()->full_name() ==
Expand Down
5 changes: 3 additions & 2 deletions eval/public/structs/legacy_type_provider.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class LegacyTypeProvider : public cel::TypeProvider {
// created ones, the TypeInfoApis returned from this method should be the same
// as the ones used in value creation.
virtual absl::optional<const LegacyTypeInfoApis*> ProvideLegacyTypeInfo(
absl::string_view name) const {
ABSL_ATTRIBUTE_UNUSED absl::string_view name) const {
return absl::nullopt;
}

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

0 comments on commit 42f39ac

Please sign in to comment.