From krw@tcn.net  Sat May  3 07:20:41 1997
Received: from Pkrw.tcn.net (Pkrw.tcn.net [199.166.4.58])
          by hub.freebsd.org (8.8.5/8.8.5) with ESMTP id HAA29990
          for <FreeBSD-gnats-submit@freebsd.org>; Sat, 3 May 1997 07:20:39 -0700 (PDT)
Received: (from krw@localhost)
	by Pkrw.tcn.net (8.8.5/8.8.5) id KAA03206;
	Sat, 3 May 1997 10:24:28 -0400 (EDT)
Message-Id: <199705031424.KAA03206@Pkrw.tcn.net>
Date: Sat, 3 May 1997 10:24:28 -0400 (EDT)
From: "Kenneth R. Westerback" <krw@tcn.net>
Reply-To: krw@tcn.net
To: FreeBSD-gnats-submit@freebsd.org
Subject: Quash warnings generated during compile of libncurses
X-Send-Pr-Version: 3.2

>Number:         3480
>Category:       misc
>Synopsis:       compiling libncurses generates annoying warnings
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:
>Keywords:
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Sat May  3 07:30:02 PDT 1997
>Closed-Date:    Wed May 21 21:38:12 MEST 1997
>Last-Modified:  Wed May 21 21:38:55 MEST 1997
>Originator:     Kenneth R. Westerback
>Release:        FreeBSD 2.2-STABLE i386
>Organization:
>Environment:

	FreeBSD 2.2-STABLE with src-2.2.0261 make world'ed

>Description:

	When libncurses is compiled (several times during make world!)
	it generates a number of warning messages, all recommending that
	some expressions be parenthesized.

	The attached diff file addresses all these warnings by

	1) creating a #define BLANK (' ' | A_NORMAL) in curses.h and
           removing a number of almost identical definitions of BLANK
	   in various files

	2) manually inserting the desired parenthesis in the few places
    	   where the warning was not generated by the use of BLANK

>How-To-Repeat:

	make libncurses and watch for warning messages

>Fix:
	
diff -u ./curses.h /usr/src/lib/libncurses/curses.h
--- ./curses.h	Sat Apr 26 11:44:58 1997
+++ /usr/src/lib/libncurses/curses.h	Sat May  3 09:31:59 1997
@@ -56,6 +56,9 @@
 #define COLOR_PAIR(n)	(n << 8)
 #define PAIR_NUMBER(a)	((a & A_COLOR) >> 8)
 
+/* chtype constants */
+#define BLANK 		(' ' | A_NORMAL)
+
 /* colors */
 extern int COLORS;
 extern int COLOR_PAIRS;
diff -u ./lib_addch.c /usr/src/lib/libncurses/lib_addch.c
--- ./lib_addch.c	Sat Apr 26 11:44:58 1997
+++ /usr/src/lib/libncurses/lib_addch.c	Sat May  3 09:43:03 1997
@@ -56,7 +56,7 @@
         	T(("win attr = %x", win->_attrs));
 		ch |= win->_attrs;
 
-		if (win->_line[y][x]&A_CHARTEXT == ' ')
+		if ((win->_line[y][x]&A_CHARTEXT) == ' ')
 			ch |= win->_bkgd;
 		else
 			ch |= (win->_bkgd&A_ATTRIBUTES);
diff -u ./lib_bkgd.c /usr/src/lib/libncurses/lib_bkgd.c
--- ./lib_bkgd.c	Sat Apr 26 11:44:58 1997
+++ /usr/src/lib/libncurses/lib_bkgd.c	Sat May  3 09:41:35 1997
@@ -27,7 +27,7 @@
 	T(("wbkgd(%x, %x) called", win, ch));
 	for (y = 0; y <= win->_maxy; y++)
 		for (x = 0; x <= win->_maxx; x++)
-			if (win->_line[y][x]&A_CHARTEXT == ' ')
+			if ((win->_line[y][x]&A_CHARTEXT) == ' ')
 				win->_line[y][x] |= ch;
 			else
 				win->_line[y][x] |= (ch&A_ATTRIBUTES);
diff -u ./lib_clrbot.c /usr/src/lib/libncurses/lib_clrbot.c
--- ./lib_clrbot.c	Sat Apr 26 11:44:58 1997
+++ /usr/src/lib/libncurses/lib_clrbot.c	Sat May  3 09:36:50 1997
@@ -12,8 +12,6 @@
 
 #include "curses.priv.h"
 
-#define BLANK ' '|A_NORMAL
-
 int wclrtobot(WINDOW *win)
 {
 chtype	*ptr, *end, *maxx = NULL;
diff -u ./lib_clreol.c /usr/src/lib/libncurses/lib_clreol.c
--- ./lib_clreol.c	Sat Apr 26 11:44:59 1997
+++ /usr/src/lib/libncurses/lib_clreol.c	Sat May  3 09:36:27 1997
@@ -12,8 +12,6 @@
 
 #include "curses.priv.h"
 
-#define BLANK ' '|A_NORMAL
-
 int  wclrtoeol(WINDOW *win)
 {
 chtype	*maxx, *ptr, *end;
diff -u ./lib_doupdate.c /usr/src/lib/libncurses/lib_doupdate.c
--- ./lib_doupdate.c	Sat Apr 26 11:44:59 1997
+++ /usr/src/lib/libncurses/lib_doupdate.c	Sat May  3 09:37:36 1997
@@ -195,8 +195,6 @@
 **
 */
 
-#define BLANK ' '|A_NORMAL
-
 static void ClrUpdate(WINDOW *scr)
 {
 int	i = 0, j = 0;
diff -u ./lib_erase.c /usr/src/lib/libncurses/lib_erase.c
--- ./lib_erase.c	Sat Apr 26 11:44:59 1997
+++ /usr/src/lib/libncurses/lib_erase.c	Sat May  3 09:39:55 1997
@@ -13,8 +13,6 @@
 #include "curses.priv.h"
 #include "terminfo.h"
 
-#define BLANK ' '
-
 int  werase(WINDOW	*win)
 {
 int	y;

>Release-Note:
>Audit-Trail:

From: "Kenneth R. Westerback" <krw@tcn.net>
To: freebsd-gnats-submit@freebsd.org, krw@tcn.net
Cc:  Subject: Re: misc/3480: compiling libncurses generates annoying warnings
Date: Sun, 11 May 1997 12:03:39 -0400

 This can be closed as it is a duplicate of PR bin/2762 (at least patches
 differ slightly but problem is the same).
 
 ---- Ken
State-Changed-From-To: open->closed 
State-Changed-By: joerg 
State-Changed-When: Wed May 21 21:38:12 MEST 1997 
State-Changed-Why:  
Dup for bin/2762, closed at request of originator. 
>Unformatted:
