NetBSD Problem Report #3562

Received: (qmail-queue invoked from smtpd); 30 Apr 1997 19:49:22 -0000
Message-Id: <199704301947.VAA29364@saruman.ics.muni.cz>
Date: Wed, 30 Apr 1997 21:47:56 +0200 (MET DST)
From: Jaromir Dolecek <dolecek@ics.muni.cz>
Reply-To: dolecek@ics.muni.cz
To: gnats-bugs@gnats.netbsd.org
Subject: <i386/endian.h> isn't strict ansi clean
X-Send-Pr-Version: 3.95

>Number:         3562
>Category:       kern
>Synopsis:       <i386/endian.h> isn't strict ansi clean
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    kern-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Apr 30 12:50:02 +0000 1997
>Closed-Date:    Wed Dec 16 11:11:51 +0000 1998
>Last-Modified:  Wed Dec 16 11:13:07 +0000 1998
>Originator:     Jaromir Dolecek
>Release:        1.2
>Organization:
	ICS MU, Brno, Czech Republic
>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) \
>Release-Note:
>Audit-Trail:

From: "J.T. Conklin" <jtc@NetBSD.ORG>
To: dolecek@ics.muni.cz
Cc: gnats-bugs@gnats.netbsd.org
Subject: Re: kern/3562: <i386/endian.h> isn't strict ansi clean 
Date: Thu, 01 May 1997 15:33:19 -0700

 > >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.

 *If* this is a bug, I think it's a pretty low priority one.  Once a
 program includes <sys/param.h> you're well beyond the limits of the
 C standard.  You shouldn't expect options like -ansi -pedantic to 
 be meaningful.
State-Changed-From-To: open->closed 
State-Changed-By: kleink 
State-Changed-When: Wed Dec 16 03:11:51 PST 1998 
State-Changed-Why:  
Fixed; warning suppressed by means of __extension__. 
>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.