diff mbox

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

Message ID 1445034719-59328-1-git-send-email-joestringer@nicira.com
State Accepted, archived
Headers show

Commit Message

Joe Stringer Oct. 16, 2015, 10:31 p.m. UTC
GCC4.4 gets confused by anonymous fields + flexible fields, complains:
lib/ofp-actions.h:510: error: flexible array member in otherwise empty
struct
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@nicira.com>
Signed-off-by: Joe Stringer <joestringer@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(-)

Comments

Pravin B Shelar Oct. 16, 2015, 10:46 p.m. UTC | #1
On Fri, Oct 16, 2015 at 3:31 PM, Joe Stringer <joestringer@nicira.com> wrote:
> GCC4.4 gets confused by anonymous fields + flexible fields, complains:
> lib/ofp-actions.h:510: error: flexible array member in otherwise empty
> struct
> 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@nicira.com>
> Signed-off-by: Joe Stringer <joestringer@nicira.com>

Acked-by: Pravin B Shelar <pshelar@nicira.com>
Joe Stringer Oct. 16, 2015, 11:27 p.m. UTC | #2
On 16 October 2015 at 15:46, Pravin Shelar <pshelar@nicira.com> wrote:
> On Fri, Oct 16, 2015 at 3:31 PM, Joe Stringer <joestringer@nicira.com> wrote:
>> GCC4.4 gets confused by anonymous fields + flexible fields, complains:
>> lib/ofp-actions.h:510: error: flexible array member in otherwise empty
>> struct
>> 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@nicira.com>
>> Signed-off-by: Joe Stringer <joestringer@nicira.com>
>
> Acked-by: Pravin B Shelar <pshelar@nicira.com>

Thanks, I applied this to master.
diff mbox

Patch

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 {
         CT_MEMBERS;
         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);