From: Sergei Trofimovich <slyfox@gentoo.org>
To: Mattias Nissler <mnissler@chromium.org>
Cc: gentoo-dev@lists.gentoo.org
Subject: [gentoo-dev] Re: [PATCH] Fix tc-cpp-is-true to work with clang
Date: Mon, 4 Nov 2019 20:18:11 +0000 [thread overview]
Message-ID: <20191104201811.5a629cdd@sf> (raw)
In-Reply-To: <20191104101120.230510-1-mnissler@chromium.org>
On Mon, 4 Nov 2019 10:11:20 +0000
Mattias Nissler <mnissler@chromium.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@chromium.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
next parent reply other threads:[~2019-11-04 20:18 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20191104101120.230510-1-mnissler@chromium.org>
2019-11-04 20:18 ` Sergei Trofimovich [this message]
2019-11-06 22:46 ` [gentoo-dev] Re: [PATCH] Fix tc-cpp-is-true to work with clang Sergei Trofimovich
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20191104201811.5a629cdd@sf \
--to=slyfox@gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
--cc=mnissler@chromium.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox