commit:     902adb9437dbd55cf4a7e4a1691f6d3b314e1640
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Sun Oct  9 20:07:34 2022 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Sun Oct  9 20:07:34 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=902adb94

sys-devel/clang-common: Introduce USE=stricter for more -Werror=

Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 .../clang-common/clang-common-15.0.2-r1.ebuild     | 25 +++++++++++++++++++++-
 .../clang-common/clang-common-15.0.2.9999.ebuild   | 25 +++++++++++++++++++++-
 .../clang-common/clang-common-16.0.0.9999.ebuild   | 25 +++++++++++++++++++++-
 .../clang-common-16.0.0_pre20221006-r1.ebuild      | 25 +++++++++++++++++++++-
 sys-devel/clang-common/metadata.xml                |  1 +
 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>

Reply via email to