Gentoo Archives: gentoo-dev

From: Sergei Trofimovich <slyfox@g.o>
To: Mattias Nissler <mnissler@××××××××.org>
Cc: gentoo-dev@l.g.o
Subject: [gentoo-dev] Re: [PATCH] Fix tc-cpp-is-true to work with clang
Date: Mon, 04 Nov 2019 20:18:40
Message-Id: 20191104201811.5a629cdd@sf
On Mon,  4 Nov 2019 10:11:20 +0000
Mattias Nissler <mnissler@××××××××.org> wrote:

> 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@××××××××.org> > --- > eclass/toolchain-funcs.eclass | 15 +++++++-------- > 1 file changed, 7 insertions(+), 8 deletions(-)
Looks good! I'll pull it in to ::gentoo in a few days. Thank you!
> 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 > -- > 2.21.0 >
-- Sergei

Replies

Subject Author
Re: [gentoo-dev] Re: [PATCH] Fix tc-cpp-is-true to work with clang Sergei Trofimovich <slyfox@g.o>