DragonFly BSD
DragonFly submit List (threaded) for 2004-02
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

Re: ng_bpf compiled with gcc3


From: YONETANI Tomokazu <qhwt+dragonfly-submit@xxxxxxxxxx>
Date: Sun, 15 Feb 2004 02:28:28 +0900

On Sun, Feb 15, 2004 at 02:09:02AM +0900, YONETANI Tomokazu wrote:
> Hi.
> This is a fix from FreeBSD-CURRENT. Not only does it silence the warning,
> but ng_bpf is broken without this when compiled with gcc3.
> 
> |revision 1.7
> |date: 2002/06/01 20:40:05;  author: alfred;  state: Exp;  lines: +1 -1
> |Declare a variable sized array within a structure using [] rather than [0]
> |to silence warnings.
> 
> Index: sys/netgraph/bpf/ng_bpf.h

No, that didn't compile with gcc2. Please try this instead.

Index: sys/netgraph/bpf/ng_bpf.h
===================================================================
RCS file: /home/source/dragonfly/cvs/src/sys/netgraph/bpf/ng_bpf.h,v
retrieving revision 1.2
diff -u -r1.2 ng_bpf.h
--- sys/netgraph/bpf/ng_bpf.h	17 Jun 2003 04:28:49 -0000	1.2
+++ sys/netgraph/bpf/ng_bpf.h	14 Feb 2004 17:18:02 -0000
@@ -54,7 +54,11 @@
 	char		ifMatch[NG_HOOKLEN+1];		/* match dest hook */
 	char		ifNotMatch[NG_HOOKLEN+1];	/* !match dest hook */
 	int32_t		bpf_prog_len;			/* #isns in program */
+#if defined(__GNUC__) && __GNUC__ >= 3
+	struct bpf_insn	bpf_prog[];			/* bpf program */
+#else
 	struct bpf_insn	bpf_prog[0];			/* bpf program */
+#endif
 };
 
 #define NG_BPF_HOOKPROG_SIZE(numInsn)	\



[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]