summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergei Trofimovich <slyfox@gentoo.org>2020-03-20 22:28:19 +0000
committerSergei Trofimovich <slyfox@gentoo.org>2020-03-20 22:33:36 +0000
commitab8fe14ae2e9110faa85ca1c4528b470c0be1535 (patch)
treedcf527048f101c7dc6e7539b59581bad4861a63c
parentprofiles: Update gnome-extra/nautilus-dropbox package.mask (diff)
downloadgentoo-ab8fe14ae2e9110faa85ca1c4528b470c0be1535.tar.gz
gentoo-ab8fe14ae2e9110faa85ca1c4528b470c0be1535.tar.bz2
gentoo-ab8fe14ae2e9110faa85ca1c4528b470c0be1535.zip
flag-o-matic.eclass: don't use -Werror in test-flag-PROG(), bug #712488
-Werror filters out too much (everything) if used compiler happens to always generate warnings. Let's drop cosmetic stripping of ignored flags until we really need it. Then we can consider more selective filtering by using more targeted -Werror= options. Reported-by: Anton Gubarkov Closes: https://bugs.gentoo.org/712488 Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
-rw-r--r--eclass/flag-o-matic.eclass19
-rwxr-xr-xeclass/tests/flag-o-matic.sh10
2 files changed, 14 insertions, 15 deletions
diff --git a/eclass/flag-o-matic.eclass b/eclass/flag-o-matic.eclass
index 9ef9ac3685e0..d8111fb9e38f 100644
--- a/eclass/flag-o-matic.eclass
+++ b/eclass/flag-o-matic.eclass
@@ -487,11 +487,15 @@ test-flag-PROG() {
printf "%s\n" "${in_src}" > "${test_in}" || die "Failed to create '${test_in}'"
+ # Don't set -Werror as there are cases when benign
+ # always-on warnings filter out all flags like bug #712488.
+ # We'll have to live with potential '-Wunused-command-line-argument'.
+ # flags.
+ #
+ # We can add more selective detection of no-op flags via
+ # '-Werror=ignored-optimization-argument' and similar error options.
local cmdline=(
"${comp[@]}"
- # Clang will warn about unknown gcc flags but exit 0.
- # Need -Werror to force it to exit non-zero.
- -Werror
"$@"
# -x<lang> options need to go before first source file
"${cmdline_extra[@]}"
@@ -499,14 +503,7 @@ test-flag-PROG() {
"${test_in}" -o "${test_out}"
)
- if ! "${cmdline[@]}" &>/dev/null; then
- # -Werror makes clang bail out on unused arguments as well;
- # try to add -Qunused-arguments to work-around that
- # other compilers don't support it but then, it's failure like
- # any other
- cmdline+=( -Qunused-arguments )
- "${cmdline[@]}" &>/dev/null
- fi
+ "${cmdline[@]}" &>/dev/null
}
# @FUNCTION: test-flag-CC
diff --git a/eclass/tests/flag-o-matic.sh b/eclass/tests/flag-o-matic.sh
index 229dff52af94..6dfacb04c077 100755
--- a/eclass/tests/flag-o-matic.sh
+++ b/eclass/tests/flag-o-matic.sh
@@ -161,10 +161,12 @@ out=$(CC=clang test-flags-CC -finvalid-flag)
[[ $? -ne 0 && -z ${out} ]]
ftend
-tbegin "test-flags-CC (gcc-valid but clang-invalid flags)"
-out=$(CC=clang test-flags-CC -finline-limit=1200)
-[[ $? -ne 0 && -z ${out} ]]
-ftend
+### '-finline-limit=1200' is 'ignored' flag, not invalid.
+### We don't filter out ignored flags currently, bug #712488
+#tbegin "test-flags-CC (gcc-valid but clang-invalid flags)"
+#out=$(CC=clang test-flags-CC -finline-limit=1200)
+#[[ $? -ne 0 && -z ${out} ]]
+#ftend
tbegin "test-flags-CC (unused flags w/clang)"
out=$(CC=clang test-flags-CC -Wl,-O1)