This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFA] Change bfd machine consts to enums.


> 
> Submitted for your approval: this changes the bfd_mach_* consts
> from #defines to enums, to make it easier to debug bfd.
> 
> Michael
> 
> 2002-02-13  Michael Snyder  <msnyder@redhat.com>
> 
> 	* archures.c: Change bfd_mach_ constants to enums.
> 	* bfd-in2.h: Regenerate.

I'm not sure this is correct, and I certainly don't think it's portable.

Consider
+ .enum bfd_mach_arm
+ .{
+ .  bfd_mach_arm_2 = 1,
+ .  bfd_mach_arm_2a,
+ .  bfd_mach_arm_3,
+ .  bfd_mach_arm_3M,
+ .  bfd_mach_arm_4,
+ .  bfd_mach_arm_4T,
+ .  bfd_mach_arm_5,
+ .  bfd_mach_arm_5T,
+ .  bfd_mach_arm_5TE,
+ .  bfd_mach_arm_XScale
+ .};

and

+ .enum bfd_mach_fr30
+ .{
+ .  bfd_mach_fr30 = 0x46523330
+ .};

Now the first of these is used in cpu-arm.c to initialize a field that is 
of type enum bfd_architecture and the second is also used to initialize a 
similar field in cpu-fr30.c.  But on a machine that uses packed enums 
these two are of different sizes.  Regardless of this, it should still be 
a type error for the static initializations to be converted without a cast.

R.



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]