Gentoo Archives: gentoo-portage-dev

From: "Michał Górny" <mgorny@g.o>
To: gentoo-portage-dev@l.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 06:40:41
Message-Id: 1516948834.1253.0.camel@gentoo.org
In Reply to: Re: [gentoo-portage-dev] [PATCH] install-qa-check.d: Scan build log for CMake unused var warnings by Zac Medico
1 W dniu czw, 25.01.2018 o godzinie 20∶49 -0800, użytkownik Zac Medico
2 napisał:
3 > On 01/25/2018 01:13 AM, Michał Górny wrote:
4 > > Scan build log and report verbosely CMake warnings about unused
5 > > variables. This is a quite common problem, yet currently it is hard
6 > > to notice it since the warning is mixed with src_configure() output.
7 > > Repeat it verbosely after the install.
8 > >
9 > > This check outputs warnings such as:
10 > >
11 > > * One or more CMake variables were not used by the project:
12 > > * CMAKE_USER_MAKE_RULES_OVERRIDE
13 > > ---
14 > > bin/install-qa-check.d/90cmake-warnings | 28 ++++++++++++++++++++++++++++
15 > > 1 file changed, 28 insertions(+)
16 > > create mode 100644 bin/install-qa-check.d/90cmake-warnings
17 > >
18 > > diff --git a/bin/install-qa-check.d/90cmake-warnings b/bin/install-qa-check.d/90cmake-warnings
19 > > new file mode 100644
20 > > index 000000000..36a09851b
21 > > --- /dev/null
22 > > +++ b/bin/install-qa-check.d/90cmake-warnings
23 > > @@ -0,0 +1,28 @@
24 > > +# Check for CMake invalid option warnings
25 > > +
26 > > +cmake_warn_check() {
27 > > + if [[ -n ${PORTAGE_LOG_FILE} && -r ${PORTAGE_LOG_FILE} ]] ; then
28 > > + local cat=cat
29 > > + [[ ${PORTAGE_LOG_FILE} == *.gz ]] && cat=zcat
30 > > +
31 > > + local vars=()
32 > > + while read -r l; do
33 > > + vars+=( "${l}" )
34 > > + done < <( "${cat}" "${PORTAGE_LOG_FILE}" \
35 > > + | sed -n -e '/Manually-specified variables were not used by the project/,/^--/{/^ /p}' \
36 > > + | sort -u)
37 >
38 > We should probably use LC_ALL=C sort to ensure locale independence.
39 >
40 > Otherwise, this patch looks good.
41 >
42
43 Done that and merged, thanks!
44
45 --
46 Best regards,
47 Michał Górny