diff options
author | Krzysztof Kosiński <krzysio@google.com> | 2023-08-23 18:44:47 +0000 |
---|---|---|
committer | Krzysztof Kosiński <krzysio@google.com> | 2023-08-30 22:47:28 +0000 |
commit | de20414400306c0898a63373ad400ecaf99b70ea (patch) | |
tree | 454af80df7c2323106bff65ddfad603a1ef3988a /third_party | |
parent | 60595ed9ec52ab5bd6780ae22b9a18da6dc788b5 (diff) | |
parent | e73882dc0fcedab1ffe789e44ed6254819639ce3 (diff) | |
download | grpc-grpc-de20414400306c0898a63373ad400ecaf99b70ea.tar.gz |
Upgrade gRPC to version 1.27.3.
Bug: 279548314
Test: presubmit
Change-Id: Ibebb444226b5c05bc4d8d2f87cf62f92fed40a65
Diffstat (limited to 'third_party')
-rw-r--r-- | third_party/BUILD | 1 | ||||
m--------- | third_party/libuv | 0 | ||||
-rw-r--r-- | third_party/libuv.BUILD | 199 | ||||
-rw-r--r-- | third_party/py/python_configure.bzl | 27 | ||||
-rw-r--r-- | third_party/six.BUILD | 10 | ||||
-rw-r--r-- | third_party/upb/BUILD | 58 | ||||
-rw-r--r-- | third_party/upb/CMakeLists.txt | 15 | ||||
-rw-r--r-- | third_party/upb/bazel/upb_proto_library.bzl | 3 | ||||
-rw-r--r-- | third_party/upb/bazel/workspace_deps.bzl | 4 | ||||
-rw-r--r-- | third_party/upb/upb/decode.c | 4 | ||||
-rw-r--r-- | third_party/upb/upb/port.c | 1 | ||||
-rw-r--r-- | third_party/upb/upb/port_def.inc | 4 | ||||
-rw-r--r-- | third_party/upb/upb/table.c | 3 |
13 files changed, 297 insertions, 32 deletions
diff --git a/third_party/BUILD b/third_party/BUILD index f013565223..646875bc59 100644 --- a/third_party/BUILD +++ b/third_party/BUILD @@ -10,4 +10,5 @@ exports_files([ "six.BUILD", "enum34.BUILD", "futures.BUILD", + "libuv.BUILD", ]) diff --git a/third_party/libuv b/third_party/libuv new file mode 160000 +Subproject 15ae750151ac9341e5945eb38f8982d59fb9920 diff --git a/third_party/libuv.BUILD b/third_party/libuv.BUILD new file mode 100644 index 0000000000..17446148d2 --- /dev/null +++ b/third_party/libuv.BUILD @@ -0,0 +1,199 @@ +COMMON_LIBUV_HEADERS = [ + "include/uv.h", + "include/uv/errno.h", + "include/uv/threadpool.h", + "include/uv/version.h", + "include/uv/tree.h", +] + +UNIX_LIBUV_HEADERS = [ + "include/uv/unix.h", + "src/unix/atomic-ops.h", + "src/unix/internal.h", + "src/unix/spinlock.h", +] + +LINUX_LIBUV_HEADERS = [ + "include/uv/linux.h", + "src/unix/linux-syscalls.h", +] + +ANDROID_LIBUV_HEADERS = [ + "include/uv/android-ifaddrs.h", +] + +DARWIN_LIBUV_HEADERS = [ + "include/uv/darwin.h", +] + +WINDOWS_LIBUV_HEADERS = [ + "include/uv/win.h", + "src/win/atomicops-inl.h", + "src/win/handle-inl.h", + "src/win/internal.h", + "src/win/req-inl.h", + "src/win/stream-inl.h", + "src/win/winapi.h", + "src/win/winsock.h", +] + +COMMON_LIBUV_SOURCES = [ + "src/fs-poll.c", + "src/heap-inl.h", + "src/idna.c", + "src/idna.h", + "src/inet.c", + "src/queue.h", + "src/strscpy.c", + "src/strscpy.h", + "src/threadpool.c", + "src/timer.c", + "src/uv-data-getter-setters.c", + "src/uv-common.c", + "src/uv-common.h", + "src/version.c", +] + +UNIX_LIBUV_SOURCES = [ + "src/unix/async.c", + "src/unix/atomic-ops.h", + "src/unix/core.c", + "src/unix/dl.c", + "src/unix/fs.c", + "src/unix/getaddrinfo.c", + "src/unix/getnameinfo.c", + "src/unix/internal.h", + "src/unix/loop.c", + "src/unix/loop-watcher.c", + "src/unix/pipe.c", + "src/unix/poll.c", + "src/unix/process.c", + "src/unix/signal.c", + "src/unix/spinlock.h", + "src/unix/stream.c", + "src/unix/tcp.c", + "src/unix/thread.c", + "src/unix/tty.c", + "src/unix/udp.c", +] + +LINUX_LIBUV_SOURCES = [ + "src/unix/linux-core.c", + "src/unix/linux-inotify.c", + "src/unix/linux-syscalls.c", + "src/unix/linux-syscalls.h", + "src/unix/procfs-exepath.c", + "src/unix/proctitle.c", + "src/unix/sysinfo-loadavg.c", + "src/unix/sysinfo-memory.c", +] + +ANDROID_LIBUV_SOURCES = [ + "src/unix/android-ifaddrs.c", + "src/unix/pthread-fixes.c", +] + +DARWIN_LIBUV_SOURCES = [ + "src/unix/bsd-ifaddrs.c", + "src/unix/darwin.c", + "src/unix/fsevents.c", + "src/unix/kqueue.c", + "src/unix/darwin-proctitle.c", + "src/unix/proctitle.c", +] + +WINDOWS_LIBUV_SOURCES = [ + "src/win/async.c", + "src/win/atomicops-inl.h", + "src/win/core.c", + "src/win/detect-wakeup.c", + "src/win/dl.c", + "src/win/error.c", + "src/win/fs-event.c", + "src/win/fs.c", + "src/win/getaddrinfo.c", + "src/win/getnameinfo.c", + "src/win/handle.c", + "src/win/handle-inl.h", + "src/win/internal.h", + "src/win/loop-watcher.c", + "src/win/pipe.c", + "src/win/poll.c", + "src/win/process-stdio.c", + "src/win/process.c", + "src/win/req-inl.h", + "src/win/signal.c", + "src/win/stream.c", + "src/win/stream-inl.h", + "src/win/tcp.c", + "src/win/thread.c", + "src/win/tty.c", + "src/win/udp.c", + "src/win/util.c", + "src/win/winapi.c", + "src/win/winapi.h", + "src/win/winsock.c", + "src/win/winsock.h", +] + +cc_library( + name = "libuv", + srcs = select({ + "//tools/cc_target_os:android": COMMON_LIBUV_SOURCES + UNIX_LIBUV_SOURCES + LINUX_LIBUV_SOURCES + ANDROID_LIBUV_SOURCES, + "//tools/cc_target_os:apple": COMMON_LIBUV_SOURCES + UNIX_LIBUV_SOURCES + DARWIN_LIBUV_SOURCES, + "//tools/cc_target_os:windows": COMMON_LIBUV_SOURCES + WINDOWS_LIBUV_SOURCES, + "//conditions:default": COMMON_LIBUV_SOURCES + UNIX_LIBUV_SOURCES + LINUX_LIBUV_SOURCES, + }), + hdrs = [ + "include/uv.h", + ] + select({ + "//tools/cc_target_os:android": COMMON_LIBUV_HEADERS + UNIX_LIBUV_HEADERS + LINUX_LIBUV_HEADERS + ANDROID_LIBUV_HEADERS, + "//tools/cc_target_os:apple": COMMON_LIBUV_HEADERS + UNIX_LIBUV_HEADERS + DARWIN_LIBUV_HEADERS, + "//tools/cc_target_os:windows": COMMON_LIBUV_HEADERS + WINDOWS_LIBUV_HEADERS, + "//conditions:default": COMMON_LIBUV_HEADERS + UNIX_LIBUV_HEADERS + LINUX_LIBUV_HEADERS, + }), + copts = [ + "-D_LARGEFILE_SOURCE", + "-D_FILE_OFFSET_BITS=64", + "-D_GNU_SOURCE", + "-pthread", + "--std=gnu89", + "-pedantic", + "-Wno-error", + "-Wno-strict-aliasing", + "-Wstrict-aliasing", + "-O2", + "-Wno-implicit-function-declaration", + "-Wno-unused-function", + "-Wno-unused-variable", + ] + select({ + "//tools/cc_target_os:apple": [], + "//tools/cc_target_os:windows": [ + "-DWIN32_LEAN_AND_MEAN", + "-D_WIN32_WINNT=0x0600", + ], + "//conditions:default": [ + "-Wno-tree-vrp", + "-Wno-omit-frame-pointer", + "-D_DARWIN_USE_64_BIT_INODE=1", + "-D_DARWIN_UNLIMITED_SELECT=1", + ], + }), + includes = [ + "include", + "src", + ], + linkopts = select({ + "//tools/cc_target_os:windows": [ + "-Xcrosstool-compilation-mode=$(COMPILATION_MODE)", + "-Wl,Iphlpapi.lib", + "-Wl,Psapi.lib", + "-Wl,User32.lib", + "-Wl,Userenv.lib", + ], + "//conditions:default": [], + }), + visibility = [ + "//visibility:public", + ], +) diff --git a/third_party/py/python_configure.bzl b/third_party/py/python_configure.bzl index e68220f470..34501c3212 100644 --- a/third_party/py/python_configure.bzl +++ b/third_party/py/python_configure.bzl @@ -13,6 +13,12 @@ _PYTHON2_LIB_PATH = "PYTHON2_LIB_PATH" _PYTHON3_BIN_PATH = "PYTHON3_BIN_PATH" _PYTHON3_LIB_PATH = "PYTHON3_LIB_PATH" +_HEADERS_HELP = ( + "Are Python headers installed? Try installing python-dev or " + + "python3-dev on Debian-based systems. Try python-devel or python3-devel " + + "on Redhat-based systems." +) + def _tpl(repository_ctx, tpl, substitutions = {}, out = None): if not out: out = tpl @@ -229,13 +235,28 @@ def _get_python_include(repository_ctx, python_bin): "from distutils import sysconfig;" + "print(sysconfig.get_python_inc())", ], - error_msg = "Problem getting python include path.", + error_msg = "Problem getting python include path for {}.".format(python_bin), error_details = ( "Is the Python binary path set up right? " + "(See ./configure or " + - _PYTHON2_BIN_PATH + ".) " + "Is distutils installed?" + python_bin + ".) " + "Is distutils installed? " + + _HEADERS_HELP ), ) - return result.stdout.splitlines()[0] + include_path = result.stdout.splitlines()[0] + _execute( + repository_ctx, + [ + python_bin, + "-c", + "import os;" + + "main_header = os.path.join('{}', 'Python.h');".format(include_path) + + "assert os.path.exists(main_header), main_header + ' does not exist.'" + ], + error_msg = "Unable to find Python headers for {}".format(python_bin), + error_details = _HEADERS_HELP, + empty_stdout_fine = True, + ) + return include_path def _get_python_import_lib_name(repository_ctx, python_bin, bin_path_key): """Get Python import library name (pythonXY.lib) on Windows.""" diff --git a/third_party/six.BUILD b/third_party/six.BUILD index 60dc781149..b048db024c 100644 --- a/third_party/six.BUILD +++ b/third_party/six.BUILD @@ -1,6 +1,14 @@ +genrule( + name = "copy_six", + srcs = ["six-1.12.0/six.py"], + outs = ["__init__.py"], + cmd = "cp $< $(@)", +) + py_library( name = "six", - srcs = ["six.py"], + srcs = ["__init__.py"], srcs_version = "PY2AND3", visibility = ["//visibility:public"], ) + diff --git a/third_party/upb/BUILD b/third_party/upb/BUILD index 040d97c79c..fa2ad904f4 100644 --- a/third_party/upb/BUILD +++ b/third_party/upb/BUILD @@ -55,6 +55,17 @@ config_setting( # Public C/C++ libraries ####################################################### cc_library( + name = "port", + textual_hdrs = [ + "upb/port_def.inc", + "upb/port_undef.inc", + ], + srcs = [ + "upb/port.c", + ], +) + +cc_library( name = "upb", srcs = [ "upb/decode.c", @@ -62,9 +73,6 @@ cc_library( "upb/generated_util.h", "upb/msg.c", "upb/msg.h", - "upb/port.c", - "upb/port_def.inc", - "upb/port_undef.inc", "upb/table.c", "upb/table.int.h", "upb/upb.c", @@ -79,6 +87,7 @@ cc_library( "//conditions:default": COPTS, }), visibility = ["//visibility:public"], + deps = [":port"], ) # Common support routines used by generated code. This library has no @@ -92,17 +101,17 @@ cc_library( hdrs = [ "upb/generated_util.h", "upb/msg.h", + "upb/port_def.inc", + "upb/port_undef.inc", ], copts = select({ ":windows": [], "//conditions:default": COPTS, }), - textual_hdrs = [ - "upb/port_def.inc", - "upb/port_undef.inc", - ], visibility = ["//visibility:public"], - deps = [":upb"], + deps = [ + ":upb", + ], ) upb_proto_library( @@ -128,6 +137,7 @@ cc_library( visibility = ["//visibility:public"], deps = [ ":descriptor_upbproto", + ":port", ":table", ":upb", ], @@ -138,7 +148,10 @@ cc_library( cc_library( name = "table", hdrs = ["upb/table.int.h"], - deps = [":upb"], + deps = [ + ":port", + ":upb", + ], ) # Legacy C/C++ Libraries (not recommended for new code) ######################## @@ -146,6 +159,7 @@ cc_library( cc_library( name = "legacy_msg_reflection", srcs = [ + "upb/msg.h", "upb/legacy_msg_reflection.c", ], hdrs = ["upb/legacy_msg_reflection.h"], @@ -154,6 +168,7 @@ cc_library( "//conditions:default": COPTS, }), deps = [ + ":port", ":table", ":upb", ], @@ -176,6 +191,7 @@ cc_library( }), deps = [ ":reflection", + ":port", ":table", ":upb", ], @@ -205,6 +221,7 @@ cc_library( ":descriptor_upbproto", ":handlers", ":reflection", + ":port", ":table", ":upb", ], @@ -240,6 +257,7 @@ cc_library( deps = [ ":descriptor_upbproto", ":handlers", + ":port", ":upb", ], ) @@ -259,9 +277,9 @@ cc_library( "//conditions:default": CPPOPTS, }), deps = [ - "@absl//absl/base:core_headers", - "@absl//absl/container:flat_hash_map", - "@absl//absl/strings", + "@com_google_absl//absl/base:core_headers", + "@com_google_absl//absl/container:flat_hash_map", + "@com_google_absl//absl/strings", "@com_google_protobuf//:protobuf", "@com_google_protobuf//:protoc_lib", ], @@ -286,6 +304,11 @@ cc_binary( # C/C++ tests ################################################################## +upb_proto_reflection_library( + name = "descriptor_upbreflection", + deps = ["@com_google_protobuf//:descriptor_proto"], +) + cc_binary( name = "benchmark", testonly = 1, @@ -313,6 +336,7 @@ cc_library( }), deps = [ ":handlers", + ":port", ":upb", ], ) @@ -328,6 +352,7 @@ cc_test( "//conditions:default": COPTS, }), deps = [ + ":port", ":upb", ":upb_pb", ":upb_test", @@ -358,6 +383,7 @@ cc_test( }), deps = [ ":handlers", + ":port", ":test_decoder_upbproto", ":upb", ":upb_pb", @@ -386,6 +412,7 @@ cc_test( }), deps = [ ":handlers", + ":port", ":reflection", ":test_cpp_upbproto", ":upb", @@ -402,6 +429,7 @@ cc_test( "//conditions:default": CPPOPTS, }), deps = [ + ":port", ":table", ":upb", ":upb_test", @@ -431,11 +459,6 @@ cc_binary( ) # copybara:strip_for_google3_begin -upb_proto_reflection_library( - name = "descriptor_upbreflection", - deps = ["@com_google_protobuf//:descriptor_proto"], -) - cc_test( name = "test_encoder", srcs = ["tests/pb/test_encoder.cc"], @@ -563,6 +586,7 @@ upb_amalgamation( ":descriptor_upbproto", ":reflection", ":handlers", + ":port", ":upb_pb", ":upb_json", ], diff --git a/third_party/upb/CMakeLists.txt b/third_party/upb/CMakeLists.txt index 836c5ff1fe..96b265dd3a 100644 --- a/third_party/upb/CMakeLists.txt +++ b/third_party/upb/CMakeLists.txt @@ -60,21 +60,22 @@ endif() enable_testing() +add_library(port + upb/port.c) add_library(upb upb/decode.c upb/encode.c upb/generated_util.h upb/msg.c upb/msg.h - upb/port.c - upb/port_def.inc - upb/port_undef.inc upb/table.c upb/table.int.h upb/upb.c upb/decode.h upb/encode.h upb/upb.h) +target_link_libraries(upb + port) add_library(generated_code_support__only_for_generated_code_do_not_use__i_give_permission_to_break_me INTERFACE) target_link_libraries(generated_code_support__only_for_generated_code_do_not_use__i_give_permission_to_break_me INTERFACE upb) @@ -85,15 +86,19 @@ add_library(reflection upb/msgfactory.h) target_link_libraries(reflection descriptor_upbproto + port table upb) add_library(table INTERFACE) target_link_libraries(table INTERFACE + port upb) add_library(legacy_msg_reflection + upb/msg.h upb/legacy_msg_reflection.c upb/legacy_msg_reflection.h) target_link_libraries(legacy_msg_reflection + port table upb) add_library(handlers @@ -104,6 +109,7 @@ add_library(handlers upb/sink.h) target_link_libraries(handlers reflection + port table upb) add_library(upb_pb @@ -121,6 +127,7 @@ target_link_libraries(upb_pb descriptor_upbproto handlers reflection + port table upb) add_library(upb_json @@ -135,6 +142,7 @@ add_library(upb_cc_bindings INTERFACE) target_link_libraries(upb_cc_bindings INTERFACE descriptor_upbproto handlers + port upb) add_library(upb_test tests/testmain.cc @@ -142,6 +150,7 @@ add_library(upb_test tests/upb_test.h) target_link_libraries(upb_test handlers + port upb) diff --git a/third_party/upb/bazel/upb_proto_library.bzl b/third_party/upb/bazel/upb_proto_library.bzl index fd48ef91a7..bea611776c 100644 --- a/third_party/upb/bazel/upb_proto_library.bzl +++ b/third_party/upb/bazel/upb_proto_library.bzl @@ -8,7 +8,7 @@ load("@bazel_tools//tools/cpp:toolchain_utils.bzl", "find_cpp_toolchain") # copybara:strip_for_google3_begin load("@bazel_skylib//lib:versions.bzl", "versions") -load("@bazel_version//:bazel_version.bzl", "bazel_version") +load("@upb_bazel_version//:bazel_version.bzl", "bazel_version") # copybara:strip_end # Generic support code ######################################################### @@ -279,6 +279,7 @@ _upb_proto_reflection_library_aspect = aspect( ), "_upb": attr.label_list( default = [ + "//:generated_code_support__only_for_generated_code_do_not_use__i_give_permission_to_break_me", "//:upb", "//:reflection", ], diff --git a/third_party/upb/bazel/workspace_deps.bzl b/third_party/upb/bazel/workspace_deps.bzl index 5034b75c31..4aec3ebbd8 100644 --- a/third_party/upb/bazel/workspace_deps.bzl +++ b/third_party/upb/bazel/workspace_deps.bzl @@ -4,11 +4,11 @@ load("//bazel:repository_defs.bzl", "bazel_version_repository") def upb_deps(): bazel_version_repository( - name = "bazel_version", + name = "upb_bazel_version", ) git_repository( - name = "absl", + name = "com_google_absl", commit = "070f6e47b33a2909d039e620c873204f78809492", remote = "https://github.com/abseil/abseil-cpp.git", shallow_since = "1541627663 -0500", diff --git a/third_party/upb/upb/decode.c b/third_party/upb/upb/decode.c index 4f07988595..4672b1b84b 100644 --- a/third_party/upb/upb/decode.c +++ b/third_party/upb/upb/decode.c @@ -249,6 +249,10 @@ static upb_msg *upb_addmsg(upb_decframe *frame, upb_msg *submsg; upb_array *arr = upb_getorcreatearr(frame, field); + UPB_ASSERT(field->label == UPB_LABEL_REPEATED); + UPB_ASSERT(field->descriptortype == UPB_DESCRIPTOR_TYPE_MESSAGE || + field->descriptortype == UPB_DESCRIPTOR_TYPE_GROUP); + *subm = frame->layout->submsgs[field->submsg_index]; submsg = upb_msg_new(*subm, frame->state->arena); CHK(submsg); diff --git a/third_party/upb/upb/port.c b/third_party/upb/upb/port.c index 023f7dc0ce..9ecf135167 100644 --- a/third_party/upb/upb/port.c +++ b/third_party/upb/upb/port.c @@ -1,5 +1,4 @@ -#include "upb/upb.h" #include "upb/port_def.inc" #ifdef UPB_MSVC_VSNPRINTF diff --git a/third_party/upb/upb/port_def.inc b/third_party/upb/upb/port_def.inc index a8967b3679..b416eaeaf1 100644 --- a/third_party/upb/upb/port_def.inc +++ b/third_party/upb/upb/port_def.inc @@ -20,9 +20,7 @@ * * This file is private and must not be included by users! */ -#ifndef UINTPTR_MAX -#error must include stdint.h first -#endif +#include <stdint.h> #if UINTPTR_MAX == 0xffffffff #define UPB_SIZE(size32, size64) size32 diff --git a/third_party/upb/upb/table.c b/third_party/upb/upb/table.c index 8896d217db..fd5bc53f96 100644 --- a/third_party/upb/upb/table.c +++ b/third_party/upb/upb/table.c @@ -756,7 +756,8 @@ uint32_t upb_murmur_hash2(const void *key, size_t len, uint32_t seed) { /* Mix 4 bytes at a time into the hash */ const uint8_t * data = (const uint8_t *)key; while(len >= 4) { - uint32_t k = *(uint32_t *)data; + uint32_t k; + memcpy(&k, data, sizeof(k)); k *= m; k ^= k >> r; |