NetBSD Problem Report #6271
Received: (qmail 4960 invoked from network); 11 Oct 1998 04:36:14 -0000
Message-Id: <19981011035528.29411.qmail@mailhost.dave.dtsp.co.nz>
Date: 11 Oct 1998 03:55:28 -0000
From: dave@dtsp.co.nz
Reply-To: dave@dtsp.co.nz
To: gnats-bugs@gnats.netbsd.org
Subject: ANSI compliance in if_arp.h header
X-Send-Pr-Version: 3.95
>Number: 6271
>Category: kern
>Synopsis: ANSI compliance in if_arp.h header
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: kern-bug-people
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Sat Oct 10 21:50:01 +0000 1998
>Closed-Date: Sun Feb 21 17:35:59 +0000 1999
>Last-Modified: Sun Feb 21 17:36:18 +0000 1999
>Originator: Dave Sainty
>Release: 11/10/98 sup
>Organization:
Dynamic Technology Services and Products Ltd (NZ)
>Environment:
>Description:
/usr/include/net/if_arp.h has a zero length array in one of its
structures. This violates ANSI C, which is "ok", but it's
inappropriate to have the compiler warn about this if compiling with
ANSI violation warnings on.
>How-To-Repeat:
In my case, #include <net/if.h>
>Fix:
This could be reimplemented as something like (->ar_hrd to typecheck the
parameter):
#define ar_sha(ap) (((u_int8_t*)(&(ap)->ar_hrd)+sizeof(struct arphdr))+0)
But this is uglier than the non-ANSI version. So my fix is to tell the
compiler it's ok...
--- ../NetBSD-sup/src/sys/net/if_arp.h Wed Feb 11 01:27:24 1998
+++ src/sys/net/if_arp.h Sun Oct 11 16:31:26 1998
@@ -73,6 +73,7 @@
u_int8_t ar_tha[]; /* target hardware address */
u_int8_t ar_tpa[]; /* target protocol address */
#endif
+ __extension__ /* ANSI C forbids zero-size array */
u_int8_t ar_remain[0]; /* minimum size, normally bigger */
#define ar_sha(ap) (((ap)->ar_remain)+0)
#define ar_spa(ap) (((ap)->ar_remain)+(ap)->ar_hln)
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed
State-Changed-By: kleink
State-Changed-When: Sun Feb 21 09:35:59 PST 1999
State-Changed-Why:
Fixed as suggested, thanks.
>Unformatted:
System: NetBSD tequila.dave.dtsp.co.nz 1.3G NetBSD 1.3G (TEQUILA) #1: Thu Aug 20 00:13:30 NZST 1998 dave@tequila.dave.dtsp.co.nz:/vol/tequila/userC/NetBSD-current/src/sys/arch/i386/compile/TEQUILA i386
(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.