[ovs-dev] [PATCH] ofp-actions: Fix build on earlier GCC.

Joe Stringer joestringer at nicira.com
Fri Oct 16 22:31:59 UTC 2015

GCC4.4 gets confused by anonymous fields + flexible fields, complains:
lib/ofp-actions.h:510: error: flexible array member in otherwise empty
lib/ofp-actions.h:512: error: bit-field ‘build_assert_failed’ width not
an integer constant
lib/ofp-actions.h:514: error: bit-field ‘build_assert_failed’ width not
an integer constant

Fix the problem by specifying the actions length as zero.

Reported-by: Pravin B Shelar <pshelar at nicira.com>
Signed-off-by: Joe Stringer <joestringer at nicira.com>
Tested manually on RHEL6.6, and via AppVeyor and Travis CI. Everything
seems happy.
 lib/ofp-actions.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/ofp-actions.h b/lib/ofp-actions.h
index 0ad2e3f9f26f..773b6170474d 100644
--- a/lib/ofp-actions.h
+++ b/lib/ofp-actions.h
@@ -507,7 +507,7 @@ struct ofpact_conntrack {
         uint8_t pad[OFPACT_ALIGN(sizeof(CT_MEMBERS))];
-    struct ofpact actions[];
+    struct ofpact actions[0];
 BUILD_ASSERT_DECL(offsetof(struct ofpact_conntrack, actions)
                   % OFPACT_ALIGNTO == 0);

More information about the dev mailing list