[binutils-gdb] bitwise operation between different enumeration types

Alan Modra amodra@sourceware.org
Tue Dec 9 09:48:06 GMT 2025


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=f667dabbffd45a453e8d96f02f031ac7151ca074

commit f667dabbffd45a453e8d96f02f031ac7151ca074
Author: Alan Modra <amodra@gmail.com>
Date:   Tue Dec 9 17:46:29 2025 +1030

    bitwise operation between different enumeration types
    
    mips.cc:9478:50: error: bitwise operation between different enumeration types ‘elfcpp::<unnamed enum>’ and ‘elfcpp::<unnamed enum>’ is deprecated [-Werror=deprecated-enum-enum-conversion]
     9478 |           merged_flags &= ~(elfcpp::EF_MIPS_ARCH | elfcpp::EF_MIPS_MACH);
          |                             ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
    
            * mips.h: Define all the EF_MIPS values in one enum.

Diff:
---
 elfcpp/mips.h | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/elfcpp/mips.h b/elfcpp/mips.h
index 409a6324165..0551bbe0db2 100644
--- a/elfcpp/mips.h
+++ b/elfcpp/mips.h
@@ -204,14 +204,11 @@ enum
   /// Code in file uses the IEEE 754-2008 NaN encoding convention.
   EF_MIPS_NAN2008 = 0x00000400,
   // MIPS dynamic
-  EF_MIPS_DYNAMIC = 0x40
-};
+  EF_MIPS_DYNAMIC = 0x40,
 
 // Machine variant if we know it.  This field was invented at Cygnus,
 // but it is hoped that other vendors will adopt it.  If some standard
 // is developed, this code should be changed to follow it.
-enum
-{
   EF_MIPS_MACH = 0x00FF0000,
 
 // Cygnus is choosing values between 80 and 9F;
@@ -261,11 +258,9 @@ enum
   E_MIPS_MACH_GS464   = EF_MIPS_MACH_GS464,
   E_MIPS_MACH_GS464E  = EF_MIPS_MACH_GS464E,
   E_MIPS_MACH_GS264E  = EF_MIPS_MACH_GS264E,
-};
 
 // MIPS architecture
-enum
-{
+
   // Four bit MIPS architecture field.
   EF_MIPS_ARCH = 0xf0000000,
   // -mips1 code.
@@ -304,7 +299,6 @@ enum
   E_MIPS_ARCH_64R2 = EF_MIPS_ARCH_64R2,
   E_MIPS_ARCH_32R6 = EF_MIPS_ARCH_32R6,
   E_MIPS_ARCH_64R6 = EF_MIPS_ARCH_64R6,
-  
 };
 
 // Values for the xxx_size bytes of an ABI flags structure.


More information about the Binutils-cvs mailing list