Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deps: update abseil and cel-cpp #31456

Merged
merged 42 commits into from
Jan 10, 2024
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
e255e5a
deps: update abseil and cel-cpp
kyessenov Dec 20, 2023
e40a25f
try to fix
kyessenov Dec 20, 2023
1403f23
more assertions
kyessenov Dec 20, 2023
aba69b0
use version abseil
kyessenov Dec 20, 2023
52f0c85
rollback one abseil release
kyessenov Dec 20, 2023
483540e
silence cel cpp
kyessenov Dec 20, 2023
989d91b
fix date
kyessenov Dec 20, 2023
271bc8d
fix gcc
kyessenov Dec 20, 2023
0b9642a
patch more
kyessenov Dec 20, 2023
4254668
relax more assertions
kyessenov Dec 20, 2023
fa57464
relax inline size
kyessenov Dec 21, 2023
ff9c48e
try again
kyessenov Dec 21, 2023
7a5477b
try again
kyessenov Dec 21, 2023
110df4e
fix
kyessenov Dec 21, 2023
b0da121
more fixes
kyessenov Dec 21, 2023
baf7a2f
again
kyessenov Dec 21, 2023
91f3564
again
kyessenov Dec 21, 2023
01bcac5
extern weak
kyessenov Dec 21, 2023
b5da585
try again
kyessenov Dec 21, 2023
b898cd5
gcc
kyessenov Dec 21, 2023
6679704
Merge remote-tracking branch 'upstream/main' into cel_cpp_up
kyessenov Jan 3, 2024
16edfd4
simplify
kyessenov Jan 3, 2024
cdb8731
disable on windows
kyessenov Jan 3, 2024
42eff97
oops
kyessenov Jan 3, 2024
6b9b5d6
skip another test
kyessenov Jan 3, 2024
f54d119
fix
kyessenov Jan 4, 2024
f21f1ba
skip more
kyessenov Jan 4, 2024
9f45440
fix
kyessenov Jan 4, 2024
780d871
extraneous dep
kyessenov Jan 4, 2024
3429f9d
patches
kyessenov Jan 4, 2024
ed0fa84
patches
kyessenov Jan 4, 2024
2a961ae
patches
kyessenov Jan 4, 2024
37c6620
final fix
kyessenov Jan 4, 2024
07c69d0
skip coverage
kyessenov Jan 5, 2024
ed9d4bf
lower coverage
kyessenov Jan 5, 2024
83de24c
revert
kyessenov Jan 5, 2024
a3618f6
Revert "revert"
kyessenov Jan 5, 2024
a6aa389
restore
kyessenov Jan 8, 2024
7fab360
Merge remote-tracking branch 'upstream/main' into cel_cpp_up
kyessenov Jan 8, 2024
2a4f40b
add back coverage
kyessenov Jan 8, 2024
0bfe832
add back coverage
kyessenov Jan 8, 2024
86c6887
disable it on windows
kyessenov Jan 8, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
314 changes: 155 additions & 159 deletions bazel/cel-cpp.patch
Original file line number Diff line number Diff line change
@@ -1,168 +1,164 @@
diff --git a/base/memory_manager.cc b/base/memory_manager.cc
index 1b7b355..4c7810c 100644
--- a/base/memory_manager.cc
+++ b/base/memory_manager.cc
@@ -234,7 +234,7 @@ class GlobalMemoryManager final : public MemoryManager {
void* Allocate(size_t size, size_t align) override {
static_cast<void>(size);
static_cast<void>(align);
- ABSL_INTERNAL_UNREACHABLE;
+ ABSL_UNREACHABLE();
return nullptr;
}
diff --git a/base/internal/value.h b/base/internal/value.h
index fb3e845..375dec8 100644
--- a/base/internal/value.h
+++ b/base/internal/value.h
@@ -55,13 +55,9 @@ NativeTypeId GetListValueTypeId(const ListValue& list_value);

@@ -242,7 +242,7 @@ class GlobalMemoryManager final : public MemoryManager {
void OwnDestructor(void* pointer, void (*destructor)(void*)) override {
static_cast<void>(pointer);
static_cast<void>(destructor);
- ABSL_INTERNAL_UNREACHABLE;
+ ABSL_UNREACHABLE();
}
};
NativeTypeId GetMapValueTypeId(const MapValue& map_value);

diff --git a/eval/eval/evaluator_stack.h b/eval/eval/evaluator_stack.h
index 1ecab27..9df65d7 100644
--- a/eval/eval/evaluator_stack.h
+++ b/eval/eval/evaluator_stack.h
@@ -5,6 +5,7 @@
#include <utility>
#include <vector>

+#include "absl/log/log.h"
#include "absl/types/span.h"
#include "eval/eval/attribute_trail.h"
#include "eval/public/cel_value.h"
diff --git a/eval/public/cel_expr_builder_factory.h b/eval/public/cel_expr_builder_factory.h
index 7321e29..0d0d5e6 100644
--- a/eval/public/cel_expr_builder_factory.h
+++ b/eval/public/cel_expr_builder_factory.h
@@ -1,6 +1,7 @@
#ifndef THIRD_PARTY_CEL_CPP_EVAL_PUBLIC_CEL_EXPR_BUILDER_FACTORY_H_
#define THIRD_PARTY_CEL_CPP_EVAL_PUBLIC_CEL_EXPR_BUILDER_FACTORY_H_

+#include "absl/log/log.h"
#include "google/protobuf/descriptor.h"
#include "eval/public/cel_expression.h"
#include "eval/public/cel_options.h"
diff --git a/eval/public/cel_value.h b/eval/public/cel_value.h
index b2d13f8..73e1909 100644
--- a/eval/public/cel_value.h
+++ b/eval/public/cel_value.h
@@ -25,7 +25,6 @@
#include "absl/base/attributes.h"
#include "absl/base/macros.h"
#include "absl/base/optimization.h"
-#include "absl/log/log.h"
#include "absl/status/status.h"
#include "absl/status/statusor.h"
#include "absl/strings/str_cat.h"
@@ -481,8 +480,8 @@ class CelValue {
}
-static_assert(std::is_trivially_copyable_v<absl::Duration>,
- "absl::Duration must be trivially copyable.");
static_assert(std::is_trivially_destructible_v<absl::Duration>,
"absl::Duration must be trivially destructible.");

// Crashes with a null pointer error.
- static void CrashNullPointer(Type type) ABSL_ATTRIBUTE_COLD {
- LOG(FATAL) << "Null pointer supplied for " << TypeName(type); // Crash ok
+ static void CrashNullPointer(Type) ABSL_ATTRIBUTE_COLD {
+ ABSL_ASSERT(false);
}
-static_assert(std::is_trivially_copyable_v<absl::Time>,
- "absl::Time must be trivially copyable.");
static_assert(std::is_trivially_destructible_v<absl::Time>,
"absl::Time must be trivially destructible.");

// Null pointer checker for pointer-based types.
@@ -493,11 +492,9 @@ class CelValue {
}
@@ -92,6 +88,9 @@ struct InlineValue final {
int64_t number;
} enum_value;
};
+#ifdef _MSC_VER
+ ~InlineValue() = delete;
+#endif
};

// 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
+ static void CrashTypeMismatch(Type,
+ Type) ABSL_ATTRIBUTE_COLD {
+ ABSL_ASSERT(false);
}
inline constexpr size_t kValueInlineSize = sizeof(InlineValue);
@@ -102,7 +101,11 @@ static_assert(kValueInlineSize <= 32,
static_assert(kValueInlineAlign <= alignof(std::max_align_t),
"Alignment of an inline value should not be overaligned.");

// Gets value of type specified
diff --git a/eval/public/portable_cel_expr_builder_factory.cc b/eval/public/portable_cel_expr_builder_factory.cc
index 80ac45c..7dceb93 100644
--- a/eval/public/portable_cel_expr_builder_factory.cc
+++ b/eval/public/portable_cel_expr_builder_factory.cc
@@ -20,6 +20,7 @@
#include <string>
#include <utility>

+#include "absl/log/log.h"
#include "absl/status/status.h"
#include "eval/compiler/flat_expr_builder.h"
#include "eval/public/cel_options.h"
diff --git a/eval/public/structs/BUILD b/eval/public/structs/BUILD
index 9187518..5151bb0 100644
--- a/eval/public/structs/BUILD
+++ b/eval/public/structs/BUILD
@@ -192,7 +192,6 @@ cc_library(
hdrs = ["legacy_type_provider.h"],
deps = [
":legacy_type_adapter",
- "//base:type_provider",
"@com_google_absl//absl/types:optional",
],
)
diff --git a/eval/public/structs/field_access_impl.cc b/eval/public/structs/field_access_impl.cc
index 788a476..e4b70b3 100644
--- a/eval/public/structs/field_access_impl.cc
+++ b/eval/public/structs/field_access_impl.cc
@@ -25,6 +25,7 @@
#include "google/protobuf/arena.h"
#include "google/protobuf/map_field.h"
#include "absl/container/flat_hash_set.h"
+#include "absl/log/log.h"
#include "absl/status/status.h"
#include "absl/status/statusor.h"
#include "absl/strings/str_cat.h"
diff --git a/eval/public/structs/legacy_type_provider.h b/eval/public/structs/legacy_type_provider.h
index b1623fc..d3d88d6 100644
--- a/eval/public/structs/legacy_type_provider.h
+++ b/eval/public/structs/legacy_type_provider.h
@@ -16,7 +16,6 @@
#define THIRD_PARTY_CEL_CPP_EVAL_PUBLIC_STRUCTS_TYPE_PROVIDER_H_

#include "absl/types/optional.h"
-#include "base/type_provider.h"
#include "eval/public/structs/legacy_type_adapter.h"

namespace google::api::expr::runtime {
@@ -25,8 +24,10 @@ namespace google::api::expr::runtime {
+#ifdef _MSC_VER
+using AnyValue = AnyData<64, kValueInlineAlign>;
+#else
using AnyValue = AnyData<kValueInlineSize, kValueInlineAlign>;
+#endif

// Metaprogramming utility for interacting with Value.
//
// Note: This API is not finalized. Consult the CEL team before introducing new
// implementations.
-class LegacyTypeProvider : public cel::TypeProvider {
+class LegacyTypeProvider {
public:
+ virtual ~LegacyTypeProvider() = default;
+
// Return LegacyTypeAdapter for the fully qualified type name if available.
//
// nullopt values are interpreted as not present.
@@ -45,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::string_view) const {
diff --git a/base/memory.h b/base/memory.h
index 3552e19..47ca57e 100644
--- a/base/memory.h
+++ b/base/memory.h
@@ -165,9 +165,11 @@ std::enable_if_t<IsDerivedHeapDataV<F>, Handle<T>> HandleFactory<T>::Make(
static_assert(std::is_base_of_v<T, F>, "F is not derived from T");
#if defined(__cpp_lib_is_pointer_interconvertible) && \
__cpp_lib_is_pointer_interconvertible >= 201907L
+#ifndef _MSC_VER
// Only available in C++20.
static_assert(std::is_pointer_interconvertible_base_of_v<Data, F>,
"F must be pointer interconvertible to Data");
+#endif
#endif
if (memory_manager.memory_management() == MemoryManagement::kPooling) {
void* addr;
diff --git a/base/value.h b/base/value.h
index 5d94d5e..d53370c 100644
--- a/base/value.h
+++ b/base/value.h
@@ -336,8 +336,6 @@ CEL_INTERNAL_VALUE_DECL(Value);
} // namespace cel

#define CEL_INTERNAL_SIMPLE_VALUE_STANDALONES(value_class) \
- static_assert(std::is_trivially_copyable_v<value_class>, \
- #value_class " must be trivially copyable"); \
static_assert(std::is_trivially_destructible_v<value_class>, \
#value_class " must be trivially destructible"); \
\
diff --git a/eval/internal/interop.cc b/eval/internal/interop.cc
index 3acde6c..62e8c68 100644
--- a/eval/internal/interop.cc
+++ b/eval/internal/interop.cc
@@ -729,6 +729,7 @@ absl::StatusOr<CelValue> ToLegacyValue(google::protobuf::Arena* arena,
return CelValue::CreateMessageWrapper(
MessageWrapperAccess::Make(message, type_info));
}
+#ifndef _MSC_VER
if (ProtoStructValueToMessageWrapper) {
auto maybe_message_wrapper = ProtoStructValueToMessageWrapper(*value);
if (maybe_message_wrapper.has_value()) {
@@ -736,6 +737,7 @@ absl::StatusOr<CelValue> ToLegacyValue(google::protobuf::Arena* arena,
std::move(maybe_message_wrapper).value());
}
}
+#endif
return absl::UnimplementedError(
"only legacy struct types and values can be used for interop");
}
diff --git a/eval/public/cel_value.cc b/eval/public/cel_value.cc
index 6aeff6d..c43864c 100644
--- a/eval/public/cel_value.cc
+++ b/eval/public/cel_value.cc
@@ -107,7 +107,7 @@ struct DebugStringVisitor {

} // namespace

-const absl::string_view kPayloadUrlMissingAttributePath =
+ABSL_CONST_INIT const absl::string_view kPayloadUrlMissingAttributePath =
cel::runtime_internal::kPayloadUrlMissingAttributePath;

CelValue CelValue::CreateDuration(absl::Duration value) {
diff --git a/internal/strings.cc b/internal/strings.cc
index dc5a118..24457ab 100644
--- a/internal/strings.cc
+++ b/internal/strings.cc
@@ -53,12 +53,12 @@ bool CheckForClosingString(absl::string_view source,
if (closing_str.empty()) return true;

const char* p = source.data();
- const char* end = source.end();
+ const char* end = p + source.size();

bool is_closed = false;
while (p + closing_str.length() <= end) {
if (*p != '\\') {
- size_t cur_pos = p - source.begin();
+ size_t cur_pos = p - source.data();
bool is_closing =
absl::StartsWith(absl::ClippedSubstr(source, cur_pos), closing_str);
if (is_closing && p + closing_str.length() < end) {
@@ -132,7 +132,7 @@ bool UnescapeInternal(absl::string_view source, absl::string_view closing_str,
dest->reserve(source.size());

const char* p = source.data();
- const char* end = source.end();
+ const char* end = p + source.size();
const char* last_byte = end - 1;

while (p < end) {
@@ -446,7 +446,9 @@ std::string EscapeInternal(absl::string_view src, bool escape_all_bytes,
// byte.
dest.reserve(src.size() * 4);
bool last_hex_escape = false; // true if last output char was \xNN.
- for (const char* p = src.begin(); p < src.end(); ++p) {
+ const char* p = src.data();
+ const char* end = p + src.size();
+ for (; p < end; ++p) {
unsigned char c = static_cast<unsigned char>(*p);
bool is_hex_escape = false;
switch (c) {
@@ -552,7 +554,9 @@ std::string EscapeString(absl::string_view str) {
std::string EscapeBytes(absl::string_view str, bool escape_all_bytes,
char escape_quote_char) {
std::string escaped_bytes;
- for (const char* p = str.begin(); p < str.end(); ++p) {
+ const char* p = str.data();
+ const char* end = p + str.size();
+ for (; p < end; ++p) {
unsigned char c = *p;
if (escape_all_bytes || !absl::ascii_isprint(c)) {
escaped_bytes += "\\x";
diff --git a/tools/flatbuffers_backed_impl.cc b/tools/flatbuffers_backed_impl.cc
index 10c0b1c..45ba72f 100644
--- a/tools/flatbuffers_backed_impl.cc
+++ b/tools/flatbuffers_backed_impl.cc
@@ -130,6 +130,7 @@ class ObjectStringIndexedMapImpl : public CelMap {
return absl::nullopt;
}
};
diff --git a/base/function_result.h b/base/function_result.h
index 9bc2d67..bf6110c 100644
--- a/base/function_result.h
+++ b/base/function_result.h
@@ -26,7 +26,10 @@ namespace cel {
// allows for lazy evaluation of expensive functions.
class FunctionResult final {
public:
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wdefaulted-function-deleted"
FunctionResult() = default;
kyessenov marked this conversation as resolved.
Show resolved Hide resolved
+#pragma GCC diagnostic pop
FunctionResult(const FunctionResult&) = default;
FunctionResult(FunctionResult&&) = default;
FunctionResult& operator=(const FunctionResult&) = default;

+ using CelMap::ListKeys;
absl::StatusOr<const CelList*> ListKeys() const override { return &keys_; }

private:
12 changes: 6 additions & 6 deletions bazel/repository_locations.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -162,12 +162,12 @@ REPOSITORY_LOCATIONS_SPEC = dict(
project_name = "Abseil",
project_desc = "Open source collection of C++ libraries drawn from the most fundamental pieces of Google’s internal codebase",
project_url = "https://abseil.io/",
version = "c8b33b0191a2db8364cacf94b267ea8a3f20ad83",
sha256 = "a7803eac00bf68eae1a84ee3b9fcf0c1173e8d9b89b2cee92c7b487ea65be2a9",
version = "20230802.0",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sha256 = "59d2976af9d6ecf001a81a35749a6e551a335b949d34918cfade07737b9d93c5",
strip_prefix = "abseil-cpp-{version}",
urls = ["https://github.com/abseil/abseil-cpp/archive/{version}.tar.gz"],
use_category = ["dataplane_core", "controlplane"],
release_date = "2023-05-16",
release_date = "2023-08-07",
cpe = "N/A",
license = "Apache-2.0",
license_url = "https://github.com/abseil/abseil-cpp/blob/{version}/LICENSE",
Expand Down Expand Up @@ -1201,8 +1201,8 @@ REPOSITORY_LOCATIONS_SPEC = dict(
project_name = "Common Expression Language (CEL) C++ library",
project_desc = "Common Expression Language (CEL) C++ library",
project_url = "https://opensource.google/projects/cel",
version = "da0aba702f44a41ec6d2eb4bbf6a9f01efc2746d",
sha256 = "d62b93fd07c6151749e83855157f3f2778d62c168318f9c40dfcfe1c336c496f",
version = "0abd738f9f54388452e6ebb0955eb039f9162b3d",
sha256 = "d163805320a782c5194b7496cdd5e8c9d9604eeffc1e531770cf6b130bc182fd",
strip_prefix = "cel-cpp-{version}",
urls = ["https://github.com/google/cel-cpp/archive/{version}.tar.gz"],
use_category = ["dataplane_ext"],
Expand All @@ -1222,7 +1222,7 @@ REPOSITORY_LOCATIONS_SPEC = dict(
"envoy.matching.inputs.cel_data_input",
"envoy.matching.matchers.cel_matcher",
],
release_date = "2023-03-08",
release_date = "2023-12-20",
cpe = "N/A",
),
com_github_google_flatbuffers = dict(
Expand Down
1 change: 1 addition & 0 deletions source/extensions/filters/common/expr/context.cc
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,7 @@ class FilterStateObjectWrapper : public google::api::expr::runtime::CelMap {
// Default stubs.
int size() const override { return 0; }
bool empty() const override { return true; }
using CelMap::ListKeys;
absl::StatusOr<const google::api::expr::runtime::CelList*> ListKeys() const override {
return &WrapperFields::get().Empty;
}
Expand Down
2 changes: 2 additions & 0 deletions source/extensions/filters/common/expr/context.h
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ template <class T> class HeadersWrapper : public google::api::expr::runtime::Cel
}
int size() const override { return ListKeys().value()->size(); }
bool empty() const override { return value_ == nullptr ? true : value_->empty(); }
using CelMap::ListKeys;
absl::StatusOr<const google::api::expr::runtime::CelList*> ListKeys() const override {
if (value_ == nullptr) {
return &WrapperFields::get().Empty;
Expand Down Expand Up @@ -158,6 +159,7 @@ class BaseWrapper : public google::api::expr::runtime::CelMap {
public:
BaseWrapper(Protobuf::Arena& arena) : arena_(arena) {}
int size() const override { return 0; }
using CelMap::ListKeys;
absl::StatusOr<const google::api::expr::runtime::CelList*> ListKeys() const override {
return absl::UnimplementedError("ListKeys() is not implemented");
}
Expand Down
Loading
Loading