1 |
commit: 3ef6b33339da7bb04afd77e1bc5db011b02d658a |
2 |
Author: Mattias Nissler <mnissler <AT> chromium <DOT> org> |
3 |
AuthorDate: Mon Nov 4 10:11:20 2019 +0000 |
4 |
Commit: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed Nov 6 22:44:33 2019 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3ef6b333 |
7 |
|
8 |
toolchain-funcs.eclass: fix tc-cpp-is-true() to work with clang |
9 |
|
10 |
Clang's preprocessor likes to output a leading newline, which makes |
11 |
the comparison always fail. GCC generates additional output with certain |
12 |
flags (e.g. -ggdb3) as well. Hence, switch the test to trigger a |
13 |
preprocessor error when the condition is not true and examine the exit |
14 |
code. |
15 |
|
16 |
Bug: https://bugs.gentoo.org/698912 |
17 |
|
18 |
Signed-off-by: Mattias Nissler <mnissler <AT> chromium.org> |
19 |
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org> |
20 |
|
21 |
eclass/toolchain-funcs.eclass | 15 +++++++-------- |
22 |
1 file changed, 7 insertions(+), 8 deletions(-) |
23 |
|
24 |
diff --git a/eclass/toolchain-funcs.eclass b/eclass/toolchain-funcs.eclass |
25 |
index e358d484417..1bc6cbbc108 100644 |
26 |
--- a/eclass/toolchain-funcs.eclass |
27 |
+++ b/eclass/toolchain-funcs.eclass |
28 |
@@ -207,14 +207,13 @@ tc-cpp-is-true() { |
29 |
local CONDITION=${1} |
30 |
shift |
31 |
|
32 |
- local RESULT=$($(tc-getTARGET_CPP) "${@}" -P - <<-EOF 2>/dev/null |
33 |
- #if ${CONDITION} |
34 |
- true |
35 |
- #endif |
36 |
- EOF |
37 |
- ) |
38 |
- |
39 |
- [[ ${RESULT} == true ]] |
40 |
+ $(tc-getTARGET_CPP) "${@}" -P - <<-EOF >/dev/null 2>&1 |
41 |
+ #if ${CONDITION} |
42 |
+ true |
43 |
+ #else |
44 |
+ #error false |
45 |
+ #endif |
46 |
+ EOF |
47 |
} |
48 |
|
49 |
# @FUNCTION: tc-detect-is-softfloat |