commit:     ebea8fa53bdd871deb841463f5fbd4f427b6ef3c
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Thu Oct 27 23:37:42 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Thu Oct 27 23:37:42 2022 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=ebea8fa5

install-qa-check.d/90gcc-warnings: add -Wreturn-type

Clang in particular optimises very aggressively based
on this (if there's a missing return at the end, it'll end
up performing mental gymnastics to deduce some other earlier
case is taken).

Signed-off-by: Sam James <sam <AT> gentoo.org>

 bin/install-qa-check.d/90gcc-warnings | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/bin/install-qa-check.d/90gcc-warnings 
b/bin/install-qa-check.d/90gcc-warnings
index 662d2fd3a..7a506d357 100644
--- a/bin/install-qa-check.d/90gcc-warnings
+++ b/bin/install-qa-check.d/90gcc-warnings
@@ -56,6 +56,9 @@ gcc_warn_check() {
                        'warning: .*matching.*\[-Wformat=\]'
                        # function returns address of local variable
                        'warning: .*\[-Wreturn-local-addr\]'
+                       # missing return at end of function, or non-void return 
in a void function
+                       # (clang at least aggressively optimises on this)
+                       'warning: .*\[-Wreturn-type\]'
                        # argument to sizeof ... is the same expression as the 
source
                        'warning: .*\[-Wsizeof-pointer-memaccess\]'
                        # iteration invokes undefined behavior

Reply via email to