1 |
On Mon, 4 Nov 2019 10:11:20 +0000 |
2 |
Mattias Nissler <mnissler@××××××××.org> wrote: |
3 |
|
4 |
> Clang's preprocessor likes to output a leading newline, which makes |
5 |
> the comparison always fail. GCC generates additional output with certain |
6 |
> flags (e.g. -ggdb3) as well. Hence, switch the test to trigger a |
7 |
> preprocessor error when the condition is not true and examine the exit |
8 |
> code. |
9 |
> |
10 |
> Bug: https://bugs.gentoo.org/698912 |
11 |
> |
12 |
> Signed-off-by: Mattias Nissler <mnissler@××××××××.org> |
13 |
> --- |
14 |
> eclass/toolchain-funcs.eclass | 15 +++++++-------- |
15 |
> 1 file changed, 7 insertions(+), 8 deletions(-) |
16 |
|
17 |
Looks good! I'll pull it in to ::gentoo in a few days. |
18 |
|
19 |
Thank you! |
20 |
|
21 |
> diff --git a/eclass/toolchain-funcs.eclass b/eclass/toolchain-funcs.eclass |
22 |
> index e358d484417..1bc6cbbc108 100644 |
23 |
> --- a/eclass/toolchain-funcs.eclass |
24 |
> +++ b/eclass/toolchain-funcs.eclass |
25 |
> @@ -207,14 +207,13 @@ tc-cpp-is-true() { |
26 |
> local CONDITION=${1} |
27 |
> shift |
28 |
> |
29 |
> - local RESULT=$($(tc-getTARGET_CPP) "${@}" -P - <<-EOF 2>/dev/null |
30 |
> - #if ${CONDITION} |
31 |
> - true |
32 |
> - #endif |
33 |
> - EOF |
34 |
> - ) |
35 |
> - |
36 |
> - [[ ${RESULT} == true ]] |
37 |
> + $(tc-getTARGET_CPP) "${@}" -P - <<-EOF >/dev/null 2>&1 |
38 |
> + #if ${CONDITION} |
39 |
> + true |
40 |
> + #else |
41 |
> + #error false |
42 |
> + #endif |
43 |
> + EOF |
44 |
> } |
45 |
> |
46 |
> # @FUNCTION: tc-detect-is-softfloat |
47 |
> -- |
48 |
> 2.21.0 |
49 |
> |
50 |
|
51 |
|
52 |
-- |
53 |
|
54 |
Sergei |