clang-tidy: Fix bugprone-macro-parentheses diagnostics
Example output:
```
/usr/bin/clang-tidy -checks=-*, bugprone-macro-parentheses -export-fixes /tmp/tmpemqa5szx/tmph_piz_ci.yaml -p=build /mnt/host/andrew/src/openbmc/libpldm/src/base.c
/mnt/host/andrew/src/openbmc/libpldm/build/../include/libpldm/base.h:137:21: error: macro argument should be enclosed in parentheses [bugprone-macro-parentheses,-warnings-as-errors]
^
()
```
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
Change-Id: Id12338430a328436d57d6560db1d3a1c53001b83
diff --git a/src/bios_table.c b/src/bios_table.c
index ef69dc2..c187ab1 100644
--- a/src/bios_table.c
+++ b/src/bios_table.c
@@ -11,19 +11,19 @@
#define POINTER_CHECK(pointer) \
do { \
- if (pointer == NULL) \
+ if ((pointer) == NULL) \
return PLDM_ERROR_INVALID_DATA; \
} while (0)
#define ATTR_TYPE_EXPECT(type, expected) \
do { \
- if (type != expected && type != (expected | 0x80)) \
+ if ((type) != (expected) && (type) != ((expected) | 0x80)) \
return PLDM_ERROR_INVALID_DATA; \
} while (0)
#define BUFFER_SIZE_EXPECT(current_size, expected_size) \
do { \
- if (current_size < expected_size) \
+ if ((current_size) < (expected_size)) \
return PLDM_ERROR_INVALID_LENGTH; \
} while (0)
@@ -203,7 +203,7 @@
#define ATTR_TYPE_EXPECT(type, expected) \
do { \
- if (type != expected && type != (expected | 0x80)) \
+ if ((type) != (expected) && (type) != ((expected) | 0x80)) \
return PLDM_ERROR_INVALID_DATA; \
} while (0)
@@ -560,7 +560,7 @@
size_t (*entry_length_handler)(const void *);
};
-#define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0]))
+#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
static const struct table_entry_length *find_table_entry_length_by_type(
uint8_t attr_type, const struct table_entry_length *handlers, size_t count)