compiler: Provide LIBPLDM_CC_UNUSED

Ensure that we have __has_attribute available, and then further
ensure that the unused attribute is provided. Once satisfied, define
LIBPDLM_CC_UNUSED and replace raw use of __attribute__((unused)).

Change-Id: I2433039297d5fdedb8b8d99b30e73e4542d9069f
Signed-off-by: Andrew Jeffery <andrew@codeconstruct.com.au>
diff --git a/src/transport/af-mctp.c b/src/transport/af-mctp.c
index ea79863..a66e79d0 100644
--- a/src/transport/af-mctp.c
+++ b/src/transport/af-mctp.c
@@ -1,4 +1,5 @@
 /* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */
+#include "compiler.h"
 #include "container-of.h"
 #include "mctp-defines.h"
 #include "responder.h"
@@ -95,7 +96,7 @@
 
 LIBPLDM_ABI_STABLE
 int pldm_transport_af_mctp_unmap_tid(struct pldm_transport_af_mctp *ctx,
-				     __attribute__((unused)) pldm_tid_t tid,
+				     LIBPLDM_CC_UNUSED pldm_tid_t tid,
 				     mctp_eid_t eid)
 {
 	ctx->tid_eid_map[eid] = 0;
diff --git a/src/transport/mctp-demux.c b/src/transport/mctp-demux.c
index 0ea1cf6..a4f7cbe 100644
--- a/src/transport/mctp-demux.c
+++ b/src/transport/mctp-demux.c
@@ -1,4 +1,5 @@
 /* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */
+#include "compiler.h"
 #include "container-of.h"
 #include "mctp-defines.h"
 #include "socket.h"
@@ -116,7 +117,7 @@
 
 LIBPLDM_ABI_STABLE
 int pldm_transport_mctp_demux_unmap_tid(struct pldm_transport_mctp_demux *ctx,
-					__attribute__((unused)) pldm_tid_t tid,
+					LIBPLDM_CC_UNUSED pldm_tid_t tid,
 					mctp_eid_t eid)
 {
 	ctx->tid_eid_map[eid] = 0;
diff --git a/src/transport/transport.c b/src/transport/transport.c
index 33197ab..24c264a 100644
--- a/src/transport/transport.c
+++ b/src/transport/transport.c
@@ -1,4 +1,5 @@
 /* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */
+#include "compiler.h"
 #include "transport.h"
 
 #include <libpldm/transport.h>
@@ -23,9 +24,9 @@
 	short revents; /* returned events */
 };
 
-static inline int poll(struct pollfd *fds __attribute__((unused)),
-		       int nfds __attribute__((unused)),
-		       int timeout __attribute__((unused)))
+static inline int poll(struct pollfd *fds LIBPLDM_CC_UNUSED,
+		       int nfds LIBPLDM_CC_UNUSED,
+		       int timeout LIBPLDM_CC_UNUSED)
 {
 	return 0;
 }