diff mbox

[ovs-dev] include: Add struct declaration to ofp-print.h.

Message ID 20170808213028.16222-1-joe@ovn.org
State Accepted
Headers show

Commit Message

Joe Stringer Aug. 8, 2017, 9:30 p.m. UTC
If a libopenvswitch user includes ofp-print.h before ofp-util.h (which
is standard alphabetical order), and turns on -Werror, then they would
hit this compilation error in the include:

error: 'struct ofputil_port_map' declared inside parameter list will not
be visible outside of this definition or declaration [-Werror]
 void ofp_print(FILE *, const void *, size_t *, const struct ofputil_port_map *,

Fixes: 50f96b10e1c8 ("Support accepting and displaying port names in OVS tools.")
Signed-off-by: Joe Stringer <joe@ovn.org>
---
 include/openvswitch/ofp-print.h | 1 +
 1 file changed, 1 insertion(+)

Comments

Ben Pfaff Aug. 8, 2017, 11:10 p.m. UTC | #1
On Tue, Aug 08, 2017 at 02:30:28PM -0700, Joe Stringer wrote:
> If a libopenvswitch user includes ofp-print.h before ofp-util.h (which
> is standard alphabetical order), and turns on -Werror, then they would
> hit this compilation error in the include:
> 
> error: 'struct ofputil_port_map' declared inside parameter list will not
> be visible outside of this definition or declaration [-Werror]
>  void ofp_print(FILE *, const void *, size_t *, const struct ofputil_port_map *,
> 
> Fixes: 50f96b10e1c8 ("Support accepting and displaying port names in OVS tools.")
> Signed-off-by: Joe Stringer <joe@ovn.org>

Our usual practice of having a .c file #include its own .h first should
defend against this, but I see that it wasn't followed here.  I'll send
a followup patch.

Acked-by: Ben Pfaff <blp@ovn.org>
Joe Stringer Aug. 8, 2017, 11:22 p.m. UTC | #2
On 8 August 2017 at 16:10, Ben Pfaff <blp@ovn.org> wrote:
> On Tue, Aug 08, 2017 at 02:30:28PM -0700, Joe Stringer wrote:
>> If a libopenvswitch user includes ofp-print.h before ofp-util.h (which
>> is standard alphabetical order), and turns on -Werror, then they would
>> hit this compilation error in the include:
>>
>> error: 'struct ofputil_port_map' declared inside parameter list will not
>> be visible outside of this definition or declaration [-Werror]
>>  void ofp_print(FILE *, const void *, size_t *, const struct ofputil_port_map *,
>>
>> Fixes: 50f96b10e1c8 ("Support accepting and displaying port names in OVS tools.")
>> Signed-off-by: Joe Stringer <joe@ovn.org>
>
> Our usual practice of having a .c file #include its own .h first should
> defend against this, but I see that it wasn't followed here.  I'll send
> a followup patch.
>
> Acked-by: Ben Pfaff <blp@ovn.org>

Thanks, applied to master and branch-2.8.
diff mbox

Patch

diff --git a/include/openvswitch/ofp-print.h b/include/openvswitch/ofp-print.h
index 20f049a37f65..d02634e3e91c 100644
--- a/include/openvswitch/ofp-print.h
+++ b/include/openvswitch/ofp-print.h
@@ -29,6 +29,7 @@  struct ofp10_match;
 struct ofp_flow_mod;
 struct ofp_header;
 struct ofputil_flow_stats;
+struct ofputil_port_map;
 struct ofputil_table_features;
 struct ofputil_table_stats;
 struct dp_packet;