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

Fix invalid bit-field #248

Merged
merged 1 commit into from
Dec 30, 2024
Merged

Fix invalid bit-field #248

merged 1 commit into from
Dec 30, 2024

Conversation

dg0yt
Copy link
Contributor

@dg0yt dg0yt commented Dec 30, 2024

Fixes gcc compiler error when using msh3:

In file included from /vcpkg/scripts/test_ports/vcpkg-ci-msh3/project/main.c:1:
/vcpkg/installed/x64-linux/include/msh3.h:377:18: error: width of ‘RESERVED’ exceeds its type
  377 |             bool RESERVED                 : 5;
      |                  ^~~~~~~~
/vcpkg/installed/x64-linux/include/msh3.h:490:18: error: width of ‘RESERVED’ exceeds its type
  490 |             bool RESERVED            : 7;
      |                  ^~~~~~~~

According to https://en.cppreference.com/w/c/language/bit_field, the width is "an integer constant expression with a value greater or equal to zero and less or equal the number of bits in the underlying type. So for a one-bit bool type, width cannot exceed 1.

Noticed in the vcpkg test port for msh3.

@nibanks nibanks merged commit 0951da4 into nibanks:main Dec 30, 2024
23 checks passed
@dg0yt dg0yt deleted the bitfield branch December 30, 2024 22:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants