flag-o-matic.eclass: filter out '-B/foo' and '-B /foo' equally
authorSergei Trofimovich <slyfox@gentoo.org>
Sun, 23 Jun 2019 08:45:11 +0000 (09:45 +0100)
committerSergei Trofimovich <slyfox@gentoo.org>
Sun, 23 Jun 2019 08:53:42 +0000 (09:53 +0100)
In bug #687198 Julian noticed that strip-unsupported-flags()
filters out '-B' but not '/foo' in CFLAGS='-B /foo' and causes
breakage.

This change still does not allow -B flag but at least filters
out both '-B' and it's parameter.

Reported-by: Julian Cléaud
Bug: https://bugs.gentoo.org/687198
Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
eclass/flag-o-matic.eclass
eclass/tests/flag-o-matic.sh

index 933104190ae38bcc9c96041929d96bf07dfb5a9d..3b32bd9d6319c577ce1c7062167fbd0493084492 100644 (file)
@@ -496,7 +496,8 @@ test-flags-PROG() {
 
        while (( $# )); do
                case "$1" in
-                       --param)
+                       # '-B /foo': bug # 687198
+                       --param|-B)
                                if test-flag-${comp} "$1" "$2"; then
                                        flags+=( "$1" "$2" )
                                fi
index 97cd71d710a275eb3a2de2ffb358db582460a824..691b052c3d4363564f40a048b5cea308f7a9f880 100755 (executable)
@@ -58,6 +58,22 @@ strip-unsupported-flags
 [[ ${CFLAGS} == "--param l1-cache-size=32" ]] && [[ ${CXXFLAGS} == "-z=2" ]] && [[ ${LDFLAGS} == "" ]]
 ftend
 
+CFLAGS="-O2 -B/foo -O1"
+CXXFLAGS="-O2 -B/foo -O1"
+LDFLAGS="-O2 -B/foo -O1"
+tbegin "strip-unsupported-flags for '-B/foo'"
+strip-unsupported-flags
+[[ ${CFLAGS} == "-O2 -O1" ]] && [[ ${CXXFLAGS} == "-O2 -O1" ]] && [[ ${LDFLAGS} == "" ]]
+ftend
+
+CFLAGS="-O2 -B /foo -O1"
+CXXFLAGS="-O2 -B /foo -O1"
+LDFLAGS="-O2 -B /foo -O1"
+tbegin "strip-unsupported-flags for '-B /foo'"
+strip-unsupported-flags
+[[ ${CFLAGS} == "-O2 -O1" ]] && [[ ${CXXFLAGS} == "-O2 -O1" ]] && [[ ${LDFLAGS} == "" ]]
+ftend
+
 for var in $(all-flag-vars) ; do
        eval ${var}=\"-filter -filter-glob -foo-${var%FLAGS}\"
 done