diff options
author | Michał Górny <mgorny@gentoo.org> | 2022-10-09 22:07:34 +0200 |
---|---|---|
committer | Michał Górny <mgorny@gentoo.org> | 2022-10-09 22:07:34 +0200 |
commit | 902adb9437dbd55cf4a7e4a1691f6d3b314e1640 (patch) | |
tree | b1b4b1dee57ab50247080ac4ee07e0a56cfc894b | |
parent | sys-devel/clang-common: Move common config into gentoo-common.cfg (diff) | |
download | gentoo-902adb9437dbd55cf4a7e4a1691f6d3b314e1640.tar.gz gentoo-902adb9437dbd55cf4a7e4a1691f6d3b314e1640.tar.bz2 gentoo-902adb9437dbd55cf4a7e4a1691f6d3b314e1640.zip |
sys-devel/clang-common: Introduce USE=stricter for more -Werror=
Signed-off-by: Michał Górny <mgorny@gentoo.org>
5 files changed, 97 insertions, 4 deletions
diff --git a/sys-devel/clang-common/clang-common-15.0.2-r1.ebuild b/sys-devel/clang-common/clang-common-15.0.2-r1.ebuild index 9962f257ccc0..a29bbbc806c9 100644 --- a/sys-devel/clang-common/clang-common-15.0.2-r1.ebuild +++ b/sys-devel/clang-common/clang-common-15.0.2-r1.ebuild @@ -11,7 +11,10 @@ HOMEPAGE="https://llvm.org/" LICENSE="Apache-2.0-with-LLVM-exceptions UoI-NCSA" SLOT="0" KEYWORDS="~amd64 ~arm ~arm64 ~ppc ~ppc64 ~riscv ~sparc ~x86 ~amd64-linux ~ppc-macos ~x64-macos" -IUSE="default-compiler-rt default-libcxx default-lld llvm-libunwind" +IUSE=" + default-compiler-rt default-libcxx default-lld llvm-libunwind + stricter +" PDEPEND=" sys-devel/clang:* @@ -82,6 +85,26 @@ src_install() { @gentoo-gcc-install.cfg EOF + if use stricter; then + newins - gentoo-stricter.cfg <<-EOF + # This file increases the strictness of older clang versions + # to match the newest upstream version. + + # clang-16 defaults + -Werror=implicit-function-declaration + -Werror=implicit-int + -Werror=incompatible-function-pointer-types + + # constructs banned by C2x + -Werror=strict-prototypes + -Werror=deprecated-non-prototype + EOF + + cat >> "${ED}/etc/clang/gentoo-common.cfg" <<-EOF || die + @gentoo-stricter.cfg + EOF + fi + local tool for tool in clang{,++,-cpp}; do newins - "${tool}.cfg" <<-EOF diff --git a/sys-devel/clang-common/clang-common-15.0.2.9999.ebuild b/sys-devel/clang-common/clang-common-15.0.2.9999.ebuild index 0ff52691cc71..993dddec4bf9 100644 --- a/sys-devel/clang-common/clang-common-15.0.2.9999.ebuild +++ b/sys-devel/clang-common/clang-common-15.0.2.9999.ebuild @@ -11,7 +11,10 @@ HOMEPAGE="https://llvm.org/" LICENSE="Apache-2.0-with-LLVM-exceptions UoI-NCSA" SLOT="0" KEYWORDS="" -IUSE="default-compiler-rt default-libcxx default-lld llvm-libunwind" +IUSE=" + default-compiler-rt default-libcxx default-lld llvm-libunwind + stricter +" PDEPEND=" sys-devel/clang:* @@ -81,6 +84,26 @@ src_install() { @gentoo-gcc-install.cfg EOF + if use stricter; then + newins - gentoo-stricter.cfg <<-EOF + # This file increases the strictness of older clang versions + # to match the newest upstream version. + + # clang-16 defaults + -Werror=implicit-function-declaration + -Werror=implicit-int + -Werror=incompatible-function-pointer-types + + # constructs banned by C2x + -Werror=strict-prototypes + -Werror=deprecated-non-prototype + EOF + + cat >> "${ED}/etc/clang/gentoo-common.cfg" <<-EOF || die + @gentoo-stricter.cfg + EOF + fi + local tool for tool in clang{,++,-cpp}; do newins - "${tool}.cfg" <<-EOF diff --git a/sys-devel/clang-common/clang-common-16.0.0.9999.ebuild b/sys-devel/clang-common/clang-common-16.0.0.9999.ebuild index 0ff52691cc71..993dddec4bf9 100644 --- a/sys-devel/clang-common/clang-common-16.0.0.9999.ebuild +++ b/sys-devel/clang-common/clang-common-16.0.0.9999.ebuild @@ -11,7 +11,10 @@ HOMEPAGE="https://llvm.org/" LICENSE="Apache-2.0-with-LLVM-exceptions UoI-NCSA" SLOT="0" KEYWORDS="" -IUSE="default-compiler-rt default-libcxx default-lld llvm-libunwind" +IUSE=" + default-compiler-rt default-libcxx default-lld llvm-libunwind + stricter +" PDEPEND=" sys-devel/clang:* @@ -81,6 +84,26 @@ src_install() { @gentoo-gcc-install.cfg EOF + if use stricter; then + newins - gentoo-stricter.cfg <<-EOF + # This file increases the strictness of older clang versions + # to match the newest upstream version. + + # clang-16 defaults + -Werror=implicit-function-declaration + -Werror=implicit-int + -Werror=incompatible-function-pointer-types + + # constructs banned by C2x + -Werror=strict-prototypes + -Werror=deprecated-non-prototype + EOF + + cat >> "${ED}/etc/clang/gentoo-common.cfg" <<-EOF || die + @gentoo-stricter.cfg + EOF + fi + local tool for tool in clang{,++,-cpp}; do newins - "${tool}.cfg" <<-EOF diff --git a/sys-devel/clang-common/clang-common-16.0.0_pre20221006-r1.ebuild b/sys-devel/clang-common/clang-common-16.0.0_pre20221006-r1.ebuild index 0ff52691cc71..993dddec4bf9 100644 --- a/sys-devel/clang-common/clang-common-16.0.0_pre20221006-r1.ebuild +++ b/sys-devel/clang-common/clang-common-16.0.0_pre20221006-r1.ebuild @@ -11,7 +11,10 @@ HOMEPAGE="https://llvm.org/" LICENSE="Apache-2.0-with-LLVM-exceptions UoI-NCSA" SLOT="0" KEYWORDS="" -IUSE="default-compiler-rt default-libcxx default-lld llvm-libunwind" +IUSE=" + default-compiler-rt default-libcxx default-lld llvm-libunwind + stricter +" PDEPEND=" sys-devel/clang:* @@ -81,6 +84,26 @@ src_install() { @gentoo-gcc-install.cfg EOF + if use stricter; then + newins - gentoo-stricter.cfg <<-EOF + # This file increases the strictness of older clang versions + # to match the newest upstream version. + + # clang-16 defaults + -Werror=implicit-function-declaration + -Werror=implicit-int + -Werror=incompatible-function-pointer-types + + # constructs banned by C2x + -Werror=strict-prototypes + -Werror=deprecated-non-prototype + EOF + + cat >> "${ED}/etc/clang/gentoo-common.cfg" <<-EOF || die + @gentoo-stricter.cfg + EOF + fi + local tool for tool in clang{,++,-cpp}; do newins - "${tool}.cfg" <<-EOF diff --git a/sys-devel/clang-common/metadata.xml b/sys-devel/clang-common/metadata.xml index 31c80b4fb555..7ea033c083c9 100644 --- a/sys-devel/clang-common/metadata.xml +++ b/sys-devel/clang-common/metadata.xml @@ -11,5 +11,6 @@ <flag name="default-compiler-rt">Use compiler-rt + libunwind instead of libgcc as the default rtlib for clang</flag> <flag name="default-libcxx">Use libc++ instead of libstdc++ as the default stdlib for clang</flag> <flag name="default-lld">Use lld as the default linker for clang</flag> + <flag name="stricter">Default to stricter behavior known from newer clang versions, turning more warnings into errors</flag> </use> </pkgmetadata> |