flag-o-matic.eclass: test-flag-PROG, ignore unused args in clang
authorMichał Górny <mgorny@gentoo.org>
Fri, 11 Aug 2017 15:17:45 +0000 (17:17 +0200)
committerMichał Górny <mgorny@gentoo.org>
Fri, 25 Aug 2017 13:53:15 +0000 (15:53 +0200)
commitae9870d9f6b1394ede86176443770b36d7e60ac1
tree5f533b8f8651d035ac7cb0f0a6111148dfc13533
parent3987c6edac86e035b1fa4b629284cdf245d66174
flag-o-matic.eclass: test-flag-PROG, ignore unused args in clang

By default, clang considers unused arguments as error when -Werror is
used. Since flag tests are performed without linking, this causes all
tests for linker flags to fail inadvertently and all those flags
are stripped as a result.

While the correctness of passing unused flags is doubtful, silently
stripping them in a few random packages is certainly not the solution
to the problem, and also makes the results differ between gcc and clang.
To account for that, use clang's -Qunused-arguments option to silence
unused argument warnings.

To avoid wasting time on testing the compiler, just try passing
-Qunused-arguments every time a flag check fails. If clang is not used,
the additional call will fail just the same as the previous one (either
because of the original flag or because of -Qunused-arguments), so
the result will be the same.
eclass/flag-o-matic.eclass
eclass/tests/flag-o-matic.sh