From f6307877d35b863ddfac1210494eedf25b136d75 Mon Sep 17 00:00:00 2001 From: Eric Salo Date: Sat, 5 Nov 2022 16:16:27 -0700 Subject: [PATCH] move portability stuff into upb/port/ Also delete redundant system #includes that are already pulled in by port/def.inc PiperOrigin-RevId: 486398989 --- BUILD | 18 +++++++++--------- bazel/amalgamate.py | 6 +++--- protos_generator/protoc-gen-upb-protos.cc | 8 ++++---- python/convert.c | 4 ++-- upb/bindings/lua/msg.c | 2 +- upb/collections/array.c | 2 +- upb/collections/array.h | 4 ++-- upb/collections/array_internal.h | 4 ++-- upb/collections/map.c | 2 +- upb/collections/map.h | 4 ++-- upb/collections/map_gencode_util.h | 4 ++-- upb/collections/map_internal.h | 4 ++-- upb/collections/map_sorter.c | 2 +- upb/collections/map_sorter_internal.h | 4 ++-- upb/collections/message_value.h | 4 ++-- upb/conformance_upb.c | 3 +-- upb/extension_registry.c | 2 +- upb/extension_registry.h | 4 ++-- upb/internal/atoi.c | 2 +- upb/internal/atoi.h | 4 ++-- upb/internal/table.c | 2 +- upb/internal/table.h | 4 ++-- upb/internal/unicode.c | 2 +- upb/internal/unicode.h | 4 ++-- upb/io/chunked_input_stream.c | 2 +- upb/io/chunked_input_stream.h | 4 ++-- upb/io/chunked_output_stream.c | 2 +- upb/io/chunked_output_stream.h | 4 ++-- upb/io/string.h | 4 ++-- upb/io/strtod.c | 3 +-- upb/io/strtod.h | 4 ++-- upb/io/tokenizer.c | 4 +--- upb/io/tokenizer.h | 4 ++-- upb/io/tokenizer_test.cc | 2 +- upb/io/zero_copy_input_stream.h | 4 ++-- upb/io/zero_copy_output_stream.h | 4 ++-- upb/json/decode.c | 2 +- upb/json/decode.h | 4 ++-- upb/json/encode.c | 5 ++--- upb/json/encode.h | 4 ++-- upb/mem/alloc.c | 2 +- upb/mem/alloc.h | 4 ++-- upb/mem/arena.c | 2 +- upb/mem/arena.h | 4 ++-- upb/mem/arena_internal.h | 4 ++-- upb/mini_table/accessors.c | 2 +- upb/mini_table/accessors.h | 4 ++-- upb/mini_table/common.c | 2 +- upb/mini_table/common.h | 4 ++-- upb/mini_table/common_internal.h | 4 ++-- upb/mini_table/decode.c | 2 +- upb/mini_table/decode.h | 4 ++-- upb/mini_table/encode.c | 2 +- upb/mini_table/encode_internal.h | 4 ++-- upb/msg.c | 2 +- upb/msg.h | 4 ++-- upb/msg_internal.h | 4 ++-- upb/{port_def.inc => port/def.inc} | 10 +++++----- upb/{port_undef.inc => port/undef.inc} | 2 +- upb/{internal => port}/vsnprintf_compat.h | 12 +++++------- upb/reflection/def_builder.c | 2 +- upb/reflection/def_builder_internal.h | 4 ++-- upb/reflection/def_builder_test.cc | 2 +- upb/reflection/def_pool.c | 5 +---- upb/reflection/def_pool.h | 4 ++-- upb/reflection/def_pool_internal.h | 4 ++-- upb/reflection/def_type.c | 2 +- upb/reflection/def_type.h | 4 ++-- upb/reflection/desc_state.c | 2 +- upb/reflection/desc_state_internal.h | 4 ++-- upb/reflection/enum_def.c | 4 +--- upb/reflection/enum_def.h | 4 ++-- upb/reflection/enum_def_internal.h | 4 ++-- upb/reflection/enum_value_def.c | 2 +- upb/reflection/enum_value_def.h | 4 ++-- upb/reflection/enum_value_def_internal.h | 4 ++-- upb/reflection/extension_range.c | 2 +- upb/reflection/extension_range.h | 4 ++-- upb/reflection/extension_range_internal.h | 4 ++-- upb/reflection/field_def.c | 2 +- upb/reflection/field_def.h | 4 ++-- upb/reflection/field_def_internal.h | 4 ++-- upb/reflection/file_def.c | 2 +- upb/reflection/file_def.h | 4 ++-- upb/reflection/file_def_internal.h | 4 ++-- upb/reflection/message.c | 2 +- upb/reflection/message.h | 4 ++-- upb/reflection/message_def.c | 2 +- upb/reflection/message_def.h | 4 ++-- upb/reflection/message_def_internal.h | 4 ++-- upb/reflection/method_def.c | 2 +- upb/reflection/method_def.h | 4 ++-- upb/reflection/method_def_internal.h | 4 ++-- upb/reflection/oneof_def.c | 2 +- upb/reflection/oneof_def.h | 4 ++-- upb/reflection/oneof_def_internal.h | 4 ++-- upb/reflection/service_def.c | 2 +- upb/reflection/service_def.h | 4 ++-- upb/reflection/service_def_internal.h | 4 ++-- upb/status.c | 3 +-- upb/status.h | 4 ++-- upb/string_view.h | 4 ++-- upb/test_cpp.cc | 7 ++----- upb/test_generated_code.cc | 2 +- upb/test_table.cc | 2 +- upb/text/encode.c | 4 ++-- upb/text/encode.h | 4 ++-- upb/upb.c | 3 +-- upb/upb.h | 8 ++------ upb/util/compare.c | 5 +---- upb/util/def_to_proto.c | 8 +++----- upb/util/required_fields.c | 6 ++---- upb/util/required_fields.h | 6 +++--- upb/wire/common_internal.h | 4 ++-- upb/wire/decode.c | 2 +- upb/wire/decode.h | 4 ++-- upb/wire/decode_fast.c | 2 +- upb/wire/decode_fast.h | 4 ++-- upb/wire/decode_internal.h | 4 ++-- upb/wire/encode.c | 2 +- upb/wire/encode.h | 4 ++-- upb/wire/encode_internal.h | 4 ++-- upbc/code_generator_request.c | 2 +- upbc/code_generator_request.h | 4 ++-- upbc/protoc-gen-upb.cc | 10 +++++----- upbc/protoc-gen-upbdefs.cc | 6 +++--- upbc/subprocess.cc | 2 +- 127 files changed, 228 insertions(+), 256 deletions(-) rename upb/{port_def.inc => port/def.inc} (97%) rename upb/{port_undef.inc => port/undef.inc} (97%) rename upb/{internal => port}/vsnprintf_compat.h (91%) diff --git a/BUILD b/BUILD index 783db2b3d0..5f113ed4bf 100644 --- a/BUILD +++ b/BUILD @@ -99,12 +99,12 @@ package_group( cc_library( name = "port", hdrs = [ - "upb/internal/vsnprintf_compat.h", + "upb/port/vsnprintf_compat.h", ], copts = UPB_DEFAULT_COPTS, textual_hdrs = [ - "upb/port_def.inc", - "upb/port_undef.inc", + "upb/port/def.inc", + "upb/port/undef.inc", ], visibility = ["//:__subpackages__"], ) @@ -321,8 +321,8 @@ cc_library( "upb/extension_registry.h", "upb/msg.h", "upb/msg_internal.h", - "upb/port_def.inc", - "upb/port_undef.inc", + "upb/port/def.inc", + "upb/port/undef.inc", "upb/wire/decode.h", "upb/wire/decode_fast.h", "upb/wire/encode.h", @@ -342,8 +342,8 @@ cc_library( hdrs = [ "upb/msg.h", "upb/msg_internal.h", - "upb/port_def.inc", - "upb/port_undef.inc", + "upb/port/def.inc", + "upb/port/undef.inc", "upb/upb.hpp", "upb/wire/decode.h", "upb/wire/decode_fast.h", @@ -376,8 +376,8 @@ cc_library( "upb/reflection/service_def.h", ], hdrs = [ - "upb/port_def.inc", - "upb/port_undef.inc", + "upb/port/def.inc", + "upb/port/undef.inc", "upb/reflection/def.h", "upb/reflection/def_pool_internal.h", ], diff --git a/bazel/amalgamate.py b/bazel/amalgamate.py index e7121c622d..d15ea57cf2 100755 --- a/bazel/amalgamate.py +++ b/bazel/amalgamate.py @@ -53,8 +53,8 @@ class Amalgamator: self.output_h.write("/* Amalgamated source file */\n") - port_def = self._find_include_file("upb/port_def.inc") - port_undef = self._find_include_file("upb/port_undef.inc") + port_def = self._find_include_file("upb/port/def.inc") + port_undef = self._find_include_file("upb/port/undef.inc") self._process_file(port_def, self.output_h) self._process_file(port_def, self.output_c) @@ -88,7 +88,7 @@ class Amalgamator: return False if not (include.startswith("upb") or include.startswith("google")): return False - if include and (include.endswith("port_def.inc") or include.endswith("port_undef.inc")): + if include and (include.endswith("port/def.inc") or include.endswith("port/undef.inc")): # Skip, we handle this separately return True if include.endswith("hpp"): diff --git a/protos_generator/protoc-gen-upb-protos.cc b/protos_generator/protoc-gen-upb-protos.cc index f9522f7088..87966bbd2d 100644 --- a/protos_generator/protoc-gen-upb-protos.cc +++ b/protos_generator/protoc-gen-upb-protos.cc @@ -150,7 +150,7 @@ void WriteHeader(const FileLayout& layout, Output& output) { } } - output("#include \"upb/port_def.inc\"\n"); + output("#include \"upb/port/def.inc\"\n"); const std::vector this_file_messages = ::upbc::SortedMessages(file); @@ -182,7 +182,7 @@ void WriteHeader(const FileLayout& layout, Output& output) { WriteEndNamespace(file, output); - output("\n#include \"upb/port_undef.inc\"\n\n"); + output("\n#include \"upb/port/undef.inc\"\n\n"); // End of "C" section. output("#endif /* $0_UPB_PROTO_H_ */\n", ToPreproc(file->name())); @@ -207,7 +207,7 @@ void WriteSource(const FileLayout& layout, Output& output, for (int i = 0; i < file->dependency_count(); i++) { output("#include \"$0\"\n", CppHeaderFilename(file->dependency(i))); } - output("#include \"upb/port_def.inc\"\n"); + output("#include \"upb/port/def.inc\"\n"); WriteStartNamespace(file, output); WriteMessageImplementations(file, output); @@ -216,7 +216,7 @@ void WriteSource(const FileLayout& layout, Output& output, WriteExtensionIdentifiers(this_file_exts, output); WriteEndNamespace(file, output); - output("#include \"upb/port_undef.inc\"\n\n"); + output("#include \"upb/port/undef.inc\"\n\n"); } void WriteMessageImplementations(const protobuf::FileDescriptor* file, diff --git a/python/convert.c b/python/convert.c index b079bdcbf7..5c979f4452 100644 --- a/python/convert.c +++ b/python/convert.c @@ -34,7 +34,7 @@ #include "upb/util/compare.h" // Must be last. -#include "upb/port_def.inc" +#include "upb/port/def.inc" PyObject* PyUpb_UpbToPy(upb_MessageValue val, const upb_FieldDef* f, PyObject* arena) { @@ -443,4 +443,4 @@ bool upb_Message_IsEqual(const upb_Message* msg1, const upb_Message* msg2, kUpb_UnknownCompareResult_Equal; } -#include "upb/port_undef.inc" +#include "upb/port/undef.inc" diff --git a/upb/bindings/lua/msg.c b/upb/bindings/lua/msg.c index 9a5ddcacf7..5c4be87037 100644 --- a/upb/bindings/lua/msg.c +++ b/upb/bindings/lua/msg.c @@ -42,7 +42,7 @@ #include "upb/json/decode.h" #include "upb/json/encode.h" #include "upb/map.h" -#include "upb/port_def.inc" +#include "upb/port/def.inc" #include "upb/reflection/message.h" #include "upb/text_encode.h" diff --git a/upb/collections/array.c b/upb/collections/array.c index b31021f6ca..adc3c4387a 100644 --- a/upb/collections/array.c +++ b/upb/collections/array.c @@ -30,7 +30,7 @@ #include "upb/collections/array_internal.h" // Must be last. -#include "upb/port_def.inc" +#include "upb/port/def.inc" static const char _upb_CTypeo_sizelg2[12] = { 0, diff --git a/upb/collections/array.h b/upb/collections/array.h index b464f6234a..d475517976 100644 --- a/upb/collections/array.h +++ b/upb/collections/array.h @@ -31,7 +31,7 @@ #include "upb/collections/message_value.h" // Must be last. -#include "upb/port_def.inc" +#include "upb/port/def.inc" #ifdef __cplusplus extern "C" { @@ -77,6 +77,6 @@ bool upb_Array_Resize(upb_Array* array, size_t size, upb_Arena* arena); } /* extern "C" */ #endif -#include "upb/port_undef.inc" +#include "upb/port/undef.inc" #endif /* UPB_COLLECTIONS_ARRAY_H_ */ diff --git a/upb/collections/array_internal.h b/upb/collections/array_internal.h index e02f975064..38c90cdc10 100644 --- a/upb/collections/array_internal.h +++ b/upb/collections/array_internal.h @@ -33,7 +33,7 @@ #include "upb/collections/array.h" // Must be last. -#include "upb/port_def.inc" +#include "upb/port/def.inc" #ifdef __cplusplus extern "C" { @@ -198,6 +198,6 @@ UPB_INLINE bool _upb_Array_Append_accessor(void* msg, size_t ofs, } /* extern "C" */ #endif -#include "upb/port_undef.inc" +#include "upb/port/undef.inc" #endif /* UPB_INTERNAL_ARRAY_INTERNAL_H_ */ diff --git a/upb/collections/map.c b/upb/collections/map.c index e09d2cc922..54ff1cee41 100644 --- a/upb/collections/map.c +++ b/upb/collections/map.c @@ -34,7 +34,7 @@ #include "upb/msg.h" // Must be last. -#include "upb/port_def.inc" +#include "upb/port/def.inc" /* Strings/bytes are special-cased in maps. */ static char _upb_CTypeo_mapsize[12] = { diff --git a/upb/collections/map.h b/upb/collections/map.h index 121dd4a5a0..d1cb79e2ee 100644 --- a/upb/collections/map.h +++ b/upb/collections/map.h @@ -31,7 +31,7 @@ #include "upb/collections/message_value.h" // Must be last. -#include "upb/port_def.inc" +#include "upb/port/def.inc" #ifdef __cplusplus extern "C" { @@ -109,6 +109,6 @@ void upb_MapIterator_SetValue(upb_Map* map, size_t iter, } /* extern "C" */ #endif -#include "upb/port_undef.inc" +#include "upb/port/undef.inc" #endif /* UPB_COLLECTIONS_MAP_H_ */ diff --git a/upb/collections/map_gencode_util.h b/upb/collections/map_gencode_util.h index 1d90f7735f..59764c96b2 100644 --- a/upb/collections/map_gencode_util.h +++ b/upb/collections/map_gencode_util.h @@ -33,7 +33,7 @@ #include "upb/collections/map_internal.h" // Must be last. -#include "upb/port_def.inc" +#include "upb/port/def.inc" #ifdef __cplusplus extern "C" { @@ -117,6 +117,6 @@ UPB_INLINE void _upb_msg_map_set_value(void* msg, const void* val, } /* extern "C" */ #endif -#include "upb/port_undef.inc" +#include "upb/port/undef.inc" #endif /* UPB_COLLECTIONS_MAP_GENCODE_UTIL_H_ */ diff --git a/upb/collections/map_internal.h b/upb/collections/map_internal.h index eb7deb7b50..b611abb41c 100644 --- a/upb/collections/map_internal.h +++ b/upb/collections/map_internal.h @@ -36,7 +36,7 @@ #include "upb/string_view.h" // Must be last. -#include "upb/port_def.inc" +#include "upb/port/def.inc" struct upb_Map { // Size of key and val, based on the map type. @@ -158,6 +158,6 @@ upb_Map* _upb_Map_New(upb_Arena* a, size_t key_size, size_t value_size); } /* extern "C" */ #endif -#include "upb/port_undef.inc" +#include "upb/port/undef.inc" #endif /* UPB_COLLECTIONS_MAP_INTERNAL_H_ */ diff --git a/upb/collections/map_sorter.c b/upb/collections/map_sorter.c index 5d7be97ec7..237ee2f57c 100644 --- a/upb/collections/map_sorter.c +++ b/upb/collections/map_sorter.c @@ -28,7 +28,7 @@ #include "upb/collections/map_sorter_internal.h" // Must be last. -#include "upb/port_def.inc" +#include "upb/port/def.inc" static void _upb_mapsorter_getkeys(const void* _a, const void* _b, void* a_key, void* b_key, size_t size) { diff --git a/upb/collections/map_sorter_internal.h b/upb/collections/map_sorter_internal.h index a385b6a840..793a279d56 100644 --- a/upb/collections/map_sorter_internal.h +++ b/upb/collections/map_sorter_internal.h @@ -33,7 +33,7 @@ #include "upb/msg_internal.h" // Must be last. -#include "upb/port_def.inc" +#include "upb/port/def.inc" #ifdef __cplusplus extern "C" { @@ -88,6 +88,6 @@ bool _upb_mapsorter_pushmap(_upb_mapsorter* s, upb_FieldType key_type, } /* extern "C" */ #endif -#include "upb/port_undef.inc" +#include "upb/port/undef.inc" #endif /* UPB_COLLECTIONS_MAP_SORTER_INTERNAL_H_ */ diff --git a/upb/collections/message_value.h b/upb/collections/message_value.h index 86bfbb9465..a0e7b19d72 100644 --- a/upb/collections/message_value.h +++ b/upb/collections/message_value.h @@ -33,7 +33,7 @@ #include "upb/upb.h" // Must be last. -#include "upb/port_def.inc" +#include "upb/port/def.inc" typedef struct upb_Array upb_Array; typedef struct upb_Map upb_Map; @@ -58,6 +58,6 @@ typedef union { upb_Message* msg; } upb_MutableMessageValue; -#include "upb/port_undef.inc" +#include "upb/port/undef.inc" #endif /* UPB_MESSAGE_VALUE_H_ */ diff --git a/upb/conformance_upb.c b/upb/conformance_upb.c index 41015409a5..8708da0938 100644 --- a/upb/conformance_upb.c +++ b/upb/conformance_upb.c @@ -31,7 +31,6 @@ #include #include -#include #include #include @@ -47,7 +46,7 @@ #include "upb/wire/encode.h" // Must be last. -#include "upb/port_def.inc" +#include "upb/port/def.inc" int test_count = 0; bool verbose = false; /* Set to true to get req/resp printed on stderr. */ diff --git a/upb/extension_registry.c b/upb/extension_registry.c index 7fd67d367e..ab3cea9450 100644 --- a/upb/extension_registry.c +++ b/upb/extension_registry.c @@ -32,7 +32,7 @@ #include "upb/msg_internal.h" // Must be last. -#include "upb/port_def.inc" +#include "upb/port/def.inc" struct upb_ExtensionRegistry { upb_Arena* arena; diff --git a/upb/extension_registry.h b/upb/extension_registry.h index 75af0bdf43..d2d1b5b8a2 100644 --- a/upb/extension_registry.h +++ b/upb/extension_registry.h @@ -32,7 +32,7 @@ #include "upb/upb.h" // Must be last. -#include "upb/port_def.inc" +#include "upb/port/def.inc" #ifdef __cplusplus extern "C" { @@ -97,6 +97,6 @@ const upb_MiniTable_Extension* upb_ExtensionRegistry_Lookup( } /* extern "C" */ #endif -#include "upb/port_undef.inc" +#include "upb/port/undef.inc" #endif /* UPB_EXTENSION_REGISTRY_H_ */ diff --git a/upb/internal/atoi.c b/upb/internal/atoi.c index e8a2c8c111..498da62ea1 100644 --- a/upb/internal/atoi.c +++ b/upb/internal/atoi.c @@ -28,7 +28,7 @@ #include "upb/internal/atoi.h" // Must be last. -#include "upb/port_def.inc" +#include "upb/port/def.inc" const char* upb_BufToUint64(const char* ptr, const char* end, uint64_t* val) { uint64_t u64 = 0; diff --git a/upb/internal/atoi.h b/upb/internal/atoi.h index e29097afb5..3192e94671 100644 --- a/upb/internal/atoi.h +++ b/upb/internal/atoi.h @@ -29,7 +29,7 @@ #define UPB_INTERNAL_ATOI_H_ // Must be last. -#include "upb/port_def.inc" +#include "upb/port/def.inc" #ifdef __cplusplus extern "C" { @@ -48,6 +48,6 @@ const char* upb_BufToInt64(const char* ptr, const char* end, int64_t* val, } /* extern "C" */ #endif -#include "upb/port_undef.inc" +#include "upb/port/undef.inc" #endif /* UPB_INTERNAL_ATOI_H_ */ diff --git a/upb/internal/table.c b/upb/internal/table.c index 1e09dc945b..b7a6eac4dc 100644 --- a/upb/internal/table.c +++ b/upb/internal/table.c @@ -36,7 +36,7 @@ #include // Must be last. -#include "upb/port_def.inc" +#include "upb/port/def.inc" #define UPB_MAXARRSIZE 16 /* 64k. */ diff --git a/upb/internal/table.h b/upb/internal/table.h index 8b0077226d..6bb1e1af67 100644 --- a/upb/internal/table.h +++ b/upb/internal/table.h @@ -52,7 +52,7 @@ #include "upb/upb.h" // Must be last. -#include "upb/port_def.inc" +#include "upb/port/def.inc" #ifdef __cplusplus extern "C" { @@ -379,6 +379,6 @@ uint32_t _upb_Hash(const void* p, size_t n, uint64_t seed); } /* extern "C" */ #endif -#include "upb/port_undef.inc" +#include "upb/port/undef.inc" #endif /* UPB_INTERNAL_TABLE_H_ */ diff --git a/upb/internal/unicode.c b/upb/internal/unicode.c index 3e1d7eb365..fa8b1eacb7 100644 --- a/upb/internal/unicode.c +++ b/upb/internal/unicode.c @@ -28,7 +28,7 @@ #include "upb/internal/unicode.h" // Must be last. -#include "upb/port_def.inc" +#include "upb/port/def.inc" int upb_Unicode_ToUTF8(uint32_t cp, char* out) { if (cp <= 0x7f) { diff --git a/upb/internal/unicode.h b/upb/internal/unicode.h index 27640ae8a5..518dfc937b 100644 --- a/upb/internal/unicode.h +++ b/upb/internal/unicode.h @@ -29,7 +29,7 @@ #define UPB_INTERNAL_UNICODE_H_ // Must be last. -#include "upb/port_def.inc" +#include "upb/port/def.inc" #ifdef __cplusplus extern "C" { @@ -72,6 +72,6 @@ int upb_Unicode_ToUTF8(uint32_t cp, char* out); } /* extern "C" */ #endif -#include "upb/port_undef.inc" +#include "upb/port/undef.inc" #endif /* UPB_INTERNAL_UNICODE_H_ */ diff --git a/upb/io/chunked_input_stream.c b/upb/io/chunked_input_stream.c index c02df70f4f..0b456de50f 100644 --- a/upb/io/chunked_input_stream.c +++ b/upb/io/chunked_input_stream.c @@ -28,7 +28,7 @@ #include "upb/io/chunked_input_stream.h" // Must be last. -#include "upb/port_def.inc" +#include "upb/port/def.inc" typedef struct { upb_ZeroCopyInputStream base; diff --git a/upb/io/chunked_input_stream.h b/upb/io/chunked_input_stream.h index 9993de3b4c..909ae3f945 100644 --- a/upb/io/chunked_input_stream.h +++ b/upb/io/chunked_input_stream.h @@ -32,7 +32,7 @@ #include "upb/mem/arena.h" // Must be last. -#include "upb/port_def.inc" +#include "upb/port/def.inc" #ifdef __cplusplus extern "C" { @@ -48,6 +48,6 @@ upb_ZeroCopyInputStream* upb_ChunkedInputStream_New(const void* data, } /* extern "C" */ #endif -#include "upb/port_undef.inc" +#include "upb/port/undef.inc" #endif /* UPB_IO_CHUNKED_INPUT_STREAM_H_ */ diff --git a/upb/io/chunked_output_stream.c b/upb/io/chunked_output_stream.c index fb5d064649..9dc2375f5a 100644 --- a/upb/io/chunked_output_stream.c +++ b/upb/io/chunked_output_stream.c @@ -28,7 +28,7 @@ #include "upb/io/chunked_output_stream.h" // Must be last. -#include "upb/port_def.inc" +#include "upb/port/def.inc" typedef struct { upb_ZeroCopyOutputStream base; diff --git a/upb/io/chunked_output_stream.h b/upb/io/chunked_output_stream.h index bc8c542ef8..e5487199c0 100644 --- a/upb/io/chunked_output_stream.h +++ b/upb/io/chunked_output_stream.h @@ -32,7 +32,7 @@ #include "upb/mem/arena.h" // Must be last. -#include "upb/port_def.inc" +#include "upb/port/def.inc" #ifdef __cplusplus extern "C" { @@ -48,6 +48,6 @@ upb_ZeroCopyOutputStream* upb_ChunkedOutputStream_New(void* data, size_t size, } /* extern "C" */ #endif -#include "upb/port_undef.inc" +#include "upb/port/undef.inc" #endif /* UPB_IO_CHUNKED_OUTPUT_STREAM_H_ */ diff --git a/upb/io/string.h b/upb/io/string.h index f5e54d6ddc..83c824c03b 100644 --- a/upb/io/string.h +++ b/upb/io/string.h @@ -39,7 +39,7 @@ #include "upb/mem/arena.h" // Must be last. -#include "upb/port_def.inc" +#include "upb/port/def.inc" #ifdef __cplusplus extern "C" { @@ -130,6 +130,6 @@ UPB_INLINE bool upb_String_PushBack(upb_String* s, char ch) { } /* extern "C" */ #endif -#include "upb/port_undef.inc" +#include "upb/port/undef.inc" #endif /* UPB_IO_STRING_H_ */ diff --git a/upb/io/strtod.c b/upb/io/strtod.c index 6b1c44a54b..e650be3118 100644 --- a/upb/io/strtod.c +++ b/upb/io/strtod.c @@ -27,12 +27,11 @@ #include "upb/io/strtod.h" -#include #include #include // Must be last. -#include "upb/port_def.inc" +#include "upb/port/def.inc" // Determine the locale-specific radix character by calling sprintf() to print // the number 1.5, then stripping off the digits. As far as I can tell, this diff --git a/upb/io/strtod.h b/upb/io/strtod.h index 7a951390bd..91ed708f7b 100644 --- a/upb/io/strtod.h +++ b/upb/io/strtod.h @@ -29,7 +29,7 @@ #define UPB_IO_STRTOD_H_ // Must be last. -#include "upb/port_def.inc" +#include "upb/port/def.inc" #ifdef __cplusplus extern "C" { @@ -41,6 +41,6 @@ double NoLocaleStrtod(const char *str, char **endptr); } /* extern "C" */ #endif -#include "upb/port_undef.inc" +#include "upb/port/undef.inc" #endif /* UPB_IO_STRTOD_H_ */ diff --git a/upb/io/tokenizer.c b/upb/io/tokenizer.c index e3acd4dad7..7a1c3d3d11 100644 --- a/upb/io/tokenizer.c +++ b/upb/io/tokenizer.c @@ -27,14 +27,12 @@ #include "upb/io/tokenizer.h" -#include - #include "upb/internal/unicode.h" #include "upb/io/string.h" #include "upb/io/strtod.h" // Must be included last. -#include "upb/port_def.inc" +#include "upb/port/def.inc" typedef enum { // Started a line comment. diff --git a/upb/io/tokenizer.h b/upb/io/tokenizer.h index ed6ca5f434..1b6c3e699b 100644 --- a/upb/io/tokenizer.h +++ b/upb/io/tokenizer.h @@ -35,7 +35,7 @@ #include "upb/upb.h" // Must be included last. -#include "upb/port_def.inc" +#include "upb/port/def.inc" #ifdef __cplusplus extern "C" { @@ -147,6 +147,6 @@ upb_StringView upb_Parse_String(const char* text, upb_Arena* arena); } /* extern "C" */ #endif -#include "upb/port_undef.inc" +#include "upb/port/undef.inc" #endif // UPB_IO_TOKENIZER_H_ diff --git a/upb/io/tokenizer_test.cc b/upb/io/tokenizer_test.cc index 5894d7305f..ea8388d8e9 100644 --- a/upb/io/tokenizer_test.cc +++ b/upb/io/tokenizer_test.cc @@ -36,7 +36,7 @@ #include "upb/upb.hpp" // Must be last. -#include "upb/port_def.inc" +#include "upb/port/def.inc" namespace proto2 { namespace io { diff --git a/upb/io/zero_copy_input_stream.h b/upb/io/zero_copy_input_stream.h index 1abded08e8..af83ee6f2e 100644 --- a/upb/io/zero_copy_input_stream.h +++ b/upb/io/zero_copy_input_stream.h @@ -31,7 +31,7 @@ #include "upb/status.h" // Must be last. -#include "upb/port_def.inc" +#include "upb/port/def.inc" #ifdef __cplusplus extern "C" { @@ -124,6 +124,6 @@ upb_ZeroCopyInputStream_ByteCount(const upb_ZeroCopyInputStream* z) { } /* extern "C" */ #endif -#include "upb/port_undef.inc" +#include "upb/port/undef.inc" #endif /* UPB_IO_ZERO_COPY_INPUT_STREAM_H_ */ diff --git a/upb/io/zero_copy_output_stream.h b/upb/io/zero_copy_output_stream.h index 61cf6952b2..bab3aa67a0 100644 --- a/upb/io/zero_copy_output_stream.h +++ b/upb/io/zero_copy_output_stream.h @@ -31,7 +31,7 @@ #include "upb/status.h" // Must be last. -#include "upb/port_def.inc" +#include "upb/port/def.inc" #ifdef __cplusplus extern "C" { @@ -125,6 +125,6 @@ upb_ZeroCopyOutputStream_ByteCount(const upb_ZeroCopyOutputStream* z) { } /* extern "C" */ #endif -#include "upb/port_undef.inc" +#include "upb/port/undef.inc" #endif /* UPB_IO_ZERO_COPY_OUTPUT_STREAM_H_ */ diff --git a/upb/json/decode.c b/upb/json/decode.c index 02f3f3a753..d1afcbba58 100644 --- a/upb/json/decode.c +++ b/upb/json/decode.c @@ -42,7 +42,7 @@ #include "upb/wire/encode.h" // Must be last. -#include "upb/port_def.inc" +#include "upb/port/def.inc" typedef struct { const char *ptr, *end; diff --git a/upb/json/decode.h b/upb/json/decode.h index 5ddb164c71..7f8b8554d3 100644 --- a/upb/json/decode.h +++ b/upb/json/decode.h @@ -31,7 +31,7 @@ #include "upb/reflection/def.h" // Must be last. -#include "upb/port_def.inc" +#include "upb/port/def.inc" #ifdef __cplusplus extern "C" { @@ -47,6 +47,6 @@ bool upb_JsonDecode(const char* buf, size_t size, upb_Message* msg, } /* extern "C" */ #endif -#include "upb/port_undef.inc" +#include "upb/port/undef.inc" #endif /* UPB_JSONDECODE_H_ */ diff --git a/upb/json/encode.c b/upb/json/encode.c index 83a1ec4c6f..6325bea036 100644 --- a/upb/json/encode.c +++ b/upb/json/encode.c @@ -32,17 +32,16 @@ #include #include #include -#include #include #include "upb/collections/map.h" -#include "upb/internal/vsnprintf_compat.h" +#include "upb/port/vsnprintf_compat.h" #include "upb/reflection/message.h" #include "upb/wire/decode.h" #include "upb/wire/encode_internal.h" // Must be last. -#include "upb/port_def.inc" +#include "upb/port/def.inc" typedef struct { char *buf, *ptr, *end; diff --git a/upb/json/encode.h b/upb/json/encode.h index 95fcca78e0..ad9444a3e2 100644 --- a/upb/json/encode.h +++ b/upb/json/encode.h @@ -31,7 +31,7 @@ #include "upb/reflection/def.h" // Must be last. -#include "upb/port_def.inc" +#include "upb/port/def.inc" #ifdef __cplusplus extern "C" { @@ -65,6 +65,6 @@ size_t upb_JsonEncode(const upb_Message* msg, const upb_MessageDef* m, } /* extern "C" */ #endif -#include "upb/port_undef.inc" +#include "upb/port/undef.inc" #endif /* UPB_JSONENCODE_H_ */ diff --git a/upb/mem/alloc.c b/upb/mem/alloc.c index 9eb215cb32..23650655ce 100644 --- a/upb/mem/alloc.c +++ b/upb/mem/alloc.c @@ -30,7 +30,7 @@ #include // Must be last. -#include "upb/port_def.inc" +#include "upb/port/def.inc" static void* upb_global_allocfunc(upb_alloc* alloc, void* ptr, size_t oldsize, size_t size) { diff --git a/upb/mem/alloc.h b/upb/mem/alloc.h index c4bd97b80b..df7a65ecca 100644 --- a/upb/mem/alloc.h +++ b/upb/mem/alloc.h @@ -29,7 +29,7 @@ #define UPB_MEM_ALLOC_H_ // Must be last. -#include "upb/port_def.inc" +#include "upb/port/def.inc" #ifdef __cplusplus extern "C" { @@ -93,6 +93,6 @@ UPB_INLINE void upb_gfree(void* ptr) { upb_free(&upb_alloc_global, ptr); } } /* extern "C" */ #endif -#include "upb/port_undef.inc" +#include "upb/port/undef.inc" #endif /* UPB_MEM_ALLOC_H_ */ diff --git a/upb/mem/arena.c b/upb/mem/arena.c index 69d609f9de..fd2f889607 100644 --- a/upb/mem/arena.c +++ b/upb/mem/arena.c @@ -28,7 +28,7 @@ #include "upb/mem/arena_internal.h" // Must be last. -#include "upb/port_def.inc" +#include "upb/port/def.inc" static uint32_t* upb_cleanup_pointer(uintptr_t cleanup_metadata) { return (uint32_t*)(cleanup_metadata & ~0x1); diff --git a/upb/mem/arena.h b/upb/mem/arena.h index 072e502881..09a917e4f9 100644 --- a/upb/mem/arena.h +++ b/upb/mem/arena.h @@ -33,7 +33,7 @@ #include "upb/mem/alloc.h" // Must be last. -#include "upb/port_def.inc" +#include "upb/port/def.inc" #ifdef __cplusplus extern "C" { @@ -163,6 +163,6 @@ UPB_INLINE upb_Arena* upb_Arena_New(void) { } /* extern "C" */ #endif -#include "upb/port_undef.inc" +#include "upb/port/undef.inc" #endif /* UPB_MEM_ARENA_H_ */ diff --git a/upb/mem/arena_internal.h b/upb/mem/arena_internal.h index 6887feb18f..95ec3e93a5 100644 --- a/upb/mem/arena_internal.h +++ b/upb/mem/arena_internal.h @@ -31,7 +31,7 @@ #include "upb/mem/arena.h" // Must be last. -#include "upb/port_def.inc" +#include "upb/port/def.inc" #ifdef __cplusplus extern "C" { @@ -65,6 +65,6 @@ struct upb_Arena { } /* extern "C" */ #endif -#include "upb/port_undef.inc" +#include "upb/port/undef.inc" #endif /* UPB_MEM_ARENA_INTERNAL_H_ */ diff --git a/upb/mini_table/accessors.c b/upb/mini_table/accessors.c index 1f110d86c6..6a254f7f30 100644 --- a/upb/mini_table/accessors.c +++ b/upb/mini_table/accessors.c @@ -33,7 +33,7 @@ // Must be last. #include "upb/msg.h" -#include "upb/port_def.inc" +#include "upb/port/def.inc" static size_t _upb_MiniTable_Field_GetSize(const upb_MiniTable_Field* f) { static unsigned char sizes[] = { diff --git a/upb/mini_table/accessors.h b/upb/mini_table/accessors.h index 52bbfeb90a..d93e24d500 100644 --- a/upb/mini_table/accessors.h +++ b/upb/mini_table/accessors.h @@ -32,7 +32,7 @@ #include "upb/mini_table/common.h" // Must be last. -#include "upb/port_def.inc" +#include "upb/port/def.inc" #ifdef __cplusplus extern "C" { @@ -331,6 +331,6 @@ upb_UnknownToMessage_Status upb_MiniTable_PromoteUnknownToMessageArray( } /* extern "C" */ #endif -#include "upb/port_undef.inc" +#include "upb/port/undef.inc" #endif // UPB_MINI_TABLE_ACCESSORS_H_ diff --git a/upb/mini_table/common.c b/upb/mini_table/common.c index e9c02408f2..783403f2bc 100644 --- a/upb/mini_table/common.c +++ b/upb/mini_table/common.c @@ -34,7 +34,7 @@ #include "upb/upb.h" // Must be last. -#include "upb/port_def.inc" +#include "upb/port/def.inc" const char _kUpb_ToBase92[] = { ' ', '!', '#', '$', '%', '&', '(', ')', '*', '+', ',', '-', '.', '/', diff --git a/upb/mini_table/common.h b/upb/mini_table/common.h index cfb11879a1..6b3474b89f 100644 --- a/upb/mini_table/common.h +++ b/upb/mini_table/common.h @@ -31,7 +31,7 @@ #include "upb/msg_internal.h" // Must be last. -#include "upb/port_def.inc" +#include "upb/port/def.inc" typedef enum { kUpb_FieldModifier_IsRepeated = 1 << 0, @@ -70,6 +70,6 @@ UPB_INLINE const upb_MiniTable_Enum* upb_MiniTable_GetSubEnumTable( } /* extern "C" */ #endif -#include "upb/port_undef.inc" +#include "upb/port/undef.inc" #endif /* UPB_MINI_TABLE_COMMON_H_ */ diff --git a/upb/mini_table/common_internal.h b/upb/mini_table/common_internal.h index 7d4e1f3653..c373d261e5 100644 --- a/upb/mini_table/common_internal.h +++ b/upb/mini_table/common_internal.h @@ -31,7 +31,7 @@ #include "upb/upb.h" // Must be last. -#include "upb/port_def.inc" +#include "upb/port/def.inc" typedef enum { kUpb_EncodedType_Double = 0, @@ -118,6 +118,6 @@ UPB_INLINE bool _upb_FieldType_IsPackable(upb_FieldType type) { } /* extern "C" */ #endif -#include "upb/port_undef.inc" +#include "upb/port/undef.inc" #endif /* UPB_MINI_TABLE_COMMON_INTERNAL_H_ */ diff --git a/upb/mini_table/decode.c b/upb/mini_table/decode.c index d5e5b820cb..9779327955 100644 --- a/upb/mini_table/decode.c +++ b/upb/mini_table/decode.c @@ -35,7 +35,7 @@ #include "upb/upb.h" // Must be last. -#include "upb/port_def.inc" +#include "upb/port/def.inc" // Note: we sort by this number when calculating layout order. typedef enum { diff --git a/upb/mini_table/decode.h b/upb/mini_table/decode.h index 7ec70e4b4d..24620e6d4f 100644 --- a/upb/mini_table/decode.h +++ b/upb/mini_table/decode.h @@ -31,7 +31,7 @@ #include "upb/mini_table/common.h" // Must be last. -#include "upb/port_def.inc" +#include "upb/port/def.inc" typedef enum { kUpb_MiniTablePlatform_32Bit, @@ -92,6 +92,6 @@ upb_MiniTable* upb_MiniTable_BuildWithBuf(const char* data, size_t len, } /* extern "C" */ #endif -#include "upb/port_undef.inc" +#include "upb/port/undef.inc" #endif /* UPB_MINI_TABLE_DECODE_H_ */ diff --git a/upb/mini_table/encode.c b/upb/mini_table/encode.c index a386e6fb3f..80ddf5715f 100644 --- a/upb/mini_table/encode.c +++ b/upb/mini_table/encode.c @@ -34,7 +34,7 @@ #include "upb/upb.h" // Must be last. -#include "upb/port_def.inc" +#include "upb/port/def.inc" typedef struct { uint64_t present_values_mask; diff --git a/upb/mini_table/encode_internal.h b/upb/mini_table/encode_internal.h index 6cc7d5a309..cec71ad70f 100644 --- a/upb/mini_table/encode_internal.h +++ b/upb/mini_table/encode_internal.h @@ -31,7 +31,7 @@ #include "upb/mini_table/common.h" // Must be last. -#include "upb/port_def.inc" +#include "upb/port/def.inc" // If the input buffer has at least this many bytes available, the encoder call // is guaranteed to succeed (as long as field number order is maintained). @@ -104,6 +104,6 @@ char* upb_MtDataEncoder_EncodeMessageSet(upb_MtDataEncoder* e, char* ptr); } /* extern "C" */ #endif -#include "upb/port_undef.inc" +#include "upb/port/undef.inc" #endif /* UPB_MINI_TABLE_ENCODE_INTERNAL_H_ */ diff --git a/upb/msg.c b/upb/msg.c index 7cd77147d1..c2c1053c02 100644 --- a/upb/msg.c +++ b/upb/msg.c @@ -32,7 +32,7 @@ #include "upb/msg_internal.h" // Must be last. -#include "upb/port_def.inc" +#include "upb/port/def.inc" const float kUpb_FltInfinity = INFINITY; const double kUpb_Infinity = INFINITY; diff --git a/upb/msg.h b/upb/msg.h index c06e52d084..abb132e59e 100644 --- a/upb/msg.h +++ b/upb/msg.h @@ -39,7 +39,7 @@ #include "upb/mem/arena.h" // Must be last. -#include "upb/port_def.inc" +#include "upb/port/def.inc" #ifdef __cplusplus extern "C" { @@ -72,6 +72,6 @@ size_t upb_Message_ExtensionCount(const upb_Message* msg); } /* extern "C" */ #endif -#include "upb/port_undef.inc" +#include "upb/port/undef.inc" #endif /* UPB_MSG_INT_H_ */ diff --git a/upb/msg_internal.h b/upb/msg_internal.h index 017dfa0c2e..19ba158565 100644 --- a/upb/msg_internal.h +++ b/upb/msg_internal.h @@ -45,7 +45,7 @@ #include "upb/upb.h" // Must be last. -#include "upb/port_def.inc" +#include "upb/port/def.inc" #ifdef __cplusplus extern "C" { @@ -435,6 +435,6 @@ typedef struct { } /* extern "C" */ #endif -#include "upb/port_undef.inc" +#include "upb/port/undef.inc" #endif /* UPB_MSG_INT_H_ */ diff --git a/upb/port_def.inc b/upb/port/def.inc similarity index 97% rename from upb/port_def.inc rename to upb/port/def.inc index f335737fe9..99e1c1d6f8 100644 --- a/upb/port_def.inc +++ b/upb/port/def.inc @@ -26,10 +26,9 @@ */ /* - * This is where we define macros used across upb. + * This is where we define internal portability macros used across upb. * - * All of these macros are undef'd in port_undef.inc to avoid leaking them to - * users. + * All of these macros are undef'd in undef.inc to avoid leaking them to users. * * The correct usage is: * @@ -37,13 +36,13 @@ * #include "upb/baz.h" * * // MUST be last included header. - * #include "upb/port_def.inc" + * #include "upb/port/def.inc" * * // Code for this file. * // <...> * * // Can be omitted for .c files, required for .h. - * #include "upb/port_undef.inc" + * #include "upb/port/undef.inc" * * This file is private and must not be included by users! */ @@ -68,6 +67,7 @@ #include #include #include +#include #if UINTPTR_MAX == 0xffffffff #define UPB_SIZE(size32, size64) size32 diff --git a/upb/port_undef.inc b/upb/port/undef.inc similarity index 97% rename from upb/port_undef.inc rename to upb/port/undef.inc index 80584a1e0e..dad44920a6 100644 --- a/upb/port_undef.inc +++ b/upb/port/undef.inc @@ -25,7 +25,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* See port_def.inc. This should #undef all macros #defined there. */ +// This should #undef all macros #defined in def.inc #undef UPB_SIZE #undef UPB_PTR_AT diff --git a/upb/internal/vsnprintf_compat.h b/upb/port/vsnprintf_compat.h similarity index 91% rename from upb/internal/vsnprintf_compat.h rename to upb/port/vsnprintf_compat.h index a9d84bb6fe..f895060162 100644 --- a/upb/internal/vsnprintf_compat.h +++ b/upb/port/vsnprintf_compat.h @@ -25,13 +25,11 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef UPB_INTERNAL_VSNPRINTF_COMPAT_H_ -#define UPB_INTERNAL_VSNPRINTF_COMPAT_H_ - -#include +#ifndef UPB_PORT_VSNPRINTF_COMPAT_H_ +#define UPB_PORT_VSNPRINTF_COMPAT_H_ // Must be last. -#include "upb/port_def.inc" +#include "upb/port/def.inc" UPB_INLINE int _upb_vsnprintf(char* buf, size_t size, const char* fmt, va_list ap) { @@ -47,6 +45,6 @@ UPB_INLINE int _upb_vsnprintf(char* buf, size_t size, const char* fmt, #endif } -#include "upb/port_undef.inc" +#include "upb/port/undef.inc" -#endif // UPB_INTERNAL_VSNPRINTF_COMPAT_H_ +#endif // UPB_PORT_VSNPRINTF_COMPAT_H_ diff --git a/upb/reflection/def_builder.c b/upb/reflection/def_builder.c index c091721cad..c79f45e37d 100644 --- a/upb/reflection/def_builder.c +++ b/upb/reflection/def_builder.c @@ -33,7 +33,7 @@ #include "upb/reflection/field_def.h" // Must be last. -#include "upb/port_def.inc" +#include "upb/port/def.inc" /* The upb core does not generally have a concept of default instances. However * for descriptor options we make an exception since the max size is known and diff --git a/upb/reflection/def_builder_internal.h b/upb/reflection/def_builder_internal.h index aacbda460c..387ea66ab7 100644 --- a/upb/reflection/def_builder_internal.h +++ b/upb/reflection/def_builder_internal.h @@ -33,7 +33,7 @@ #include "upb/reflection/def_type.h" // Must be last. -#include "upb/port_def.inc" +#include "upb/port/def.inc" // We want to copy the options verbatim into the destination options proto. // We use serialize+parse as our deep copy. @@ -168,6 +168,6 @@ UPB_INLINE void _upb_DefBuilder_CheckIdentFull(upb_DefBuilder* ctx, } /* extern "C" */ #endif -#include "upb/port_undef.inc" +#include "upb/port/undef.inc" #endif /* UPB_REFLECTION_DEF_BUILDER_INTERNAL_H_ */ diff --git a/upb/reflection/def_builder_test.cc b/upb/reflection/def_builder_test.cc index 3dd5d97582..e8cfcc468c 100644 --- a/upb/reflection/def_builder_test.cc +++ b/upb/reflection/def_builder_test.cc @@ -30,7 +30,7 @@ #include "upb/reflection/def_builder_internal.h" // Must be last. -#include "upb/port_def.inc" +#include "upb/port/def.inc" struct IdentTest { const char* text; diff --git a/upb/reflection/def_pool.c b/upb/reflection/def_pool.c index 025cde8a80..86db6f1813 100644 --- a/upb/reflection/def_pool.c +++ b/upb/reflection/def_pool.c @@ -36,7 +36,7 @@ #include "upb/reflection/service_def_internal.h" // Must be last. -#include "upb/port_def.inc" +#include "upb/port/def.inc" struct upb_DefPool { upb_Arena* arena; @@ -339,9 +339,6 @@ const upb_FileDef* upb_DefPool_AddFile( return _upb_DefPool_AddFile(s, file_proto, NULL, status); } -/* Include here since we want most of this file to be stdio-free. */ -#include - bool _upb_DefPool_LoadDefInitEx(upb_DefPool* s, const _upb_DefPool_Init* init, bool rebuild_minitable) { /* Since this function should never fail (it would indicate a bug in upb) we diff --git a/upb/reflection/def_pool.h b/upb/reflection/def_pool.h index 256c06b2ce..919028ef34 100644 --- a/upb/reflection/def_pool.h +++ b/upb/reflection/def_pool.h @@ -35,7 +35,7 @@ #include "upb/string_view.h" // Must be last. -#include "upb/port_def.inc" +#include "upb/port/def.inc" #ifdef __cplusplus extern "C" { @@ -101,6 +101,6 @@ const upb_FieldDef** upb_DefPool_GetAllExtensions(const upb_DefPool* s, } /* extern "C" */ #endif -#include "upb/port_undef.inc" +#include "upb/port/undef.inc" #endif /* UPB_REFLECTION_DEF_POOL_H_ */ diff --git a/upb/reflection/def_pool_internal.h b/upb/reflection/def_pool_internal.h index 5da30a97a3..98412bed9d 100644 --- a/upb/reflection/def_pool_internal.h +++ b/upb/reflection/def_pool_internal.h @@ -31,7 +31,7 @@ #include "upb/reflection/def_pool.h" // Must be last. -#include "upb/port_def.inc" +#include "upb/port/def.inc" #ifdef __cplusplus extern "C" { @@ -70,6 +70,6 @@ bool _upb_DefPool_LoadDefInitEx(upb_DefPool* s, const _upb_DefPool_Init* init, } /* extern "C" */ #endif -#include "upb/port_undef.inc" +#include "upb/port/undef.inc" #endif /* UPB_REFLECTION_DEF_POOL_INTERNAL_H_ */ diff --git a/upb/reflection/def_type.c b/upb/reflection/def_type.c index 033e7102f9..110cc35d98 100644 --- a/upb/reflection/def_type.c +++ b/upb/reflection/def_type.c @@ -28,7 +28,7 @@ #include "upb/reflection/def_type.h" // Must be last. -#include "upb/port_def.inc" +#include "upb/port/def.inc" upb_deftype_t _upb_DefType_Type(upb_value v) { const uintptr_t num = (uintptr_t)upb_value_getconstptr(v); diff --git a/upb/reflection/def_type.h b/upb/reflection/def_type.h index 31ce3e263c..8a4efc81c7 100644 --- a/upb/reflection/def_type.h +++ b/upb/reflection/def_type.h @@ -31,7 +31,7 @@ #include "upb/internal/table.h" // Must be last. -#include "upb/port_def.inc" +#include "upb/port/def.inc" // Inside a symtab we store tagged pointers to specific def types. typedef enum { @@ -76,6 +76,6 @@ const void* _upb_DefType_Unpack(upb_value v, upb_deftype_t type); } /* extern "C" */ #endif -#include "upb/port_undef.inc" +#include "upb/port/undef.inc" #endif /* UPB_REFLECTION_DEF_TYPE_H_ */ diff --git a/upb/reflection/desc_state.c b/upb/reflection/desc_state.c index 470d786520..09f4c2af0e 100644 --- a/upb/reflection/desc_state.c +++ b/upb/reflection/desc_state.c @@ -28,7 +28,7 @@ #include "upb/reflection/desc_state_internal.h" // Must be last. -#include "upb/port_def.inc" +#include "upb/port/def.inc" bool _upb_DescState_Grow(upb_DescState* d, upb_Arena* a) { const size_t oldbufsize = d->bufsize; diff --git a/upb/reflection/desc_state_internal.h b/upb/reflection/desc_state_internal.h index e4cf4ee2f9..8b431f1da9 100644 --- a/upb/reflection/desc_state_internal.h +++ b/upb/reflection/desc_state_internal.h @@ -31,7 +31,7 @@ #include "upb/mini_table/encode_internal.h" // Must be last. -#include "upb/port_def.inc" +#include "upb/port/def.inc" // Manages the storage for mini descriptor strings as they are being encoded. // TODO(b/234740652): Move some of this state directly into the encoder, maybe. @@ -58,6 +58,6 @@ bool _upb_DescState_Grow(upb_DescState* d, upb_Arena* a); } /* extern "C" */ #endif -#include "upb/port_undef.inc" +#include "upb/port/undef.inc" #endif /* UPB_REFLECTION_DESC_STATE_INTERNAL_H_ */ diff --git a/upb/reflection/enum_def.c b/upb/reflection/enum_def.c index fc9f217e2e..a7150585b8 100644 --- a/upb/reflection/enum_def.c +++ b/upb/reflection/enum_def.c @@ -25,8 +25,6 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include - #include "upb/mini_table/decode.h" #include "upb/reflection/def_builder_internal.h" #include "upb/reflection/def_type.h" @@ -37,7 +35,7 @@ #include "upb/reflection/message_def_internal.h" // Must be last. -#include "upb/port_def.inc" +#include "upb/port/def.inc" struct upb_EnumDef { const google_protobuf_EnumOptions* opts; diff --git a/upb/reflection/enum_def.h b/upb/reflection/enum_def.h index dd9225694c..07fb8aaef6 100644 --- a/upb/reflection/enum_def.h +++ b/upb/reflection/enum_def.h @@ -34,7 +34,7 @@ #include "upb/string_view.h" // Must be last. -#include "upb/port_def.inc" +#include "upb/port/def.inc" #ifdef __cplusplus extern "C" { @@ -67,6 +67,6 @@ int upb_EnumDef_ValueCount(const upb_EnumDef* e); } /* extern "C" */ #endif -#include "upb/port_undef.inc" +#include "upb/port/undef.inc" #endif /* UPB_REFLECTION_ENUM_DEF_H_ */ diff --git a/upb/reflection/enum_def_internal.h b/upb/reflection/enum_def_internal.h index ae15dff044..55e4f89590 100644 --- a/upb/reflection/enum_def_internal.h +++ b/upb/reflection/enum_def_internal.h @@ -31,7 +31,7 @@ #include "upb/reflection/enum_def.h" // Must be last. -#include "upb/port_def.inc" +#include "upb/port/def.inc" #ifdef __cplusplus extern "C" { @@ -50,6 +50,6 @@ upb_EnumDef* _upb_EnumDefs_New(upb_DefBuilder* ctx, int n, } /* extern "C" */ #endif -#include "upb/port_undef.inc" +#include "upb/port/undef.inc" #endif /* UPB_REFLECTION_ENUM_DEF_INTERNAL_H_ */ diff --git a/upb/reflection/enum_value_def.c b/upb/reflection/enum_value_def.c index affdb913ff..afa1f0d73a 100644 --- a/upb/reflection/enum_value_def.c +++ b/upb/reflection/enum_value_def.c @@ -32,7 +32,7 @@ #include "upb/reflection/file_def_internal.h" // Must be last. -#include "upb/port_def.inc" +#include "upb/port/def.inc" struct upb_EnumValueDef { const google_protobuf_EnumValueOptions* opts; diff --git a/upb/reflection/enum_value_def.h b/upb/reflection/enum_value_def.h index 208d280b9f..2ab98ddd89 100644 --- a/upb/reflection/enum_value_def.h +++ b/upb/reflection/enum_value_def.h @@ -33,7 +33,7 @@ #include "upb/reflection/common.h" // Must be last. -#include "upb/port_def.inc" +#include "upb/port/def.inc" #ifdef __cplusplus extern "C" { @@ -52,6 +52,6 @@ const google_protobuf_EnumValueOptions* upb_EnumValueDef_Options( } /* extern "C" */ #endif -#include "upb/port_undef.inc" +#include "upb/port/undef.inc" #endif /* UPB_REFLECTION_ENUM_VALUE_DEF_H_ */ diff --git a/upb/reflection/enum_value_def_internal.h b/upb/reflection/enum_value_def_internal.h index 53a3d13737..c073ce8885 100644 --- a/upb/reflection/enum_value_def_internal.h +++ b/upb/reflection/enum_value_def_internal.h @@ -31,7 +31,7 @@ #include "upb/reflection/enum_value_def.h" // Must be last. -#include "upb/port_def.inc" +#include "upb/port/def.inc" #ifdef __cplusplus extern "C" { @@ -52,6 +52,6 @@ const upb_EnumValueDef** _upb_EnumValueDefs_Sorted(const upb_EnumValueDef* v, } /* extern "C" */ #endif -#include "upb/port_undef.inc" +#include "upb/port/undef.inc" #endif /* UPB_REFLECTION_ENUM_VALUE_DEF_INTERNAL_H_ */ diff --git a/upb/reflection/extension_range.c b/upb/reflection/extension_range.c index 5590366bf0..eb098cb8ed 100644 --- a/upb/reflection/extension_range.c +++ b/upb/reflection/extension_range.c @@ -31,7 +31,7 @@ #include "upb/reflection/message_def_internal.h" // Must be last. -#include "upb/port_def.inc" +#include "upb/port/def.inc" struct upb_ExtensionRange { const google_protobuf_ExtensionRangeOptions* opts; diff --git a/upb/reflection/extension_range.h b/upb/reflection/extension_range.h index a870e542e0..6220397f33 100644 --- a/upb/reflection/extension_range.h +++ b/upb/reflection/extension_range.h @@ -33,7 +33,7 @@ #include "upb/reflection/common.h" // Must be last. -#include "upb/port_def.inc" +#include "upb/port/def.inc" #ifdef __cplusplus extern "C" { @@ -50,6 +50,6 @@ const google_protobuf_ExtensionRangeOptions* upb_ExtensionRange_Options( } /* extern "C" */ #endif -#include "upb/port_undef.inc" +#include "upb/port/undef.inc" #endif /* UPB_REFLECTION_EXTENSION_RANGE_H_ */ diff --git a/upb/reflection/extension_range_internal.h b/upb/reflection/extension_range_internal.h index 0215fc32ca..2aa643b03b 100644 --- a/upb/reflection/extension_range_internal.h +++ b/upb/reflection/extension_range_internal.h @@ -31,7 +31,7 @@ #include "upb/reflection/extension_range.h" // Must be last. -#include "upb/port_def.inc" +#include "upb/port/def.inc" #ifdef __cplusplus extern "C" { @@ -49,6 +49,6 @@ upb_ExtensionRange* _upb_ExtensionRanges_New( } /* extern "C" */ #endif -#include "upb/port_undef.inc" +#include "upb/port/undef.inc" #endif /* UPB_REFLECTION_EXTENSION_RANGE_INTERNAL_H_ */ diff --git a/upb/reflection/field_def.c b/upb/reflection/field_def.c index a0f83598d7..3a97f331a4 100644 --- a/upb/reflection/field_def.c +++ b/upb/reflection/field_def.c @@ -42,7 +42,7 @@ #include "upb/reflection/oneof_def_internal.h" // Must be last. -#include "upb/port_def.inc" +#include "upb/port/def.inc" #define UPB_FIELD_TYPE_UNSPECIFIED 0 diff --git a/upb/reflection/field_def.h b/upb/reflection/field_def.h index d22166ff7f..b9c7b4f037 100644 --- a/upb/reflection/field_def.h +++ b/upb/reflection/field_def.h @@ -34,7 +34,7 @@ #include "upb/string_view.h" // Must be last. -#include "upb/port_def.inc" +#include "upb/port/def.inc" // Maximum field number allowed for FieldDefs. // This is an inherent limit of the protobuf wire format. @@ -85,6 +85,6 @@ upb_FieldType upb_FieldDef_Type(const upb_FieldDef* f); } /* extern "C" */ #endif -#include "upb/port_undef.inc" +#include "upb/port/undef.inc" #endif /* UPB_REFLECTION_FIELD_DEF_H_ */ diff --git a/upb/reflection/field_def_internal.h b/upb/reflection/field_def_internal.h index 0626f90be0..2f46802b49 100644 --- a/upb/reflection/field_def_internal.h +++ b/upb/reflection/field_def_internal.h @@ -31,7 +31,7 @@ #include "upb/reflection/field_def.h" // Must be last. -#include "upb/port_def.inc" +#include "upb/port/def.inc" #ifdef __cplusplus extern "C" { @@ -63,6 +63,6 @@ const upb_FieldDef** _upb_FieldDefs_Sorted(const upb_FieldDef* f, int n, } /* extern "C" */ #endif -#include "upb/port_undef.inc" +#include "upb/port/undef.inc" #endif /* UPB_REFLECTION_FIELD_DEF_INTERNAL_H_ */ diff --git a/upb/reflection/file_def.c b/upb/reflection/file_def.c index b0a8f63b33..45d422609f 100644 --- a/upb/reflection/file_def.c +++ b/upb/reflection/file_def.c @@ -34,7 +34,7 @@ #include "upb/reflection/service_def_internal.h" // Must be last. -#include "upb/port_def.inc" +#include "upb/port/def.inc" struct upb_FileDef { const google_protobuf_FileOptions* opts; diff --git a/upb/reflection/file_def.h b/upb/reflection/file_def.h index 895a798bc1..a5bf2ffe4b 100644 --- a/upb/reflection/file_def.h +++ b/upb/reflection/file_def.h @@ -33,7 +33,7 @@ #include "upb/reflection/common.h" // Must be last. -#include "upb/port_def.inc" +#include "upb/port/def.inc" #ifdef __cplusplus extern "C" { @@ -71,6 +71,6 @@ int upb_FileDef_WeakDependencyCount(const upb_FileDef* f); } /* extern "C" */ #endif -#include "upb/port_undef.inc" +#include "upb/port/undef.inc" #endif /* UPB_REFLECTION_FILE_DEF_H_ */ diff --git a/upb/reflection/file_def_internal.h b/upb/reflection/file_def_internal.h index 23710e7065..9c014000f3 100644 --- a/upb/reflection/file_def_internal.h +++ b/upb/reflection/file_def_internal.h @@ -31,7 +31,7 @@ #include "upb/reflection/file_def.h" // Must be last. -#include "upb/port_def.inc" +#include "upb/port/def.inc" #ifdef __cplusplus extern "C" { @@ -52,6 +52,6 @@ void _upb_FileDef_Create(upb_DefBuilder* ctx, } /* extern "C" */ #endif -#include "upb/port_undef.inc" +#include "upb/port/undef.inc" #endif /* UPB_REFLECTION_FILE_DEF_INTERNAL_H_ */ diff --git a/upb/reflection/message.c b/upb/reflection/message.c index 7bb510f099..8bb59c4a33 100644 --- a/upb/reflection/message.c +++ b/upb/reflection/message.c @@ -39,7 +39,7 @@ #include "upb/reflection/oneof_def.h" // Must be last. -#include "upb/port_def.inc" +#include "upb/port/def.inc" static size_t get_field_size(const upb_MiniTable_Field* f) { static unsigned char sizes[] = { diff --git a/upb/reflection/message.h b/upb/reflection/message.h index 6a6d58a958..56eb722d51 100644 --- a/upb/reflection/message.h +++ b/upb/reflection/message.h @@ -32,7 +32,7 @@ #include "upb/reflection/common.h" // Must be last. -#include "upb/port_def.inc" +#include "upb/port/def.inc" #ifdef __cplusplus extern "C" { @@ -98,6 +98,6 @@ bool upb_Message_DiscardUnknown(upb_Message* msg, const upb_MessageDef* m, } /* extern "C" */ #endif -#include "upb/port_undef.inc" +#include "upb/port/undef.inc" #endif /* UPB_REFLECTION_MESSAGE_H_ */ diff --git a/upb/reflection/message_def.c b/upb/reflection/message_def.c index df43c16b95..42b40b5980 100644 --- a/upb/reflection/message_def.c +++ b/upb/reflection/message_def.c @@ -37,7 +37,7 @@ #include "upb/reflection/oneof_def_internal.h" // Must be last. -#include "upb/port_def.inc" +#include "upb/port/def.inc" struct upb_MessageDef { const google_protobuf_MessageOptions* opts; diff --git a/upb/reflection/message_def.h b/upb/reflection/message_def.h index fbda689016..fb26bfeb67 100644 --- a/upb/reflection/message_def.h +++ b/upb/reflection/message_def.h @@ -34,7 +34,7 @@ #include "upb/string_view.h" // Must be last. -#include "upb/port_def.inc" +#include "upb/port/def.inc" // Well-known field tag numbers for map-entry messages. #define kUpb_MapEntry_KeyFieldNumber 1 @@ -159,6 +159,6 @@ upb_WellKnown upb_MessageDef_WellKnownType(const upb_MessageDef* m); } /* extern "C" */ #endif -#include "upb/port_undef.inc" +#include "upb/port/undef.inc" #endif /* UPB_REFLECTION_MESSAGE_DEF_H_ */ diff --git a/upb/reflection/message_def_internal.h b/upb/reflection/message_def_internal.h index b125625c7c..ba96cc22b7 100644 --- a/upb/reflection/message_def_internal.h +++ b/upb/reflection/message_def_internal.h @@ -31,7 +31,7 @@ #include "upb/reflection/message_def.h" // Must be last. -#include "upb/port_def.inc" +#include "upb/port/def.inc" #ifdef __cplusplus extern "C" { @@ -57,6 +57,6 @@ upb_MessageDef* _upb_MessageDefs_New( } /* extern "C" */ #endif -#include "upb/port_undef.inc" +#include "upb/port/undef.inc" #endif /* UPB_REFLECTION_MESSAGE_DEF_INTERNAL_H_ */ diff --git a/upb/reflection/method_def.c b/upb/reflection/method_def.c index b8b7b9a1a4..9a4971d5c2 100644 --- a/upb/reflection/method_def.c +++ b/upb/reflection/method_def.c @@ -31,7 +31,7 @@ #include "upb/reflection/service_def.h" // Must be last. -#include "upb/port_def.inc" +#include "upb/port/def.inc" struct upb_MethodDef { const google_protobuf_MethodOptions* opts; diff --git a/upb/reflection/method_def.h b/upb/reflection/method_def.h index 207c384bdc..5ee701adea 100644 --- a/upb/reflection/method_def.h +++ b/upb/reflection/method_def.h @@ -33,7 +33,7 @@ #include "upb/reflection/common.h" // Must be last. -#include "upb/port_def.inc" +#include "upb/port/def.inc" #ifdef __cplusplus extern "C" { @@ -54,6 +54,6 @@ const upb_ServiceDef* upb_MethodDef_Service(const upb_MethodDef* m); } /* extern "C" */ #endif -#include "upb/port_undef.inc" +#include "upb/port/undef.inc" #endif /* UPB_REFLECTION_METHOD_DEF_H_ */ diff --git a/upb/reflection/method_def_internal.h b/upb/reflection/method_def_internal.h index 4c08358566..1eeff262ea 100644 --- a/upb/reflection/method_def_internal.h +++ b/upb/reflection/method_def_internal.h @@ -31,7 +31,7 @@ #include "upb/reflection/method_def.h" // Must be last. -#include "upb/port_def.inc" +#include "upb/port/def.inc" #ifdef __cplusplus extern "C" { @@ -48,6 +48,6 @@ upb_MethodDef* _upb_MethodDefs_New( } /* extern "C" */ #endif -#include "upb/port_undef.inc" +#include "upb/port/undef.inc" #endif /* UPB_REFLECTION_METHOD_DEF_INTERNAL_H_ */ diff --git a/upb/reflection/oneof_def.c b/upb/reflection/oneof_def.c index a4f364d3ef..b394520a3a 100644 --- a/upb/reflection/oneof_def.c +++ b/upb/reflection/oneof_def.c @@ -36,7 +36,7 @@ #include "upb/reflection/oneof_def_internal.h" // Must be last. -#include "upb/port_def.inc" +#include "upb/port/def.inc" struct upb_OneofDef { const google_protobuf_OneofOptions* opts; diff --git a/upb/reflection/oneof_def.h b/upb/reflection/oneof_def.h index daeec47029..709a5c2aa2 100644 --- a/upb/reflection/oneof_def.h +++ b/upb/reflection/oneof_def.h @@ -33,7 +33,7 @@ #include "upb/reflection/common.h" // Must be last. -#include "upb/port_def.inc" +#include "upb/port/def.inc" #ifdef __cplusplus extern "C" { @@ -61,6 +61,6 @@ const google_protobuf_OneofOptions* upb_OneofDef_Options(const upb_OneofDef* o); } /* extern "C" */ #endif -#include "upb/port_undef.inc" +#include "upb/port/undef.inc" #endif /* UPB_REFLECTION_ONEOF_DEF_H_ */ diff --git a/upb/reflection/oneof_def_internal.h b/upb/reflection/oneof_def_internal.h index ac832ae18b..807b558676 100644 --- a/upb/reflection/oneof_def_internal.h +++ b/upb/reflection/oneof_def_internal.h @@ -31,7 +31,7 @@ #include "upb/reflection/oneof_def.h" // Must be last. -#include "upb/port_def.inc" +#include "upb/port/def.inc" #ifdef __cplusplus extern "C" { @@ -52,6 +52,6 @@ size_t _upb_OneofDefs_Finalize(upb_DefBuilder* ctx, upb_MessageDef* m); } /* extern "C" */ #endif -#include "upb/port_undef.inc" +#include "upb/port/undef.inc" #endif /* UPB_REFLECTION_ONEOF_DEF_INTERNAL_H_ */ diff --git a/upb/reflection/service_def.c b/upb/reflection/service_def.c index 67c6a8fde8..b904aff61a 100644 --- a/upb/reflection/service_def.c +++ b/upb/reflection/service_def.c @@ -32,7 +32,7 @@ #include "upb/reflection/service_def_internal.h" // Must be last. -#include "upb/port_def.inc" +#include "upb/port/def.inc" struct upb_ServiceDef { const google_protobuf_ServiceOptions* opts; diff --git a/upb/reflection/service_def.h b/upb/reflection/service_def.h index e5bde6952f..b2a9fa09fc 100644 --- a/upb/reflection/service_def.h +++ b/upb/reflection/service_def.h @@ -33,7 +33,7 @@ #include "upb/reflection/common.h" // Must be last. -#include "upb/port_def.inc" +#include "upb/port/def.inc" #ifdef __cplusplus extern "C" { @@ -54,6 +54,6 @@ const google_protobuf_ServiceOptions* upb_ServiceDef_Options(const upb_ServiceDe } /* extern "C" */ #endif -#include "upb/port_undef.inc" +#include "upb/port/undef.inc" #endif /* UPB_REFLECTION_SERVICE_DEF_H_ */ diff --git a/upb/reflection/service_def_internal.h b/upb/reflection/service_def_internal.h index eb50f54421..49201bb2f0 100644 --- a/upb/reflection/service_def_internal.h +++ b/upb/reflection/service_def_internal.h @@ -31,7 +31,7 @@ #include "upb/reflection/service_def.h" // Must be last. -#include "upb/port_def.inc" +#include "upb/port/def.inc" #ifdef __cplusplus extern "C" { @@ -48,6 +48,6 @@ upb_ServiceDef* _upb_ServiceDefs_New( } /* extern "C" */ #endif -#include "upb/port_undef.inc" +#include "upb/port/undef.inc" #endif /* UPB_REFLECTION_SERVICE_DEF_INTERNAL_H_ */ diff --git a/upb/status.c b/upb/status.c index e2a9c1a3ab..9435355597 100644 --- a/upb/status.c +++ b/upb/status.c @@ -30,12 +30,11 @@ #include #include #include -#include #include #include // Must be last. -#include "upb/port_def.inc" +#include "upb/port/def.inc" void upb_Status_Clear(upb_Status* status) { if (!status) return; diff --git a/upb/status.h b/upb/status.h index 596691b30e..aab12b36a8 100644 --- a/upb/status.h +++ b/upb/status.h @@ -31,7 +31,7 @@ #include // Must be last. -#include "upb/port_def.inc" +#include "upb/port/def.inc" #ifdef __cplusplus extern "C" { @@ -61,6 +61,6 @@ void upb_Status_VAppendErrorFormat(upb_Status* status, const char* fmt, } /* extern "C" */ #endif -#include "upb/port_undef.inc" +#include "upb/port/undef.inc" #endif /* UPB_STATUS_H_ */ diff --git a/upb/string_view.h b/upb/string_view.h index 95ebd4c1a8..953afb09c4 100644 --- a/upb/string_view.h +++ b/upb/string_view.h @@ -31,7 +31,7 @@ #include // Must be last. -#include "upb/port_def.inc" +#include "upb/port/def.inc" #ifdef __cplusplus extern "C" { @@ -68,6 +68,6 @@ UPB_INLINE bool upb_StringView_IsEqual(upb_StringView a, upb_StringView b) { } /* extern "C" */ #endif -#include "upb/port_undef.inc" +#include "upb/port/undef.inc" #endif /* UPB_STRING_VIEW_H_ */ diff --git a/upb/test_cpp.cc b/upb/test_cpp.cc index 88a4e5d5da..51fca5b161 100644 --- a/upb/test_cpp.cc +++ b/upb/test_cpp.cc @@ -23,11 +23,8 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -/* - * Tests for C++ wrappers. - */ +// Tests for C++ wrappers. -#include #include #include @@ -47,7 +44,7 @@ #include "upb/upb.h" // Must be last. -#include "upb/port_def.inc" +#include "upb/port/def.inc" TEST(Cpp, Iteration) { upb::DefPool defpool; diff --git a/upb/test_generated_code.cc b/upb/test_generated_code.cc index 013ed634a6..3f9a66de3a 100644 --- a/upb/test_generated_code.cc +++ b/upb/test_generated_code.cc @@ -37,7 +37,7 @@ #include "upb/upb.hpp" // Must be last. -#include "upb/port_def.inc" +#include "upb/port/def.inc" #if !defined(MIN) #define MIN(x, y) ((x) < (y) ? (x) : (y)) diff --git a/upb/test_table.cc b/upb/test_table.cc index ddb129a38e..d57f673434 100644 --- a/upb/test_table.cc +++ b/upb/test_table.cc @@ -43,7 +43,7 @@ #include "upb/upb.hpp" // Must be last. -#include "upb/port_def.inc" +#include "upb/port/def.inc" // Convenience interface for C++. We don't put this in upb itself because // the table is not exposed to users. diff --git a/upb/text/encode.c b/upb/text/encode.c index 154c1bdb54..d20b7c4464 100644 --- a/upb/text/encode.c +++ b/upb/text/encode.c @@ -35,12 +35,12 @@ #include "upb/collections/map.h" #include "upb/collections/map_sorter_internal.h" -#include "upb/internal/vsnprintf_compat.h" +#include "upb/port/vsnprintf_compat.h" #include "upb/reflection/message.h" #include "upb/wire/encode_internal.h" // Must be last. -#include "upb/port_def.inc" +#include "upb/port/def.inc" typedef struct { char *buf, *ptr, *end; diff --git a/upb/text/encode.h b/upb/text/encode.h index 657fe16675..3e3d1d528e 100644 --- a/upb/text/encode.h +++ b/upb/text/encode.h @@ -31,7 +31,7 @@ #include "upb/reflection/def.h" // Must be last. -#include "upb/port_def.inc" +#include "upb/port/def.inc" #ifdef __cplusplus extern "C" { @@ -64,6 +64,6 @@ size_t upb_TextEncode(const upb_Message* msg, const upb_MessageDef* m, } /* extern "C" */ #endif -#include "upb/port_undef.inc" +#include "upb/port/undef.inc" #endif /* UPB_TEXT_ENCODE_H_ */ diff --git a/upb/upb.c b/upb/upb.c index 61649cb737..aecf5338a9 100644 --- a/upb/upb.c +++ b/upb/upb.c @@ -26,13 +26,12 @@ */ #include -#include #include #include "upb/wire/encode_internal.h" // Must be last. -#include "upb/port_def.inc" +#include "upb/port/def.inc" /* Miscellaneous utilities ****************************************************/ diff --git a/upb/upb.h b/upb/upb.h index 4ac33cc170..4cb2bbbc34 100644 --- a/upb/upb.h +++ b/upb/upb.h @@ -32,11 +32,7 @@ #ifndef UPB_H_ #define UPB_H_ -#include #include -#include -#include -#include #include // TODO(b/232091617): Remove these and fix everything that breaks as a result. @@ -45,7 +41,7 @@ #include "upb/string_view.h" // Must be last. -#include "upb/port_def.inc" +#include "upb/port/def.inc" #ifdef __cplusplus extern "C" { @@ -151,6 +147,6 @@ UPB_INLINE int _upb_Log2CeilingSize(int x) { return 1 << _upb_Log2Ceiling(x); } } /* extern "C" */ #endif -#include "upb/port_undef.inc" +#include "upb/port/undef.inc" #endif /* UPB_H_ */ diff --git a/upb/util/compare.c b/upb/util/compare.c index b4dcfb54df..59025cbb83 100644 --- a/upb/util/compare.c +++ b/upb/util/compare.c @@ -27,10 +27,7 @@ #include "upb/util/compare.h" -#include -#include - -#include "upb/port_def.inc" +#include "upb/port/def.inc" struct upb_UnknownFields; typedef struct upb_UnknownFields upb_UnknownFields; diff --git a/upb/util/def_to_proto.c b/upb/util/def_to_proto.c index cae4cd735f..b994577e05 100644 --- a/upb/util/def_to_proto.c +++ b/upb/util/def_to_proto.c @@ -29,16 +29,14 @@ #include #include -#include -#include -#include "upb/internal/vsnprintf_compat.h" +#include "upb/port/vsnprintf_compat.h" #include "upb/reflection/field_def_internal.h" #include "upb/reflection/file_def_internal.h" #include "upb/reflection/message.h" -/* Must be last. */ -#include "upb/port_def.inc" +// Must be last. +#include "upb/port/def.inc" typedef struct { upb_Arena* arena; diff --git a/upb/util/required_fields.c b/upb/util/required_fields.c index a0e01311b3..abc1781906 100644 --- a/upb/util/required_fields.c +++ b/upb/util/required_fields.c @@ -28,16 +28,14 @@ #include "upb/util/required_fields.h" #include -#include #include -#include #include "upb/collections/map.h" -#include "upb/internal/vsnprintf_compat.h" +#include "upb/port/vsnprintf_compat.h" #include "upb/reflection/message.h" // Must be last. -#include "upb/port_def.inc" +#include "upb/port/def.inc" //////////////////////////////////////////////////////////////////////////////// // upb_FieldPath_ToText() diff --git a/upb/util/required_fields.h b/upb/util/required_fields.h index e58f7ca38f..c415215ec5 100644 --- a/upb/util/required_fields.h +++ b/upb/util/required_fields.h @@ -31,8 +31,8 @@ #include "upb/reflection/def.h" #include "upb/reflection/message.h" -/* Must be last. */ -#include "upb/port_def.inc" +// Must be last. +#include "upb/port/def.inc" #ifdef __cplusplus extern "C" { @@ -89,6 +89,6 @@ bool upb_util_HasUnsetRequired(const upb_Message* msg, const upb_MessageDef* m, } /* extern "C" */ #endif -#include "upb/port_undef.inc" +#include "upb/port/undef.inc" #endif /* UPB_UTIL_REQUIRED_FIELDS_H_ */ diff --git a/upb/wire/common_internal.h b/upb/wire/common_internal.h index 46db77a1bb..93e6d99b67 100644 --- a/upb/wire/common_internal.h +++ b/upb/wire/common_internal.h @@ -29,7 +29,7 @@ #define UPB_WIRE_COMMON_INTERNAL_H_ // Must be last. -#include "upb/port_def.inc" +#include "upb/port/def.inc" // MessageSet wire format is: // message MessageSet { @@ -45,6 +45,6 @@ enum { kUpb_MsgSet_Message = 3, }; -#include "upb/port_undef.inc" +#include "upb/port/undef.inc" #endif /* UPB_WIRE_COMMON_INTERNAL_H_ */ diff --git a/upb/wire/decode.c b/upb/wire/decode.c index d7ae44a0ce..167fc425e6 100644 --- a/upb/wire/decode.c +++ b/upb/wire/decode.c @@ -36,7 +36,7 @@ #include "upb/wire/decode_internal.h" // Must be last. -#include "upb/port_def.inc" +#include "upb/port/def.inc" // A few fake field types for our tables. enum { diff --git a/upb/wire/decode.h b/upb/wire/decode.h index d489fdae30..b693a8feaa 100644 --- a/upb/wire/decode.h +++ b/upb/wire/decode.h @@ -35,7 +35,7 @@ #include "upb/msg.h" // Must be last. -#include "upb/port_def.inc" +#include "upb/port/def.inc" #ifdef __cplusplus extern "C" { @@ -89,6 +89,6 @@ upb_DecodeStatus upb_Decode(const char* buf, size_t size, upb_Message* msg, } /* extern "C" */ #endif -#include "upb/port_undef.inc" +#include "upb/port/undef.inc" #endif /* UPB_WIRE_DECODE_H_ */ diff --git a/upb/wire/decode_fast.c b/upb/wire/decode_fast.c index c88b1d5d8b..f4a25478c9 100644 --- a/upb/wire/decode_fast.c +++ b/upb/wire/decode_fast.c @@ -41,7 +41,7 @@ #include "upb/wire/decode_internal.h" // Must be last. -#include "upb/port_def.inc" +#include "upb/port/def.inc" #if UPB_FASTTABLE diff --git a/upb/wire/decode_fast.h b/upb/wire/decode_fast.h index 34d9453278..d5e7853e25 100644 --- a/upb/wire/decode_fast.h +++ b/upb/wire/decode_fast.h @@ -65,7 +65,7 @@ #include "upb/msg.h" // Must be last. -#include "upb/port_def.inc" +#include "upb/port/def.inc" #ifdef __cplusplus extern "C" { @@ -162,6 +162,6 @@ TAGBYTES(r) } /* extern "C" */ #endif -#include "upb/port_undef.inc" +#include "upb/port/undef.inc" #endif /* UPB_WIRE_DECODE_FAST_H_ */ diff --git a/upb/wire/decode_internal.h b/upb/wire/decode_internal.h index 59bf244ed7..dd3322bf9f 100644 --- a/upb/wire/decode_internal.h +++ b/upb/wire/decode_internal.h @@ -39,7 +39,7 @@ #include "third_party/utf8_range/utf8_range.h" // Must be last. -#include "upb/port_def.inc" +#include "upb/port/def.inc" #define DECODE_NOGROUP (uint32_t) - 1 @@ -206,6 +206,6 @@ UPB_INLINE void _upb_Decoder_PopLimit(upb_Decoder* d, const char* ptr, _upb_Decoder_CheckLimit(d); } -#include "upb/port_undef.inc" +#include "upb/port/undef.inc" #endif /* UPB_WIRE_DECODE_INTERNAL_H_ */ diff --git a/upb/wire/encode.c b/upb/wire/encode.c index fb2dcd3248..df5e207313 100644 --- a/upb/wire/encode.c +++ b/upb/wire/encode.c @@ -36,7 +36,7 @@ #include "upb/wire/common_internal.h" // Must be last. -#include "upb/port_def.inc" +#include "upb/port/def.inc" #define UPB_PB_VARINT_MAX_LEN 10 diff --git a/upb/wire/encode.h b/upb/wire/encode.h index 8245d08398..983b6da8dc 100644 --- a/upb/wire/encode.h +++ b/upb/wire/encode.h @@ -35,7 +35,7 @@ #include "upb/msg.h" // Must be last. -#include "upb/port_def.inc" +#include "upb/port/def.inc" #ifdef __cplusplus extern "C" { @@ -76,6 +76,6 @@ upb_EncodeStatus upb_Encode(const void* msg, const upb_MiniTable* l, } /* extern "C" */ #endif -#include "upb/port_undef.inc" +#include "upb/port/undef.inc" #endif /* UPB_WIRE_ENCODE_H_ */ diff --git a/upb/wire/encode_internal.h b/upb/wire/encode_internal.h index 24ae9767c8..8786449242 100644 --- a/upb/wire/encode_internal.h +++ b/upb/wire/encode_internal.h @@ -29,7 +29,7 @@ #define UPB_WIRE_ENCODE_INTERNAL_H_ // Must be last. -#include "upb/port_def.inc" +#include "upb/port/def.inc" #ifdef __cplusplus extern "C" { @@ -49,6 +49,6 @@ void _upb_EncodeRoundTripFloat(float val, char* buf, size_t size); } /* extern "C" */ #endif -#include "upb/port_undef.inc" +#include "upb/port/undef.inc" #endif /* UPB_WIRE_ENCODE_INTERNAL_H_ */ diff --git a/upbc/code_generator_request.c b/upbc/code_generator_request.c index 8355cbc75f..bb63d186c3 100644 --- a/upbc/code_generator_request.c +++ b/upbc/code_generator_request.c @@ -33,7 +33,7 @@ #include "upb/reflection/def.h" // Must be last. -#include "upb/port_def.inc" +#include "upb/port/def.inc" /******************************************************************************/ diff --git a/upbc/code_generator_request.h b/upbc/code_generator_request.h index 03deb29fea..1d01927fee 100644 --- a/upbc/code_generator_request.h +++ b/upbc/code_generator_request.h @@ -33,7 +33,7 @@ #include "upbc/code_generator_request.upb.h" // Must be last. -#include "upb/port_def.inc" +#include "upb/port/def.inc" #ifdef __cplusplus extern "C" { @@ -47,6 +47,6 @@ upbc_CodeGeneratorRequest* upbc_MakeCodeGeneratorRequest( } /* extern "C" */ #endif -#include "upb/port_undef.inc" +#include "upb/port/undef.inc" #endif /* UPBC_CODE_GENERATOR_REQUEST_H_ */ diff --git a/upbc/protoc-gen-upb.cc b/upbc/protoc-gen-upb.cc index 6632746839..7d71e2c95d 100644 --- a/upbc/protoc-gen-upb.cc +++ b/upbc/protoc-gen-upb.cc @@ -39,7 +39,7 @@ #include "upbc/names.h" // Must be last. -#include "upb/port_def.inc" +#include "upb/port/def.inc" namespace upbc { namespace { @@ -902,7 +902,7 @@ void WriteHeader(const FileLayout& layout, Output& output) { } output( - "#include \"upb/port_def.inc\"\n" + "#include \"upb/port/def.inc\"\n" "\n" "#ifdef __cplusplus\n" "extern \"C\" {\n" @@ -1023,7 +1023,7 @@ void WriteHeader(const FileLayout& layout, Output& output) { "} /* extern \"C\" */\n" "#endif\n" "\n" - "#include \"upb/port_undef.inc\"\n" + "#include \"upb/port/undef.inc\"\n" "\n" "#endif /* $0_UPB_H_ */\n", ToPreproc(file->name())); @@ -1514,7 +1514,7 @@ void WriteSource(const FileLayout& layout, Output& output, output( "\n" - "#include \"upb/port_def.inc\"\n" + "#include \"upb/port/def.inc\"\n" "\n"); int msg_count = WriteMessages(layout, output, fasttable_enabled); @@ -1530,7 +1530,7 @@ void WriteSource(const FileLayout& layout, Output& output, output(" $0,\n", ext_count); output("};\n\n"); - output("#include \"upb/port_undef.inc\"\n"); + output("#include \"upb/port/undef.inc\"\n"); output("\n"); } diff --git a/upbc/protoc-gen-upbdefs.cc b/upbc/protoc-gen-upbdefs.cc index 410c6fa9e3..033d1e54ba 100644 --- a/upbc/protoc-gen-upbdefs.cc +++ b/upbc/protoc-gen-upbdefs.cc @@ -71,7 +71,7 @@ void WriteDefHeader(const protobuf::FileDescriptor* file, Output& output) { "#define $0_UPBDEFS_H_\n\n" "#include \"upb/reflection/def.h\"\n" "#include \"upb/reflection/def_pool_internal.h\"\n" - "#include \"upb/port_def.inc\"\n" + "#include \"upb/port/def.inc\"\n" "#ifdef __cplusplus\n" "extern \"C\" {\n" "#endif\n\n", @@ -79,7 +79,7 @@ void WriteDefHeader(const protobuf::FileDescriptor* file, Output& output) { output("#include \"upb/reflection/def.h\"\n"); output("\n"); - output("#include \"upb/port_def.inc\"\n"); + output("#include \"upb/port/def.inc\"\n"); output("\n"); output("extern _upb_DefPool_Init $0;\n", DefInitSymbol(file)); @@ -94,7 +94,7 @@ void WriteDefHeader(const protobuf::FileDescriptor* file, Output& output) { "} /* extern \"C\" */\n" "#endif\n" "\n" - "#include \"upb/port_undef.inc\"\n" + "#include \"upb/port/undef.inc\"\n" "\n" "#endif /* $0_UPBDEFS_H_ */\n", ToPreproc(file->name())); diff --git a/upbc/subprocess.cc b/upbc/subprocess.cc index e46abc86fc..41ee7e57a2 100644 --- a/upbc/subprocess.cc +++ b/upbc/subprocess.cc @@ -45,7 +45,7 @@ #include "upb/upb.h" /* Must be last. */ -#include "upb/port_def.inc" +#include "upb/port/def.inc" namespace upbc {