# We expect warning options for gcc as arguments and return the ones which are
# accepted by the given gcc.
#
-# $Id: ld-warnings,v 1.2 2007/12/06 22:07:29 bernd67 Exp $
set -ue
#set -vx
*ld:\ unrecognized\ *option\ \'*)
opt="${error#*\'}"
opt="${opt%\'*}"
- OPTS="${OPTS//-Wl,$opt}"
+ ;;
+ *) continue
;;
esac
+ # if we come here, we have in $opt the option to remove. and
+ # we remove all instances. And we save agoinst leading "-"
+ NEW_OPTS=""
+ for o in $OPTS; do
+ case "$o" in
+ -Wl,$opt) : echo "Removed $o" >&2;;
+ *) NEW_OPTS="$NEW_OPTS $o";;
+ esac
+ done
+ OPTS="$NEW_OPTS"
done
echo $OPTS
}