Gentoo Archives: gentoo-commits

From: Sergei Trofimovich <slyfox@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: eclass/
Date: Mon, 30 Sep 2019 09:00:49
Message-Id: 1569834031.60328373651331a8d1beab33f4a499e0b3ad61d7.slyfox@gentoo
1 commit: 60328373651331a8d1beab33f4a499e0b3ad61d7
2 Author: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
3 AuthorDate: Mon Sep 30 08:52:04 2019 +0000
4 Commit: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
5 CommitDate: Mon Sep 30 09:00:31 2019 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=60328373
7
8 flag-o-matic.eclass: fix test-flag-PROG() for CC="gcc -m64"
9
10 bug #695706 added compiler validation via 'type -p ${CC}', but that
11 does not take into account possible options present in ${CC} itself:
12
13 $ type -P x86_64-pc-linux-gnu-gcc -m64; echo $?
14 /usr/lib/ccache/bin/x86_64-pc-linux-gnu-gcc
15 1
16
17 $ type -P x86_64-pc-linux-gnu-gcc ; echo $?
18 /usr/lib/ccache/bin/x86_64-pc-linux-gnu-gcc
19 0
20
21 The change picks first argument (binary name) and validates only that.
22
23 Reported-by: Pavol Cupka
24 Closes: https://bugs.gentoo.org/695888
25 Bug: https://bugs.gentoo.org/show_bug.cgi?id=695706
26 Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>
27
28 eclass/flag-o-matic.eclass | 8 +++++---
29 1 file changed, 5 insertions(+), 3 deletions(-)
30
31 diff --git a/eclass/flag-o-matic.eclass b/eclass/flag-o-matic.eclass
32 index 89b259cc222..f882b09d621 100644
33 --- a/eclass/flag-o-matic.eclass
34 +++ b/eclass/flag-o-matic.eclass
35 @@ -436,11 +436,13 @@ test-flag-PROG() {
36 [[ -z ${comp} || -z $1 ]] && return 1
37
38 # verify selected compiler exists before using it
39 - comp=$(tc-get${comp})
40 - type -p ${comp} >/dev/null || return 1
41 + comp=($(tc-get${comp}))
42 + # 'comp' can already contain compiler options.
43 + # 'type' needs a binary name
44 + type -p ${comp[0]} >/dev/null || return 1
45
46 local cmdline=(
47 - ${comp}
48 + "${comp[@]}"
49 # Clang will warn about unknown gcc flags but exit 0.
50 # Need -Werror to force it to exit non-zero.
51 -Werror