-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Patch cel-cpp to not break build #31894
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
From 09a072b4bb5a75e1df15beba29a9f13b1948ff8b Mon Sep 17 00:00:00 2001 | ||
From: Ivan Prisyazhnyy <[email protected]> | ||
Date: Thu, 18 Jan 2024 13:55:29 +0000 | ||
Subject: [PATCH] Fix: use of sized deallocation in base/memory.h wo check | ||
|
||
Dependant projects that do not use `-fsized-deallocation` | ||
would not compile with the call to delete(void*, size_t, align). | ||
|
||
There are other places that already check for | ||
`defined(__cpp_sized_deallocation)` and this patch just shares | ||
this practice. | ||
|
||
Testing: | ||
|
||
// fix .bazelrc to have: | ||
build --cxxopt=-fno-sized-deallocation | ||
|
||
$ bazel build --verbose_failures //base:\* | ||
|
||
Signed-off-by: Ivan Prisyazhnyy <[email protected]> | ||
--- | ||
base/memory.h | 8 +++++++- | ||
1 file changed, 7 insertions(+), 1 deletion(-) | ||
|
||
diff --git a/base/memory.h b/base/memory.h | ||
index 3552e19a..c310128a 100644 | ||
--- a/base/memory.h | ||
+++ b/base/memory.h | ||
@@ -89,8 +89,14 @@ class Allocator { | ||
|
||
void deallocate(pointer p, size_type n) { | ||
if (!allocation_only_) { | ||
- ::operator delete(static_cast<void*>(p), n * sizeof(T), | ||
+#if defined(__cpp_sized_deallocation) && __cpp_sized_deallocation >= 201309L | ||
+ ::operator delete(static_cast<void *>(p), n * sizeof(T), | ||
static_cast<std::align_val_t>(alignof(T))); | ||
+#else | ||
+ ::operator delete(static_cast<void *>(p), | ||
+ static_cast<std::align_val_t>(alignof(T))); | ||
+ static_cast<void>(n); // unused | ||
+#endif | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -702,7 +702,10 @@ def _com_github_facebook_zstd(): | |
def _com_google_cel_cpp(): | ||
external_http_archive( | ||
"com_google_cel_cpp", | ||
patches = ["@envoy//bazel:cel-cpp.patch"], | ||
patches = [ | ||
"@envoy//bazel:cel-cpp.patch", | ||
"@envoy//bazel:cel-cpp-memory.patch", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. lets just use existing patch - no? |
||
], | ||
patch_args = ["-p1"], | ||
) | ||
|
||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think we dont want the commit header - just the diff