clang-tidy: Fix readability-isolate-declaration diagnostics
For example:
```
/usr/bin/clang-tidy -checks=-*, readability-isolate-declaration -export-fixes /tmp/tmpcxe3bcdw/tmpedwgdqvr.yaml -p=build /mnt/host/andrew/src/openbmc/libpldm/src/bios_table.c
/mnt/host/andrew/src/openbmc/libpldm/build/../src/bios_table.c:1093:2: error: multiple declarations in a single statement reduces readability [readability-isolate-declaration,-warnings-as-errors]
const struct pldm_bios_attr_val_table_entry *tmp, *to_update = entry;
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/mnt/host/andrew/src/openbmc/libpldm/build/../src/bios_table.c:1094:2: error: multiple declarations in a single statement reduces readability [readability-isolate-declaration,-warnings-as-errors]
size_t buffer_length = *dest_length, copied_length = 0, length = 0;
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
Change-Id: Ib866f2b36944c77dafcfbd3484a442444466f973
diff --git a/src/bios_table.c b/src/bios_table.c
index e8a419c..e9e1f3f 100644
--- a/src/bios_table.c
+++ b/src/bios_table.c
@@ -1090,8 +1090,11 @@
src_table, src_length, PLDM_BIOS_ATTR_VAL_TABLE);
int rc = PLDM_SUCCESS;
- const struct pldm_bios_attr_val_table_entry *tmp, *to_update = entry;
- size_t buffer_length = *dest_length, copied_length = 0, length = 0;
+ const struct pldm_bios_attr_val_table_entry *tmp;
+ const struct pldm_bios_attr_val_table_entry *to_update = entry;
+ size_t buffer_length = *dest_length;
+ size_t copied_length = 0;
+ size_t length = 0;
while (!pldm_bios_table_iter_is_end(iter)) {
tmp = pldm_bios_table_iter_attr_value_entry_value(iter);
length = attr_value_table_entry_length(tmp);
diff --git a/src/platform.c b/src/platform.c
index 93ca6e9..844dc6f 100644
--- a/src/platform.c
+++ b/src/platform.c
@@ -85,8 +85,8 @@
size_t calculated_possible_states_size = 0;
{
- char *states_ptr = (char *)possible_states,
- *const begin_states_ptr = states_ptr;
+ char *states_ptr = (char *)possible_states;
+ char *const begin_states_ptr = states_ptr;
for (int i = 0; i < sensor->composite_sensor_count; ++i) {
struct state_sensor_possible_states *states =
diff --git a/tests/libpldm_bios_table_test.cpp b/tests/libpldm_bios_table_test.cpp
index d8df263..4cefa30 100644
--- a/tests/libpldm_bios_table_test.cpp
+++ b/tests/libpldm_bios_table_test.cpp
@@ -406,7 +406,9 @@
3, 0, 0, 0, 0, 0, 0, 0, /* defaut value */
};
- uint64_t lower, upper, def;
+ uint64_t lower;
+ uint64_t upper;
+ uint64_t def;
uint32_t scalar;
auto entry = reinterpret_cast<struct pldm_bios_attr_table_entry*>(
integerEntry.data());