[PATCH v2 2/3] bfd: guard ARCH_SIZE uses to avoid -Wundef

Andreas Schwab schwab@linux-m68k.org
Mon Sep 15 18:36:45 GMT 2025


On Sep 15 2025, Andrew Hanson wrote:

> diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h
> index de7cc410a99..3db99097800 100644
> --- a/bfd/elf-bfd.h
> +++ b/bfd/elf-bfd.h
> @@ -47,10 +47,9 @@ extern "C" {
>  
>  /* If size isn't specified as 64 or 32, NAME macro should fail.  */
>  #ifndef NAME
> -#if ARCH_SIZE == 64
> +#if defined(ARCH_SIZE) && ARCH_SIZE == 64
>  #define NAME(x, y) x ## 64 ## _ ## y
> -#endif
> -#if ARCH_SIZE == 32
> +#elif defined(ARCH_SIZE) && ARCH_SIZE == 32
>  #define NAME(x, y) x ## 32 ## _ ## y
>  #endif
>  #endif

Just put #ifdef ARCH_SIZE around the block, no need to duplicate it.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."


More information about the Binutils mailing list