diff --git a/upb/alloc.h b/upb/alloc.h index 870a1b1d9e..e6719c5731 100644 --- a/upb/alloc.h +++ b/upb/alloc.h @@ -89,10 +89,10 @@ UPB_INLINE void* upb_grealloc(void* ptr, size_t oldsize, size_t size) { UPB_INLINE void upb_gfree(void* ptr) { upb_free(&upb_alloc_global, ptr); } -#include "upb/port_undef.inc" - #ifdef __cplusplus } /* extern "C" */ #endif +#include "upb/port_undef.inc" + #endif /* UPB_ALLOC_H_ */ diff --git a/upb/arena.h b/upb/arena.h index 1fabbf2aef..f978322db6 100644 --- a/upb/arena.h +++ b/upb/arena.h @@ -157,10 +157,10 @@ UPB_INLINE upb_Arena* upb_Arena_New(void) { return upb_Arena_Init(NULL, 0, &upb_alloc_global); } -#include "upb/port_undef.inc" - #ifdef __cplusplus } /* extern "C" */ #endif +#include "upb/port_undef.inc" + #endif /* UPB_ARENA_H_ */ diff --git a/upb/decode.h b/upb/decode.h index 985e3e4c39..f9ad98f7c9 100644 --- a/upb/decode.h +++ b/upb/decode.h @@ -36,7 +36,7 @@ #include "upb/extension_registry.h" #include "upb/msg.h" -/* Must be last. */ +// Must be last. #include "upb/port_def.inc" #ifdef __cplusplus diff --git a/upb/decode_fast.h b/upb/decode_fast.h index b04aeedb85..3ccd1a02b1 100644 --- a/upb/decode_fast.h +++ b/upb/decode_fast.h @@ -64,6 +64,13 @@ #include "upb/msg.h" +// Must be last. +#include "upb/port_def.inc" + +#ifdef __cplusplus +extern "C" { +#endif + struct upb_Decoder; // The fallback, generic parsing function that can handle any field type. @@ -150,4 +157,10 @@ TAGBYTES(r) #undef UPB_PARSE_PARAMS +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#include "upb/port_undef.inc" + #endif /* UPB_DECODE_FAST_H_ */ diff --git a/upb/def.h b/upb/def.h index 2cb312df1a..84cd2fb85b 100644 --- a/upb/def.h +++ b/upb/def.h @@ -32,12 +32,12 @@ #include "upb/internal/table.h" #include "upb/upb.h" -/* Must be last. */ +// Must be last. #include "upb/port_def.inc" #ifdef __cplusplus extern "C" { -#endif /* __cplusplus */ +#endif struct upb_EnumDef; typedef struct upb_EnumDef upb_EnumDef; @@ -407,10 +407,10 @@ UPB_INLINE bool _upb_DefPool_LoadDefInit(upb_DefPool* s, return _upb_DefPool_LoadDefInitEx(s, init, false); } -#include "upb/port_undef.inc" - #ifdef __cplusplus } /* extern "C" */ -#endif /* __cplusplus */ +#endif + +#include "upb/port_undef.inc" #endif /* UPB_DEF_H_ */ diff --git a/upb/encode.h b/upb/encode.h index 791d84a74c..977baa424a 100644 --- a/upb/encode.h +++ b/upb/encode.h @@ -34,7 +34,7 @@ #include "upb/msg.h" -/* Must be last. */ +// Must be last. #include "upb/port_def.inc" #ifdef __cplusplus @@ -72,10 +72,10 @@ upb_EncodeStatus upb_Encode(const void* msg, const upb_MiniTable* l, int options, upb_Arena* arena, char** buf, size_t* size); -#include "upb/port_undef.inc" - #ifdef __cplusplus } /* extern "C" */ #endif +#include "upb/port_undef.inc" + #endif /* UPB_ENCODE_H_ */ diff --git a/upb/extension_registry.h b/upb/extension_registry.h index 0e0a4440ca..cafe6893d4 100644 --- a/upb/extension_registry.h +++ b/upb/extension_registry.h @@ -28,10 +28,11 @@ #ifndef UPB_EXTENSION_REGISTRY_H_ #define UPB_EXTENSION_REGISTRY_H_ -#include - #include "upb/upb.h" +// Must be last. +#include "upb/port_def.inc" + #ifdef __cplusplus extern "C" { #endif @@ -81,4 +82,6 @@ upb_ExtensionRegistry* upb_ExtensionRegistry_New(upb_Arena* arena); } /* extern "C" */ #endif +#include "upb/port_undef.inc" + #endif /* UPB_EXTENSION_REGISTRY_H_ */ diff --git a/upb/json_decode.h b/upb/json_decode.h index 848f4df33c..c7b6839427 100644 --- a/upb/json_decode.h +++ b/upb/json_decode.h @@ -30,6 +30,9 @@ #include "upb/def.h" +// Must be last. +#include "upb/port_def.inc" + #ifdef __cplusplus extern "C" { #endif @@ -44,4 +47,6 @@ bool upb_JsonDecode(const char* buf, size_t size, upb_Message* msg, } /* extern "C" */ #endif +#include "upb/port_undef.inc" + #endif /* UPB_JSONDECODE_H_ */ diff --git a/upb/json_encode.h b/upb/json_encode.h index 6e0cac3fc1..7d83206580 100644 --- a/upb/json_encode.h +++ b/upb/json_encode.h @@ -30,6 +30,9 @@ #include "upb/def.h" +// Must be last. +#include "upb/port_def.inc" + #ifdef __cplusplus extern "C" { #endif @@ -62,4 +65,6 @@ size_t upb_JsonEncode(const upb_Message* msg, const upb_MessageDef* m, } /* extern "C" */ #endif +#include "upb/port_undef.inc" + #endif /* UPB_JSONENCODE_H_ */ diff --git a/upb/msg.h b/upb/msg.h index 89db4dd6eb..cdb5c2bd13 100644 --- a/upb/msg.h +++ b/upb/msg.h @@ -62,10 +62,10 @@ const char* upb_Message_GetUnknown(const upb_Message* msg, size_t* len); /* Returns the number of extensions present in this message. */ size_t upb_Message_ExtensionCount(const upb_Message* msg); -#include "upb/port_undef.inc" - #ifdef __cplusplus } /* extern "C" */ #endif +#include "upb/port_undef.inc" + #endif /* UPB_MSG_INT_H_ */ diff --git a/upb/msg_internal.h b/upb/msg_internal.h index 7360ad12c1..3ed032d5e0 100644 --- a/upb/msg_internal.h +++ b/upb/msg_internal.h @@ -35,7 +35,6 @@ #ifndef UPB_MSG_INT_H_ #define UPB_MSG_INT_H_ -#include #include #include @@ -44,7 +43,7 @@ #include "upb/msg.h" #include "upb/upb.h" -/* Must be last. */ +// Must be last. #include "upb/port_def.inc" #ifdef __cplusplus diff --git a/upb/reflection.h b/upb/reflection.h index 6071fba6f5..23a7d34c5d 100644 --- a/upb/reflection.h +++ b/upb/reflection.h @@ -32,9 +32,11 @@ #include "upb/def.h" #include "upb/map.h" #include "upb/msg.h" -#include "upb/port_def.inc" #include "upb/upb.h" +// Must be last. +#include "upb/port_def.inc" + #ifdef __cplusplus extern "C" { #endif diff --git a/upb/status.h b/upb/status.h index 2c5c2a7f8b..596691b30e 100644 --- a/upb/status.h +++ b/upb/status.h @@ -29,8 +29,8 @@ #define UPB_STATUS_H_ #include -#include +// Must be last. #include "upb/port_def.inc" #ifdef __cplusplus @@ -57,10 +57,10 @@ void upb_Status_VSetErrorFormat(upb_Status* status, const char* fmt, void upb_Status_VAppendErrorFormat(upb_Status* status, const char* fmt, va_list args) UPB_PRINTF(2, 0); -#include "upb/port_undef.inc" - #ifdef __cplusplus } /* extern "C" */ #endif +#include "upb/port_undef.inc" + #endif /* UPB_STATUS_H_ */ diff --git a/upb/string_view.h b/upb/string_view.h index 6a3395148e..95ebd4c1a8 100644 --- a/upb/string_view.h +++ b/upb/string_view.h @@ -64,10 +64,10 @@ UPB_INLINE bool upb_StringView_IsEqual(upb_StringView a, upb_StringView b) { #define UPB_STRINGVIEW_FORMAT "%.*s" #define UPB_STRINGVIEW_ARGS(view) (int)(view).size, (view).data -#include "upb/port_undef.inc" - #ifdef __cplusplus } /* extern "C" */ #endif +#include "upb/port_undef.inc" + #endif /* UPB_STRING_VIEW_H_ */ diff --git a/upb/text_encode.h b/upb/text_encode.h index 2e817a3e50..312db24e35 100644 --- a/upb/text_encode.h +++ b/upb/text_encode.h @@ -30,6 +30,9 @@ #include "upb/def.h" +// Must be last. +#include "upb/port_def.inc" + #ifdef __cplusplus extern "C" { #endif @@ -61,4 +64,6 @@ size_t upb_TextEncode(const upb_Message* msg, const upb_MessageDef* m, } /* extern "C" */ #endif +#include "upb/port_undef.inc" + #endif /* UPB_TEXTENCODE_H_ */ diff --git a/upb/upb.h b/upb/upb.h index 20cb928f79..e77fd40bdb 100644 --- a/upb/upb.h +++ b/upb/upb.h @@ -152,10 +152,10 @@ UPB_INLINE int _upb_Log2Ceiling(int x) { UPB_INLINE int _upb_Log2CeilingSize(int x) { return 1 << _upb_Log2Ceiling(x); } -#include "upb/port_undef.inc" - #ifdef __cplusplus } /* extern "C" */ #endif +#include "upb/port_undef.inc" + #endif /* UPB_H_ */