Re: [RFC]: (void)0 instead of empty defines

From: Sam Leffler <sam_at_freebsd.org>
Date: Mon, 15 Jun 2009 12:51:55 -0700
Marcel Moolenaar wrote:
>
> On Jun 15, 2009, at 11:58 AM, Roman Divacky wrote:
>
>>> Are you saying that:
>>>
>>> if (cond)
>>>   ;
>>>
>>> is considered worthy of a warning by the compiler?  Is it just "if" or
>>> all conditional control constructs (e.g. while)?
>>>
>>> I can image many instances of this construct arising from debugging
>>> facilities.  This sounds like a stupid restriction and I would argue we
>>> should just disable the warning.
>>
>> it already found a bug in csup (recently fixed by lulf). It sure can be
>> disabled but I'd like it to be discussed a little bit more as it already
>> proved to be useful.
>
> If the patch is all we need to compile the kernel with the warning
> enabled and knowing that the warning has already found real bugs,
> then it's a no-brainer to me: commit.
>

The patch is incomplete in that it only changes code that makes clang 
kvetch.  There are many other instances in the tree of using #defines 
for debug facilities and leaving them empty when disabled that this 
patch does not address.

What this change effectively does is impose a new element of style to 
deal w/ a compiler idiosynchrocy (and/or compilation option).  While I 
can agree finding bugs is good I don't see this as a reason to add this 
requirement.  We could just as easily enable various gcc options and 
require other coding conventions.  Furthermore we have other tools that 
are supposed to find things like this (e.g. coverity) but they are not 
being used.

    Sam
Received on Mon Jun 15 2009 - 17:51:56 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:50 UTC