Re: [PATCH] kmemcheck: fix sparse warning

From: Vegard Nossum
Date: Wed Jul 08 2009 - 15:28:36 EST


2009/7/6 Johannes Berg <johannes@xxxxxxxxxxxxxxxx>:
> Whether or not the sparse warning
>
> warning: do-while statement is not a compound statement
>
> is justified or not in this case, it is annoying and
> trivial to fix.
>
> Signed-off-by: Johannes Berg <johannes@xxxxxxxxxxxxxxxx>
> ---
> Âinclude/linux/kmemcheck.h | Â Â4 ++--
> Â1 file changed, 2 insertions(+), 2 deletions(-)
>
> --- wireless-testing.orig/include/linux/kmemcheck.h   2009-07-06 11:41:16.000000000 +0200
> +++ wireless-testing/include/linux/kmemcheck.h Â2009-07-06 11:41:30.000000000 +0200
> @@ -137,13 +137,13 @@ static inline void kmemcheck_mark_initia
> Â Â Â Âint name##_end[0];
>
> Â#define kmemcheck_annotate_bitfield(ptr, name) Â Â Â Â Â Â Â Â Â Â Â Â \
> - Â Â Â do if (ptr) { Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â \
> + Â Â Â do { if (ptr) { Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â \
> Â Â Â Â Â Â Â Âint _n = (long) &((ptr)->name##_end) Â Â Â Â Â Â Â Â Â Â\
> Â Â Â Â Â Â Â Â Â Â Â Â- (long) &((ptr)->name##_begin); Â Â Â Â Â Â Â Â\
> Â Â Â Â Â Â Â ÂBUILD_BUG_ON(_n < 0); Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â \
> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â\
> Â Â Â Â Â Â Â Âkmemcheck_mark_initialized(&((ptr)->name##_begin), _n); \
> - Â Â Â } while (0)
> + Â Â Â } } while (0)
>
> Â#define kmemcheck_annotate_variable(var) Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â \
> Â Â Â Âdo { Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â\
>
>
>

I'll change the patch title to "kmemcheck: work around bogus sparse
warning" and fix the indentation, sounds ok?

Meanwhile, I Cced sparse mailing list in case somebody else knows
anything else about this warning (what it means, whether it's
justified in this case, whether it should be fixed in sparse, etc.).

Thanks.


Vegard
¢éì®&Þ~º&¶¬–+-±éÝ¥Šw®žË±Êâmébžìdz¹Þ)í…æèw*jg¬±¨¶‰šŽŠÝj/êäz¹ÞŠà2ŠÞ¨è­Ú&¢)ß«a¶Úþø®G«éh®æj:+v‰¨Šwè†Ù>Wš±êÞiÛaxPjØm¶Ÿÿà -»+ƒùdš_