lmi
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lmi] [lmi-commits] odd/multiarch adf0725 04/10: Validate $LMI_COMPI


From: Vadim Zeitlin
Subject: Re: [lmi] [lmi-commits] odd/multiarch adf0725 04/10: Validate $LMI_COMPILER as well as $LMI_TRIPLET
Date: Thu, 16 May 2019 00:44:42 +0200

On Wed, 15 May 2019 17:59:55 -0400 (EDT) Greg Chicares <address@hidden> wrote:

GC> branch: odd/multiarch
GC> commit adf072500fa4f5bda7ce8c81df8ae8ad6f75ee4d
GC> Author: Gregory W. Chicares <address@hidden>
GC> Commit: Gregory W. Chicares <address@hidden>
GC> 
GC>     Validate $LMI_COMPILER as well as $LMI_TRIPLET
GC> ---
GC>  set_arch.sh | 21 +++++++++++++++++----
GC>  1 file changed, 17 insertions(+), 4 deletions(-)
GC> 
GC> diff --git a/set_arch.sh b/set_arch.sh
GC> index c51cd44..95d4c18 100755
GC> --- a/set_arch.sh
GC> +++ b/set_arch.sh
GC> @@ -137,16 +137,29 @@ case "$lmi_build_type" in
GC>  esac
GC>  }
GC>  
GC> -# test compiler similarly
GC> +case "$LMI_COMPILER" in
GC> +    (gcc) ;;
GC> +    (*)
GC> +        # This script is to be sourced, so it can't use a builtin
GC> +        # command like 'print' here. Similarly, 'exit' would have
GC> +        # a surprising effect.
GC> +        echo "Changed nothing because compiler is untested."
GC> +        return 2;
GC> +        ;;
GC> +esac

 I've missed a similar comment that had been previously added in the switch
over LMI_TRIPLET, but now that I've noticed it I can't prevent myself from
asking where does the idea that built-ins can't be used in sourced files
come from? AFAIK there is no problem with this and a simple test seems to
confirm that it works just fine.

 Of course, as we had previously discussed, "print" is zsh-specific, but
a next commit already corrects it to "printf", and the latter should be
perfectly usable here. And even though I have no particular problems with
using "echo" neither, I think the first part of this comment is surprising
and, AFAICS, misleading.

GC>  case "$LMI_TRIPLET" in
GC> -    (i686-w64-mingw32)   foo ;;
GC> -    (x86_64-w64-mingw32) foo ;;
GC> +    (i686-w64-mingw32)   ;;
GC> +    (x86_64-w64-mingw32) ;;
GC>      (*)
GC>          # This script is to be sourced, so it can't use a builtin
GC>          # command like 'print' here. Similarly, 'exit' would have
GC>          # a surprising effect.
GC> -        echo "Untested host triplet. Expect surprises."
GC> +        echo "Changed nothing because host triplet is untested."
GC> +        return 3;
GC>          ;;
GC>  esac
GC>  
GC> +foo
GC> +
GC>  unset -f foo

 And while I'm asking questions, why do we use this foo function? This is
actually 2 questions:

1. Why do we use a function at all?
2. Why does this function use this meaningless name?


 This is obviously all rather low priority, but I wanted to mention these
issues in case they were due to oversight and not some (hidden from me)
grand design.

 Regards,
VZ


reply via email to

[Prev in Thread] Current Thread [Next in Thread]