NetBSD Problem Report #44641

From www@NetBSD.org  Sat Feb 26 12:15:10 2011
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
	by www.NetBSD.org (Postfix) with ESMTP id F067C63B8B8
	for <gnats-bugs@gnats.NetBSD.org>; Sat, 26 Feb 2011 12:15:09 +0000 (UTC)
Message-Id: <20110226121509.3FF6D63B889@www.NetBSD.org>
Date: Sat, 26 Feb 2011 12:15:09 +0000 (UTC)
From: henning.petersen@t-online.de
Reply-To: henning.petersen@t-online.de
To: gnats-bugs@NetBSD.org
Subject: Word bool used as variable name.
X-Send-Pr-Version: www-1.0

>Number:         44641
>Category:       lib
>Synopsis:       Word bool used as variable name.
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    lib-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Feb 26 12:20:01 +0000 2011
>Closed-Date:    Wed Mar 30 08:22:37 +0000 2011
>Last-Modified:  Wed Mar 30 08:25:01 +0000 2011
>Originator:     Henning Petersen
>Release:        NetBSD-current
>Organization:
>Environment:
>Description:
Word bool used as variable name , rename bool to boolean.
>How-To-Repeat:

>Fix:
	diff -u -r1.3 citrus_prop.c
--- lib/libc/citrus/citrus_prop.c	22 Nov 2006 23:47:21 -0000	1.3
+++ lib/libc/citrus/citrus_prop.c	26 Feb 2011 09:41:47 -0000
@@ -33,8 +33,9 @@
 #endif /* LIBC_SCCS and not lint */

 #include <assert.h>
-#include <limits.h>
 #include <errno.h>
+#include <limits.h>
+#include <stdbool.h>
 #include <stddef.h>
 #include <stdio.h>
 #include <stdint.h>
@@ -51,7 +52,8 @@
 	_citrus_prop_type_t type;
 	union {
 		const char *str;
-		int bool, chr;
+		int chr;
+		bool boolean;
 		uint64_t num;
 	} u;
 } _citrus_prop_object_t;
@@ -228,7 +230,7 @@
 		if (_bcs_tolower(_memstream_getc(ms)) == 'r' &&
 		    _bcs_tolower(_memstream_getc(ms)) == 'u' &&
 		    _bcs_tolower(_memstream_getc(ms)) == 'e') {
-			obj->u.bool = 1;
+			obj->u.boolean = true;
 			return 0;
 		}
 		break;
@@ -237,7 +239,7 @@
 		    _bcs_tolower(_memstream_getc(ms)) == 'l' &&
 		    _bcs_tolower(_memstream_getc(ms)) == 's' &&
 		    _bcs_tolower(_memstream_getc(ms)) == 'e') {
-			obj->u.bool = 0;
+			obj->u.boolean = false;
 			return 0;
 		}
 	}
@@ -407,7 +409,7 @@
 	    hint->name,	ostart.u._func_, oend.u._func_);\
 } while (/*CONSTCOND*/0)
 		switch (hint->type) {
-		case _CITRUS_PROP_BOOL: CALL0(bool); break;
+		case _CITRUS_PROP_BOOL: CALL0(boolean); break;
 		case _CITRUS_PROP_STR : CALL0( str); break;
 		case _CITRUS_PROP_CHR : CALL1( chr); break;
 		case _CITRUS_PROP_NUM : CALL1( num); break;
Index: lib/libc/citrus/citrus_prop.h
===================================================================


diff -u -r1.3 citrus_prop.h
--- lib/libc/citrus/citrus_prop.h	23 Nov 2006 13:59:03 -0000	1.3
+++ lib/libc/citrus/citrus_prop.h	26 Feb 2011 09:41:47 -0000
@@ -45,7 +45,7 @@
 typedef struct { \
 	_citrus_prop_##_func_##_cb_func_t func; \
 } _citrus_prop_##_func_##_cb_t;
-_CITRUS_PROP_CB0_T(bool, int)
+_CITRUS_PROP_CB0_T(boolean, int)
 _CITRUS_PROP_CB0_T(str, const char *)
 #undef _CITRUS_PROP_CB0_T

@@ -65,7 +65,7 @@
 #define _CITRUS_PROP_CB_T_OPS(_name_) \
 	_citrus_prop_##_name_##_cb_t _name_
 	union {
-		_CITRUS_PROP_CB_T_OPS(bool);
+		_CITRUS_PROP_CB_T_OPS(boolean);
 		_CITRUS_PROP_CB_T_OPS(str);
 		_CITRUS_PROP_CB_T_OPS(chr);
 		_CITRUS_PROP_CB_T_OPS(num);
@@ -73,7 +73,7 @@
 };

 #define _CITRUS_PROP_HINT_BOOL(name, cb) \
-	{ name, _CITRUS_PROP_BOOL, { .bool = { cb } } }
+	{ name, _CITRUS_PROP_BOOL, { .boolean = { cb } } }
 #define _CITRUS_PROP_HINT_STR(name, cb) \
 	{ name, _CITRUS_PROP_STR, { .str = { cb } } }
 #define _CITRUS_PROP_HINT_CHR(name, cb) \

>Release-Note:

>Audit-Trail:

State-Changed-From-To: open->closed
State-Changed-By: jruoho@NetBSD.org
State-Changed-When: Wed, 30 Mar 2011 08:22:37 +0000
State-Changed-Why:

Fixed, thanks.



From: "Jukka Ruohonen" <jruoho@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/44641 CVS commit: src/lib/libc/citrus
Date: Wed, 30 Mar 2011 08:22:02 +0000

 Module Name:	src
 Committed By:	jruoho
 Date:		Wed Mar 30 08:22:02 UTC 2011

 Modified Files:
 	src/lib/libc/citrus: citrus_iconv.c citrus_prop.c citrus_prop.h

 Log Message:
 From Henning Petersen in PR # 44641: C99 primitive type 'bool' used
 as a variable name. Also small KNF, as in FreeBSD.


 To generate a diff of this commit:
 cvs rdiff -u -r1.8 -r1.9 src/lib/libc/citrus/citrus_iconv.c
 cvs rdiff -u -r1.3 -r1.4 src/lib/libc/citrus/citrus_prop.c \
     src/lib/libc/citrus/citrus_prop.h

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

>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-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.