On Sun, May 08, 2022 at 09:55:09PM +0200, Bruno Haible wrote:
> Dmitry V. Levin wrote:
> > Thanks, I agree with this approach in general, but could you rewrite the
> > test to invoke the compiler just once, please?  You can use cc_set_libc
> > and cc_set_vars cases as examples.
> 
> Sure. Find it attached. Tested with various GCC versions, clang, and tcc:
[...]
> +         sed 's/^        //' << EOF > "$dummy.c"
> +         #ifdef __i386__
> +         ABI=x86
> +         #else
> +         #ifdef __ILP32__
> +         ABI=x32
> +         #else
> +         ABI=64

I'd prefer to be on the safe side and have ABI=64 assigned by default
somewhere before the eval.  This would also save one line of code.

> +         #endif
> +         #endif
> +EOF
> +         cc_set_abi=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^ABI' | 
> sed 's, ,,g'`
> +         eval "$cc_set_abi"
> +         case "$ABI" in

commit 9a37c126ce64403b83e9cfe72e29c26ab3a209b3 claims that quotes
in case commands are redundant.



-- 
ldv

Reply via email to