diff --git a/benchmarks/BUILD b/benchmarks/BUILD index 99ac504341..b9bd32bec2 100644 --- a/benchmarks/BUILD +++ b/benchmarks/BUILD @@ -102,6 +102,7 @@ cc_test( "//upb/mini_table", "//upb/reflection", "//upb/reflection:internal", + "//upb/reflection:reflection_cc", "//upb/wire", "@abseil-cpp//absl/container:flat_hash_set", "@abseil-cpp//absl/log:absl_check", diff --git a/cmake/installed_include_golden.txt b/cmake/installed_include_golden.txt index f79eacd144..6b0d748ed5 100644 --- a/cmake/installed_include_golden.txt +++ b/cmake/installed_include_golden.txt @@ -213,7 +213,6 @@ upb/port/undef.inc upb/port/vsnprintf_compat.h upb/reflection/common.h upb/reflection/def.h -upb/reflection/def.hpp upb/reflection/def_pool.h upb/reflection/def_type.h upb/reflection/descriptor_bootstrap.h @@ -224,7 +223,6 @@ upb/reflection/extension_range.h upb/reflection/field_def.h upb/reflection/file_def.h upb/reflection/message.h -upb/reflection/message.hpp upb/reflection/message_def.h upb/reflection/message_reserved_range.h upb/reflection/method_def.h diff --git a/hpb/internal/BUILD b/hpb/internal/BUILD index 3d4da25489..d6d023c964 100644 --- a/hpb/internal/BUILD +++ b/hpb/internal/BUILD @@ -78,6 +78,7 @@ cc_library( "//upb/message:promote", "//upb/mini_table", "//upb/wire", + "@abseil-cpp//absl/log:check", "@abseil-cpp//absl/status:statusor", "@abseil-cpp//absl/strings:string_view", ], diff --git a/hpb/internal/message_lock.cc b/hpb/internal/message_lock.cc index 28fead4e9b..d7bc21bbc2 100644 --- a/hpb/internal/message_lock.cc +++ b/hpb/internal/message_lock.cc @@ -11,6 +11,7 @@ #include #include +#include "absl/log/check.h" #include "absl/status/statusor.h" #include "absl/strings/string_view.h" #include "hpb/status.h" @@ -90,7 +91,9 @@ absl::StatusOr Serialize(const upb_Message* message, void DeepCopy(upb_Message* target, const upb_Message* source, const upb_MiniTable* mini_table, upb_Arena* arena) { MessageLock msg_lock(source); - upb_Message_DeepCopy(target, source, mini_table, arena); + // TODO: Change to absl::ThrowStdBadAlloc once our min absl version is above + // 202603 + ABSL_CHECK(upb_Message_DeepCopy(target, source, mini_table, arena)); } upb_Message* DeepClone(const upb_Message* source, diff --git a/src/google/protobuf/compiler/rust/BUILD b/src/google/protobuf/compiler/rust/BUILD index 738359873c..3240ff964d 100644 --- a/src/google/protobuf/compiler/rust/BUILD +++ b/src/google/protobuf/compiler/rust/BUILD @@ -202,7 +202,7 @@ bootstrap_cc_library( ":enum", ":extension", ":message", - "//upb/reflection:reflection", + "//upb/reflection:reflection_cc", "//upb_generator:plugin", ], copts = COPTS, @@ -244,7 +244,7 @@ bootstrap_cc_library( bootstrap_deps = [ ":enum", ":extension", - "//upb/reflection:reflection", + "//upb/reflection:reflection_cc", ], copts = COPTS, strip_include_prefix = "/src", @@ -272,7 +272,7 @@ bootstrap_cc_library( srcs = ["extension.cc"], hdrs = ["extension.h"], bootstrap_deps = [ - "//upb/reflection:reflection", + "//upb/reflection:reflection_cc", ], copts = COPTS, strip_include_prefix = "/src", @@ -291,7 +291,7 @@ bootstrap_cc_library( srcs = ["enum.cc"], hdrs = ["enum.h"], bootstrap_deps = [ - "//upb/reflection:reflection", + "//upb/reflection:reflection_cc", ], copts = COPTS, strip_include_prefix = "/src", diff --git a/toolchain/BUILD.bazel b/toolchain/BUILD.bazel index a56931dfde..49e420f684 100644 --- a/toolchain/BUILD.bazel +++ b/toolchain/BUILD.bazel @@ -98,12 +98,15 @@ cc_toolchain_config( cc_toolchain_config( name = "osx-aarch_64-config", extra_compiler_flags = [ - "-I/usr/tools/xcode_14_0/macosx/usr/include/c++/v1", - "-I/usr/tools/xcode_14_0/macosx/usr/include", - "-F/usr/tools/xcode_14_0/macosx/System/Library/Frameworks", + "-isystem/usr/tools/xcode_14_0/macosx/usr/include/c++/v1", + "-isystem/usr/tools/xcode_14_0/macosx/usr/include", + "-iframework/usr/tools/xcode_14_0/macosx/System/Library/Frameworks", "-Wno-error=nullability-completeness", "-Wno-error=availability", "-Wno-error=elaborated-enum-base", + "-Wno-error=undef", + "-Wno-error=shadow", + "-Wno-error=unknown-pragmas", ], extra_linker_flags = ["-framework CoreFoundation"], linker_path = "/usr/tools", @@ -115,12 +118,15 @@ cc_toolchain_config( cc_toolchain_config( name = "osx-x86_64-config", extra_compiler_flags = [ - "-I/usr/tools/xcode_14_0/macosx/usr/include/c++/v1", - "-I/usr/tools/xcode_14_0/macosx/usr/include", - "-F/usr/tools/xcode_14_0/macosx/System/Library/Frameworks", + "-isystem/usr/tools/xcode_14_0/macosx/usr/include/c++/v1", + "-isystem/usr/tools/xcode_14_0/macosx/usr/include", + "-iframework/usr/tools/xcode_14_0/macosx/System/Library/Frameworks", "-Wno-error=nullability-completeness", "-Wno-error=availability", "-Wno-error=elaborated-enum-base", + "-Wno-error=undef", + "-Wno-error=shadow", + "-Wno-error=unknown-pragmas", ], extra_linker_flags = ["-framework CoreFoundation"], linker_path = "/usr/tools", @@ -134,6 +140,9 @@ cc_toolchain_config( extra_compiler_flags = [ "-isystem/usr/lib/gcc/i686-w64-mingw32/10-posix/include/c++", "-isystem/usr/lib/gcc/i686-w64-mingw32/10-posix/include/c++/i686-w64-mingw32", + "-Wno-error=undef", + "-Wno-error=shadow", + "-Wno-error=unknown-pragmas", ], extra_include = "/usr/lib/gcc/i686-w64-mingw32", extra_linker_flags = [ @@ -152,6 +161,9 @@ cc_toolchain_config( extra_compiler_flags = [ "-isystem/usr/lib/gcc/x86_64-w64-mingw32/10-posix/include/c++/", "-isystem/usr/lib/gcc/x86_64-w64-mingw32/10-posix/include/c++/x86_64-w64-mingw32", + "-Wno-error=undef", + "-Wno-error=shadow", + "-Wno-error=unknown-pragmas", ], extra_include = "/usr/lib/gcc/x86_64-w64-mingw32/10-posix/include", extra_linker_flags = [ diff --git a/upb/json/BUILD b/upb/json/BUILD index 1c766f2c0d..7e72b36748 100644 --- a/upb/json/BUILD +++ b/upb/json/BUILD @@ -50,6 +50,8 @@ cc_test( "//upb/base", "//upb/mem", "//upb/reflection", + "//upb/reflection:internal_cc", + "//upb/reflection:reflection_cc", "@googletest//:gtest", "@googletest//:gtest_main", ], @@ -68,6 +70,8 @@ cc_test( "//upb/base", "//upb/mem", "//upb/reflection", + "//upb/reflection:internal_cc", + "//upb/reflection:reflection_cc", "@googletest//:gtest", "@googletest//:gtest_main", ], diff --git a/upb/message/BUILD b/upb/message/BUILD index 94b4c51ce2..5f8c667f96 100644 --- a/upb/message/BUILD +++ b/upb/message/BUILD @@ -579,6 +579,9 @@ cc_test( "//upb/mini_table:internal", "//upb/port", "//upb/reflection", + "//upb/reflection:internal", + "//upb/reflection:internal_cc", + "//upb/reflection:reflection_cc", "//upb/test:fuzz_util", "//upb/test:test_messages_proto3_upb_proto", "//upb/text:debug", diff --git a/upb/reflection/BUILD b/upb/reflection/BUILD index 3ae2aae18b..9583df872b 100644 --- a/upb/reflection/BUILD +++ b/upb/reflection/BUILD @@ -38,9 +38,7 @@ bootstrap_cc_library( name = "reflection", hdrs = [ "def.h", - "def.hpp", "message.h", - "message.hpp", ], bootstrap_deps = [ ":internal", @@ -60,10 +58,30 @@ bootstrap_cc_library( ], ) -alias( +bootstrap_cc_library( name = "reflection_cc", - actual = ":reflection", + hdrs = [ + "def.hpp", + "message.hpp", + ], + bootstrap_deps = [ + ":descriptor_upb_proto", + ":internal", + ":internal_cc", + ":reflection", + ], + copts = UPB_DEFAULT_COPTS, + features = UPB_DEFAULT_FEATURES, visibility = ["//visibility:public"], + deps = [ + "//upb/base", + "//upb/mem", + "//upb/message", + "//upb/mini_descriptor", + "//upb/mini_table", + "//upb/port", + "@abseil-cpp//absl/log:absl_check", + ], ) bootstrap_cc_library( @@ -92,7 +110,6 @@ bootstrap_cc_library( hdrs = [ "common.h", "def.h", - "def.hpp", "def_pool.h", "def_type.h", "enum_def.h", @@ -116,7 +133,6 @@ bootstrap_cc_library( "internal/service_def.h", "internal/upb_edition_defaults.h", "message.h", - "message.hpp", "message_def.h", "message_reserved_range.h", "method_def.h", @@ -144,10 +160,28 @@ bootstrap_cc_library( ], ) -alias( +bootstrap_cc_library( name = "internal_cc", - actual = ":internal", + hdrs = [ + "def.hpp", + "message.hpp", + ], + bootstrap_deps = [ + ":descriptor_upb_proto", + ":internal", + ], + copts = UPB_DEFAULT_COPTS, + features = UPB_DEFAULT_FEATURES, visibility = ["//upb:__subpackages__"], + deps = [ + "//upb/base", + "//upb/mem", + "//upb/message", + "//upb/mini_descriptor", + "//upb/mini_table", + "//upb/port", + "@abseil-cpp//absl/log:absl_check", + ], ) cc_library( @@ -200,7 +234,9 @@ cc_test( ], deps = [ ":internal", + ":internal_cc", ":reflection", + ":reflection_cc", "//src/google/protobuf", "//src/google/protobuf:descriptor_upb_c_proto", "//src/google/protobuf:unittest_upb_reflection_proto", diff --git a/upb/reflection/def.hpp b/upb/reflection/def.hpp index db29bdaf15..822a875691 100644 --- a/upb/reflection/def.hpp +++ b/upb/reflection/def.hpp @@ -14,6 +14,7 @@ #include #include +#include "absl/log/absl_check.h" #include "upb/base/descriptor_constants.h" #include "upb/base/status.hpp" #include "upb/base/string_view.h" @@ -27,7 +28,6 @@ #include "upb/reflection/descriptor_bootstrap.h" #include "upb/reflection/internal/def_pool.h" #include "upb/reflection/internal/enum_def.h" -#include "upb/reflection/message.h" // Must be last #include "upb/port/def.inc" @@ -65,7 +65,9 @@ class FieldDefPtr { std::string MiniDescriptorEncode() const { upb::Arena arena; upb_StringView md; - upb_FieldDef_MiniDescriptorEncode(ptr_, arena.ptr(), &md); + // TODO: Change to absl::ThrowStdBadAlloc once our min absl version is above + // 202603 + ABSL_CHECK(upb_FieldDef_MiniDescriptorEncode(ptr_, arena.ptr(), &md)); return std::string(md.data, md.size); } @@ -207,7 +209,9 @@ class MessageDefPtr { std::string MiniDescriptorEncode() const { upb::Arena arena; upb_StringView md; - upb_MessageDef_MiniDescriptorEncode(ptr_, arena.ptr(), &md); + // TODO: Change to absl::ThrowStdBadAlloc once our min absl version is above + // 202603 + ABSL_CHECK(upb_MessageDef_MiniDescriptorEncode(ptr_, arena.ptr(), &md)); return std::string(md.data, md.size); } @@ -423,7 +427,9 @@ class EnumDefPtr { std::string MiniDescriptorEncode() const { upb::Arena arena; upb_StringView md; - upb_EnumDef_MiniDescriptorEncode(ptr_, arena.ptr(), &md); + // TODO: Change to absl::ThrowStdBadAlloc once our min absl version is above + // 202603 + ABSL_CHECK(upb_EnumDef_MiniDescriptorEncode(ptr_, arena.ptr(), &md)); return std::string(md.data, md.size); } diff --git a/upb/test/BUILD b/upb/test/BUILD index 12cdd5233d..508dbe2982 100644 --- a/upb/test/BUILD +++ b/upb/test/BUILD @@ -218,6 +218,8 @@ cc_test( ":proto3_test_upb_proto", ":proto3_test_upb_proto_reflection", "//upb/reflection", + "//upb/reflection:internal_cc", + "//upb/reflection:reflection_cc", "@googletest//:gtest", "@googletest//:gtest_main", ], @@ -239,6 +241,8 @@ cc_test( "//upb/port", "//upb/reflection", "//upb/reflection:descriptor_upb_proto", + "//upb/reflection:internal_cc", + "//upb/reflection:reflection_cc", "@googletest//:gtest", "@googletest//:gtest_main", ], @@ -278,6 +282,8 @@ cc_test( "//upb/json", "//upb/port", "//upb/reflection", + "//upb/reflection:internal_cc", + "//upb/reflection:reflection_cc", "@googletest//:gtest", "@googletest//:gtest_main", ], diff --git a/upb/util/BUILD b/upb/util/BUILD index 4cfcd843ae..73a1c480dc 100644 --- a/upb/util/BUILD +++ b/upb/util/BUILD @@ -61,6 +61,8 @@ cc_library( "//upb/base", "//upb/mem", "//upb/reflection:internal", + "//upb/reflection:internal_cc", + "//upb/reflection:reflection_cc", "@googletest//:gtest", ], ) @@ -82,6 +84,8 @@ cc_test( "//upb/base", "//upb/mem", "//upb/reflection", + "//upb/reflection:internal_cc", + "//upb/reflection:reflection_cc", "//upb/test:parse_text_proto", "@abseil-cpp//absl/strings", "@googletest//:gtest", @@ -150,6 +154,8 @@ cc_test( "//upb/mem", "//upb/reflection", "//upb/reflection:internal", + "//upb/reflection:internal_cc", + "//upb/reflection:reflection_cc", "@abseil-cpp//absl/strings", "@googletest//:gtest", "@googletest//:gtest_main", diff --git a/upb_generator/BUILD b/upb_generator/BUILD index 3ea8d163f6..404c848417 100644 --- a/upb_generator/BUILD +++ b/upb_generator/BUILD @@ -39,7 +39,7 @@ bootstrap_cc_library( "common.h", ], bootstrap_deps = [ - "//upb/reflection:reflection", + "//upb/reflection:reflection_cc", ], copts = UPB_DEFAULT_CPPOPTS, features = UPB_DEFAULT_FEATURES, @@ -64,6 +64,7 @@ bootstrap_cc_library( bootstrap_deps = [ ":common", "//upb/reflection:reflection", + "//upb/reflection:reflection_cc", "//upb/reflection:descriptor_upb_proto", ], copts = UPB_DEFAULT_CPPOPTS, @@ -90,7 +91,7 @@ bootstrap_cc_library( bootstrap_deps = [ ":plugin_upb_proto", "//upb/reflection:descriptor_upb_proto", - "//upb/reflection:reflection", + "//upb/reflection:reflection_cc", "//upb_generator:file_layout", ], copts = UPB_DEFAULT_CPPOPTS, diff --git a/upb_generator/c/BUILD b/upb_generator/c/BUILD index f8c26683f8..9ba36a71f3 100644 --- a/upb_generator/c/BUILD +++ b/upb_generator/c/BUILD @@ -48,7 +48,7 @@ bootstrap_cc_binary( "//upb_generator:file_layout", "//upb_generator:plugin", "//upb/reflection:descriptor_upb_proto", - "//upb/reflection:reflection", + "//upb/reflection:reflection_cc", ], copts = UPB_DEFAULT_CPPOPTS, features = UPB_DEFAULT_FEATURES, diff --git a/upb_generator/common/BUILD b/upb_generator/common/BUILD index b13a921316..21e5204fb1 100644 --- a/upb_generator/common/BUILD +++ b/upb_generator/common/BUILD @@ -40,7 +40,7 @@ cc_library( "//upb/base", "//upb/mem", "//upb/mini_table", - "//upb/reflection", + "//upb/reflection:reflection_cc", "@abseil-cpp//absl/container:flat_hash_set", "@abseil-cpp//absl/log:absl_check", ], diff --git a/upb_generator/minitable/BUILD b/upb_generator/minitable/BUILD index c451879820..ae6ce03272 100644 --- a/upb_generator/minitable/BUILD +++ b/upb_generator/minitable/BUILD @@ -26,7 +26,7 @@ bootstrap_cc_library( "//upb_generator:common", "//upb_generator:file_layout", "//upb/reflection:descriptor_upb_proto", - "//upb/reflection:reflection", + "//upb/reflection:reflection_cc", ], copts = UPB_DEFAULT_CPPOPTS, features = UPB_DEFAULT_FEATURES, @@ -93,7 +93,7 @@ bootstrap_cc_binary( "//upb_generator:file_layout", "//upb_generator:common", "//upb_generator:plugin", - "//upb/reflection:reflection", + "//upb/reflection:reflection_cc", ], copts = UPB_DEFAULT_CPPOPTS, features = UPB_DEFAULT_FEATURES, diff --git a/upb_generator/reflection/BUILD b/upb_generator/reflection/BUILD index 307cacd9b8..d3d65f8c84 100644 --- a/upb_generator/reflection/BUILD +++ b/upb_generator/reflection/BUILD @@ -50,7 +50,7 @@ cc_binary( "//src/google/protobuf/io:printer", "//upb/mem", "//upb/port", - "//upb/reflection", + "//upb/reflection:reflection_cc", "//upb/util:def_to_proto", "//upb_generator:common", "//upb_generator:file_layout",