[ovs-dev] [PATCH] sparse: Add guards to prevent FreeBSD-incompatible #include order.

Ben Pfaff blp at ovn.org
Fri Dec 22 20:58:56 UTC 2017


On Thu, Dec 21, 2017 at 04:50:28PM -0800, Justin Pettit wrote:
> 
> > On Nov 6, 2017, at 2:42 PM, Ben Pfaff <blp at ovn.org> wrote:
> 
> > diff --git a/include/sparse/arpa/inet.h b/include/sparse/arpa/inet.h
> > index dd64e61764e8..3634b230c8bb 100644
> > --- a/include/sparse/arpa/inet.h
> > +++ b/include/sparse/arpa/inet.h
> > @@ -18,4 +18,8 @@
> > #error "Use this header only with sparse.  It is not a correct implementation."
> > #endif
> > 
> > +#ifndef NETINET_IN_H_INCLUDED
> > +#error "Must include <netinet/in.h> before <arpa/inet.h> for FreeBSD support"
> > +#endif
> > +
> > #include <netinet/in.h>
> 
> This method was clever.

Thanks!

> > diff --git a/lib/lldp/lldpd-structs.h b/lib/lldp/lldpd-structs.h
> > index 15e5ce8fa75d..6a3ffb8d33f0 100644
> > --- a/lib/lldp/lldpd-structs.h
> > +++ b/lib/lldp/lldpd-structs.h
> > @@ -20,11 +20,9 @@
> > #define _LLDPD_STRUCTS_H
> > 
> > #include <net/if.h>
> > -#ifndef _WIN32
> > +#include <sys/types.h>
> > #include <netinet/in.h>
> > -#endif
> 
> Based on other changes, I assume including "<netinet/in.h>" on Windows is fine.  I just wanted to make sure, since it seems like there were some hoops jumped for Windows.

I think it's OK.

> Acked-by: Justin Pettit <jpettit at ovn.org>

Thank you for the review.  I applied this to master.


More information about the dev mailing list