This is the mail archive of the gcc-patches@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: [tuples] walk_tree for tuples


depending on whether you want to spread the "shorthand" all around the
system - or just keep it in one spot.

Is the general use that someone would go through all of the labels, or
all but the default?  So far everything that I have seen the default
is a special case - so having a separate accessor for it makes sense.
If all labels are treated equal in most of the rest of the system -
then I think including the default is a good idea.

On 7/12/07, Diego Novillo <dnovillo@google.com> wrote:
On 7/12/07 2:50 PM, Christopher Matthews wrote:
> Are you sure that there is a one off error? In gs_switch_set_label I
> add one to the incoming position to make room for the default.
>
>> static inline void
>> gs_switch_set_label (gimple gs, int index, tree label)
>> {
>>  GS_CHECK (gs, GS_SWITCH);
>>  gcc_assert ((unsigned)index <= gs->gs_switch.nlabels);
>>  gs->gs_switch.labels[index + 1] = label;
>> }
>
> I did it this way to keep the fact that the default label was stored
> in [0] away from the build implementation. Or am I completely missing
> where the 1 off is?

I don't see an off by one error here.  However, the gs_switch_label and
gs_switch_set_label shouldn't add 1 to INDEX.  It should be possible to
get at label[0] using them.  The gs_switch_default_label accessor is
just a clarifying shorthand.



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