From 033859ff5da2e48146f7807763e05835a2251414 Mon Sep 17 00:00:00 2001 From: Protobuf Team Bot Date: Fri, 24 Jun 2022 13:52:58 -0700 Subject: [PATCH] rename internal/upb.h as internal/encode.h add build target for upb/internal/encode.h and lock down its visibility PiperOrigin-RevId: 457087638 --- BUILD | 17 ++++++++++++++--- upb/decode.c | 4 +--- upb/internal/{upb.h => encode.h} | 8 +++----- upb/json_encode.c | 5 ++--- upb/status.c | 4 ---- upb/text_encode.c | 2 +- upb/upb.c | 10 +--------- upb/upb_internal.h | 2 +- 8 files changed, 23 insertions(+), 29 deletions(-) rename upb/internal/{upb.h => encode.h} (95%) diff --git a/BUILD b/BUILD index 277071aca9..f396377bfa 100644 --- a/BUILD +++ b/BUILD @@ -108,7 +108,6 @@ cc_library( "upb/encode.c", "upb/internal/decode.h", "upb/internal/table.h", - "upb/internal/upb.h", "upb/msg.c", "upb/msg_internal.h", "upb/status.c", @@ -130,6 +129,7 @@ cc_library( visibility = ["//visibility:public"], deps = [ ":arena_internal", + ":encode_internal", ":extension_registry", ":fastdecode", ":port", @@ -390,7 +390,6 @@ cc_library( cc_library( name = "textformat", srcs = [ - "upb/internal/upb.h", "upb/text_encode.c", ], hdrs = [ @@ -399,6 +398,7 @@ cc_library( copts = UPB_DEFAULT_COPTS, visibility = ["//visibility:public"], deps = [ + ":encode_internal", ":port", ":reflection", ":table_internal", @@ -408,7 +408,6 @@ cc_library( cc_library( name = "json", srcs = [ - "upb/internal/upb.h", "upb/json_decode.c", "upb/json_encode.c", ], @@ -419,6 +418,7 @@ cc_library( copts = UPB_DEFAULT_COPTS, visibility = ["//visibility:public"], deps = [ + ":encode_internal", ":port", ":reflection", ":upb", @@ -720,6 +720,14 @@ cc_library( deps = [":port"], ) +cc_library( + name = "encode_internal", + hdrs = ["upb/internal/encode.h"], + copts = UPB_DEFAULT_COPTS, + visibility = ["//:__subpackages__"], + deps = [":port"], +) + cc_library( name = "table_internal", srcs = [ @@ -752,6 +760,7 @@ upb_amalgamation( ":arena_internal", ":collections", ":descriptor_upb_proto", + ":encode_internal", ":extension_registry", ":fastdecode", ":mini_table", @@ -780,6 +789,7 @@ upb_amalgamation( ":collections", ":descriptor_upb_proto", ":descriptor_upb_proto_reflection", + ":encode_internal", ":extension_registry", ":fastdecode", ":json", @@ -809,6 +819,7 @@ upb_amalgamation( ":arena_internal", ":collections", ":descriptor_upb_proto", + ":encode_internal", ":extension_registry", ":fastdecode", ":json", diff --git a/upb/decode.c b/upb/decode.c index afd654c24c..7f1e11effb 100644 --- a/upb/decode.c +++ b/upb/decode.c @@ -27,14 +27,12 @@ #include "upb/decode.h" -#include #include #include "upb/internal/decode.h" -#include "upb/internal/upb.h" #include "upb/upb.h" -/* Must be last. */ +// Must be last. #include "upb/port_def.inc" /* Maps descriptor type -> elem_size_lg2. */ diff --git a/upb/internal/upb.h b/upb/internal/encode.h similarity index 95% rename from upb/internal/upb.h rename to upb/internal/encode.h index 7f72710020..c74d08fac8 100644 --- a/upb/internal/upb.h +++ b/upb/internal/encode.h @@ -25,10 +25,8 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef UPB_INTERNAL_UPB_H_ -#define UPB_INTERNAL_UPB_H_ - -#include "upb/upb.h" +#ifndef UPB_INTERNAL_ENCODE_H_ +#define UPB_INTERNAL_ENCODE_H_ // Must be last. #include "upb/port_def.inc" @@ -53,4 +51,4 @@ void _upb_EncodeRoundTripFloat(float val, char* buf, size_t size); #include "upb/port_undef.inc" -#endif /* UPB_INTERNAL_UPB_H_ */ +#endif /* UPB_INTERNAL_ENCODE_H_ */ diff --git a/upb/json_encode.c b/upb/json_encode.c index e13c0f771d..7836b47b1b 100644 --- a/upb/json_encode.c +++ b/upb/json_encode.c @@ -31,17 +31,16 @@ #include #include #include -#include #include #include #include #include "upb/decode.h" -#include "upb/internal/upb.h" +#include "upb/internal/encode.h" #include "upb/internal/vsnprintf_compat.h" #include "upb/reflection.h" -/* Must be last. */ +// Must be last. #include "upb/port_def.inc" typedef struct { diff --git a/upb/status.c b/upb/status.c index c00b9c86b2..e2a9c1a3ab 100644 --- a/upb/status.c +++ b/upb/status.c @@ -30,14 +30,10 @@ #include #include #include -#include -#include #include #include #include -#include "upb/internal/upb.h" - // Must be last. #include "upb/port_def.inc" diff --git a/upb/text_encode.c b/upb/text_encode.c index dfb213f2bb..fe5f458cdf 100644 --- a/upb/text_encode.c +++ b/upb/text_encode.c @@ -34,7 +34,7 @@ #include #include -#include "upb/internal/upb.h" +#include "upb/internal/encode.h" #include "upb/internal/vsnprintf_compat.h" #include "upb/reflection.h" diff --git a/upb/upb.c b/upb/upb.c index 08ae964777..0c088b00f4 100644 --- a/upb/upb.c +++ b/upb/upb.c @@ -25,19 +25,11 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "upb/internal/upb.h" - -#include #include -#include -#include -#include #include #include -#include -#include "upb/arena.h" -#include "upb/status.h" +#include "upb/internal/encode.h" // Must be last. #include "upb/port_def.inc" diff --git a/upb/upb_internal.h b/upb/upb_internal.h index 6c1fec3398..ba8ab7ea94 100644 --- a/upb/upb_internal.h +++ b/upb/upb_internal.h @@ -31,6 +31,6 @@ // TODO(b/232091617): Delete this entire header which currently exists only for // temporary backwards compatibility. -#include "upb/internal/upb.h" +#include "upb/internal/encode.h" #endif /* UPB_INT_H_ */