This is the mail archive of the 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: Implement -Wimplicit-fallthrough: core

On Fri, Jul 22, 2016 at 12:44:07PM +0200, Marek Polacek wrote:
> --- gcc/gcc/cp/parser.h
> +++ gcc/gcc/cp/parser.h
> @@ -46,7 +46,7 @@ struct GTY (()) cp_token {
>       Otherwise, this value is RID_MAX.  */
>    ENUM_BITFIELD (rid) keyword : 8;
>    /* Token flags.  */
> -  unsigned char flags;
> +  unsigned short flags;
>    /* True if this token is from a context where it is implicitly extern "C" */
>    BOOL_BITFIELD implicit_extern_c : 1;
>    /* True if an error has already been reported for this token, such as a

I'm afraid this is really bad.
Right now, there are 8 and 8 bit bitfields, then 8-bit char, 3 individual
bits, 5 unused bits and 32-bit int, nicely packed into 64-bit word before a
union with pointer members, and the C++ FE lexes everything first, so there
are possibly millions of tokens in memory.
Can't you just make it unsigned int flags : 11; instead?  Or instead
reshuffle the cpplib.h flags?  E.g. I don't see the C++ FE to use the
NO_EXPAND flag, so moving it to the upper byte of the short and moving the
new flag to its bit?  Perhaps that is even better for now.


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