commit:     82b182fb344a841fccb2b599fc4ea0d5c4ab254f
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Sun Jun 23 08:45:11 2019 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Sun Jun 23 08:53:42 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=82b182fb

flag-o-matic.eclass: filter out '-B/foo' and '-B /foo' equally

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 <AT> gentoo.org>

 eclass/flag-o-matic.eclass   |  3 ++-
 eclass/tests/flag-o-matic.sh | 16 ++++++++++++++++
 2 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/eclass/flag-o-matic.eclass b/eclass/flag-o-matic.eclass
index 933104190ae..3b32bd9d631 100644
--- a/eclass/flag-o-matic.eclass
+++ b/eclass/flag-o-matic.eclass
@@ -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

diff --git a/eclass/tests/flag-o-matic.sh b/eclass/tests/flag-o-matic.sh
index 97cd71d710a..691b052c3d4 100755
--- a/eclass/tests/flag-o-matic.sh
+++ b/eclass/tests/flag-o-matic.sh
@@ -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

Reply via email to