summaryrefslogtreecommitdiff
path: root/lib/lldp
diff options
context:
space:
mode:
authorBen Pfaff <blp@ovn.org>2017-11-06 14:42:32 -0800
committerBen Pfaff <blp@ovn.org>2017-12-22 12:58:02 -0800
commitb2befd5bb2db811ac0273bc52be158d3476a5ff7 (patch)
tree1c4e11f4cabdf80e2904b8268b5f3a2daafae3a9 /lib/lldp
parent9041097aeec97b41f8a2d607e2c72a99b4f60d6a (diff)
downloadopenvswitch-b2befd5bb2db811ac0273bc52be158d3476a5ff7.tar.gz
sparse: Add guards to prevent FreeBSD-incompatible #include order.
FreeBSD insists that <sys/types.h> be included before <netinet/in.h> and that <netinet/in.h> be included before <arpa/inet.h>. This adds guards to the "sparse" headers to yield a warning if this order is violated. This commit also adjusts the order of many #includes to suit this requirement. Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Justin Pettit <jpettit@ovn.org>
Diffstat (limited to 'lib/lldp')
-rw-r--r--lib/lldp/lldpd-structs.h4
-rw-r--r--lib/lldp/lldpd.c3
-rw-r--r--lib/lldp/lldpd.h4
3 files changed, 4 insertions, 7 deletions
diff --git a/lib/lldp/lldpd-structs.h b/lib/lldp/lldpd-structs.h
index 15e5ce8fa..6a3ffb8d3 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
#include <sys/socket.h>
-#include <sys/types.h>
#include "aa-structs.h"
#include "lldp-const.h"
#include "packets.h"
diff --git a/lib/lldp/lldpd.c b/lib/lldp/lldpd.c
index e9d1cf18e..ff5e62846 100644
--- a/lib/lldp/lldpd.c
+++ b/lib/lldp/lldpd.c
@@ -18,6 +18,8 @@
#include <config.h>
#include "lldpd.h"
+#include <sys/types.h>
+#include <netinet/in.h>
#include <arpa/inet.h>
#include <errno.h>
#include <fcntl.h>
@@ -28,7 +30,6 @@
#include <sys/socket.h>
#include <sys/stat.h>
#include <sys/time.h>
-#include <sys/types.h>
#include <sys/wait.h>
#include <unistd.h>
#ifndef _WIN32
diff --git a/lib/lldp/lldpd.h b/lib/lldp/lldpd.h
index f77c6d523..5267c112a 100644
--- a/lib/lldp/lldpd.h
+++ b/lib/lldp/lldpd.h
@@ -19,13 +19,11 @@
#ifndef _LLDPD_H
#define _LLDPD_H
-#ifndef _WIN32
+#include <sys/types.h>
#include <netinet/in.h>
-#endif
#include <stdlib.h>
#include <stddef.h>
#include <string.h>
-#include <sys/types.h>
#include "dp-packet.h"
#include "openvswitch/list.h"
#include "lldpd-structs.h"