Skip to content

Commit

Permalink
Handle conflicting macros for FreeBSD
Browse files Browse the repository at this point in the history
  • Loading branch information
jbloggz committed Jul 13, 2023
1 parent 2d8b38f commit 12d6baf
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/google/protobuf/port_def.inc
Expand Up @@ -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.
Expand Down
7 changes: 7 additions & 0 deletions src/google/protobuf/port_undef.inc
Expand Up @@ -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)
Expand Down

0 comments on commit 12d6baf

Please sign in to comment.