[PATCH] net: codel: fix build errors

Subsystems: the rest

STALE5207d

7 messages, 4 authors, 2012-05-14 · open the first message on its own page

[PATCH] net: codel: fix build errors

From: Sasha Levin <hidden>
Date: 2012-05-14 17:13:49

Fix the following build error:

net/sched/sch_fq_codel.c: In function 'fq_codel_dump_stats':
net/sched/sch_fq_codel.c:464:3: error: unknown field 'qdisc_stats' specified in initializer
net/sched/sch_fq_codel.c:464:3: warning: missing braces around initializer
net/sched/sch_fq_codel.c:464:3: warning: (near initialization for 'st.<anonymous>')
net/sched/sch_fq_codel.c:465:3: error: unknown field 'qdisc_stats' specified in initializer
net/sched/sch_fq_codel.c:465:3: warning: excess elements in struct initializer
net/sched/sch_fq_codel.c:465:3: warning: (near initialization for 'st')
net/sched/sch_fq_codel.c:466:3: error: unknown field 'qdisc_stats' specified in initializer
net/sched/sch_fq_codel.c:466:3: warning: excess elements in struct initializer
net/sched/sch_fq_codel.c:466:3: warning: (near initialization for 'st')
net/sched/sch_fq_codel.c:467:3: error: unknown field 'qdisc_stats' specified in initializer
net/sched/sch_fq_codel.c:467:3: warning: excess elements in struct initializer
net/sched/sch_fq_codel.c:467:3: warning: (near initialization for 'st')
make[1]: *** [net/sched/sch_fq_codel.o] Error 1

Signed-off-by: Sasha Levin <redacted>
---
 include/linux/pkt_sched.h |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/include/linux/pkt_sched.h b/include/linux/pkt_sched.h
index 32aef0a..c304eda 100644
--- a/include/linux/pkt_sched.h
+++ b/include/linux/pkt_sched.h
@@ -732,7 +732,9 @@ struct tc_fq_codel_xstats {
 	union {
 		struct tc_fq_codel_qd_stats qdisc_stats;
 		struct tc_fq_codel_cl_stats class_stats;
-	};
+	} u;
+#define qdisc_stats u.qdisc_stats
+#define class_stats u.class_stats
 };
 
 #endif
-- 
1.7.8.6

Re: [PATCH] net: codel: fix build errors

From: Stephen Hemminger <hidden>
Date: 2012-05-14 17:35:30

On Mon, 14 May 2012 19:14:47 +0200
Sasha Levin [off-list ref] wrote:
Fix the following build error:

net/sched/sch_fq_codel.c: In function 'fq_codel_dump_stats':
net/sched/sch_fq_codel.c:464:3: error: unknown field 'qdisc_stats' specified in initializer
net/sched/sch_fq_codel.c:464:3: warning: missing braces around initializer
net/sched/sch_fq_codel.c:464:3: warning: (near initialization for 'st.<anonymous>')
net/sched/sch_fq_codel.c:465:3: error: unknown field 'qdisc_stats' specified in initializer
net/sched/sch_fq_codel.c:465:3: warning: excess elements in struct initializer
net/sched/sch_fq_codel.c:465:3: warning: (near initialization for 'st')
net/sched/sch_fq_codel.c:466:3: error: unknown field 'qdisc_stats' specified in initializer
net/sched/sch_fq_codel.c:466:3: warning: excess elements in struct initializer
net/sched/sch_fq_codel.c:466:3: warning: (near initialization for 'st')
net/sched/sch_fq_codel.c:467:3: error: unknown field 'qdisc_stats' specified in initializer
net/sched/sch_fq_codel.c:467:3: warning: excess elements in struct initializer
net/sched/sch_fq_codel.c:467:3: warning: (near initialization for 'st')
make[1]: *** [net/sched/sch_fq_codel.o] Error 1

Signed-off-by: Sasha Levin <redacted>
Which Gcc version, looks like your compiler is old.

Re: [PATCH] net: codel: fix build errors

From: Sasha Levin <hidden>
Date: 2012-05-14 17:38:13

On Mon, May 14, 2012 at 7:35 PM, Stephen Hemminger
[off-list ref] wrote:
On Mon, 14 May 2012 19:14:47 +0200
Sasha Levin [off-list ref] wrote:
quoted
Fix the following build error:

net/sched/sch_fq_codel.c: In function 'fq_codel_dump_stats':
net/sched/sch_fq_codel.c:464:3: error: unknown field 'qdisc_stats' specified in initializer
net/sched/sch_fq_codel.c:464:3: warning: missing braces around initializer
net/sched/sch_fq_codel.c:464:3: warning: (near initialization for 'st.<anonymous>')
net/sched/sch_fq_codel.c:465:3: error: unknown field 'qdisc_stats' specified in initializer
net/sched/sch_fq_codel.c:465:3: warning: excess elements in struct initializer
net/sched/sch_fq_codel.c:465:3: warning: (near initialization for 'st')
net/sched/sch_fq_codel.c:466:3: error: unknown field 'qdisc_stats' specified in initializer
net/sched/sch_fq_codel.c:466:3: warning: excess elements in struct initializer
net/sched/sch_fq_codel.c:466:3: warning: (near initialization for 'st')
net/sched/sch_fq_codel.c:467:3: error: unknown field 'qdisc_stats' specified in initializer
net/sched/sch_fq_codel.c:467:3: warning: excess elements in struct initializer
net/sched/sch_fq_codel.c:467:3: warning: (near initialization for 'st')
make[1]: *** [net/sched/sch_fq_codel.o] Error 1

Signed-off-by: Sasha Levin <redacted>
Which Gcc version, looks like your compiler is old.
gcc version 4.5.3 (Gentoo 4.5.3-r2 p1.1, pie-0.4.7)

This is the latest gcc provided by gentoo.

Re: [PATCH] net: codel: fix build errors

From: Eric Dumazet <hidden>
Date: 2012-05-14 21:08:17

On Mon, 2012-05-14 at 19:14 +0200, Sasha Levin wrote:
quoted hunk
Fix the following build error:

net/sched/sch_fq_codel.c: In function 'fq_codel_dump_stats':
net/sched/sch_fq_codel.c:464:3: error: unknown field 'qdisc_stats' specified in initializer
net/sched/sch_fq_codel.c:464:3: warning: missing braces around initializer
net/sched/sch_fq_codel.c:464:3: warning: (near initialization for 'st.<anonymous>')
net/sched/sch_fq_codel.c:465:3: error: unknown field 'qdisc_stats' specified in initializer
net/sched/sch_fq_codel.c:465:3: warning: excess elements in struct initializer
net/sched/sch_fq_codel.c:465:3: warning: (near initialization for 'st')
net/sched/sch_fq_codel.c:466:3: error: unknown field 'qdisc_stats' specified in initializer
net/sched/sch_fq_codel.c:466:3: warning: excess elements in struct initializer
net/sched/sch_fq_codel.c:466:3: warning: (near initialization for 'st')
net/sched/sch_fq_codel.c:467:3: error: unknown field 'qdisc_stats' specified in initializer
net/sched/sch_fq_codel.c:467:3: warning: excess elements in struct initializer
net/sched/sch_fq_codel.c:467:3: warning: (near initialization for 'st')
make[1]: *** [net/sched/sch_fq_codel.o] Error 1

Signed-off-by: Sasha Levin <redacted>
---
 include/linux/pkt_sched.h |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/include/linux/pkt_sched.h b/include/linux/pkt_sched.h
index 32aef0a..c304eda 100644
--- a/include/linux/pkt_sched.h
+++ b/include/linux/pkt_sched.h
@@ -732,7 +732,9 @@ struct tc_fq_codel_xstats {
 	union {
 		struct tc_fq_codel_qd_stats qdisc_stats;
 		struct tc_fq_codel_cl_stats class_stats;
-	};
+	} u;
+#define qdisc_stats u.qdisc_stats
+#define class_stats u.class_stats
 };
 
Anonymous unions are fine, we use them a lot in kernel.

Please fix the initializers instead in fq_codel_dump_stats(), because
these two #define are not very nice.

Re: [PATCH] net: codel: fix build errors

From: David Miller <davem@davemloft.net>
Date: 2012-05-14 21:22:00

From: Eric Dumazet <redacted>
Date: Mon, 14 May 2012 23:08:03 +0200
Anonymous unions are fine, we use them a lot in kernel.

Please fix the initializers instead in fq_codel_dump_stats(), because
these two #define are not very nice.
Agreed.

Re: [PATCH] net: codel: fix build errors

From: Sasha Levin <hidden>
Date: 2012-05-14 21:39:32

On Mon, May 14, 2012 at 11:08 PM, Eric Dumazet [off-list ref] wrote:
Anonymous unions are fine, we use them a lot in kernel.
While we use them a lot, we don't try initializing them that often.
Please fix the initializers instead in fq_codel_dump_stats(), because
these two #define are not very nice.
The only method I know of fixing that up is getting braces around them
in the initializer, which is hacky and will break every time a new
member is added to the struct before the anonymous union. Is there a
different solution?

Re: [PATCH] net: codel: fix build errors

From: Eric Dumazet <hidden>
Date: 2012-05-14 21:49:19

On Mon, 2012-05-14 at 23:39 +0200, Sasha Levin wrote:
On Mon, May 14, 2012 at 11:08 PM, Eric Dumazet [off-list ref] wrote:
quoted
Anonymous unions are fine, we use them a lot in kernel.
While we use them a lot, we don't try initializing them that often.
quoted
Please fix the initializers instead in fq_codel_dump_stats(), because
these two #define are not very nice.
The only method I know of fixing that up is getting braces around them
in the initializer, which is hacky and will break every time a new
member is added to the struct before the anonymous union. Is there a
different solution?

instead of 

	struct foo x = {
		.field = value;
		.sub.f2 = xxx;
		...
	};

use :

	struct foo x = {
		.field = value;
	};

	x.sub.f2 = xxx;
	...
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help