Skip to content

base: fix ABSL_ATTRIBUTE_WARN_UNUSED with gcc <= 12#2044

Open
jolivain wants to merge 1 commit intoabseil:masterfrom
jolivain:fix_warn_unused_with_gcc12
Open

base: fix ABSL_ATTRIBUTE_WARN_UNUSED with gcc <= 12#2044
jolivain wants to merge 1 commit intoabseil:masterfrom
jolivain:fix_warn_unused_with_gcc12

Conversation

@jolivain
Copy link
Copy Markdown

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/

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>
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.

1 participant