commit: e9eb2f7b8b25559b555c0ec8806b602e486753de Author: Sam James <sam <AT> gentoo <DOT> org> AuthorDate: Fri Apr 7 10:39:53 2023 +0000 Commit: Sam James <sam <AT> gentoo <DOT> org> CommitDate: Fri Apr 7 10:41:46 2023 +0000 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=e9eb2f7b
bin/install-qa-check.d/90gcc-warnings: add more warnings These are all indicative of possible runtime issues. Signed-off-by: Sam James <sam <AT> gentoo.org> NEWS | 15 +++++++++++++++ bin/install-qa-check.d/90gcc-warnings | 9 +++++++++ 2 files changed, 24 insertions(+) diff --git a/NEWS b/NEWS index 0361e6ac6..3dfaf2a09 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,18 @@ +portage-3.0.47 (UNRELEASED) +--------------- + +Features: +* install-qa-check.d: 90gcc-warnings: Add additional code quality warnings: + - -Wrestrict + - -Wstringop-overread + - -Wstringop-truncation + - -Wformat-truncation + - -Wcast-function-type + - -Wnull-dereference + - -Wmain + - -Wimplicit-int + - -Wstring-compare + portage-3.0.46 (2023-04-07) --------------- diff --git a/bin/install-qa-check.d/90gcc-warnings b/bin/install-qa-check.d/90gcc-warnings index dbfbc4a9a..449bf2362 100644 --- a/bin/install-qa-check.d/90gcc-warnings +++ b/bin/install-qa-check.d/90gcc-warnings @@ -19,6 +19,7 @@ gcc_warn_check() { # only will and does, no might :) 'warning: .*will.*\[-Wstrict-aliasing\]' 'warning: .*does.*\[-Wstrict-aliasing\]' + 'warning: .*\[-Wrestrict\]' # strict aliasing violation in C++ (Clang) 'warning: .*\[-Wundefined-reinterpret-cast\]' @@ -44,6 +45,8 @@ gcc_warn_check() { 'warning: .*will always overflow destination buffer' # compile-time part of FORTIFY_SOURCE 'warning: .*\[-Wstringop-overflow\]' + 'warning: .*\[-Wstringop-overread\]' + 'warning: .*\[-Wstringop-truncation\]' # clang-only, equivalent of -Wstringop-overflow 'warning: .*\[-Wfortify-source\]' 'warning: .*assuming pointer wraparound does not occur' @@ -86,6 +89,7 @@ gcc_warn_check() { # -Wformat variants 'warning: .*too few arguments for format' 'warning: .*missing sentinel in function call.*\[-Wformat=\]' + 'warning: .*\[-Wformat-truncation\]' # format ... expects a matching ... argument # (iow, too few arguments for format in new wording :)) 'warning: .*matching.*\[-Wformat=\]' @@ -104,6 +108,8 @@ gcc_warn_check() { # more specific form of -Wincompatible-pointer-types (Clang) 'warning: .*\[-Wincompatible-function-pointer-types\]' # these will fail with CFI (https://reviews.llvm.org/D134831) + # (gcc lacks -strict) + #'warning: .*\[-Wcast-function-type\]' 'warning: .*\[-Wcast-function-type-strict\]' # using wrong deallocator, e.g. using free() on object allocated using my_malloc() # when my_malloc() is annotated as needing my_free(). @@ -117,9 +123,12 @@ gcc_warn_check() { 'warning: .*\[-Wodr\]' # warning: argument value A will result in undefined behaviour (Clang) 'warning: .*\[-Wargument-undefined-behaviour\]' + 'warning: .*\[-Wnull-dereference\]' # general sensible warnings (will be rejected by modern compilers soon) + 'warning: .*\[-Wmain\]' 'warning: .*\[-Wimplicit-int\]' + 'warning: .*\[-Wstring-compare\]' # this may be valid code :/ #': warning: multi-character character constant'