From b9def2b80dd1e1b6b8acc7af45fa17b814a46491 Mon Sep 17 00:00:00 2001 From: Gianni Tedesco Date: Tue, 1 Dec 2020 08:05:17 +0900 Subject: [PATCH] Don't include sys/param.h for _BYTE_ORDER It includes a bunch of other files including a lot of macros which can reduce the namespace available for actual protobuf. For example, create a protobuf with a member called SIGSEGV. Since macros cannot be namespaced in C++ this results in code which cannot be compiled. Fix this by just directly including endian.h --- src/google/protobuf/io/coded_stream.h | 2 +- src/google/protobuf/stubs/port.h | 5 +---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/src/google/protobuf/io/coded_stream.h b/src/google/protobuf/io/coded_stream.h index 0fff1782cf07..bdfa4f826c85 100644 --- a/src/google/protobuf/io/coded_stream.h +++ b/src/google/protobuf/io/coded_stream.h @@ -131,7 +131,7 @@ #pragma runtime_checks("c", off) #endif #else -#include // __BYTE_ORDER +#include // __BYTE_ORDER #if ((defined(__LITTLE_ENDIAN__) && !defined(__BIG_ENDIAN__)) || \ (defined(__BYTE_ORDER) && __BYTE_ORDER == __LITTLE_ENDIAN)) && \ !defined(PROTOBUF_DISABLE_LITTLE_ENDIAN_OPT_FOR_TEST) diff --git a/src/google/protobuf/stubs/port.h b/src/google/protobuf/stubs/port.h index db8b62f6b3a4..a9c3d0c8398e 100644 --- a/src/google/protobuf/stubs/port.h +++ b/src/google/protobuf/stubs/port.h @@ -57,10 +57,7 @@ #pragma runtime_checks("c", off) #endif #else - #include // __BYTE_ORDER - #if defined(__OpenBSD__) - #include - #endif + #include // __BYTE_ORDER #if ((defined(__LITTLE_ENDIAN__) && !defined(__BIG_ENDIAN__)) || \ (defined(__BYTE_ORDER) && __BYTE_ORDER == __LITTLE_ENDIAN) || \ (defined(BYTE_ORDER) && BYTE_ORDER == LITTLE_ENDIAN)) && \