From 8d0d13f2bcf5e0df9285a57052b209d4bc85a944 Mon Sep 17 00:00:00 2001 From: Protobuf Team Bot Date: Thu, 23 Jun 2022 13:43:40 -0700 Subject: [PATCH] Fix the dependency chain for internal/arena.h Clean up a few other superfluous #include's and forward declarations PiperOrigin-RevId: 456851942 --- BUILD | 22 +++++++++++++++++++--- upb/alloc.h | 2 +- upb/arena.h | 2 -- upb/array.c | 3 ++- upb/array.h | 1 - upb/map.c | 3 ++- upb/map.h | 1 - 7 files changed, 24 insertions(+), 10 deletions(-) diff --git a/BUILD b/BUILD index b2ac9bbdec..b14bad4a94 100644 --- a/BUILD +++ b/BUILD @@ -106,7 +106,6 @@ cc_library( "upb/arena.c", "upb/decode.c", "upb/encode.c", - "upb/internal/arena.h", "upb/internal/decode.h", "upb/internal/table.h", "upb/internal/upb.h", @@ -130,6 +129,7 @@ cc_library( copts = UPB_DEFAULT_COPTS, visibility = ["//visibility:public"], deps = [ + ":arena_internal", ":extension_registry", ":fastdecode", ":port", @@ -270,13 +270,13 @@ cc_library( "upb/decode.h", "upb/decode_fast.c", "upb/decode_fast.h", - "upb/internal/arena.h", "upb/internal/decode.h", "upb/msg.h", "upb/msg_internal.h", ], copts = UPB_DEFAULT_COPTS, deps = [ + ":arena_internal", ":extension_registry", ":port", ":table", @@ -407,7 +407,6 @@ cc_library( cc_library( name = "json", srcs = [ - "upb/internal/arena.h", "upb/internal/upb.h", "upb/json_decode.c", "upb/json_encode.c", @@ -708,6 +707,20 @@ sh_test( # Internal C/C++ libraries ##################################################### +cc_library( + name = "arena_internal", + srcs = [ + "upb/alloc.h", + "upb/arena.h", + ], + hdrs = ["upb/internal/arena.h"], + copts = UPB_DEFAULT_COPTS, + visibility = ["//:__subpackages__"], + deps = [ + ":port", + ], +) + cc_library( name = "table", hdrs = [ @@ -738,6 +751,7 @@ upb_amalgamation( "upb.h", ], libs = [ + ":arena_internal", ":collections", ":descriptor_upb_proto", ":extension_registry", @@ -764,6 +778,7 @@ upb_amalgamation( "php-upb.h", ], libs = [ + ":arena_internal", ":collections", ":descriptor_upb_proto", ":descriptor_upb_proto_reflection", @@ -793,6 +808,7 @@ upb_amalgamation( "ruby-upb.h", ], libs = [ + ":arena_internal", ":collections", ":descriptor_upb_proto", ":extension_registry", diff --git a/upb/alloc.h b/upb/alloc.h index add70b8799..870a1b1d9e 100644 --- a/upb/alloc.h +++ b/upb/alloc.h @@ -28,13 +28,13 @@ #ifndef UPB_ALLOC_H_ #define UPB_ALLOC_H_ +// Must be last. #include "upb/port_def.inc" #ifdef __cplusplus extern "C" { #endif -struct upb_alloc; typedef struct upb_alloc upb_alloc; /* A combined `malloc()`/`free()` function. diff --git a/upb/arena.h b/upb/arena.h index 81a673bd9a..1fabbf2aef 100644 --- a/upb/arena.h +++ b/upb/arena.h @@ -28,7 +28,6 @@ #ifndef UPB_ARENA_H_ #define UPB_ARENA_H_ -#include #include #include "upb/alloc.h" @@ -54,7 +53,6 @@ extern "C" { typedef void upb_CleanupFunc(void* ud); -struct upb_Arena; typedef struct upb_Arena upb_Arena; typedef struct { diff --git a/upb/array.c b/upb/array.c index b4cdc49924..17bec38145 100644 --- a/upb/array.c +++ b/upb/array.c @@ -29,8 +29,9 @@ #include -#include "upb/internal/table.h" #include "upb/msg.h" + +// Must be last. #include "upb/port_def.inc" static const char _upb_CTypeo_sizelg2[12] = { diff --git a/upb/array.h b/upb/array.h index f7936fa2d9..7117392ed8 100644 --- a/upb/array.h +++ b/upb/array.h @@ -28,7 +28,6 @@ #ifndef UPB_ARRAY_H_ #define UPB_ARRAY_H_ -#include "google/protobuf/descriptor.upb.h" #include "upb/message_value.h" // Must be last. diff --git a/upb/map.c b/upb/map.c index d92776f546..6cc785db65 100644 --- a/upb/map.c +++ b/upb/map.c @@ -29,8 +29,9 @@ #include -#include "upb/internal/table.h" #include "upb/msg.h" + +// Must be last. #include "upb/port_def.inc" /* Strings/bytes are special-cased in maps. */ diff --git a/upb/map.h b/upb/map.h index 8ee0ddd05e..ecaaa1d029 100644 --- a/upb/map.h +++ b/upb/map.h @@ -28,7 +28,6 @@ #ifndef UPB_MAP_H_ #define UPB_MAP_H_ -#include "google/protobuf/descriptor.upb.h" #include "upb/message_value.h" // Must be last.