From aeea5fd22a31ae7127bcd34d8dae3f8a4ace26a4 Mon Sep 17 00:00:00 2001 From: tg Date: Thu, 25 Jul 2013 15:54:33 +0000 Subject: [PATCH] =?UTF-8?q?rewrite=20lots=20of=20=E2=80=9Celif=20test?= =?UTF-8?q?=E2=80=9D=20into=20=E2=80=9Ccase=E2=80=9D=20statements?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit (except those where the condition isn’t related) --- Build.sh | 240 +++++++++++++++++++++++++++++++++---------------------- 1 file changed, 143 insertions(+), 97 deletions(-) diff --git a/Build.sh b/Build.sh index 8bf4350..c87c299 100644 --- a/Build.sh +++ b/Build.sh @@ -1,5 +1,5 @@ #!/bin/sh -srcversion='$MirOS: src/bin/mksh/Build.sh,v 1.642 2013/07/25 15:43:59 tg Exp $' +srcversion='$MirOS: src/bin/mksh/Build.sh,v 1.643 2013/07/25 15:54:33 tg Exp $' #- # Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, # 2011, 2012, 2013 @@ -1087,19 +1087,23 @@ if ac_ifcpp 'if 0' compiler_fails '' \ 'if the compiler does not fail correctly'; then save_CFLAGS=$CFLAGS : ${HAVE_CAN_DELEXE=x} - if test $ct = dmc; then - CFLAGS="$CFLAGS ${ccpl}/DELEXECUTABLE" - ac_testn can_delexe compiler_fails 0 'for the /DELEXECUTABLE linker option' <<-EOF - int main(void) { return (0); } - EOF - elif test $ct = dec; then + case $ct in + dec) CFLAGS="$CFLAGS ${ccpl}-non_shared" ac_testn can_delexe compiler_fails 0 'for the -non_shared linker option' <<-EOF int main(void) { return (0); } EOF - else + ;; + dmc) + CFLAGS="$CFLAGS ${ccpl}/DELEXECUTABLE" + ac_testn can_delexe compiler_fails 0 'for the /DELEXECUTABLE linker option' <<-EOF + int main(void) { return (0); } + EOF + ;; + *) exit 1 - fi + ;; + esac test 1 = $HAVE_CAN_DELEXE || CFLAGS=$save_CFLAGS ac_testn compiler_still_fails '' 'if the compiler still does not fail correctly' <<-EOF EOF @@ -1112,52 +1116,65 @@ if ac_ifcpp 'ifdef __TINYC__' couldbe_tcc '!' compiler_known 0 \ HAVE_COMPILER_KNOWN=1 fi -if test $ct = sunpro; then +case $ct in +bcc) + save_NOWARN="${ccpc}-w" + DOWARN="${ccpc}-w!" + ;; +dec) + # -msg_* flags not used yet, or is -w2 correct? + ;; +dmc) + save_NOWARN="${ccpc}-w" + DOWARN="${ccpc}-wx" + ;; +hpcc) + save_NOWARN= + DOWARN=+We + ;; +kencc) + save_NOWARN= + DOWARN= + ;; +mipspro) + save_NOWARN= + DOWARN="-diag_error 1-10000" + ;; +msc) + save_NOWARN="${ccpc}/w" + DOWARN="${ccpc}/WX" + ;; +sunpro) test x"$save_NOWARN" = x"" && save_NOWARN='-errwarn=%none' ac_flags 0 errwarnnone "$save_NOWARN" test 1 = $HAVE_CAN_ERRWARNNONE || save_NOWARN= ac_flags 0 errwarnall "-errwarn=%all" test 1 = $HAVE_CAN_ERRWARNALL && DOWARN="-errwarn=%all" -elif test $ct = hpcc; then - save_NOWARN= - DOWARN=+We -elif test $ct = mipspro; then - save_NOWARN= - DOWARN="-diag_error 1-10000" -elif test $ct = msc; then - save_NOWARN="${ccpc}/w" - DOWARN="${ccpc}/WX" -elif test $ct = dmc; then - save_NOWARN="${ccpc}-w" - DOWARN="${ccpc}-wx" -elif test $ct = bcc; then - save_NOWARN="${ccpc}-w" - DOWARN="${ccpc}-w!" -elif test $ct = dec; then - : -msg_* flags not used yet, or is -w2 correct? -elif test $ct = kencc; then - save_NOWARN= - DOWARN= -elif test $ct = xlc; then - save_NOWARN=-qflag=i:e - DOWARN=-qflag=i:i -elif test $ct = tendra; then + ;; +tendra) save_NOWARN=-w -elif test $ct = ucode; then + ;; +ucode) save_NOWARN= DOWARN=-w2 -elif test $ct = watcom; then + ;; +watcom) save_NOWARN= DOWARN=-Wc,-we -else + ;; +xlc) + save_NOWARN=-qflag=i:e + DOWARN=-qflag=i:i + ;; +*) test x"$save_NOWARN" = x"" && save_NOWARN=-Wno-error ac_flags 0 wnoerror "$save_NOWARN" test 1 = $HAVE_CAN_WNOERROR || save_NOWARN= ac_flags 0 werror -Werror test 1 = $HAVE_CAN_WERROR && DOWARN=-Werror -fi - -test $ct = icc && DOWARN="$DOWARN -wd1419" + test $ct = icc && DOWARN="$DOWARN -wd1419" + ;; +esac NOWARN=$save_NOWARN # @@ -1165,7 +1182,16 @@ NOWARN=$save_NOWARN # i=`echo :"$orig_CFLAGS" | sed 's/^://' | tr -c -d $alll$allu$alln` # optimisation: only if orig_CFLAGS is empty -test x"$i" = x"" && if test $ct = sunpro; then +test x"$i" = x"" && case $ct in +hpcc) + phase=u + ac_flags 1 otwo +O2 + phase=x + ;; +kencc|tcc|tendra) + # no special optimisation + ;; +sunpro) cat >x <<-'EOF' int main(void) { return (0); } #define __IDSTRING_CONCAT(l,p) __LINTED__ ## l ## _ ## p @@ -1175,22 +1201,34 @@ test x"$i" = x"" && if test $ct = sunpro; then yes pad | head -n 256 >>x ac_flags - 1 otwo -xO2 x ac_flags - 1 stackon "${ccpc}/GZ" 'if stack checks can be enabled' test.sh <<-EOF exit \$rv EOF chmod 755 test.sh -if test $cm = llvm; then - emitbc="-emit-llvm -c" -elif test $cm = dragonegg; then +case $cm in +dragonegg) emitbc="-S -flto" -else + ;; +llvm) + emitbc="-emit-llvm -c" + ;; +*) emitbc=-c -fi + ;; +esac echo ": # work around NeXTstep bug" >Rebuild.sh echo set -x >>Rebuild.sh for file in $SRCS; do