flag-o-matic.eclass: test-flag-PROG, refactor to reduce duplication
authorMichał Górny <mgorny@gentoo.org>
Fri, 11 Aug 2017 15:14:55 +0000 (17:14 +0200)
committerMichał Górny <mgorny@gentoo.org>
Fri, 25 Aug 2017 13:53:11 +0000 (15:53 +0200)
eclass/flag-o-matic.eclass

index b2f3742b3ecfc5804970eb0da633122d1778eedd..0393a30b74c35127f9b897fe192988362aa2c60a 100644 (file)
@@ -433,11 +433,15 @@ test-flag-PROG() {
                # 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
+       if "${cmdline[@]}" -x${lang} - </dev/null &>/dev/null ; then
+               cmdline+=( "${flag}" -x${lang} - )
        else
-               "${cmdline[@]}" "${flag}" -c -o /dev/null /dev/null >/dev/null 2>&1
+               # XXX: what's the purpose of this? does it even work with
+               # any compiler?
+               cmdline+=( "${flag}" -c -o /dev/null /dev/null )
        fi
+
+       "${cmdline[@]}" </dev/null &>/dev/null
 }
 
 # @FUNCTION: test-flag-CC