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: [PATCH] Avoid excessive function type casts with splay-trees


Ping?

On 12/15/17 19:59, Bernd Edlinger wrote:
> On 12/15/17 11:51, Jakub Jelinek wrote:
>> On Fri, Dec 15, 2017 at 10:44:54AM +0000, Bernd Edlinger wrote:
>>> when working on the -Wcast-function-type patch I noticed some rather
>>> ugly and non-portable function type casts that are necessary to accomplish
>>> some actually very simple tasks.
>>>
>>> Often functions taking pointer arguments are called with a different signature
>>> taking uintptr_t arguments, which is IMHO not really safe to do...
>>>
>>> The attached patch adds a context argument to the callback functions but
>>> keeps the existing interface as far as possible.
>>
>> Just formatting nits, not full review:
>>
>>> +  return strcmp ((char*) k1, (char*) k2);
>>
>> char * instead of char*, please.
>>
>>> +void
>>> +splay_tree_delete_key_wrapper (splay_tree_key key, void *fn)
>>> +{
>>> +  splay_tree_delete_key_fn delete_key = (splay_tree_delete_key_fn) (uintptr_t) fn;
>>
>> Too long line, should be:
>>     splay_tree_delete_key_fn delete_key
>>       = (splay_tree_delete_key_fn) (uintptr_t) fn;
>>
>>> +void
>>> +splay_tree_delete_value_wrapper (splay_tree_value value, void *fn)
>>> +{
>>> +  splay_tree_delete_value_fn delete_value = (splay_tree_delete_value_fn) (uintptr_t) fn;
>>
>> Ditto.
>>
> 
> Yes, thanks.
> 
> Updated patch attached.
> 
> 
> Bernd.
> 

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