base: fix ABSL_ATTRIBUTE_WARN_UNUSED with gcc <= 12#2044
Open
jolivain wants to merge 1 commit intoabseil:masterfrom
Open
base: fix ABSL_ATTRIBUTE_WARN_UNUSED with gcc <= 12#2044jolivain wants to merge 1 commit intoabseil:masterfrom
jolivain wants to merge 1 commit intoabseil:masterfrom
Conversation
Gcc <= 12 does not support mixing standard C++ attributes with
GNU attributes. See [1].
This can lead to build failures such as [2] [3] and [4]. In those
situations, the compilation fails with error such as:
/usr/include/absl/base/attributes.h:1076:36: error: expected identifier before '[' token
Gcc maintainers mentioned in [1] comment 9 that this bugfix will
not be backported in Gcc 12. Gcc 12 is still used in LTS
distributions. For example, it is included in Debian 12 (Bookworm),
which is still supported until 2028. See [5].
This commit adds a workaround for gcc <= 12 which uses
__attribute__ in that case, which fixes the compilation failure.
[1] https://gcc.gnu.org/PR69585
[2] protocolbuffers/protobuf#26383
[3] https://autobuild.buildroot.org/results/33f6cfd37cb48c15a53b3e7123d5ce8388a0f2ab/build-end.log
[4] https://gitlab.com/buildroot.org/buildroot/-/jobs/13904066346
[5] https://www.debian.org/releases/bookworm/
Signed-off-by: Julien Olivain <ju.o@free.fr>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Gcc <= 12 does not support mixing standard C++ attributes with GNU attributes. See [1].
This can lead to build failures such as [2] [3] and [4]. In those situations, the compilation fails with error such as:
Gcc maintainers mentioned in [1] comment 9 that this bugfix will not be backported in Gcc 12. Gcc 12 is still used in LTS distributions. For example, it is included in Debian 12 (Bookworm), which is still supported until 2028. See [5].
This commit adds a workaround for gcc <= 12 which uses attribute in that case, which fixes the compilation failure.
[1] https://gcc.gnu.org/PR69585
[2] protocolbuffers/protobuf#26383
[3] https://autobuild.buildroot.org/results/33f6cfd37cb48c15a53b3e7123d5ce8388a0f2ab/build-end.log
[4] https://gitlab.com/buildroot.org/buildroot/-/jobs/13904066346
[5] https://www.debian.org/releases/bookworm/