Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle conflicting macros for FreeBSD #13303

Closed
wants to merge 1 commit into from

Conversation

jbloggz
Copy link
Contributor

@jbloggz jbloggz commented Jul 13, 2023

The unittest_proto3_bad_macros.proto test is failing on FreeBSD due to the GID_MAX/UID_MAX macros. This is because port_def.inc is missing these entries (as well as TRUE/FALSE) for FreeBSD. This PR adds those missing macros.
See compile errors below:

[ 87%] Building CXX object CMakeFiles/tests.dir/src/google/protobuf/unittest_preserve_unknown_enum2.pb.cc.o
[ 87%] Building CXX object CMakeFiles/tests.dir/src/google/protobuf/unittest_proto3.pb.cc.o
[ 87%] Building CXX object CMakeFiles/tests.dir/src/google/protobuf/unittest_proto3_arena.pb.cc.o
[ 87%] Building CXX object CMakeFiles/tests.dir/src/google/protobuf/unittest_proto3_arena_lite.pb.cc.o
[ 88%] Building CXX object CMakeFiles/tests.dir/src/google/protobuf/unittest_proto3_bad_macros.pb.cc.o
In file included from /usr/home/jpb/protobuf/src/google/protobuf/unittest_proto3_bad_macros.pb.cc:4:
/usr/home/jpb/protobuf/src/google/protobuf/unittest_proto3_bad_macros.pb.h:71:15: error: expected unqualified-id
constexpr GID GID_MAX = static_cast<GID>(0);
              ^
/usr/include/sys/limits.h:85:18: note: expanded from macro 'GID_MAX'
#define GID_MAX         UINT_MAX        /* max value for a gid_t */
                        ^
/usr/include/sys/limits.h:59:18: note: expanded from macro 'UINT_MAX'
#define UINT_MAX        __UINT_MAX      /* max value for an unsigned int */
                        ^
/usr/include/x86/_limits.h:58:20: note: expanded from macro '__UINT_MAX'
#define __UINT_MAX      0xffffffff      /* max value for an unsigned int */
                        ^
In file included from /usr/home/jpb/protobuf/src/google/protobuf/unittest_proto3_bad_macros.pb.cc:4:
/usr/home/jpb/protobuf/src/google/protobuf/unittest_proto3_bad_macros.pb.h:102:15: error: expected unqualified-id
constexpr UID UID_MAX = static_cast<UID>(0);
              ^
/usr/include/sys/limits.h:86:18: note: expanded from macro 'UID_MAX'
#define UID_MAX         UINT_MAX        /* max value for a uid_t */
                        ^
/usr/include/sys/limits.h:59:18: note: expanded from macro 'UINT_MAX'
#define UINT_MAX        __UINT_MAX      /* max value for an unsigned int */
                        ^
/usr/include/x86/_limits.h:58:20: note: expanded from macro '__UINT_MAX'
#define __UINT_MAX      0xffffffff      /* max value for an unsigned int */
                        ^
2 errors generated.
gmake[2]: *** [CMakeFiles/tests.dir/build.make:2038: CMakeFiles/tests.dir/src/google/protobuf/unittest_proto3_bad_macros.pb.cc.o] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:1178: CMakeFiles/tests.dir/all] Error 2
gmake: *** [Makefile:146: all] Error 2

@jbloggz jbloggz requested a review from a team as a code owner July 13, 2023 13:44
@jbloggz jbloggz requested review from acozzette and removed request for a team July 13, 2023 13:44
@google-cla
Copy link

google-cla bot commented Jul 13, 2023

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@fowles fowles added c++ 🅰️ safe for tests Mark a commit as safe to run presubmits over labels Jul 13, 2023
@github-actions github-actions bot removed the 🅰️ safe for tests Mark a commit as safe to run presubmits over label Jul 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants