-
Notifications
You must be signed in to change notification settings - Fork 6.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
12a070a
commit 5f5ff5b
Showing
5 changed files
with
165 additions
and
165 deletions.
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 |
---|---|---|
@@ -1,47 +1,47 @@ | ||
diff --git a/src/core/ext/transport/chttp2/transport/hpack_parser.cc b/src/core/ext/transport/chttp2/transport/hpack_parser.cc | ||
index cb17759bba..a3c3598430 100644 | ||
--- a/src/core/ext/transport/chttp2/transport/hpack_parser.cc | ||
+++ b/src/core/ext/transport/chttp2/transport/hpack_parser.cc | ||
@@ -1032,7 +1032,7 @@ class HPackParser::Parser { | ||
private: | ||
void GPR_ATTRIBUTE_NOINLINE LogHeader(const HPackTable::Memento& memento) { | ||
- const char* type; | ||
+ const char* type = nullptr; | ||
switch (log_info_.type) { | ||
case LogInfo::kHeaders: | ||
type = "HDR"; | ||
diff --git a/src/core/lib/slice/slice.cc b/src/core/lib/slice/slice.cc | ||
index 2e78b4de9e..77e88cab70 100644 | ||
--- a/src/core/lib/slice/slice.cc | ||
+++ b/src/core/lib/slice/slice.cc | ||
@@ -181,6 +181,7 @@ grpc_slice grpc_slice_from_moved_buffer(grpc_core::UniquePtr<char> p, | ||
size_t len) { | ||
uint8_t* ptr = reinterpret_cast<uint8_t*>(p.get()); | ||
grpc_slice slice; | ||
+ memset(&slice, 0, sizeof(grpc_slice)); | ||
if (len <= sizeof(slice.data.inlined.bytes)) { | ||
slice.refcount = nullptr; | ||
slice.data.inlined.length = len; | ||
@@ -199,7 +200,7 @@ grpc_slice grpc_slice_from_moved_string(grpc_core::UniquePtr<char> p) { | ||
} | ||
grpc_slice grpc_slice_from_cpp_string(std::string str) { | ||
- grpc_slice slice; | ||
+ grpc_slice slice = { 0 }; | ||
if (str.size() <= sizeof(slice.data.inlined.bytes)) { | ||
slice.refcount = nullptr; | ||
slice.data.inlined.length = str.size(); | ||
diff --git a/src/core/lib/surface/server.cc b/src/core/lib/surface/server.cc | ||
index 4c0220837e..bb5a367107 100644 | ||
--- a/src/core/lib/surface/server.cc | ||
+++ b/src/core/lib/surface/server.cc | ||
@@ -902,7 +902,7 @@ grpc_call_error Server::QueueRequestedCall(size_t cq_idx, RequestedCall* rc) { | ||
GRPC_ERROR_CREATE_FROM_STATIC_STRING("Server Shutdown")); | ||
return GRPC_CALL_OK; | ||
} | ||
- RequestMatcherInterface* rm; | ||
+ RequestMatcherInterface* rm = nullptr; | ||
switch (rc->type) { | ||
case RequestedCall::Type::BATCH_CALL: | ||
rm = unregistered_request_matcher_.get(); | ||
diff --git a/src/core/ext/transport/chttp2/transport/hpack_parser.cc b/src/core/ext/transport/chttp2/transport/hpack_parser.cc | ||
index cb17759bba..a3c3598430 100644 | ||
--- a/src/core/ext/transport/chttp2/transport/hpack_parser.cc | ||
+++ b/src/core/ext/transport/chttp2/transport/hpack_parser.cc | ||
@@ -1032,7 +1032,7 @@ class HPackParser::Parser { | ||
|
||
private: | ||
void GPR_ATTRIBUTE_NOINLINE LogHeader(const HPackTable::Memento& memento) { | ||
- const char* type; | ||
+ const char* type = nullptr; | ||
switch (log_info_.type) { | ||
case LogInfo::kHeaders: | ||
type = "HDR"; | ||
diff --git a/src/core/lib/slice/slice.cc b/src/core/lib/slice/slice.cc | ||
index 2e78b4de9e..77e88cab70 100644 | ||
--- a/src/core/lib/slice/slice.cc | ||
+++ b/src/core/lib/slice/slice.cc | ||
@@ -181,6 +181,7 @@ grpc_slice grpc_slice_from_moved_buffer(grpc_core::UniquePtr<char> p, | ||
size_t len) { | ||
uint8_t* ptr = reinterpret_cast<uint8_t*>(p.get()); | ||
grpc_slice slice; | ||
+ memset(&slice, 0, sizeof(grpc_slice)); | ||
if (len <= sizeof(slice.data.inlined.bytes)) { | ||
slice.refcount = nullptr; | ||
slice.data.inlined.length = len; | ||
@@ -199,7 +200,7 @@ grpc_slice grpc_slice_from_moved_string(grpc_core::UniquePtr<char> p) { | ||
} | ||
|
||
grpc_slice grpc_slice_from_cpp_string(std::string str) { | ||
- grpc_slice slice; | ||
+ grpc_slice slice = { 0 }; | ||
if (str.size() <= sizeof(slice.data.inlined.bytes)) { | ||
slice.refcount = nullptr; | ||
slice.data.inlined.length = str.size(); | ||
diff --git a/src/core/lib/surface/server.cc b/src/core/lib/surface/server.cc | ||
index 4c0220837e..bb5a367107 100644 | ||
--- a/src/core/lib/surface/server.cc | ||
+++ b/src/core/lib/surface/server.cc | ||
@@ -902,7 +902,7 @@ grpc_call_error Server::QueueRequestedCall(size_t cq_idx, RequestedCall* rc) { | ||
GRPC_ERROR_CREATE_FROM_STATIC_STRING("Server Shutdown")); | ||
return GRPC_CALL_OK; | ||
} | ||
- RequestMatcherInterface* rm; | ||
+ RequestMatcherInterface* rm = nullptr; | ||
switch (rc->type) { | ||
case RequestedCall::Type::BATCH_CALL: | ||
rm = unregistered_request_matcher_.get(); |
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 |
---|---|---|
@@ -1,91 +1,91 @@ | ||
diff --git a/CMakeLists.txt b/CMakeLists.txt | ||
index 23098aa578..a8e8bc274b 100644 | ||
--- a/CMakeLists.txt | ||
+++ b/CMakeLists.txt | ||
@@ -85,6 +85,9 @@ set_property(CACHE gRPC_SSL_PROVIDER PROPERTY STRINGS "module" "package") | ||
set(gRPC_PROTOBUF_PROVIDER "module" CACHE STRING "Provider of protobuf library") | ||
set_property(CACHE gRPC_PROTOBUF_PROVIDER PROPERTY STRINGS "module" "package") | ||
+set(gRPC_UPB_PROVIDER "module" CACHE STRING "Provider of upb library") | ||
+set_property(CACHE gRPC_UPB_PROVIDER PROPERTY STRINGS "module" "package") | ||
+ | ||
set(gRPC_PROTOBUF_PACKAGE_TYPE "" CACHE STRING "Algorithm for searching protobuf package") | ||
set_property(CACHE gRPC_PROTOBUF_PACKAGE_TYPE PROPERTY STRINGS "CONFIG" "MODULE") | ||
@@ -1631,6 +1634,7 @@ target_link_libraries(gpr | ||
absl::time | ||
absl::optional | ||
absl::variant | ||
+ ${_gRPC_UPB_LIBRARIES} | ||
) | ||
if(_gRPC_PLATFORM_ANDROID) | ||
target_link_libraries(gpr | ||
@@ -2435,7 +2439,6 @@ target_link_libraries(grpc | ||
gpr | ||
${_gRPC_SSL_LIBRARIES} | ||
address_sorting | ||
- upb | ||
) | ||
if(_gRPC_PLATFORM_IOS OR _gRPC_PLATFORM_MAC) | ||
target_link_libraries(grpc "-framework CoreFoundation") | ||
@@ -2979,7 +2982,6 @@ target_link_libraries(grpc_unsecure | ||
absl::utility | ||
gpr | ||
address_sorting | ||
- upb | ||
) | ||
if(_gRPC_PLATFORM_IOS OR _gRPC_PLATFORM_MAC) | ||
target_link_libraries(grpc_unsecure "-framework CoreFoundation") | ||
@@ -4251,6 +4253,7 @@ endif() | ||
endif() | ||
+if (gRPC_UPB_PROVIDER STREQUAL "module") | ||
add_library(upb | ||
third_party/upb/third_party/utf8_range/naive.c | ||
third_party/upb/third_party/utf8_range/range2-neon.c | ||
@@ -4319,7 +4322,7 @@ if(gRPC_INSTALL) | ||
ARCHIVE DESTINATION ${gRPC_INSTALL_LIBDIR} | ||
) | ||
endif() | ||
- | ||
+endif() | ||
if(gRPC_BUILD_TESTS) | ||
diff --git a/cmake/gRPCConfig.cmake.in b/cmake/gRPCConfig.cmake.in | ||
index 3623f4aa5e..df6ced560e 100644 | ||
--- a/cmake/gRPCConfig.cmake.in | ||
+++ b/cmake/gRPCConfig.cmake.in | ||
@@ -8,6 +8,7 @@ list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/modules) | ||
@_gRPC_FIND_CARES@ | ||
@_gRPC_FIND_ABSL@ | ||
@_gRPC_FIND_RE2@ | ||
+@_gRPC_FIND_UPB@ | ||
# Targets | ||
include(${CMAKE_CURRENT_LIST_DIR}/gRPCTargets.cmake) | ||
diff --git a/cmake/upb.cmake b/cmake/upb.cmake | ||
index f2a0e508c3..09751f5ef0 100644 | ||
--- a/cmake/upb.cmake | ||
+++ b/cmake/upb.cmake | ||
@@ -12,9 +12,19 @@ | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
+set(_gRPC_UPB_GRPC_GENERATED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/src/core/ext/upb-generated" "${CMAKE_CURRENT_SOURCE_DIR}/src/core/ext/upbdefs-generated") | ||
+if (gRPC_UPB_PROVIDER STREQUAL "module") | ||
+ | ||
set(UPB_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/third_party/upb) | ||
set(_gRPC_UPB_INCLUDE_DIR "${UPB_ROOT_DIR}") | ||
set(_gRPC_UPB_GRPC_GENERATED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/src/core/ext/upb-generated" "${CMAKE_CURRENT_SOURCE_DIR}/src/core/ext/upbdefs-generated") | ||
set(_gRPC_UPB_LIBRARIES upb) | ||
+ | ||
+elseif(gRPC_UPB_PROVIDER STREQUAL "package") | ||
+ find_package(upb CONFIG REQUIRED) | ||
+ set(_gRPC_UPB_LIBRARIES upb::fastdecode upb::json upb::upb upb::utf8_range upb::textformat upb::reflection upb::descriptor_upb_proto) | ||
+ set(_gRPC_UPB_INCLUDE_DIR) | ||
+ set(_gRPC_FIND_UPB "if(NOT upb_FOUND)\n find_package(upb CONFIG REQUIRED)\nendif()") | ||
+endif() | ||
diff --git a/CMakeLists.txt b/CMakeLists.txt | ||
index 23098aa578..a8e8bc274b 100644 | ||
--- a/CMakeLists.txt | ||
+++ b/CMakeLists.txt | ||
@@ -85,6 +85,9 @@ set_property(CACHE gRPC_SSL_PROVIDER PROPERTY STRINGS "module" "package") | ||
set(gRPC_PROTOBUF_PROVIDER "module" CACHE STRING "Provider of protobuf library") | ||
set_property(CACHE gRPC_PROTOBUF_PROVIDER PROPERTY STRINGS "module" "package") | ||
|
||
+set(gRPC_UPB_PROVIDER "module" CACHE STRING "Provider of upb library") | ||
+set_property(CACHE gRPC_UPB_PROVIDER PROPERTY STRINGS "module" "package") | ||
+ | ||
set(gRPC_PROTOBUF_PACKAGE_TYPE "" CACHE STRING "Algorithm for searching protobuf package") | ||
set_property(CACHE gRPC_PROTOBUF_PACKAGE_TYPE PROPERTY STRINGS "CONFIG" "MODULE") | ||
|
||
@@ -1631,6 +1634,7 @@ target_link_libraries(gpr | ||
absl::time | ||
absl::optional | ||
absl::variant | ||
+ ${_gRPC_UPB_LIBRARIES} | ||
) | ||
if(_gRPC_PLATFORM_ANDROID) | ||
target_link_libraries(gpr | ||
@@ -2435,7 +2439,6 @@ target_link_libraries(grpc | ||
gpr | ||
${_gRPC_SSL_LIBRARIES} | ||
address_sorting | ||
- upb | ||
) | ||
if(_gRPC_PLATFORM_IOS OR _gRPC_PLATFORM_MAC) | ||
target_link_libraries(grpc "-framework CoreFoundation") | ||
@@ -2979,7 +2982,6 @@ target_link_libraries(grpc_unsecure | ||
absl::utility | ||
gpr | ||
address_sorting | ||
- upb | ||
) | ||
if(_gRPC_PLATFORM_IOS OR _gRPC_PLATFORM_MAC) | ||
target_link_libraries(grpc_unsecure "-framework CoreFoundation") | ||
@@ -4251,6 +4253,7 @@ endif() | ||
|
||
endif() | ||
|
||
+if (gRPC_UPB_PROVIDER STREQUAL "module") | ||
add_library(upb | ||
third_party/upb/third_party/utf8_range/naive.c | ||
third_party/upb/third_party/utf8_range/range2-neon.c | ||
@@ -4319,7 +4322,7 @@ if(gRPC_INSTALL) | ||
ARCHIVE DESTINATION ${gRPC_INSTALL_LIBDIR} | ||
) | ||
endif() | ||
- | ||
+endif() | ||
|
||
if(gRPC_BUILD_TESTS) | ||
|
||
diff --git a/cmake/gRPCConfig.cmake.in b/cmake/gRPCConfig.cmake.in | ||
index 3623f4aa5e..df6ced560e 100644 | ||
--- a/cmake/gRPCConfig.cmake.in | ||
+++ b/cmake/gRPCConfig.cmake.in | ||
@@ -8,6 +8,7 @@ list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/modules) | ||
@_gRPC_FIND_CARES@ | ||
@_gRPC_FIND_ABSL@ | ||
@_gRPC_FIND_RE2@ | ||
+@_gRPC_FIND_UPB@ | ||
|
||
# Targets | ||
include(${CMAKE_CURRENT_LIST_DIR}/gRPCTargets.cmake) | ||
diff --git a/cmake/upb.cmake b/cmake/upb.cmake | ||
index f2a0e508c3..09751f5ef0 100644 | ||
--- a/cmake/upb.cmake | ||
+++ b/cmake/upb.cmake | ||
@@ -12,9 +12,19 @@ | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
+set(_gRPC_UPB_GRPC_GENERATED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/src/core/ext/upb-generated" "${CMAKE_CURRENT_SOURCE_DIR}/src/core/ext/upbdefs-generated") | ||
+if (gRPC_UPB_PROVIDER STREQUAL "module") | ||
+ | ||
set(UPB_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/third_party/upb) | ||
|
||
set(_gRPC_UPB_INCLUDE_DIR "${UPB_ROOT_DIR}") | ||
set(_gRPC_UPB_GRPC_GENERATED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/src/core/ext/upb-generated" "${CMAKE_CURRENT_SOURCE_DIR}/src/core/ext/upbdefs-generated") | ||
|
||
set(_gRPC_UPB_LIBRARIES upb) | ||
+ | ||
+elseif(gRPC_UPB_PROVIDER STREQUAL "package") | ||
+ find_package(upb CONFIG REQUIRED) | ||
+ set(_gRPC_UPB_LIBRARIES upb::fastdecode upb::json upb::upb upb::utf8_range upb::textformat upb::reflection upb::descriptor_upb_proto) | ||
+ set(_gRPC_UPB_INCLUDE_DIR) | ||
+ set(_gRPC_FIND_UPB "if(NOT upb_FOUND)\n find_package(upb CONFIG REQUIRED)\nendif()") | ||
+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 |
---|---|---|
@@ -1,16 +1,16 @@ | ||
diff --git a/CMakeLists.txt b/CMakeLists.txt | ||
index 25990a5d8a..ba8df92858 100644 | ||
--- a/CMakeLists.txt | ||
+++ b/CMakeLists.txt | ||
@@ -326,6 +326,11 @@ include(cmake/xxhash.cmake) | ||
include(cmake/zlib.cmake) | ||
include(cmake/download_archive.cmake) | ||
+if (ABSL_USE_CXX17) | ||
+ message(STATUS "Found absl uses CXX17, enable CXX17 feature.") | ||
+ set(CMAKE_CXX_STANDARD 17) | ||
+endif() | ||
+ | ||
# Setup external proto library at third_party/envoy-api with 2 download URLs | ||
if (NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/third_party/envoy-api) | ||
# Download the archive via HTTP, validate the checksum, and extract to third_party/envoy-api. | ||
diff --git a/CMakeLists.txt b/CMakeLists.txt | ||
index 25990a5d8a..ba8df92858 100644 | ||
--- a/CMakeLists.txt | ||
+++ b/CMakeLists.txt | ||
@@ -326,6 +326,11 @@ include(cmake/xxhash.cmake) | ||
include(cmake/zlib.cmake) | ||
include(cmake/download_archive.cmake) | ||
|
||
+if (ABSL_USE_CXX17) | ||
+ message(STATUS "Found absl uses CXX17, enable CXX17 feature.") | ||
+ set(CMAKE_CXX_STANDARD 17) | ||
+endif() | ||
+ | ||
# Setup external proto library at third_party/envoy-api with 2 download URLs | ||
if (NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/third_party/envoy-api) | ||
# Download the archive via HTTP, validate the checksum, and extract to third_party/envoy-api. |
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 |
---|---|---|
@@ -1,10 +1,10 @@ | ||
file(GLOB GRPC_PLUGINS "${_IMPORT_PREFIX}/../@HOST_TRIPLET@/tools/grpc/grpc_*_plugin*") | ||
|
||
foreach(PLUGIN ${GRPC_PLUGINS}) | ||
get_filename_component(PLUGIN_NAME "${PLUGIN}" NAME_WE) | ||
add_executable(gRPC::${PLUGIN_NAME} IMPORTED) | ||
set_property(TARGET gRPC::${PLUGIN_NAME} APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE) | ||
set_target_properties(gRPC::${PLUGIN_NAME} PROPERTIES | ||
IMPORTED_LOCATION_RELEASE "${PLUGIN}" | ||
) | ||
endforeach() | ||
file(GLOB GRPC_PLUGINS "${_IMPORT_PREFIX}/../@HOST_TRIPLET@/tools/grpc/grpc_*_plugin*") | ||
|
||
foreach(PLUGIN ${GRPC_PLUGINS}) | ||
get_filename_component(PLUGIN_NAME "${PLUGIN}" NAME_WE) | ||
add_executable(gRPC::${PLUGIN_NAME} IMPORTED) | ||
set_property(TARGET gRPC::${PLUGIN_NAME} APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE) | ||
set_target_properties(gRPC::${PLUGIN_NAME} PROPERTIES | ||
IMPORTED_LOCATION_RELEASE "${PLUGIN}" | ||
) | ||
endforeach() |
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