Navigation Menu

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

Use byteswap.h when building against musl libc #8503

Merged
merged 1 commit into from Apr 16, 2021

Conversation

georgthegreat
Copy link
Contributor

Though manpages say bswap_ macros are GNU extensions, both bionic libc and musl libc provide them from the very first releases.

As musl intentionally does not define any specific macro, I suggest changing ifdefs to be based on operating systems rather than on libc's.

@google-cla google-cla bot added the cla: yes label Apr 16, 2021
@acozzette acozzette merged commit f763a2a into protocolbuffers:master Apr 16, 2021
@acozzette
Copy link
Member

Thanks, @georgthegreat.

@georgthegreat
Copy link
Contributor Author

georgthegreat commented Apr 17, 2021

Thanks, @acozzette.
As a follow up, I'd like to add a snippet illustrating the problem being fixed.
Whenever a source is dependent on both byteswap.h and protobuf, the following error will occur:

byteswap.h:22:9: error: 'bswap_16' macro redefined [-Werror,-Wmacro-redefined]
#define bswap_16(x) __bswap_16(x)
        ^
google/protobuf/stubs/port.h:321:9: note: previous definition is here
#define bswap_16(x) bswap_16(x)
        ^

@georgthegreat georgthegreat deleted the byteswap-musl branch April 17, 2021 09:23
georgthegreat added a commit to georgthegreat/protobuf that referenced this pull request Apr 19, 2021
georgthegreat added a commit to georgthegreat/protobuf that referenced this pull request Apr 19, 2021
AlekSi added a commit to AlekSi/talos-tools that referenced this pull request Jun 26, 2021
talos-bot pushed a commit to siderolabs/tools that referenced this pull request Jun 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants