commit: 85723dbd4d8fa6392001adeb8ca695a29e530949 Author: Sam James <sam <AT> gentoo <DOT> org> AuthorDate: Wed Nov 9 01:16:27 2022 +0000 Commit: Sam James <sam <AT> gentoo <DOT> org> CommitDate: Wed Nov 9 01:17:50 2022 +0000 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=85723dbd
bin: replace check-implicit-pointer-usage.py Always die on -Wimplicit-function-declaration as Clang 16 is going to make it fatal and it's always pretty dubious. The licencing of check-implicit-pointer-usage.py is also unclear, but the tool has been broken since GCC 4.5(!) Bug: https://bugs.gentoo.org/365655 Bug: https://bugs.gentoo.org/870412 Signed-off-by: Sam James <sam <AT> gentoo.org> bin/check-implicit-pointer-usage.py | 79 ----------------------------------- bin/install-qa-check.d/90gcc-warnings | 46 ++++---------------- 2 files changed, 7 insertions(+), 118 deletions(-) diff --git a/bin/check-implicit-pointer-usage.py b/bin/check-implicit-pointer-usage.py deleted file mode 100755 index 06b666c88..000000000 --- a/bin/check-implicit-pointer-usage.py +++ /dev/null @@ -1,79 +0,0 @@ -#!/usr/bin/env python - -# Ripped from HP and updated from Debian -# Update by Gentoo to support unicode output - -# -# Copyright (c) 2004 Hewlett-Packard Development Company, L.P. -# David Mosberger <[email protected]> -# -# Scan standard input for GCC warning messages that are likely to -# source of real 64-bit problems. In particular, see whether there -# are any implicitly declared functions whose return values are later -# interpreted as pointers. Those are almost guaranteed to cause -# crashes. -# - -import re -import sys - -implicit_pattern = re.compile( - r"([^:]*):(\d+): warning: implicit declaration " + "of function [`']([^']*)'" -) -pointer_pattern = ( - r"([^:]*):(\d+): warning: " - + r"(" - + r"(assignment" - + r"|initialization" - + r"|return" - + r"|passing arg \d+ of `[^']*'" - + r"|passing arg \d+ of pointer to function" - + r") makes pointer from integer without a cast" - + r"|" - + r"cast to pointer from integer of different size)" -) - -unicode_quote_open = "\u2018" -unicode_quote_close = "\u2019" - - -def write(msg): - sys.stdout.buffer.write(msg.encode("utf_8", "backslashreplace")) - - -pointer_pattern = re.compile(pointer_pattern) - -last_implicit_filename = "" -last_implicit_linenum = -1 -last_implicit_func = "" - -while True: - line = sys.stdin.buffer.readline().decode("utf_8", "replace") - if not line: - break - # translate unicode open/close quotes to ascii ones - line = line.replace(unicode_quote_open, "`") - line = line.replace(unicode_quote_close, "'") - m = implicit_pattern.match(line) - if m: - last_implicit_filename = m.group(1) - last_implicit_linenum = int(m.group(2)) - last_implicit_func = m.group(3) - else: - m = pointer_pattern.match(line) - if m: - pointer_filename = m.group(1) - pointer_linenum = int(m.group(2)) - if ( - last_implicit_filename == pointer_filename - and last_implicit_linenum == pointer_linenum - ): - write( - "Function `%s' implicitly converted to pointer at " - "%s:%d\n" - % ( - last_implicit_func, - last_implicit_filename, - last_implicit_linenum, - ) - ) diff --git a/bin/install-qa-check.d/90gcc-warnings b/bin/install-qa-check.d/90gcc-warnings index f5dae8a76..cd12558ba 100644 --- a/bin/install-qa-check.d/90gcc-warnings +++ b/bin/install-qa-check.d/90gcc-warnings @@ -110,12 +110,17 @@ gcc_warn_check() { f=$(LC_CTYPE=C LC_COLLATE=C "${grep_cmd}" -E -a "${joined_msgs}" "${PORTAGE_LOG_FILE}" | uniq) if [[ -n ${f} ]] ; then abort="yes" + # for now, don't make this fatal (see bug #337031) #if [[ ${f} == *'will always overflow destination buffer'* ]]; then # always_overflow=yes #fi - if [[ ${always_overflow} = yes ]] ; then + if [[ ${f} == *'[-Wimplicit-function-declaration]'* ]] ; then + implicit_func_decl=yes + fi + + if [[ ${always_overflow} = yes || ${implicit_func_decl} = yes ]] ; then eerror eerror "QA Notice: Package triggers severe warnings which indicate that it" eerror " may exhibit random runtime failures." @@ -134,47 +139,10 @@ gcc_warn_check() { fi fi - local cat_cmd=cat - [[ ${PORTAGE_LOG_FILE} = *.gz ]] && cat_cmd=zcat [[ ${reset_debug} = 1 ]] && set -x - # Use safe cwd, avoiding unsafe import for bug #469338. - f=$(cd "${PORTAGE_PYM_PATH}" ; ${cat_cmd} "${PORTAGE_LOG_FILE}" | \ - "${PORTAGE_PYTHON:-/usr/bin/python}" "${PORTAGE_BIN_PATH}"/check-implicit-pointer-usage.py || die "check-implicit-pointer-usage.py failed") - - if [[ -n ${f} ]] ; then - # In the future this will be a forced "die". In preparation, - # increase the log level from "qa" to "eerror" so that people - # are aware this is a problem that must be fixed ASAP. - - # Just warn on 32bit hosts but bail on 64bit hosts - case ${CHOST} in - alpha*|aarch64*|arm64*|hppa64*|ia64*|powerpc64*|loongarch64*|mips64*|riscv64*|sparc64*|sparcv9*|s390x*|x86_64*) gentoo_bug=yes ;; - esac - - abort=yes - - if [[ ${gentoo_bug} = yes ]] ; then - eerror - eerror "QA Notice: Package triggers severe warnings which indicate that it" - eerror " will almost certainly crash on 64bit architectures." - eerror - eerror "${f}" - eerror - eerror " Please file a bug about this at https://bugs.gentoo.org/" - eerror " with the maintainer of the package." - eerror - else - __vecho -ne '\n' - eqawarn "QA Notice: Package triggers severe warnings which indicate that it" - eqawarn " will almost certainly crash on 64bit architectures." - eqawarn "${f}" - __vecho -ne '\n' - fi - - fi if [[ ${abort} == "yes" ]] ; then - if [[ ${gentoo_bug} = yes || ${always_overflow} = yes ]] ; then + if [[ ${gentoo_bug} = yes || ${always_overflow} = yes || ${implicit_func_decl} = yes ]] ; then die "install aborted due to severe warnings shown above" else echo "Please do not file a Gentoo bug and instead" \
