[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 3/8] gnttab: Remove unused-but-set variable



On 28.04.2022 09:32, Michal Orzel wrote:
> 
> 
> On 28.04.2022 09:27, Jan Beulich wrote:
>>>> diff --git a/xen/arch/arm/include/asm/grant_table.h
>>>> b/xen/arch/arm/include/asm/grant_table.h
>>>> index d31a4d6805d6..9f68c2a37eb6 100644
>>>> --- a/xen/arch/arm/include/asm/grant_table.h
>>>> +++ b/xen/arch/arm/include/asm/grant_table.h
>>>> @@ -31,10 +31,10 @@ static inline void gnttab_mark_dirty(struct domain
>>>> *d, mfn_t mfn)
>>>>  
>>>>  int create_grant_host_mapping(unsigned long gpaddr, mfn_t mfn,
>>>>                                unsigned int flags, unsigned int
>>>> cache_flags);
>>>> -#define gnttab_host_mapping_get_page_type(ro, ld, rd) (0)
>>>> +#define gnttab_host_mapping_get_page_type(ro, ld, rd) (ro, ld, rd, 0)
>>>>  int replace_grant_host_mapping(unsigned long gpaddr, mfn_t mfn,
>>>>                                 unsigned long new_gpaddr, unsigned int
>>>> flags);
>>>> -#define gnttab_release_host_mappings(domain) 1
>>>> +#define gnttab_release_host_mappings(domain) (domain, 1)
>>>>  
>>>>  /*
>>>>   * The region used by Xen on the memory will never be mapped in DOM0
>>>>
>>>> It's about parameter evaluation, not about adding extra code when compiled.
>>>>
>>>
>>> Unfortunately, solution presented by Andrew does not work.
>>> We will get the following error due to -Werror=unused-value:
>>> "left-hand operand of comma expression has no effect"
>>
>> Perhaps
>>
>> #define gnttab_host_mapping_get_page_type(ro, ld, rd) \
>>     ((void)(ro), (void)(ld), (void)(rd), 0)
>>
>> ?
> I already tried that and it won't work producing the following:
> "error: void value not ignored as it ought to be"
> 
> Michal

Sorry about that but I was wrong. Your solution does work.
I did not enclose the params in parentheses.

Michal



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.