Subject: port-mac68k/5334: GCC 2.8.1 complains about missing parenteses in if-else
To: None <gnats-bugs@gnats.netbsd.org>
From: None <ivanenko@ctpa03.mit.edu>
List: netbsd-bugs
Date: 04/21/1998 11:00:46
>Number:         5334
>Category:       port-mac68k
>Synopsis:       GCC 2.8.1 complains about missing parenteses in if-else
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    gnats-admin (GNATS administrator)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Apr 21 08:05:02 1998
>Last-Modified:
>Originator:     
>Organization:
working for myself
	
>Release:        <NetBSD-current source date> current as ofTue Apr 21 10:46:55 EDT 1998
>Environment:
	
Cross-compiling with standard gcc 2.8.1 distribution from SunOS 4.1.3 to 
NetBSD/mac68k, gcc configured with 
./configure --target=m68k-apple-netbsd --with-gnu-as
System: SunOS 4.1.3 2 sun4c
Architecture: sun4

>Description:
	

The statements in questions look like

if(condition)
  if(condition)
    statement;
  else
    statement;

"else" part is ambiguos and GCC suggests putting explicit parenteses.
Since kernel is compiled with -Werror, compilation stops. One solution is 
to put -Wno-parenteses in compiler switches or (I think better) apply the 
patch below. The following files are affected (in MD part)


The warnings in those files were triggered while compiling mac68k/GENERIC 
kernel. There are definitely more of those around the code!

I have submitted also the appropriate patch for MI part.

>How-To-Repeat:
	
See environment above. I have not tried to compile GCC 2.8.1 on NetBSD box,
it would take forenver on my Mac IIcx
>Fix:
	

Here is the diff -c

*** /syjet/src/sys/arch/mac68k/mac68k/machdep.c	Fri Apr 10 07:12:20 1998
--- sys/arch/mac68k/mac68k/machdep.c	Sat Apr 18 21:44:57 1998
***************
*** 373,384 ****
  	 * memory. Insure a minimum of 16 buffers.
  	 * We allocate 3/4 as many swap buffer headers as file i/o buffers.
  	 */
! 	if (bufpages == 0)
  		if (physmem < btoc(2 * 1024 * 1024))
  			bufpages = physmem / (10 * CLSIZE);
  		else
  			bufpages = (btoc(2 * 1024 * 1024) + physmem) /
  			    (20 * CLSIZE);
  
  	if (nbuf == 0) {
  		nbuf = bufpages;
--- 373,385 ----
  	 * memory. Insure a minimum of 16 buffers.
  	 * We allocate 3/4 as many swap buffer headers as file i/o buffers.
  	 */
! 	if (bufpages == 0) {
  		if (physmem < btoc(2 * 1024 * 1024))
  			bufpages = physmem / (10 * CLSIZE);
  		else
  			bufpages = (btoc(2 * 1024 * 1024) + physmem) /
  			    (20 * CLSIZE);
+ 	}
  
  	if (nbuf == 0) {
  		nbuf = bufpages;
>Audit-Trail:
>Unformatted:
    GCC 2.8.1 complains about missing parenteses in if-else
	sw-bug