libmctp: Introduce compiler.h

Define __unused here and include compiler.h in all the places we can
make use of it. Clean up some header ordering and include styles while
we're at it.

Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
Change-Id: I33ddbdacbddbbf557dc02e42d8dde71a16e1cabe
diff --git a/tests/test_astlpc.c b/tests/test_astlpc.c
index 32c221f..054eda1 100644
--- a/tests/test_astlpc.c
+++ b/tests/test_astlpc.c
@@ -12,9 +12,10 @@
 #define pr_fmt(x) "test: " x
 #endif
 
+#include "compiler.h"
+#include "container_of.h"
 #include "libmctp-astlpc.h"
 #include "libmctp-log.h"
-#include "container_of.h"
 
 #ifdef NDEBUG
 #undef NDEBUG
@@ -149,8 +150,6 @@
 	.lpc_write = mctp_astlpc_mmio_lpc_write,
 };
 
-#define __unused __attribute__((unused))
-
 static void rx_message(uint8_t eid __unused, void *data __unused, void *msg,
 		       size_t len)
 {
diff --git a/tests/test_cmds.c b/tests/test_cmds.c
index 057a755..1b7536a 100644
--- a/tests/test_cmds.c
+++ b/tests/test_cmds.c
@@ -2,14 +2,15 @@
 
 #include "test-utils.h"
 
+#include "compiler.h"
+#include "libmctp.h"
+#include "libmctp-alloc.h"
+#include "libmctp-cmds.h"
+
 #include <stdio.h>
 #include <string.h>
 #include <assert.h>
 
-#include <libmctp.h>
-#include <libmctp-alloc.h>
-#include <libmctp-cmds.h>
-
 #ifdef NDEBUG
 #undef NDEBUG
 #endif
@@ -30,8 +31,6 @@
 	};
 };
 
-#define __unused __attribute__((unused))
-
 static void control_message_transport_callback(mctp_eid_t src __unused,
 					       void *data, void *buf,
 					       size_t len __unused)
diff --git a/tests/test_core.c b/tests/test_core.c
index f571084..dacf197 100644
--- a/tests/test_core.c
+++ b/tests/test_core.c
@@ -19,6 +19,7 @@
 #include <string.h>
 #include <unistd.h>
 
+#include "compiler.h"
 #include "libmctp-alloc.h"
 #include "libmctp-log.h"
 #include "range.h"
@@ -31,8 +32,6 @@
 #define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0]))
 #endif
 
-#define __unused __attribute__((unused))
-
 #define MAX_PAYLOAD_SIZE 50000
 
 struct pktbuf {
diff --git a/tests/test_eid.c b/tests/test_eid.c
index 51f989c..031d044 100644
--- a/tests/test_eid.c
+++ b/tests/test_eid.c
@@ -5,11 +5,10 @@
 #include <stdio.h>
 #include <string.h>
 
-#include <libmctp.h>
-
+#include "compiler.h"
+#include "libmctp.h"
 #include "test-utils.h"
 
-
 struct test_ctx {
 	struct mctp			*mctp;
 	struct mctp_binding_test	*binding;
diff --git a/tests/test_seq.c b/tests/test_seq.c
index e99dc94..8838acb 100644
--- a/tests/test_seq.c
+++ b/tests/test_seq.c
@@ -5,8 +5,8 @@
 #include <stdio.h>
 #include <string.h>
 
-#include <libmctp.h>
-
+#include "compiler.h"
+#include "libmctp.h"
 #include "test-utils.h"
 
 #define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0]))
diff --git a/tests/test_serial.c b/tests/test_serial.c
index 12d1476..3c6d147 100644
--- a/tests/test_serial.c
+++ b/tests/test_serial.c
@@ -6,6 +6,7 @@
 #include "config.h"
 #endif
 
+#include "compiler.h"
 #include "libmctp-log.h"
 #include "libmctp-serial.h"
 
@@ -43,8 +44,6 @@
 
 static bool seen;
 
-#define __unused __attribute__((unused))
-
 static void rx_message(uint8_t eid __unused, void *data __unused, void *msg,
 		       size_t len)
 {