lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <2a56b48632fe8982735769b52aafe721b29b1bcf.camel@perches.com>
Date:   Wed, 25 Jul 2018 18:27:00 -0700
From:   Joe Perches <joe@...ches.com>
To:     Prakruthi Deepak Heragu <pheragu@...eaurora.org>, apw@...onical.com
Cc:     linux-kernel@...r.kernel.org, ckadabi@...eaurora.org,
        tsoni@...eaurora.org, bryanh@...eaurora.org,
        Abhijeet Dharmapurikar <adharmap@...eaurora.org>
Subject: Re: [PATCH v1] checkpatch: check for #if 0/#if 1

On Wed, 2018-07-25 at 16:14 -0700, Prakruthi Deepak Heragu wrote:
> The #if 0 or #if 1 is used to toggle features. Warn if #if 0 or #if 1
> is present and suggest that they can be removed.
> 
> Signed-off-by: Abhijeet Dharmapurikar <adharmap@...eaurora.org>
> Signed-off-by: Prakruthi Deepak Heragu <pheragu@...eaurora.org>
> ---
> Changes in v1:
> - Rephrase the warning message to fit in a single line without 
>   80 column limit
> 
>  scripts/checkpatch.pl | 11 ++++++++---
>  1 file changed, 8 insertions(+), 3 deletions(-)
> 
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> index 3394ed8..72513c2 100755
> --- a/scripts/checkpatch.pl
> +++ b/scripts/checkpatch.pl
> @@ -5383,9 +5383,14 @@ sub process {
>  
>  # warn about #if 0
>  		if ($line =~ /^.\s*\#\s*if\s+0\b/) {
> -			CHK("REDUNDANT_CODE",
> -			    "if this code is redundant consider removing it\n" .
> -				$herecurr);
> +			WARN("IF_0",
> +			     "Consider removing the #if 0 and its #endif\n".  $herecurr);

No, this wording is not correct at all.

The entire block, i.e.: 'this code' should be considered
to be removed, not just the #if 0 and its #endif.

For #if 1 code, then just the #if 1 and the #endif should
be removed.

> +		}
> +
> +# warn about #if 1
> +		if ($line =~ /^.\s*\#\s*if\s+1\b/) {
> +			WARN("IF_1",
> +			     "Consider removing the #if 1 and its #endif\n".  $herecurr);
>  		}
>  
>  # check for needless "if (<foo>) fn(<foo>)" uses

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ