From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 0DDB6138334 for ; Mon, 4 Nov 2019 20:18:40 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 4BFFEE09A6; Mon, 4 Nov 2019 20:18:36 +0000 (UTC) Received: from smtp.gentoo.org (dev.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 6C693E096A for ; Mon, 4 Nov 2019 20:18:34 +0000 (UTC) Received: from sf (tunnel547699-pt.tunnel.tserv1.lon2.ipv6.he.net [IPv6:2001:470:1f1c:3e6::2]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: slyfox) by smtp.gentoo.org (Postfix) with ESMTPSA id 664C434C894; Mon, 4 Nov 2019 20:18:31 +0000 (UTC) Date: Mon, 4 Nov 2019 20:18:11 +0000 From: Sergei Trofimovich To: Mattias Nissler Cc: gentoo-dev@lists.gentoo.org Subject: [gentoo-dev] Re: [PATCH] Fix tc-cpp-is-true to work with clang Message-ID: <20191104201811.5a629cdd@sf> In-Reply-To: <20191104101120.230510-1-mnissler@chromium.org> References: <20191104101120.230510-1-mnissler@chromium.org> X-Mailer: Claws Mail 3.17.4 (GTK+ 2.24.32; x86_64-pc-linux-gnu) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-dev@lists.gentoo.org Reply-to: gentoo-dev@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Archives-Salt: 46134ca9-b1bf-478f-a5f7-f88e5e2197b2 X-Archives-Hash: 054ea86a0f3e9b2834a2d90593fc4d8e On Mon, 4 Nov 2019 10:11:20 +0000 Mattias Nissler 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 > --- > 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