This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB 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: [rfa] space reduction in gdbtypes.h


Andrew C says:

>  #define BOUND_BY_REF_IN_REG          2
>  #define BOUND_BY_VALUE_IN_REG        1
>  #define BOUND_SIMPLE                 0
> -  int upper_bound_type;
> -  int lower_bound_type;
> +  int upper_bound_type : 4;
> +  int lower_bound_type : 4;
> 
> Hmm, doesn't this part scream ENUM?

I agree, it does, but I wanted to patch one thing at a time,
so I left it as an int.

This data field is not actually functional at the moment.
There are a few places that test the bounds.  But there is only one
place that sets any bounds at all.  parse.c sets upper_bound_type
to BOUND_CANNOT_BE_DETERMINED in one place.  That's the only
assignment I found.

I suspect we're going to need some functional code in this area
to fix several FORTRAN array bounds PR's.

> Without that the packing is unsafe: 
> adding an extra variant that overflows the field won't be detected; 
> compilers capable of checking enum assignments won't do anything useful.

Well, the definitions are right next to the use, which would make
it obvious.

And I hope that a person who adds new variants would test their new code
at least ONCE to see if the new variants worked!

Would you like me to go ahead and make this an enum right now?

Michael C


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