clang-format: copy latest and re-format
clang-format-16 has some backwards incompatible changes that require
additional settings for best compatibility and re-running the formatter.
Copy the latest .clang-format from the docs repository[1] and reformat
the repository.
[1] https://gerrit.openbmc.org/c/openbmc/docs/+/63441
Further, shift the fixup for C's `_Static_assert` into src/msgbuf.h to
prevent a clang-tidy-16 error:
```
/data0/jenkins/workspace/ci-repository/openbmc/libpldm/src/msgbuf.h:315:2: error: '_Static_assert' is a C11 extension [clang-diagnostic-c11-extensions,-warnings-as-errors]
_Static_assert(sizeof(*dst) == sizeof(ldst),
^
```
And fix up the function prototype in the definition of `pldm_open()`:
```
../src/requester/pldm.c:128:16: error: a function declaration without a prototype is deprecated in all versions of C [clang-diagnostic-strict-prototypes,-warnings-as-errors]
void pldm_close()
^
void
```
Change-Id: I57b53f51914e39237e733d024e62ab41b3d306c1
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
diff --git a/src/requester/pldm.c b/src/requester/pldm.c
index c78512f..973f194 100644
--- a/src/requester/pldm.c
+++ b/src/requester/pldm.c
@@ -50,39 +50,39 @@
/* This macro does the setup and teardown required for the old API to use the
* new API. Since the setup/teardown logic is the same for all four send/recv
* functions, it makes sense to only define it once. */
-#define PLDM_REQ_FN(eid, fd, fn, ...) \
- do { \
- struct pldm_transport_mctp_demux *demux; \
- bool using_open_transport = false; \
- pldm_requester_rc_t rc; \
- pldm_tid_t tid = 1; \
- struct pldm_transport *ctx; \
+#define PLDM_REQ_FN(eid, fd, fn, ...) \
+ do { \
+ struct pldm_transport_mctp_demux *demux; \
+ bool using_open_transport = false; \
+ pldm_requester_rc_t rc; \
+ pldm_tid_t tid = 1; \
+ struct pldm_transport *ctx; \
/* The fd can be for a socket we opened or one the consumer \
- * opened. */ \
- if (open_transport && \
- mctp_fd == pldm_transport_mctp_demux_get_socket_fd( \
- open_transport)) { \
- using_open_transport = true; \
- demux = open_transport; \
- } else { \
- demux = pldm_transport_mctp_demux_init_with_fd(fd); \
- if (!demux) { \
- rc = PLDM_REQUESTER_OPEN_FAIL; \
- goto transport_out; \
- } \
- } \
- ctx = pldm_transport_mctp_demux_core(demux); \
- rc = pldm_transport_mctp_demux_map_tid(demux, tid, eid); \
- if (rc) { \
- rc = PLDM_REQUESTER_OPEN_FAIL; \
- goto transport_out; \
- } \
- rc = fn(ctx, tid, __VA_ARGS__); \
- transport_out: \
- if (!using_open_transport) { \
- pldm_transport_mctp_demux_destroy(demux); \
- } \
- return rc; \
+ * opened. */ \
+ if (open_transport && \
+ mctp_fd == pldm_transport_mctp_demux_get_socket_fd( \
+ open_transport)) { \
+ using_open_transport = true; \
+ demux = open_transport; \
+ } else { \
+ demux = pldm_transport_mctp_demux_init_with_fd(fd); \
+ if (!demux) { \
+ rc = PLDM_REQUESTER_OPEN_FAIL; \
+ goto transport_out; \
+ } \
+ } \
+ ctx = pldm_transport_mctp_demux_core(demux); \
+ rc = pldm_transport_mctp_demux_map_tid(demux, tid, eid); \
+ if (rc) { \
+ rc = PLDM_REQUESTER_OPEN_FAIL; \
+ goto transport_out; \
+ } \
+ rc = fn(ctx, tid, __VA_ARGS__); \
+ transport_out: \
+ if (!using_open_transport) { \
+ pldm_transport_mctp_demux_destroy(demux); \
+ } \
+ return rc; \
} while (0)
pldm_requester_rc_t pldm_recv_any(mctp_eid_t eid, int mctp_fd,
@@ -97,7 +97,7 @@
uint8_t **pldm_resp_msg, size_t *resp_msg_len)
{
pldm_requester_rc_t rc =
- pldm_recv_any(eid, mctp_fd, pldm_resp_msg, resp_msg_len);
+ pldm_recv_any(eid, mctp_fd, pldm_resp_msg, resp_msg_len);
struct pldm_msg_hdr *hdr = (struct pldm_msg_hdr *)(*pldm_resp_msg);
if (hdr->instance_id != instance_id) {
free(*pldm_resp_msg);
@@ -125,7 +125,7 @@
/* Adding this here for completeness in the case we can't smoothly
* transition apps over to the new api */
-void pldm_close()
+void pldm_close(void)
{
if (open_transport) {
pldm_transport_mctp_demux_destroy(open_transport);