Fix warning in cache_common.c (#2952)

This commit is contained in:
jhendersonHDF 2023-05-14 22:12:28 -05:00 committed by GitHub
parent 17750ea9c2
commit 977884a575
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -24,6 +24,7 @@
hbool_t pass = TRUE; /* set to false on error */
const char *failure_mssg = NULL;
static char tmp_msg_buf[256];
static test_entry_t *pico_entries = NULL, *orig_pico_entries = NULL;
static test_entry_t *nano_entries = NULL, *orig_nano_entries = NULL;
@ -2316,8 +2317,7 @@ verify_clean(void)
void
verify_entry_status(H5C_t *cache_ptr, int tag, int num_entries, struct expected_entry_status expected[])
{
char msg[256];
int i;
int i;
i = 0;
while ((pass) && (i < num_entries)) {
@ -2329,16 +2329,16 @@ verify_entry_status(H5C_t *cache_ptr, int tag, int num_entries, struct expected_
if ((!expected[i].in_cache) && ((expected[i].is_protected) || (expected[i].is_pinned))) {
pass = FALSE;
HDsnprintf(msg, sizeof(msg), "%d: Contradictory data in expected[%d].\n", tag, i);
failure_mssg = msg;
HDsnprintf(tmp_msg_buf, sizeof(tmp_msg_buf), "%d: Contradictory data in expected[%d].\n", tag, i);
failure_mssg = tmp_msg_buf;
}
if ((!expected[i].in_cache) && (expected[i].is_dirty) && (!entry_ptr->expunged)) {
pass = FALSE;
HDsnprintf(msg, sizeof(msg), "%d: expected[%d] specs non-expunged, dirty, non-resident.\n", tag,
i);
failure_mssg = msg;
HDsnprintf(tmp_msg_buf, sizeof(tmp_msg_buf),
"%d: expected[%d] specs non-expunged, dirty, non-resident.\n", tag, i);
failure_mssg = tmp_msg_buf;
}
if (pass) {
@ -2348,10 +2348,11 @@ verify_entry_status(H5C_t *cache_ptr, int tag, int num_entries, struct expected_
if (in_cache != expected[i].in_cache) {
pass = FALSE;
HDsnprintf(msg, sizeof(msg), "%d entry (%d, %d) in cache actual/expected = %d/%d.\n", tag,
HDsnprintf(tmp_msg_buf, sizeof(tmp_msg_buf),
"%d entry (%d, %d) in cache actual/expected = %d/%d.\n", tag,
(int)expected[i].entry_type, (int)expected[i].entry_index, (int)in_cache,
(int)expected[i].in_cache);
failure_mssg = msg;
failure_mssg = tmp_msg_buf;
}
}
@ -2360,10 +2361,11 @@ verify_entry_status(H5C_t *cache_ptr, int tag, int num_entries, struct expected_
if (entry_ptr->size != expected[i].size) {
pass = FALSE;
HDsnprintf(msg, sizeof(msg), "%d entry (%d, %d) size actual/expected = %ld/%ld.\n", tag,
HDsnprintf(tmp_msg_buf, sizeof(tmp_msg_buf),
"%d entry (%d, %d) size actual/expected = %ld/%ld.\n", tag,
(int)expected[i].entry_type, (int)expected[i].entry_index, (long)(entry_ptr->size),
(long)expected[i].size);
failure_mssg = msg;
failure_mssg = tmp_msg_buf;
}
}
@ -2372,10 +2374,11 @@ verify_entry_status(H5C_t *cache_ptr, int tag, int num_entries, struct expected_
if (entry_ptr->header.size != expected[i].size) {
pass = FALSE;
HDsnprintf(msg, sizeof(msg), "%d entry (%d, %d) header size actual/expected = %ld/%ld.\n",
tag, (int)expected[i].entry_type, (int)expected[i].entry_index,
HDsnprintf(tmp_msg_buf, sizeof(tmp_msg_buf),
"%d entry (%d, %d) header size actual/expected = %ld/%ld.\n", tag,
(int)expected[i].entry_type, (int)expected[i].entry_index,
(long)(entry_ptr->header.size), (long)expected[i].size);
failure_mssg = msg;
failure_mssg = tmp_msg_buf;
}
}
@ -2384,10 +2387,11 @@ verify_entry_status(H5C_t *cache_ptr, int tag, int num_entries, struct expected_
if (entry_ptr->at_main_addr != expected[i].at_main_addr) {
pass = FALSE;
HDsnprintf(msg, sizeof(msg), "%d entry (%d, %d) at main addr actual/expected = %d/%d.\n", tag,
HDsnprintf(tmp_msg_buf, sizeof(tmp_msg_buf),
"%d entry (%d, %d) at main addr actual/expected = %d/%d.\n", tag,
(int)expected[i].entry_type, (int)expected[i].entry_index,
(int)(entry_ptr->at_main_addr), (int)expected[i].at_main_addr);
failure_mssg = msg;
failure_mssg = tmp_msg_buf;
}
}
@ -2396,10 +2400,11 @@ verify_entry_status(H5C_t *cache_ptr, int tag, int num_entries, struct expected_
if (entry_ptr->is_dirty != expected[i].is_dirty) {
pass = FALSE;
HDsnprintf(msg, sizeof(msg), "%d entry (%d, %d) is_dirty actual/expected = %d/%d.\n", tag,
HDsnprintf(tmp_msg_buf, sizeof(tmp_msg_buf),
"%d entry (%d, %d) is_dirty actual/expected = %d/%d.\n", tag,
(int)expected[i].entry_type, (int)expected[i].entry_index,
(int)(entry_ptr->is_dirty), (int)expected[i].is_dirty);
failure_mssg = msg;
failure_mssg = tmp_msg_buf;
}
}
@ -2408,10 +2413,11 @@ verify_entry_status(H5C_t *cache_ptr, int tag, int num_entries, struct expected_
if (entry_ptr->header.is_dirty != expected[i].is_dirty) {
pass = FALSE;
HDsnprintf(msg, sizeof(msg), "%d entry (%d, %d) header is_dirty actual/expected = %d/%d.\n",
tag, (int)expected[i].entry_type, (int)expected[i].entry_index,
HDsnprintf(tmp_msg_buf, sizeof(tmp_msg_buf),
"%d entry (%d, %d) header is_dirty actual/expected = %d/%d.\n", tag,
(int)expected[i].entry_type, (int)expected[i].entry_index,
(int)(entry_ptr->header.is_dirty), (int)expected[i].is_dirty);
failure_mssg = msg;
failure_mssg = tmp_msg_buf;
}
}
@ -2420,10 +2426,11 @@ verify_entry_status(H5C_t *cache_ptr, int tag, int num_entries, struct expected_
if (entry_ptr->is_protected != expected[i].is_protected) {
pass = FALSE;
HDsnprintf(msg, sizeof(msg), "%d entry (%d, %d) is_protected actual/expected = %d/%d.\n", tag,
HDsnprintf(tmp_msg_buf, sizeof(tmp_msg_buf),
"%d entry (%d, %d) is_protected actual/expected = %d/%d.\n", tag,
(int)expected[i].entry_type, (int)expected[i].entry_index,
(int)(entry_ptr->is_protected), (int)expected[i].is_protected);
failure_mssg = msg;
failure_mssg = tmp_msg_buf;
}
}
@ -2432,11 +2439,11 @@ verify_entry_status(H5C_t *cache_ptr, int tag, int num_entries, struct expected_
if (entry_ptr->header.is_protected != expected[i].is_protected) {
pass = FALSE;
HDsnprintf(msg, sizeof(msg),
HDsnprintf(tmp_msg_buf, sizeof(tmp_msg_buf),
"%d entry (%d, %d) header is_protected actual/expected = %d/%d.\n", tag,
(int)expected[i].entry_type, (int)expected[i].entry_index,
(int)(entry_ptr->header.is_protected), (int)expected[i].is_protected);
failure_mssg = msg;
failure_mssg = tmp_msg_buf;
}
}
@ -2445,10 +2452,11 @@ verify_entry_status(H5C_t *cache_ptr, int tag, int num_entries, struct expected_
if (entry_ptr->is_pinned != expected[i].is_pinned) {
pass = FALSE;
HDsnprintf(msg, sizeof(msg), "%d entry (%d, %d) is_pinned actual/expected = %d/%d.\n", tag,
HDsnprintf(tmp_msg_buf, sizeof(tmp_msg_buf),
"%d entry (%d, %d) is_pinned actual/expected = %d/%d.\n", tag,
(int)expected[i].entry_type, (int)expected[i].entry_index,
(int)(entry_ptr->is_pinned), (int)expected[i].is_pinned);
failure_mssg = msg;
failure_mssg = tmp_msg_buf;
}
}
@ -2457,10 +2465,11 @@ verify_entry_status(H5C_t *cache_ptr, int tag, int num_entries, struct expected_
if (entry_ptr->is_corked != expected[i].is_corked) {
pass = FALSE;
HDsnprintf(msg, sizeof(msg), "%d entry (%d, %d) is_corked actual/expected = %d/%d.\n", tag,
HDsnprintf(tmp_msg_buf, sizeof(tmp_msg_buf),
"%d entry (%d, %d) is_corked actual/expected = %d/%d.\n", tag,
(int)expected[i].entry_type, (int)expected[i].entry_index,
(int)(entry_ptr->is_corked), (int)expected[i].is_corked);
failure_mssg = msg;
failure_mssg = tmp_msg_buf;
}
}
@ -2469,10 +2478,11 @@ verify_entry_status(H5C_t *cache_ptr, int tag, int num_entries, struct expected_
if (entry_ptr->header.is_pinned != expected[i].is_pinned) {
pass = FALSE;
HDsnprintf(msg, sizeof(msg), "%d entry (%d, %d) header is_pinned actual/expected = %d/%d.\n",
tag, (int)expected[i].entry_type, (int)expected[i].entry_index,
HDsnprintf(tmp_msg_buf, sizeof(tmp_msg_buf),
"%d entry (%d, %d) header is_pinned actual/expected = %d/%d.\n", tag,
(int)expected[i].entry_type, (int)expected[i].entry_index,
(int)(entry_ptr->header.is_pinned), (int)expected[i].is_pinned);
failure_mssg = msg;
failure_mssg = tmp_msg_buf;
}
}
@ -2483,13 +2493,13 @@ verify_entry_status(H5C_t *cache_ptr, int tag, int num_entries, struct expected_
(entry_ptr->destroyed != expected[i].destroyed)) {
pass = FALSE;
HDsnprintf(msg, sizeof(msg),
HDsnprintf(tmp_msg_buf, sizeof(tmp_msg_buf),
"%d entry (%d,%d) deserialized = %d(%d), serialized = %d(%d), dest = %d(%d)\n",
tag, (int)expected[i].entry_type, (int)expected[i].entry_index,
(int)(entry_ptr->deserialized), (int)(expected[i].deserialized),
(int)(entry_ptr->serialized), (int)(expected[i].serialized),
(int)(entry_ptr->destroyed), (int)(expected[i].destroyed));
failure_mssg = msg;
failure_mssg = tmp_msg_buf;
}
}
@ -2499,20 +2509,21 @@ verify_entry_status(H5C_t *cache_ptr, int tag, int num_entries, struct expected_
if (pass) {
if (entry_ptr->flush_dep_npar != expected[i].flush_dep_npar) {
pass = FALSE;
HDsnprintf(msg, sizeof(msg), "%d entry (%d, %d) flush_dep_npar actual/expected = %u/%u.\n",
tag, expected[i].entry_type, expected[i].entry_index, entry_ptr->flush_dep_npar,
HDsnprintf(tmp_msg_buf, sizeof(tmp_msg_buf),
"%d entry (%d, %d) flush_dep_npar actual/expected = %u/%u.\n", tag,
expected[i].entry_type, expected[i].entry_index, entry_ptr->flush_dep_npar,
expected[i].flush_dep_npar);
failure_mssg = msg;
failure_mssg = tmp_msg_buf;
} /* end if */
} /* end if */
if ((pass) && (in_cache)) {
if (entry_ptr->header.flush_dep_nparents != expected[i].flush_dep_npar) {
pass = FALSE;
HDsnprintf(msg, sizeof(msg),
HDsnprintf(tmp_msg_buf, sizeof(tmp_msg_buf),
"%d entry (%d, %d) header flush_dep_nparents actual/expected = %u/%u.\n", tag,
expected[i].entry_type, expected[i].entry_index,
entry_ptr->header.flush_dep_nparents, expected[i].flush_dep_npar);
failure_mssg = msg;
failure_mssg = tmp_msg_buf;
} /* end if */
} /* end if */
@ -2522,11 +2533,11 @@ verify_entry_status(H5C_t *cache_ptr, int tag, int num_entries, struct expected_
for (u = 0; u < entry_ptr->flush_dep_npar; u++) {
if (entry_ptr->flush_dep_par_type[u] != expected[i].flush_dep_par_type[u]) {
pass = FALSE;
HDsnprintf(msg, sizeof(msg),
HDsnprintf(tmp_msg_buf, sizeof(tmp_msg_buf),
"%d entry (%d, %d) flush_dep_par_type[%u] actual/expected = %d/%d.\n", tag,
expected[i].entry_type, expected[i].entry_index, u,
entry_ptr->flush_dep_par_type[u], expected[i].flush_dep_par_type[u]);
failure_mssg = msg;
failure_mssg = tmp_msg_buf;
} /* end if */
} /* end for */
} /* end if */
@ -2534,11 +2545,11 @@ verify_entry_status(H5C_t *cache_ptr, int tag, int num_entries, struct expected_
for (u = 0; u < entry_ptr->flush_dep_npar; u++) {
if (entry_ptr->flush_dep_par_idx[u] != expected[i].flush_dep_par_idx[u]) {
pass = FALSE;
HDsnprintf(msg, sizeof(msg),
HDsnprintf(tmp_msg_buf, sizeof(tmp_msg_buf),
"%d entry (%d, %d) flush_dep_par_idx[%u] actual/expected = %d/%d.\n", tag,
expected[i].entry_type, expected[i].entry_index, u,
entry_ptr->flush_dep_par_idx[u], expected[i].flush_dep_par_idx[u]);
failure_mssg = msg;
failure_mssg = tmp_msg_buf;
} /* end if */
} /* end for */
} /* end if */
@ -2547,40 +2558,41 @@ verify_entry_status(H5C_t *cache_ptr, int tag, int num_entries, struct expected_
if (pass) {
if (entry_ptr->flush_dep_nchd != expected[i].flush_dep_nchd) {
pass = FALSE;
HDsnprintf(msg, sizeof(msg), "%d entry (%d, %d) flush_dep_nchd actual/expected = %u/%u.\n",
tag, expected[i].entry_type, expected[i].entry_index, entry_ptr->flush_dep_nchd,
HDsnprintf(tmp_msg_buf, sizeof(tmp_msg_buf),
"%d entry (%d, %d) flush_dep_nchd actual/expected = %u/%u.\n", tag,
expected[i].entry_type, expected[i].entry_index, entry_ptr->flush_dep_nchd,
expected[i].flush_dep_nchd);
failure_mssg = msg;
failure_mssg = tmp_msg_buf;
} /* end if */
} /* end if */
if ((pass) && (in_cache)) {
if (entry_ptr->header.flush_dep_nchildren != expected[i].flush_dep_nchd) {
pass = FALSE;
HDsnprintf(msg, sizeof(msg),
HDsnprintf(tmp_msg_buf, sizeof(tmp_msg_buf),
"%d entry (%d, %d) header flush_dep_nchildren actual/expected = %u/%u.\n", tag,
expected[i].entry_type, expected[i].entry_index,
entry_ptr->header.flush_dep_nchildren, expected[i].flush_dep_nchd);
failure_mssg = msg;
failure_mssg = tmp_msg_buf;
} /* end if */
} /* end if */
if (pass) {
if (entry_ptr->flush_dep_ndirty_chd != expected[i].flush_dep_ndirty_chd) {
pass = FALSE;
HDsnprintf(msg, sizeof(msg),
HDsnprintf(tmp_msg_buf, sizeof(tmp_msg_buf),
"%d entry (%d, %d) flush_dep_ndirty_chd actual/expected = %u/%u.\n", tag,
expected[i].entry_type, expected[i].entry_index, entry_ptr->flush_dep_ndirty_chd,
expected[i].flush_dep_ndirty_chd);
failure_mssg = msg;
failure_mssg = tmp_msg_buf;
} /* end if */
} /* end if */
if ((pass) && (in_cache)) {
if (entry_ptr->header.flush_dep_ndirty_children != expected[i].flush_dep_ndirty_chd) {
pass = FALSE;
HDsnprintf(msg, sizeof(msg),
HDsnprintf(tmp_msg_buf, sizeof(tmp_msg_buf),
"%d entry (%d, %d) header flush_dep_ndirty_children actual/expected = %u/%u.\n",
tag, expected[i].entry_type, expected[i].entry_index,
entry_ptr->header.flush_dep_ndirty_children, expected[i].flush_dep_ndirty_chd);
failure_mssg = msg;
failure_mssg = tmp_msg_buf;
} /* end if */
} /* end if */
@ -2588,10 +2600,11 @@ verify_entry_status(H5C_t *cache_ptr, int tag, int num_entries, struct expected_
if (pass) {
if (expected[i].flush_order >= 0 && entry_ptr->flush_order != (unsigned)expected[i].flush_order) {
pass = FALSE;
HDsnprintf(msg, sizeof(msg), "%d entry (%d, %d) flush_order actual/expected = %u/%d.\n", tag,
HDsnprintf(tmp_msg_buf, sizeof(tmp_msg_buf),
"%d entry (%d, %d) flush_order actual/expected = %u/%d.\n", tag,
expected[i].entry_type, expected[i].entry_index, entry_ptr->flush_order,
expected[i].flush_order);
failure_mssg = msg;
failure_mssg = tmp_msg_buf;
} /* end if */
} /* end if */
@ -5228,7 +5241,6 @@ resize_configs_are_equal(const H5C_auto_size_ctl_t *a, const H5C_auto_size_ctl_t
void
validate_mdc_config(hid_t file_id, H5AC_cache_config_t *ext_config_ptr, hbool_t compare_init, int test_num)
{
static char msg[256];
H5F_t *file_ptr = NULL;
H5C_t *cache_ptr = NULL;
H5AC_cache_config_t scratch;
@ -5244,8 +5256,8 @@ validate_mdc_config(hid_t file_id, H5AC_cache_config_t *ext_config_ptr, hbool_t
if (file_ptr == NULL) {
pass = FALSE;
HDsnprintf(msg, (size_t)128, "Can't get file_ptr #%d.", test_num);
failure_mssg = msg;
HDsnprintf(tmp_msg_buf, sizeof(tmp_msg_buf), "Can't get file_ptr #%d.", test_num);
failure_mssg = tmp_msg_buf;
}
else {
@ -5260,8 +5272,8 @@ validate_mdc_config(hid_t file_id, H5AC_cache_config_t *ext_config_ptr, hbool_t
(cache_ptr->resize_ctl.version != H5C__CURR_AUTO_SIZE_CTL_VER)) {
pass = FALSE;
HDsnprintf(msg, (size_t)128, "Can't access cache resize_ctl #%d.", test_num);
failure_mssg = msg;
HDsnprintf(tmp_msg_buf, sizeof(tmp_msg_buf), "Can't access cache resize_ctl #%d.", test_num);
failure_mssg = tmp_msg_buf;
}
}
@ -5271,8 +5283,8 @@ validate_mdc_config(hid_t file_id, H5AC_cache_config_t *ext_config_ptr, hbool_t
if (!resize_configs_are_equal(&int_config, &cache_ptr->resize_ctl, compare_init)) {
pass = FALSE;
HDsnprintf(msg, (size_t)128, "Unexpected internal config #%d.", test_num);
failure_mssg = msg;
HDsnprintf(tmp_msg_buf, sizeof(tmp_msg_buf), "Unexpected internal config #%d.", test_num);
failure_mssg = tmp_msg_buf;
}
}
@ -5284,8 +5296,8 @@ validate_mdc_config(hid_t file_id, H5AC_cache_config_t *ext_config_ptr, hbool_t
if (H5Fget_mdc_config(file_id, &scratch) < 0) {
pass = FALSE;
HDsnprintf(msg, (size_t)128, "H5Fget_mdc_config() failed #%d.", test_num);
failure_mssg = msg;
HDsnprintf(tmp_msg_buf, sizeof(tmp_msg_buf), "H5Fget_mdc_config() failed #%d.", test_num);
failure_mssg = tmp_msg_buf;
}
}
@ -5305,8 +5317,8 @@ validate_mdc_config(hid_t file_id, H5AC_cache_config_t *ext_config_ptr, hbool_t
if (!CACHE_CONFIGS_EQUAL((*ext_config_ptr), scratch, FALSE, compare_init)) {
pass = FALSE;
HDsnprintf(msg, (size_t)128, "Unexpected external config #%d.", test_num);
failure_mssg = msg;
HDsnprintf(tmp_msg_buf, sizeof(tmp_msg_buf), "Unexpected external config #%d.", test_num);
failure_mssg = tmp_msg_buf;
}
}