Skip to content

generated_message_tctable_decl: improve portability: avoid ambiguous bool type, use uint8_t #21815

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

barracuda156
Copy link

Fixes the failure on 32-bit powerpc:

In file included from /opt/local/var/macports/build/_opt_local_ppcports_devel_protobuf/protobuf/work/protobuf-30.2/upb/message/internal/accessors.h:22,
                 from /opt/local/var/macports/build/_opt_local_ppcports_devel_protobuf/protobuf/work/protobuf-30.2/upb/message/accessors.h:16,
                 from /opt/local/var/macports/build/_opt_local_ppcports_devel_protobuf/protobuf/work/protobuf-30.2/upb/generated_code_support.h:13,
                 from /opt/local/var/macports/build/_opt_local_ppcports_devel_protobuf/protobuf/work/protobuf-30.2/upb/reflection/cmake/google/protobuf/descriptor.upb.h:12,
                 from /opt/local/var/macports/build/_opt_local_ppcports_devel_protobuf/protobuf/work/protobuf-30.2/upb/reflection/descriptor_bootstrap.h:14,
                 from /opt/local/var/macports/build/_opt_local_ppcports_devel_protobuf/protobuf/work/protobuf-30.2/upb/reflection/common.h:15,
                 from /opt/local/var/macports/build/_opt_local_ppcports_devel_protobuf/protobuf/work/protobuf-30.2/upb/reflection/enum_def.h:14,
                 from /opt/local/var/macports/build/_opt_local_ppcports_devel_protobuf/protobuf/work/protobuf-30.2/upb/reflection/message_reserved_range.c:8:
/opt/local/var/macports/build/_opt_local_ppcports_devel_protobuf/protobuf/work/protobuf-30.2/upb/message/internal/message.h: In function 'upb_TaggedAuxPtr_Extension':
/opt/local/var/macports/build/_opt_local_ppcports_devel_protobuf/protobuf/work/protobuf-30.2/upb/message/internal/message.h:61:10: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
   61 |   return (upb_Extension*)(ptr.ptr & ~1ULL);
      |          ^
In file included from /opt/local/var/macports/build/_opt_local_ppcports_devel_protobuf/protobuf/work/protobuf-30.2/src/google/protobuf/field_mask.pb.h:23,
                 from /opt/local/var/macports/build/_opt_local_ppcports_devel_protobuf/protobuf/work/protobuf-30.2/src/google/protobuf/[field_mask.pb.cc:6](http://field_mask.pb.cc:6/):
/opt/local/var/macports/build/_opt_local_ppcports_devel_protobuf/protobuf/work/protobuf-30.2/src/google/protobuf/generated_message_tctable_decl.h:260:34: error: static assertion failed
  260 | static_assert(sizeof(MapAuxInfo) <= 8, "");
      |               ~~~~~~~~~~~~~~~~~~~^~~~
/opt/local/var/macports/build/_opt_local_ppcports_devel_protobuf/protobuf/work/protobuf-30.2/src/google/protobuf/generated_message_tctable_decl.h:260:34: note: the comparison reduces to '(12 <= 8)'

@mkruskal-google mkruskal-google added c++ 🅰️ safe for tests Mark a commit as safe to run presubmits over labels May 19, 2025
@github-actions github-actions bot removed the 🅰️ safe for tests Mark a commit as safe to run presubmits over label May 19, 2025
@@ -154,7 +154,7 @@ class MapTypeCard {
public:
MapTypeCard() = default;
constexpr MapTypeCard(int number, WireFormatLite::WireType wiretype,
bool is_signed, bool is_zigzag, bool is_utf8)
uint8_t is_signed, uint8_t is_zigzag, uint8_t is_utf8)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we keep the input/output of the API as bool?
We only need to change the members to be uint8_t : 1.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I guess so. I will verify that once back to the machine and update the PR accordingly.

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.

3 participants