Merge branch 'master' into maps

pull/13171/head
Joshua Haberman 5 years ago
commit 4c1a97ae9c
  1. 48
      BUILD
  2. 9
      CMakeLists.txt
  3. 2
      bazel/workspace_deps.bzl
  4. 4
      upb/decode.c
  5. 1
      upb/port.c
  6. 4
      upb/port_def.inc
  7. 3
      upb/table.c

48
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 = [
@ -62,9 +73,6 @@ cc_library(
"upb/encode.c",
"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
@ -96,12 +105,11 @@ cc_library(
":windows": [],
"//conditions:default": COPTS
}),
textual_hdrs = [
"upb/port_def.inc",
"upb/port_undef.inc",
],
visibility = ["//visibility:public"],
deps = [":upb"],
deps = [
":port",
":upb",
],
)
upb_proto_library(
@ -137,7 +145,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) ########################
@ -242,9 +253,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",
],
@ -269,6 +280,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,
@ -423,11 +439,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"],
@ -556,6 +567,7 @@ upb_amalgamation(
":descriptor_upbproto",
":reflection",
":handlers",
":port",
":upb_pb",
":upb_json",
],
@ -619,7 +631,7 @@ cc_binary(
}),
visibility = ["//visibility:public"],
deps = [
"@absl//absl/strings",
"@com_google_absl//absl/strings",
"@com_google_protobuf//:protoc_lib"
],
)

@ -60,22 +60,24 @@ endif()
enable_testing()
add_library(port
upb/port.c)
add_library(upb
upb/decode.c
upb/encode.c
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
port
upb)
add_library(reflection
upb/def.c
@ -88,6 +90,7 @@ target_link_libraries(reflection
upb)
add_library(table INTERFACE)
target_link_libraries(table INTERFACE
port
upb)
add_library(handlers
upb/handlers.c

@ -9,7 +9,7 @@ def upb_deps():
)
git_repository(
name = "absl",
name = "com_google_absl",
commit = "070f6e47b33a2909d039e620c873204f78809492",
remote = "https://github.com/abseil/abseil-cpp.git",
shallow_since = "1541627663 -0500",

@ -250,6 +250,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);

@ -1,5 +1,4 @@
#include "upb/upb.h"
#include "upb/port_def.inc"
#ifdef UPB_MSVC_VSNPRINTF

@ -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

@ -732,7 +732,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;

Loading…
Cancel
Save