[RFA] "constify" parse_exp_1

Keith Seitz keiths@redhat.com
Sat Mar 9 01:04:00 GMT 2013


On 03/08/2013 05:00 PM, Pedro Alves wrote:
>> This is perfectly fine:
>>
>>   	  for (loc = t->base.loc; loc; loc = loc->next)
>>   	    {
>> -	      p = tmp_p;
>> +	      const char *q;
>> +
>> +	      q = tmp_p;
>> -	      exp = parse_exp_1 (&p, loc->address,
>> +	      exp = parse_exp_1 (&q, loc->address,
>> 				 block_for_pc (loc->address), 1);
>> +	      p = (char *) q;
>>
>> It's perfectly valid, as we know Q on output must point within
>> the object/string TMP_P pointed at on entry.
>> This reads much more intuitively to me, no funny arithmetic, and
>> gets rid of the aliasing issue with the other suggestion, and
>> no new function necessary.
>
> And confirmed this approach is valid.

I have a revision, but after this morning's fiasco, I'm a bit leery of 
submitting it until substantial further review. My focus is waxing 
quickly right now.

I've also got amendments to address Tom's comments.

Thanks,
Keith



More information about the Gdb-patches mailing list