This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [arm] Automate --with-cpu
- From: Paul Brook <paul at codesourcery dot com>
- To: neroden at twcny dot rr dot com (Nathanael Nerode)
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Fri, 30 Apr 2004 15:46:41 +0100
- Subject: Re: [arm] Automate --with-cpu
- Organization: CodeSourcery
- References: <20040429154210.GA1820@twcny.rr.com>
On Thursday 29 April 2004 16:42, Nathanael Nerode wrote:
> I like the concept, but:
>
> + # See if it matches any of the entries in
> arm-cores.def eval "val=\$with_$which"
> ! [ x"$val" = x ] && val=unset
> ! for opt in `sed -e '/ARM_CORE/!d' \
> ! -e 's/ARM_CORE(\([^,]*\),.*$/\1/' \
> ! ${srcdir}/config/arm/arm-cores.def` unset .
> ! do
> ! [ x$opt = x"$val" ] && break
> ! done
>
> Isn't there a clearer way to write this logic? It's hideously unreadable.
Now I think about it, there is.
Tested with cross to arm-none-elf.
Ok?
Paul
2004-04-30 Paul Brook <paul@codesourcery.com>
* config.gcc: Simplify arm --with-{cpu,tune} test.
Index: config.gcc
===================================================================
RCS file: /var/cvsroot/gcc-cvs/gcc/gcc/config.gcc,v
retrieving revision 1.454
diff -u -p -r1.454 config.gcc
--- a/config.gcc 30 Apr 2004 13:14:02 -0000 1.454
+++ b/config.gcc 30 Apr 2004 14:13:07 -0000
@@ -2223,17 +2223,15 @@ fi
for which in cpu tune; do
# See if it matches any of the entries in arm-cores.def
eval "val=\$with_$which"
- [ x"$val" = x ] && val=unset
- for opt in `sed -e '/ARM_CORE/!d' \
- -e 's/ARM_CORE(\([^,]*\),.*$/\1/' \
- ${srcdir}/config/arm/arm-cores.def` unset .
- do
- [ x$opt = x"$val" ] && break
- done
- if [ $opt = . ]; then
- echo "Unknown CPU used in --with-$which=$val" 1>&2
- exit 1
-
+ if [ x"$val" = x ] \
+ || grep "^ARM_CORE($val," \
+ ${srcdir}/config/arm/arm-cores.def \
+ > /dev/null; then
+ # Ok
+ true
+ else
+ echo "Unknown CPU used in --with-$which=$val" 1>&2
+ exit 1
fi
done