From 4c5953abfd49429de3ee8174790e2aa4faed696c Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Tue, 13 Jun 2023 09:49:35 -0500 Subject: [PATCH 1/4] clang-tidy clang-analyzer-core issues addressed src/H5system.c:1293:13: warning: Dereference of null pointer [clang-analyzer-core.NullDereference] src/H5trace.c:4048:17: warning: Passed-by-value struct argument contains uninitialized data (e.g., via the field chain: 'initial.user') [clang-analyzer-core.CallAndMessage] --- src/H5system.c | 2 +- src/H5trace.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/H5system.c b/src/H5system.c index a13a5e89f04..e80b710933c 100644 --- a/src/H5system.c +++ b/src/H5system.c @@ -1290,7 +1290,7 @@ H5_get_option(int argc, const char *const *argv, const char *opts, const struct } } - if (l_opts[i].name == NULL) { + if (l_opts && l_opts[i].name == NULL) { /* exhausted all of the l_opts we have and still didn't match */ if (H5_opterr) HDfprintf(stderr, "%s: unknown option \"%s\"\n", argv[0], arg); diff --git a/src/H5trace.c b/src/H5trace.c index 2cf40d8ff51..df1ee23c96c 100644 --- a/src/H5trace.c +++ b/src/H5trace.c @@ -3984,7 +3984,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) hssize_t i; FILE *out = H5_debug_g.trace; static hbool_t is_first_invocation = TRUE; - H5_timer_t function_timer; + H5_timer_t function_timer = {0.0, 0.0, 0.0}; H5_timevals_t function_times = {0.0, 0.0, 0.0}; static H5_timer_t running_timer; H5_timevals_t running_times; From ee87ed2f7ccea3b4c9cef6d8338c0e2aca53ce37 Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 13 Jun 2023 14:52:01 +0000 Subject: [PATCH 2/4] Committing clang-format changes --- src/H5trace.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/H5trace.c b/src/H5trace.c index df1ee23c96c..f22f48237aa 100644 --- a/src/H5trace.c +++ b/src/H5trace.c @@ -3984,8 +3984,8 @@ H5_trace(const double *returning, const char *func, const char *type, ...) hssize_t i; FILE *out = H5_debug_g.trace; static hbool_t is_first_invocation = TRUE; - H5_timer_t function_timer = {0.0, 0.0, 0.0}; - H5_timevals_t function_times = {0.0, 0.0, 0.0}; + H5_timer_t function_timer = {0.0, 0.0, 0.0}; + H5_timevals_t function_times = {0.0, 0.0, 0.0}; static H5_timer_t running_timer; H5_timevals_t running_times; static int current_depth = 0; From ea29f7dade66d0e9b631bd7045404f77e172df82 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Tue, 13 Jun 2023 09:58:15 -0500 Subject: [PATCH 3/4] Remove dead code src/H5trace.c:285:13: warning: Value stored to 'argname' is never read [clang-analyzer-deadcode.DeadStores] --- src/H5trace.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/H5trace.c b/src/H5trace.c index f22f48237aa..019be2b9a96 100644 --- a/src/H5trace.c +++ b/src/H5trace.c @@ -281,8 +281,6 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) argname = HDva_arg(ap, char *); if (argname) H5RS_asprintf_cat(rs, "%s%s=", argno ? ", " : "", argname); - else - argname = ""; /* A pointer/array */ if (ptr) { From 716eb0e90f5a3a5ce05aff2ef668157ba41f5a4c Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Tue, 13 Jun 2023 10:23:50 -0500 Subject: [PATCH 4/4] Correct initialization --- src/H5trace.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/H5trace.c b/src/H5trace.c index 019be2b9a96..521bd30c6ac 100644 --- a/src/H5trace.c +++ b/src/H5trace.c @@ -3982,7 +3982,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) hssize_t i; FILE *out = H5_debug_g.trace; static hbool_t is_first_invocation = TRUE; - H5_timer_t function_timer = {0.0, 0.0, 0.0}; + H5_timer_t function_timer = {{0.0, 0.0, 0.0}, {0.0, 0.0, 0.0}, {0.0, 0.0, 0.0}, FALSE}; H5_timevals_t function_times = {0.0, 0.0, 0.0}; static H5_timer_t running_timer; H5_timevals_t running_times;