Gentoo Archives: gentoo-portage-dev

From: Zac Medico <zmedico@g.o>
To: gentoo-portage-dev@l.g.o, "Michał Górny" <mgorny@g.o>
Subject: Re: [gentoo-portage-dev] [PATCH] install-qa-check.d: Scan build log for CMake unused var warnings
Date: Fri, 26 Jan 2018 04:49:24
Message-Id: 4f969983-3d46-b111-5d01-48d8435b341d@gentoo.org
In Reply to: [gentoo-portage-dev] [PATCH] install-qa-check.d: Scan build log for CMake unused var warnings by "Michał Górny"
1 On 01/25/2018 01:13 AM, Michał Górny wrote:
2 > Scan build log and report verbosely CMake warnings about unused
3 > variables. This is a quite common problem, yet currently it is hard
4 > to notice it since the warning is mixed with src_configure() output.
5 > Repeat it verbosely after the install.
6 >
7 > This check outputs warnings such as:
8 >
9 > * One or more CMake variables were not used by the project:
10 > * CMAKE_USER_MAKE_RULES_OVERRIDE
11 > ---
12 > bin/install-qa-check.d/90cmake-warnings | 28 ++++++++++++++++++++++++++++
13 > 1 file changed, 28 insertions(+)
14 > create mode 100644 bin/install-qa-check.d/90cmake-warnings
15 >
16 > diff --git a/bin/install-qa-check.d/90cmake-warnings b/bin/install-qa-check.d/90cmake-warnings
17 > new file mode 100644
18 > index 000000000..36a09851b
19 > --- /dev/null
20 > +++ b/bin/install-qa-check.d/90cmake-warnings
21 > @@ -0,0 +1,28 @@
22 > +# Check for CMake invalid option warnings
23 > +
24 > +cmake_warn_check() {
25 > + if [[ -n ${PORTAGE_LOG_FILE} && -r ${PORTAGE_LOG_FILE} ]] ; then
26 > + local cat=cat
27 > + [[ ${PORTAGE_LOG_FILE} == *.gz ]] && cat=zcat
28 > +
29 > + local vars=()
30 > + while read -r l; do
31 > + vars+=( "${l}" )
32 > + done < <( "${cat}" "${PORTAGE_LOG_FILE}" \
33 > + | sed -n -e '/Manually-specified variables were not used by the project/,/^--/{/^ /p}' \
34 > + | sort -u)
35 We should probably use LC_ALL=C sort to ensure locale independence.
36
37 Otherwise, this patch looks good.
38
39 > +
40 > + if [[ ${vars} ]]; then
41 > + eqawarn "One or more CMake variables were not used by the project:"
42 > + local v
43 > + for v in "${vars[@]}"; do
44 > + eqawarn " ${v}"
45 > + done
46 > + fi
47 > + fi
48 > +}
49 > +
50 > +cmake_warn_check
51 > +: # guarantee successful exit
52 > +
53 > +# vim:ft=sh
54 >
55
56
57 --
58 Thanks,
59 Zac

Attachments

File name MIME type
signature.asc application/pgp-signature

Replies