NetBSD Problem Report #51191

From www@NetBSD.org  Mon May 30 06:36:00 2016
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "mail.netbsd.org", Issuer "Postmaster NetBSD.org" (verified OK))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 70D3C7A46A
	for <gnats-bugs@gnats.NetBSD.org>; Mon, 30 May 2016 06:36:00 +0000 (UTC)
Message-Id: <20160530063559.810967ABDD@mollari.NetBSD.org>
Date: Mon, 30 May 2016 06:35:59 +0000 (UTC)
From: dcb314@hotmail.com
Reply-To: dcb314@hotmail.com
To: gnats-bugs@NetBSD.org
Subject: src/usr.bin/make/suff.c:1619]: (style) Redundant condition
X-Send-Pr-Version: www-1.0

>Number:         51191
>Category:       bin
>Synopsis:       src/usr.bin/make/suff.c:1619]: (style) Redundant condition
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon May 30 06:40:00 +0000 2016
>Closed-Date:    Thu Jun 30 05:51:48 +0000 2016
>Last-Modified:  Thu Jun 30 05:51:48 +0000 2016
>Originator:     David Binderman
>Release:        cvs dated 20160529
>Organization:
>Environment:
>Description:
src/usr.bin/make/suff.c:1619]: (style) Redundant condition: If 'EXPR == '\\'', the comparison 'EXPR != 0' is always true.

Source code is

        } else if (*cp == '\\' && *cp != '\0') {

Suggest new code

        } else if (*cp == '\\') {

Also, in the same file:

[src/usr.bin/make/suff.c:812]: (style) Same expression in both branches of ternary operator.
[src/usr.bin/make/suff.c:2601]: (style) Same expression in both branches of ternary operator.
[src/usr.bin/make/suff.c:2643]: (style) Same expression in both branches of ternary operator.
[src/usr.bin/make/suff.c:2656]: (style) Same expression in both branches of ternary operator.

and

[src/usr.bin/make/suff.c:1218]: (warning) %x in format string (no. 1) requires '
unsigned int' but the argument type is 'struct _Src *'.
[src/usr.bin/make/suff.c:1218]: (warning) %x in format string (no. 2) requires '
unsigned int' but the argument type is 'struct _Src *'.
[src/usr.bin/make/suff.c:1218]: (warning) %x in format string (no. 3) requires '
unsigned int' but the argument type is 'struct List *'.
[src/usr.bin/make/suff.c:1236]: (warning) %x in format string (no. 1) requires '
unsigned int' but the argument type is 'struct _Src *'.
[src/usr.bin/make/suff.c:1236]: (warning) %x in format string (no. 2) requires '
unsigned int' but the argument type is 'struct _Src *'.
[src/usr.bin/make/suff.c:1236]: (warning) %x in format string (no. 3) requires '
unsigned int' but the argument type is 'struct List *'.
[src/usr.bin/make/suff.c:1315]: (warning) %x in format string (no. 1) requires '
unsigned int' but the argument type is 'struct List *'.
[src/usr.bin/make/suff.c:1315]: (warning) %x in format string (no. 2) requires '
unsigned int' but the argument type is 'struct _Src *'.
[src/usr.bin/make/suff.c:1326]: (warning) %x in format string (no. 1) requires '
unsigned int' but the argument type is 'struct List *'.
[src/usr.bin/make/suff.c:1326]: (warning) %x in format string (no. 2) requires '
unsigned int' but the argument type is 'struct _Src *'.
[src/usr.bin/make/suff.c:1375]: (warning) %x in format string (no. 1) requires '
unsigned int' but the argument type is 'struct _Src *'.
[src/usr.bin/make/suff.c:1375]: (warning) %x in format string (no. 2) requires '
unsigned int' but the argument type is 'struct List *'.
[src/usr.bin/make/suff.c:1384]: (warning) %x in format string (no. 1) requires '
unsigned int' but the argument type is 'struct _Src *'.
[src/usr.bin/make/suff.c:1384]: (warning) %x in format string (no. 2) requires '
unsigned int' but the argument type is 'struct List *'.
[src/usr.bin/make/suff.c:1500]: (warning) %x in format string (no. 1) requires '
unsigned int' but the argument type is 'struct _Src *'.
[src/usr.bin/make/suff.c:1500]: (warning) %x in format string (no. 2) requires '
unsigned int' but the argument type is 'struct _Src *'.



>How-To-Repeat:

>Fix:

>Release-Note:

>Audit-Trail:
From: "David A. Holland" <dholland@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/51191 CVS commit: src/usr.bin/make
Date: Thu, 30 Jun 2016 05:28:23 +0000

 Module Name:	src
 Committed By:	dholland
 Date:		Thu Jun 30 05:28:23 UTC 2016

 Modified Files:
 	src/usr.bin/make: suff.c

 Log Message:
 Fix botched logic; PR 51191 from David Binderman.


 To generate a diff of this commit:
 cvs rdiff -u -r1.81 -r1.82 src/usr.bin/make/suff.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: "David A. Holland" <dholland@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/51191 CVS commit: src/usr.bin/make
Date: Thu, 30 Jun 2016 05:31:00 +0000

 Module Name:	src
 Committed By:	dholland
 Date:		Thu Jun 30 05:31:00 UTC 2016

 Modified Files:
 	src/usr.bin/make: suff.c

 Log Message:
 Cleanse an old mangy way of avoiding an unused variable warning.
 PR 51191 from David Binderman.


 To generate a diff of this commit:
 cvs rdiff -u -r1.82 -r1.83 src/usr.bin/make/suff.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: "David A. Holland" <dholland@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/51191 CVS commit: src/usr.bin/make
Date: Thu, 30 Jun 2016 05:34:04 +0000

 Module Name:	src
 Committed By:	dholland
 Date:		Thu Jun 30 05:34:04 UTC 2016

 Modified Files:
 	src/usr.bin/make: suff.c

 Log Message:
 Fix DEBUG_SRC build. Partly from PR 51191.


 To generate a diff of this commit:
 cvs rdiff -u -r1.83 -r1.84 src/usr.bin/make/suff.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: David Holland <dholland-bugs@netbsd.org>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: bin/51191: src/usr.bin/make/suff.c:1619]: (style) Redundant
 condition
Date: Thu, 30 Jun 2016 05:34:05 +0000

 On Mon, May 30, 2016 at 06:40:00AM +0000, dcb314@hotmail.com wrote:
  > Source code is
  > 
  >         } else if (*cp == '\\' && *cp != '\0') {
  > 
  > Suggest new code
  > 
  >         } else if (*cp == '\\') {

 I think it's supposed to be

    if (*cp == '\\' && *(cp+1) != '\0')

  > Also, in the same file:
  > 
  > [src/usr.bin/make/suff.c:812]: (style) Same expression in both branches of ternary operator.
  > [src/usr.bin/make/suff.c:2601]: (style) Same expression in both branches of ternary operator.
  > [src/usr.bin/make/suff.c:2643]: (style) Same expression in both branches of ternary operator.
  > [src/usr.bin/make/suff.c:2656]: (style) Same expression in both branches of ternary operator.

 This seems to be a cheesy variant of (void)dummy to ignore an unused
 parameter.

  > and
  > 
  > [src/usr.bin/make/suff.c:1218]: (warning) %x in format string (no. 1) requires '
  > unsigned int' but the argument type is 'struct _Src *'.
  > [...]

 more wrong than that with DEBUG_SRC :-) fixed now.

 -- 
 David A. Holland
 dholland@netbsd.org

State-Changed-From-To: open->closed
State-Changed-By: dholland@NetBSD.org
State-Changed-When: Thu, 30 Jun 2016 05:51:48 +0000
State-Changed-Why:
fixed, thanks


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2014 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.