From b7ab805b06bdcd5fb35bbf5f9eb52bd3fa47cf8b Mon Sep 17 00:00:00 2001 From: Ryan Northey Date: Tue, 24 Feb 2026 09:58:19 +0000 Subject: [PATCH] warnings: Quieten unused fun currently, warnings are triggered for unused functions, that in some of our (Envoy) builds can be hard to suppress, and are treated as errors. upstreaming Envoy patch. Signed-off-by: Ryan Northey --- common/typeinfo.h | 6 +++--- common/values/list_value.h | 2 +- common/values/map_value.h | 2 +- eval/public/structs/legacy_type_adapter.h | 10 +++++----- eval/public/structs/legacy_type_info_apis.h | 6 +++--- eval/public/structs/proto_message_type_adapter.h | 2 +- runtime/internal/attribute_matcher.h | 4 ++-- 7 files changed, 16 insertions(+), 16 deletions(-) diff --git a/common/typeinfo.h b/common/typeinfo.h index de242ad49..dadc42cba 100644 --- a/common/typeinfo.h +++ b/common/typeinfo.h @@ -81,7 +81,7 @@ std::enable_if_t< std::conjunction_v, std::negation>>, TypeInfo> -TypeId(const T& t) { +TypeId(const T& t [[maybe_unused]]) { return NativeTypeTraits>::Id(t); } @@ -91,7 +91,7 @@ std::enable_if_t< std::negation>, std::is_final>, TypeInfo> -TypeId(const T& t) { +TypeId(const T& t [[maybe_unused]]) { return cel::TypeId>(); } @@ -100,7 +100,7 @@ std::enable_if_t< std::conjunction_v>, common_internal::HasCelTypeId>, TypeInfo> -TypeId(const T& t) { +TypeId(const T& t [[maybe_unused]]) { return CelTypeId(t); } diff --git a/common/values/list_value.h b/common/values/list_value.h index 73aadf789..516d16dcc 100644 --- a/common/values/list_value.h +++ b/common/values/list_value.h @@ -272,7 +272,7 @@ class ListValueBuilder { virtual size_t Size() const = 0; - virtual void Reserve(size_t capacity) {} + virtual void Reserve(size_t capacity [[maybe_unused]]) {} virtual ListValue Build() && = 0; }; diff --git a/common/values/map_value.h b/common/values/map_value.h index 093100f96..ffbdea6c9 100644 --- a/common/values/map_value.h +++ b/common/values/map_value.h @@ -294,7 +294,7 @@ class MapValueBuilder { virtual size_t Size() const = 0; - virtual void Reserve(size_t capacity) {} + virtual void Reserve(size_t capacity [[maybe_unused]]) {} virtual MapValue Build() && = 0; }; diff --git a/eval/public/structs/legacy_type_adapter.h b/eval/public/structs/legacy_type_adapter.h index 795c56339..1c239bdb9 100644 --- a/eval/public/structs/legacy_type_adapter.h +++ b/eval/public/structs/legacy_type_adapter.h @@ -65,9 +65,9 @@ class LegacyTypeMutationApis { CelValue::MessageWrapper::Builder& instance) const = 0; virtual absl::Status SetFieldByNumber( - int64_t field_number, const CelValue& value, - cel::MemoryManagerRef memory_manager, - CelValue::MessageWrapper::Builder& instance) const { + int64_t field_number [[maybe_unused]], const CelValue& value [[maybe_unused]], + cel::MemoryManagerRef memory_manager [[maybe_unused]], + CelValue::MessageWrapper::Builder& instance [[maybe_unused]]) const { return absl::UnimplementedError("SetFieldByNumber is not yet implemented"); } }; @@ -116,8 +116,8 @@ class LegacyTypeAccessApis { // whether the leaf field is set to a non-default value. virtual absl::StatusOr Qualify( absl::Span, - const CelValue::MessageWrapper& instance, bool presence_test, - cel::MemoryManagerRef memory_manager) const { + const CelValue::MessageWrapper& instance [[maybe_unused]], bool presence_test [[maybe_unused]], + cel::MemoryManagerRef memory_manager [[maybe_unused]]) const { return absl::UnimplementedError("Qualify unsupported."); } diff --git a/eval/public/structs/legacy_type_info_apis.h b/eval/public/structs/legacy_type_info_apis.h index 7226b3b48..4f07470a1 100644 --- a/eval/public/structs/legacy_type_info_apis.h +++ b/eval/public/structs/legacy_type_info_apis.h @@ -62,7 +62,7 @@ class LegacyTypeInfoApis { const MessageWrapper& wrapped_message) const = 0; virtual const google::protobuf::Descriptor* absl_nullable GetDescriptor( - const MessageWrapper& wrapped_message) const { + const MessageWrapper& wrapped_message [[maybe_unused]]) const { return nullptr; } @@ -84,7 +84,7 @@ class LegacyTypeInfoApis { // // Nullptr signals that the value does not provide mutation apis. virtual const LegacyTypeMutationApis* GetMutationApis( - const MessageWrapper& wrapped_message) const { + const MessageWrapper& wrapped_message [[maybe_unused]]) const { return nullptr; } @@ -93,7 +93,7 @@ class LegacyTypeInfoApis { // The underlying string is expected to remain valid as long as the // LegacyTypeInfoApis instance. virtual absl::optional FindFieldByName( - absl::string_view name) const { + absl::string_view name [[maybe_unused]]) const { return absl::nullopt; } }; diff --git a/eval/public/structs/proto_message_type_adapter.h b/eval/public/structs/proto_message_type_adapter.h index e7b4a4c7f..f2fc43a8a 100644 --- a/eval/public/structs/proto_message_type_adapter.h +++ b/eval/public/structs/proto_message_type_adapter.h @@ -52,7 +52,7 @@ class ProtoMessageTypeAdapter : public LegacyTypeInfoApis, const MessageWrapper& wrapped_message) const override; const google::protobuf::Descriptor* absl_nullable GetDescriptor( - const MessageWrapper& wrapped_message) const override { + const MessageWrapper& wrapped_message [[maybe_unused]]) const override { return descriptor_; } diff --git a/runtime/internal/attribute_matcher.h b/runtime/internal/attribute_matcher.h index 271749bf6..5235f1036 100644 --- a/runtime/internal/attribute_matcher.h +++ b/runtime/internal/attribute_matcher.h @@ -29,14 +29,14 @@ class AttributeMatcher { // Checks whether the attribute trail matches any unknown patterns. // Used to identify and collect referenced unknowns in an UnknownValue. - virtual MatchResult CheckForUnknown(const Attribute& attr) const { + virtual MatchResult CheckForUnknown(const Attribute& attr [[maybe_unused]]) const { return MatchResult::NONE; }; // Checks whether the attribute trail matches any missing patterns. // Used to identify missing attributes, and report an error if referenced // directly. - virtual MatchResult CheckForMissing(const Attribute& attr) const { + virtual MatchResult CheckForMissing(const Attribute& attr [[maybe_unused]]) const { return MatchResult::NONE; }; };