vapier      15/05/06 07:04:53

  Modified:             flag-o-matic.eclass
  Log:
  make flag testing work for clang too crbug.com/474652

Revision  Changes    Path
1.205                eclass/flag-o-matic.eclass

file : 
http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/flag-o-matic.eclass?rev=1.205&view=markup
plain: 
http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/flag-o-matic.eclass?rev=1.205&content-type=text/plain
diff : 
http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/flag-o-matic.eclass?r1=1.204&r2=1.205

Index: flag-o-matic.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/flag-o-matic.eclass,v
retrieving revision 1.204
retrieving revision 1.205
diff -u -r1.204 -r1.205
--- flag-o-matic.eclass 31 Dec 2014 08:26:48 -0000      1.204
+++ flag-o-matic.eclass 6 May 2015 07:04:53 -0000       1.205
@@ -1,6 +1,6 @@
 # Copyright 1999-2014 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/flag-o-matic.eclass,v 1.204 
2014/12/31 08:26:48 vapier Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/flag-o-matic.eclass,v 1.205 
2015/05/06 07:04:53 vapier Exp $
 
 # @ECLASS: flag-o-matic.eclass
 # @MAINTAINER:
@@ -415,13 +415,18 @@
 
        [[ -z ${comp} || -z ${flag} ]] && return 1
 
-       # use -c so we can test the assembler as well
-       local PROG=$(tc-get${comp})
-       if ${PROG} -c -o /dev/null -x${lang} - < /dev/null > /dev/null 2>&1 ; 
then
-               ${PROG} "${flag}" -c -o /dev/null -x${lang} - < /dev/null \
-                       > /dev/null 2>&1
+       local cmdline=(
+               $(tc-get${comp})
+               # Clang will warn about unknown gcc flags but exit 0.
+               # Need -Werror to force it to exit non-zero.
+               -Werror
+               # Use -c so we can test the assembler as well.
+               -c -o /dev/null
+       )
+       if "${cmdline[@]}" -x${lang} - </dev/null >/dev/null 2>&1 ; then
+               "${cmdline[@]}" "${flag}" -x${lang} - </dev/null >/dev/null 2>&1
        else
-               ${PROG} "${flag}" -c -o /dev/null /dev/null > /dev/null 2>&1
+               "${cmdline[@]}" "${flag}" -c -o /dev/null /dev/null >/dev/null 
2>&1
        fi
 }
 




Reply via email to