Subject: kern/3562: isn't strict ansi clean
To: None <gnats-bugs@gnats.netbsd.org>
From: Jaromir Dolecek <dolecek@ics.muni.cz>
List: netbsd-bugs
Date: 04/30/1997 21:47:56
>Number:         3562
>Category:       kern
>Synopsis:       <i386/endian.h> isn't strict ansi clean
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    kern-bug-people (Kernel Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Apr 30 12:50:02 1997
>Last-Modified:
>Originator:     Jaromir Dolecek
>Organization:
	ICS MU, Brno, Czech Republic
>Release:        1.2
>Environment:
	
System: NetBSD saruman.ics.muni.cz 1.2 NetBSD 1.2 (SARUMAN_12) #21: Mon Mar 24 15:47:33 MET 1997 dolecek@saruman.ics.muni.cz:/home/dolecek/N12/usr/src/sys/arch/i386/compile/SARUMAN_12 i386
Architecture: i386

>Description:
	When program uses htons() pulled in by <sys/param.h> and is 
	compiled w/ -ansi -pedantic options on, compiler complains:

	>make misc.o
	cc -c -g -ansi -pedantic-errors -Dunix -Wall -DDEBUG misc.c
	misc.c: In function `connect_server':
	misc.c:573: ANSI C forbids braced-groups within expressions
	misc.c:619: ANSI C forbids braced-groups within expressions

	Problem is htons() is macro (at least on i386) which 
	expands to something what's not ANSI C-clean.

	It's issue of i386 and pc532 at least (I have looked on these
	two + alpha - alpha is okay).
>How-To-Repeat:
	Include <sys/param.h> in program, use htons() and try compile 
	it w/ -ansi -pedantic. 
>Fix:
*** endian.h.orig	Wed Apr 30 21:18:01 1997
--- endian.h	Wed Apr 30 21:40:27 1997
***************
*** 67,73 ****
  __END_DECLS
  
  
! #ifdef __GNUC__
  
  #if defined(_KERNEL) && !defined(I386_CPU)
  #define	__byte_swap_long_variable(x) \
--- 67,73 ----
  __END_DECLS
  
  
! #if defined(__GNUC__) && !defined(_ANSI_SOURCE) && !defined(__STRICT_ANSI__)
  
  #if defined(_KERNEL) && !defined(I386_CPU)
  #define	__byte_swap_long_variable(x) \
>Audit-Trail:
>Unformatted: