constified note_stores

Kaveh R. Ghazi ghazi@caip.rutgers.edu
Mon Jun 9 23:45:00 GMT 2008


From: "Ian Lance Taylor" <iant@google.com>

> Joern Rennecke <joernr@arc.com> writes:
>
>> I have been using note_stores to modify selected assignments.  Now when I
>> try to move this code to gcc 4.4, I find that I get a warning because
>> my walker function takes a non-const rtx - and if I make it take a const 
>> rtx,
>> there will be a warning somewhere inside because there is a code path
>> where a SET_SRC is modified.
>> data is in use to point to a libiberty hash table.
>>
>> So, am I supposed to ignore the warning?
>> Roll my own copy of the original note_stores?
>> Resurrect the original note_stores in rtlanal.c (by whatever name)?
>
> Use CONST_CAST_RTX where necessary.
> Ian

Or pass in a struct pointer to the "data" parameter containing both your 
hash table and the rtx to be modified.  Pull out either member in the walker 
function as necessary.

Me, I prefer being const-correct, but I understand not everyone shares my 
enthusiasm for it. :-/

        --Kaveh
--
Kaveh R. Ghazi



More information about the Gcc mailing list