[Spice-devel] [[spice-common] 2/4] common: Fix -Wunused-parameter
Uri Lublin
uril at redhat.com
Tue Sep 2 03:15:17 PDT 2014
On 09/02/2014 12:47 PM, Fabiano Fidêncio wrote:
> Hi,
>
> On Tue, 2014-09-02 at 12:33 +0300, Uri Lublin wrote:
>> On 09/01/2014 04:45 PM, Fabiano Fidêncio wrote:
>>> ---
>>> common/canvas_utils.c | 3 ++-
>>> common/lines.c | 19 ++++++++++++++-----
>>> common/marshaller.c | 2 +-
>>> common/pixman_utils.c | 2 +-
>>> common/quic.c | 2 +-
>>> common/quic_rgb_tmpl.c | 8 ++++----
>>> common/quic_tmpl.c | 8 ++++----
>>> common/rop3.c | 14 +++++++++-----
>>> 8 files changed, 36 insertions(+), 22 deletions(-)
>>>
>>> diff --git a/common/pixman_utils.c b/common/pixman_utils.c
>>> index db7a67f..5bf5717 100644
>>> --- a/common/pixman_utils.c
>>> +++ b/common/pixman_utils.c
>>> @@ -30,7 +30,7 @@
>>>
>>> #define SOLID_RASTER_OP(_name, _size, _type, _equation) \
>>> static void \
>>> -solid_rop_ ## _name ## _ ## _size (_type *ptr, int len, _type src) \
>>> +solid_rop_ ## _name ## _ ## _size (_type *ptr, int len, SPICE_GNUC_UNUSED _type src) \
>>> { \
>>> while (len--) { \
>>> _type dst = *ptr; \
>>>
>> Hi,
>>
>> Just wanted to mention that src is actually used within this function
>> for most OPs.
>> It is hidden within _equation.
>> For some operations (such as "clear" and "noop") src is not used.
> I completely overlooked at this case, you're right (and GCC is a bit
> dumb for catching this up).
>
>> I guess the patch is OK (but a bit confusing), as gcc documentation [1],
>> explains that attribute unused means "to be possibly unused"
>> [1] https://gcc.gnu.org/onlinedocs/gcc/Variable-Attributes.html
> Yeah, I'll remove this change and resubmit this patch.
If you remove this change, you'll likely get some errors/warnings for
those OPs that do not use src.
I'd keep the change and add a comment that for most OPs 'src' is used but
for some it is not used, so the attribute added makes gcc happy.
More information about the Spice-devel
mailing list