[gcc-as-cxx] enum conversion to int

Matt matt@use.net
Tue Jan 5 00:40:00 GMT 2010


Hi,

I'm trying to fix some errors/warnings to make sure that gcc-as-cxx 
doesn't bitrot too much. I ran into this issue, and an unsure how to fix 
it without really ugly casting:

enum df_changeable_flags
df_set_flags (enum df_changeable_flags changeable_flags)
{
   enum df_changeable_flags old_flags = df->changeable_flags;
   df->changeable_flags |= changeable_flags;
   return old_flags;
}

I'm getting this warning on the second line of the function:
./../gcc-trunk/gcc/df-core.c: In function df_changeable_flags 
df_set_flags(df_changeable_flags):
../../gcc-trunk/gcc/df-core.c:474: error: invalid conversion from int to 
df_changeable_flags

At first blanch, it seems like df_changeable_flags should be a typedef to 
byte (or int, which is what it was being implicitly converted to 
everywhere), and the enum should be disbanded into individual #defines.

I wanted to make sure that this wasn't a warning false positive first, 
though.

--
tangled strands of DNA explain the way that I behave.
http://www.clock.org/~matt



More information about the Gcc mailing list