summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMattias Nissler <mnissler@chromium.org>2019-11-04 10:11:20 +0000
committerSergei Trofimovich <slyfox@gentoo.org>2019-11-06 22:44:33 +0000
commit3ef6b33339da7bb04afd77e1bc5db011b02d658a (patch)
tree82f88edfa2044ef28ca390135d2cf159f08c90b4
parentnet-wireless/srslte: bump (diff)
downloadgentoo-3ef6b33339da7bb04afd77e1bc5db011b02d658a.tar.gz
gentoo-3ef6b33339da7bb04afd77e1bc5db011b02d658a.tar.bz2
gentoo-3ef6b33339da7bb04afd77e1bc5db011b02d658a.zip
toolchain-funcs.eclass: fix tc-cpp-is-true() to work with clang
Clang's preprocessor likes to output a leading newline, which makes the comparison always fail. GCC generates additional output with certain flags (e.g. -ggdb3) as well. Hence, switch the test to trigger a preprocessor error when the condition is not true and examine the exit code. Bug: https://bugs.gentoo.org/698912 Signed-off-by: Mattias Nissler <mnissler@chromium.org> Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
-rw-r--r--eclass/toolchain-funcs.eclass15
1 files changed, 7 insertions, 8 deletions
diff --git a/eclass/toolchain-funcs.eclass b/eclass/toolchain-funcs.eclass
index e358d484417..1bc6cbbc108 100644
--- a/eclass/toolchain-funcs.eclass
+++ b/eclass/toolchain-funcs.eclass
@@ -207,14 +207,13 @@ tc-cpp-is-true() {
local CONDITION=${1}
shift
- local RESULT=$($(tc-getTARGET_CPP) "${@}" -P - <<-EOF 2>/dev/null
- #if ${CONDITION}
- true
- #endif
- EOF
- )
-
- [[ ${RESULT} == true ]]
+ $(tc-getTARGET_CPP) "${@}" -P - <<-EOF >/dev/null 2>&1
+ #if ${CONDITION}
+ true
+ #else
+ #error false
+ #endif
+ EOF
}
# @FUNCTION: tc-detect-is-softfloat