Handle conflicting macros for FreeBSD

pull/13303/head
Josef Barnes 2 years ago
parent 2d8b38f316
commit 12d6baf35a
  1. 13
      src/google/protobuf/port_def.inc
  2. 7
      src/google/protobuf/port_undef.inc

@ -1030,6 +1030,19 @@ static_assert(PROTOBUF_ABSL_MIN(20230125, 3),
#undef TYPE_BOOL
#endif // __APPLE__
#ifdef __FreeBSD__
// Inconvenient macro names from /usr/include/sys/param.h.
#pragma push_macro("TRUE")
#undef TRUE
#pragma push_macro("FALSE")
#undef FALSE
// Inconvenient macro names from /usr/include/sys/limits.h.
#pragma push_macro("UID_MAX")
#undef UID_MAX
#pragma push_macro("GID_MAX")
#undef GID_MAX
#endif // __FreeBSD__
#if defined(__clang__) || defined(__GNUC__) || defined(_MSC_VER)
// Don't let Objective-C Macros interfere with proto identifiers with the same
// name.

@ -192,6 +192,13 @@
#pragma pop_macro("TYPE_BOOL")
#endif // __APPLE__
#ifdef __FreeBSD__
#pragma pop_macro("TRUE")
#pragma pop_macro("FALSE")
#pragma pop_macro("UID_MAX")
#pragma pop_macro("GID_MAX")
#endif // __FreeBSD__
#if defined(__clang__) || defined(__GNUC__) || defined(_MSC_VER)
#pragma pop_macro("DEBUG")
#endif // defined(__clang__) || defined(__GNUC__) || defined(_MSC_VER)

Loading…
Cancel
Save