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

Andrew Hanson andrew@andrewhanson.dev
Sun Sep 14 19:52:46 GMT 2025


* bfd/elf-bfd.h: Use `#if defined(ARCH_SIZE) && (ARCH_SIZE == 64)` and
  `#elif defined(ARCH_SIZE) && (ARCH_SIZE == 32)` instead of testing
  `ARCH_SIZE` directly, to silence -Wundef when ARCH_SIZE is not defined.
---
 bfd/elf-bfd.h | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

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
-- 
2.51.0



More information about the Binutils mailing list