From 466408978fe17f7dad2300915d78f4e5bfdf9d0c Mon Sep 17 00:00:00 2001 From: Protobuf Team Bot Date: Wed, 28 Dec 2022 15:52:52 -0800 Subject: [PATCH] Add extern C blocks to wire_reader and eps_copy_input_stream. PiperOrigin-RevId: 498262528 --- upb/wire/eps_copy_input_stream.h | 8 ++++++++ upb/wire/reader.c | 5 +++-- upb/wire/reader.h | 8 ++++++++ 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/upb/wire/eps_copy_input_stream.h b/upb/wire/eps_copy_input_stream.h index 92634328c5..5875a827a6 100644 --- a/upb/wire/eps_copy_input_stream.h +++ b/upb/wire/eps_copy_input_stream.h @@ -35,6 +35,10 @@ // Must be last. #include "upb/port/def.inc" +#ifdef __cplusplus +extern "C" { +#endif + // The maximum number of bytes a single protobuf field can take up in the // wire format. We only want to do one bounds check per field, so the input // stream guarantees that after upb_EpsCopyInputStream_IsDone() is called, @@ -405,6 +409,10 @@ static UPB_FORCEINLINE bool upb_EpsCopyInputStream_TryParseDelimitedFast( return true; } +#ifdef __cplusplus +} /* extern "C" */ +#endif + #include "upb/port/undef.inc" #endif // UPB_WIRE_EPS_COPY_INPUT_STREAM_H_ diff --git a/upb/wire/reader.c b/upb/wire/reader.c index 1ba0b479b3..f5b9b0b0ce 100644 --- a/upb/wire/reader.c +++ b/upb/wire/reader.c @@ -27,11 +27,12 @@ #include "upb/wire/reader.h" -// Must be last. -#include "upb/port/def.inc" #include "upb/wire/eps_copy_input_stream.h" #include "upb/wire/types.h" +// Must be last. +#include "upb/port/def.inc" + UPB_NOINLINE _upb_WireReader_ReadLongVarintRet _upb_WireReader_ReadLongVarint(const char* ptr, uint64_t val) { _upb_WireReader_ReadLongVarintRet ret = {NULL, 0}; diff --git a/upb/wire/reader.h b/upb/wire/reader.h index b05b3d07ad..13d6327193 100644 --- a/upb/wire/reader.h +++ b/upb/wire/reader.h @@ -35,6 +35,10 @@ // Must be last. #include "upb/port/def.inc" +#ifdef __cplusplus +extern "C" { +#endif + // The upb_WireReader interface is suitable for general-purpose parsing of // protobuf binary wire format. It is designed to be used along with // upb_EpsCopyInputStream for buffering, and all parsing routines in this file @@ -198,6 +202,10 @@ UPB_INLINE const char* upb_WireReader_SkipValue( } } +#ifdef __cplusplus +} /* extern "C" */ +#endif + #include "upb/port/undef.inc" #endif // UPB_WIRE_READER_H_