Subject: kern/3562: isn't strict ansi clean
To: None <>
From: Jaromir Dolecek <>
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
>Originator:     Jaromir Dolecek
	ICS MU, Brno, Czech Republic
>Release:        1.2
System: NetBSD 1.2 NetBSD 1.2 (SARUMAN_12) #21: Mon Mar 24 15:47:33 MET 1997 i386
Architecture: i386

	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).
	Include <sys/param.h> in program, use htons() and try compile 
	it w/ -ansi -pedantic. 
*** endian.h.orig	Wed Apr 30 21:18:01 1997
--- endian.h	Wed Apr 30 21:40:27 1997
*** 67,73 ****
! #ifdef __GNUC__
  #if defined(_KERNEL) && !defined(I386_CPU)
  #define	__byte_swap_long_variable(x) \
--- 67,73 ----
! #if defined(__GNUC__) && !defined(_ANSI_SOURCE) && !defined(__STRICT_ANSI__)
  #if defined(_KERNEL) && !defined(I386_CPU)
  #define	__byte_swap_long_variable(x) \