[lttng-dev] [PATCH 1/3] urcu: avoid "expression result unused" from clang
Lai Jiangshan
eag0628 at gmail.com
Sat Dec 8 02:54:06 EST 2012
How about the one in yy.diff?
xx.diff fixes the one what I had sent in 1/3 patch, but it may still
cause warning in future if the complier become more strict.
On Sat, Dec 8, 2012 at 1:27 AM, Lai Jiangshan <eag0628 at gmail.com> wrote:
>
>
> On Saturday, December 8, 2012, Mathieu Desnoyers wrote:
>>
>> * Lai Jiangshan (laijs at cn.fujitsu.com) wrote:
>> > The last expression result is unused and clang will complain.
>> > The trick in the patch supresses the complaint
>>
>> Hrm, but with this patch, gcc complains:
>>
>> rculfhash.c:1921:3: warning: variable '_w' set but not used
>> [-Wunused-but-set-variable]
>>
>> using
>>
>> gcc version 4.7.2 (Debian 4.7.2-4)
>
>
> Ouch, my gcc is too old
>
>
>>
>>
>> Thoughts ?
>>
>> Thanks,
>>
>> Mathieu
>>
>> >
>> > Signed-off-by: Lai Jiangshan <laijs at cn.fujitsu.com>
>> > ---
>> > urcu/system.h | 5 ++++-
>> > 2 files changed, 4 insertions(+), 1 deletions(-)
>> >
>> > diff --git a/urcu/system.h b/urcu/system.h
>> > index 2a45f22..6b7b0af 100644
>> > --- a/urcu/system.h
>> > +++ b/urcu/system.h
>> > @@ -46,12 +46,15 @@
>> > /*
>> > * Store v into x, where x is located in shared memory. Performs the
>> > * required cache flush after writing. Returns v.
>> > + * "_w" here avoids the warning from clang:
>> > + * warning: expression result unused [-Wunused-value]
>> > */
>> > #define CMM_STORE_SHARED(x, v) \
>> > ({ \
>> > __typeof__(x) _v = _CMM_STORE_SHARED(x, v); \
>> > + __typeof__(x) _w; \
>> > cmm_smp_wmc(); \
>> > - _v; \
>> > + _w = _v; \
>> > })
>> >
>> > #endif /* _URCU_SYSTEM_H */
>> > --
>> > 1.7.4.4
>> >
>> >
>> > _______________________________________________
>> > lttng-dev mailing list
>> > lttng-dev at lists.lttng.org
>> > http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
>>
>>
>> --
>> Mathieu Desnoyers
>> Operating System Efficiency R&D Consultant
>> EfficiOS Inc.
>> http://www.efficios.com
>>
>> _______________________________________________
>> lttng-dev mailing list
>> lttng-dev at lists.lttng.org
>> http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
-------------- next part --------------
A non-text attachment was scrubbed...
Name: xx.diff
Type: application/octet-stream
Size: 335 bytes
Desc: not available
URL: <http://lists.lttng.org/pipermail/lttng-dev/attachments/20121208/4ee46052/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: yy.diff
Type: application/octet-stream
Size: 314 bytes
Desc: not available
URL: <http://lists.lttng.org/pipermail/lttng-dev/attachments/20121208/4ee46052/attachment-0001.obj>
More information about the lttng-dev
mailing list