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 Feb 6, 2008 1:18 PM, Manuel LÃpez-IbÃÃez <lopezibanez@gmail.com> wrote:
> On 06/02/2008, Felipe Contreras <felipe.contreras@gmail.com> wrote:
> >
> > So, shouldn't gcc allow this without warnings then?
> >
> > typedef enum OMX_ERRORTYPE
> > {
> >   OMX_ErrorNone = 0,
> >   OMX_ErrorInsufficientResources = 0x80001000
> > } OMX_ERRORTYPE;
> >
>
> And what warning do you get and with which version of GCC you get it?
>
> manu@localhost:~$ cat felipe.c
> typedef enum OMX_ERRORTYPE
> {
>  OMX_ErrorNone = 0,
>  OMX_ErrorInsufficientResources = 0x80001000
> } OMX_ERRORTYPE;
> manu@localhost:~$ ~/personal/gcc/objdir/gcc/cc1 -Wall -Wextra
> -Wconversion ~/felipe.c
> manu@localhost:~$ ~/personal/gcc/objdir/gcc/cc1 --version
> GNU C (GCC) version 4.3.0 20080122 (experimental) (x86_64-unknown-linux-gnu)
>         compiled by GNU C version 4.3.0 20080122 (experimental), GMP
> version 4.2.2, MPFR version 2.3.0.
> GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096

0x80001000u and 0x80001000UL didn't work:

gcc test.c -o test -pedantic
test.c:7: warning: ISO C restricts enumerator values to range of 'int'

This is with:
gcc (GCC) 4.1.2 20070925 (Red Hat 4.1.2-33)

-- 
Felipe Contreras

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