This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC 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: Wrong warning? ISO C restricts enumerator values to range of ‘int’


On 06/02/2008, Dave Korn <dave.korn@artimi.com> wrote:
> On 06 February 2008 11:05, Felipe Contreras wrote:
>
> > So, shouldn't gcc allow this without warnings then?
> >
> > typedef enum OMX_ERRORTYPE
> > {
> >   OMX_ErrorNone = 0,
> >   OMX_ErrorInsufficientResources = 0x80001000
> > } OMX_ERRORTYPE;
> >

OK. I see, you used "-pedantic" and the warning is:
felipe.c:5: warning: ISO C restricts enumerator values to range of 'int'

which is generated by c-decl.c (build_enumerator):

  if (pedantic && !int_fits_type_p (value, integer_type_node))
    {
      pedwarn ("ISO C restricts enumerator values to range of %<int%>");
      /* XXX This causes -pedantic to change the meaning of the program.
         Remove?  -zw 2004-03-15  */
      value = convert (integer_type_node, value);
    }

Cheers,

Manuel.


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