Gentoo Archives: gentoo-portage-dev

From: "Michał Górny" <mgorny@g.o>
To: gentoo-portage-dev@l.g.o
Cc: "Michał Górny" <mgorny@g.o>
Subject: [gentoo-portage-dev] [PATCH 2/2] Use a single grep call for gcc warning checks
Date: Fri, 12 Sep 2014 15:48:08
Message-Id: 1410536863-17389-2-git-send-email-mgorny@gentoo.org
In Reply to: [gentoo-portage-dev] [PATCH 1/2] Update gcc warning checks to work with gcc-4.9 by "Michał Górny"
1 Use a single grep call with all gcc warning checks combined rather than
2 calling grep separately for each message being checked. Aside to being
3 faster, this also avoids outputting warnings in separate blocks.
4 ---
5 bin/install-qa-check.d/90gcc-warnings | 62 +++++++++++++++++++----------------
6 1 file changed, 33 insertions(+), 29 deletions(-)
7
8 diff --git a/bin/install-qa-check.d/90gcc-warnings b/bin/install-qa-check.d/90gcc-warnings
9 index 812bf41..ad38754 100644
10 --- a/bin/install-qa-check.d/90gcc-warnings
11 +++ b/bin/install-qa-check.d/90gcc-warnings
12 @@ -68,39 +68,43 @@ gcc_warn_check() {
13 #': warning: missing sentinel in function call'
14 #': warning: not enough variable arguments to fit a sentinel'
15 )
16 +
17 + # join all messages into one grep-expression
18 + local joined_msgs
19 + printf -v joined_msgs '%s|' "${msgs[@]}"
20 + joined_msgs=${joined_msgs%|}
21 +
22 local abort="no"
23 - local i=0
24 local grep_cmd=grep
25 [[ $PORTAGE_LOG_FILE = *.gz ]] && grep_cmd=zgrep
26 - while [[ -n ${msgs[${i}]} ]] ; do
27 - m=${msgs[$((i++))]}
28 - # force C locale to work around slow unicode locales #160234
29 - f=$(LC_ALL=C $grep_cmd "${m}" "${PORTAGE_LOG_FILE}")
30 - if [[ -n ${f} ]] ; then
31 - abort="yes"
32 - # for now, don't make this fatal (see bug #337031)
33 - #case "$m" in
34 - # ": warning: call to .* will always overflow destination buffer") always_overflow=yes ;;
35 - #esac
36 - if [[ $always_overflow = yes ]] ; then
37 - eerror
38 - eerror "QA Notice: Package triggers severe warnings which indicate that it"
39 - eerror " may exhibit random runtime failures."
40 - eerror
41 - eerror "${f}"
42 - eerror
43 - eerror " Please file a bug about this at http://bugs.gentoo.org/"
44 - eerror " with the maintaining herd of the package."
45 - eerror
46 - else
47 - __vecho -ne '\n'
48 - eqawarn "QA Notice: Package triggers severe warnings which indicate that it"
49 - eqawarn " may exhibit random runtime failures."
50 - eqawarn "${f}"
51 - __vecho -ne '\n'
52 - fi
53 +
54 + # force C locale to work around slow unicode locales #160234
55 + f=$(LC_CTYPE=C LC_COLLATE=C "${grep_cmd}" -E "${joined_msgs}" "${PORTAGE_LOG_FILE}")
56 + if [[ -n ${f} ]] ; then
57 + abort="yes"
58 + # for now, don't make this fatal (see bug #337031)
59 + #if [[ ${f} == *'will always overflow destination buffer'* ]]; then
60 + # always_overflow=yes
61 + #fi
62 + if [[ $always_overflow = yes ]] ; then
63 + eerror
64 + eerror "QA Notice: Package triggers severe warnings which indicate that it"
65 + eerror " may exhibit random runtime failures."
66 + eerror
67 + eerror "${f}"
68 + eerror
69 + eerror " Please file a bug about this at http://bugs.gentoo.org/"
70 + eerror " with the maintaining herd of the package."
71 + eerror
72 + else
73 + __vecho -ne '\n'
74 + eqawarn "QA Notice: Package triggers severe warnings which indicate that it"
75 + eqawarn " may exhibit random runtime failures."
76 + eqawarn "${f}"
77 + __vecho -ne '\n'
78 fi
79 - done
80 + fi
81 +
82 local cat_cmd=cat
83 [[ $PORTAGE_LOG_FILE = *.gz ]] && cat_cmd=zcat
84 [[ $reset_debug = 1 ]] && set -x
85 --
86 2.1.0

Replies