This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Teach gimple_canonical_types_compatible_p about incomplete types
- From: Jan Hubicka <hubicka at ucw dot cz>
- To: Joseph Myers <joseph at codesourcery dot com>
- Cc: Jan Hubicka <hubicka at ucw dot cz>, Bernhard Reutner-Fischer <rep dot dot dot nop at gmail dot com>, gcc-patches at gcc dot gnu dot org, rguenther at suse dot de
- Date: Fri, 29 May 2015 23:17:58 +0200
- Subject: Re: Teach gimple_canonical_types_compatible_p about incomplete types
- Authentication-results: sourceware.org; auth=none
- References: <20150524234944 dot GB71623 at kam dot mff dot cuni dot cz> <616E26E8-0AAF-4A31-A38A-AC40EAF13D12 at gmail dot com> <20150526001604 dot GA43680 at kam dot mff dot cuni dot cz> <alpine dot DEB dot 2 dot 10 dot 1505292052250 dot 17156 at digraph dot polyomino dot org dot uk>
> On Tue, 26 May 2015, Jan Hubicka wrote:
>
> > > On May 25, 2015 1:49:45 AM GMT+02:00, Jan Hubicka <hubicka@ucw.cz> wrote:
> > >
> > >
> > > >2 Each enumerated type shall be compatible with char , a signed
> > > >integer
> > > > type, or an unsigned integer type. The choice of type is
> > > >implementation-defined, but shall be capable of representing the
> > > >values
> > > > of all the members of the enumeration. The enumerated type is
> > > > incomplete until immediately after the that terminates the list of
> > > > enumerator declarations, and complete thereafter.
> > > >
> > > >(we ignore this completely as far as I know, it is easy to fix though,
> > > >all
> > > > we need is to make ENUMERATION_TYPE pretend to be INTEGER_TYPE)
> > >
> > > Don't forget -fshort-enum though.
> >
> > I believe -fshort-enum is makes us non-complian to the C standard and thus
> > we are free to not follow this rule :)
>
> -fshort-enums is perfectly compatible with the C standard. The choice of
> integer type depends on the enumerated type in question - different
> enumerated types can be compatible with different integer types.
I see, so it does not need to be actual "int"/"unsigned int". I suppose we are then
safe to just treat ENUMERATION_TYPE as INTEGER_TYPE.
Thank you for clarification!
Honza
>
> --
> Joseph S. Myers
> joseph@codesourcery.com