From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id E72041382C5 for ; Thu, 23 Jun 2016 06:52:55 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 27296141EA; Thu, 23 Jun 2016 06:52:37 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 3C78DE090B for ; Thu, 23 Jun 2016 06:52:36 +0000 (UTC) Received: from gentoo.org (amun.cheops.bitzolder.nl [83.162.207.175]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: grobian) by smtp.gentoo.org (Postfix) with ESMTPSA id 821B4340862 for ; Thu, 23 Jun 2016 06:52:34 +0000 (UTC) Date: Thu, 23 Jun 2016 08:52:20 +0200 From: Fabian Groffen To: gentoo-dev@lists.gentoo.org Subject: Re: [gentoo-dev] [PATCH 3/4] toolchain-funcs.eclass: Add tc-get-compiler-type() Message-ID: <20160623065220.svcr7uwzvr274zax@gentoo.org> Mail-Followup-To: gentoo-dev@lists.gentoo.org References: <20160622200654.6961-1-mgorny@gentoo.org> <20160622200654.6961-4-mgorny@gentoo.org> 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 MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="4uwn6i7ieq7hx4bn" Content-Disposition: inline In-Reply-To: <20160622200654.6961-4-mgorny@gentoo.org> User-Agent: Mutt/1.6.1 (SunOS 5.11, VIM - Vi IMproved 7.4) Organization: Gentoo Foundation, Inc. X-Archives-Salt: 8a8e346a-ab9f-4fe6-9a7f-770b9aac624d X-Archives-Hash: bea06c0206353e037e8adc878300be65 --4uwn6i7ieq7hx4bn Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 22-06-2016 22:06:53 +0200, Micha=C5=82 G=C3=B3rny wrote: > +# @FUNCTION: tc-get-compiler-type > +# @RETURN: keyword identifying the compiler: gcc, clang, unknown > +tc-get-compiler-type() { > + set -- $($(tc-getCPP "$@") -E -P - <<<"CPP_WORKS __GNUC__ __clang__") % echo "CPP_WORKS __GNUC__ __clang__" | clang -E -P -=20 CPP_WORKS 4 1 The logic below does the right thing, but it might be good for future reference to make note of this (clang). > + > + # CPP_WORKS shouldn't be substituted -- so if it's not there, > + # cpp is probably broken > + if [[ $1 !=3D CPP_WORKS ]]; then > + echo unknown > + # Check which of the defines were substituted > + elif [[ $3 !=3D __clang__ ]]; then > + echo clang > + elif [[ $2 !=3D __GNUC__ ]]; then > + echo gcc > + else > + echo unknown > + fi > +} --=20 Fabian Groffen Gentoo on a different level --4uwn6i7ieq7hx4bn Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iEYEAREKAAYFAldrhyQACgkQX3X2B8XHTomUtgCffGfDS0fo/kUT0+U3wZB6pSD9 d1wAn3GYhHF2iihJIu3a3wU6FU4AeyZu =qIZO -----END PGP SIGNATURE----- --4uwn6i7ieq7hx4bn--