From 7aac05a3420acad964bee0a626c6fa6b9b39ffb4 Mon Sep 17 00:00:00 2001 From: Jinshan Xiong Date: Wed, 4 Dec 2024 07:55:28 -0800 Subject: [PATCH] DAOS-16826 build: Fix compiling issues in gcc 14 (#15531) * Fix compiling issues in gcc 14 Signed-off-by: Jinshan Xiong Co-authored-by: Jeff Olivier Signed-off-by: Dalton Bohning --- site_scons/site_tools/compiler_setup.py | 1 + src/client/dfuse/dfuse_core.c | 2 +- src/gurt/telemetry.c | 2 +- src/placement/tests/benchmark_util.h | 3 +-- src/placement/tests/jump_map_place_obj.c | 2 +- src/utils/crt_launch/crt_launch.c | 4 ++-- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/site_scons/site_tools/compiler_setup.py b/site_scons/site_tools/compiler_setup.py index 9f25ccace719..abee049e3e71 100644 --- a/site_scons/site_tools/compiler_setup.py +++ b/site_scons/site_tools/compiler_setup.py @@ -4,6 +4,7 @@ DESIRED_FLAGS = ['-fstack-usage', '-Wno-sign-compare', + '-Wno-missing-attributes', '-Wno-unused-parameter', '-Wno-missing-field-initializers', '-Wno-implicit-fallthrough', diff --git a/src/client/dfuse/dfuse_core.c b/src/client/dfuse/dfuse_core.c index 6397b283e97a..0895451f9f85 100644 --- a/src/client/dfuse/dfuse_core.c +++ b/src/client/dfuse/dfuse_core.c @@ -1401,7 +1401,7 @@ dfuse_fs_start(struct dfuse_info *dfuse_info, struct dfuse_cont *dfs) * standard allocation macros */ args.allocated = 1; - args.argv = calloc(sizeof(*args.argv), args.argc); + args.argv = calloc(args.argc, sizeof(*args.argv)); if (!args.argv) D_GOTO(err, rc = -DER_NOMEM); diff --git a/src/gurt/telemetry.c b/src/gurt/telemetry.c index be7762184a93..be4b26bf0297 100644 --- a/src/gurt/telemetry.c +++ b/src/gurt/telemetry.c @@ -830,7 +830,7 @@ d_tm_init_with_name(int id, uint64_t mem_size, int flags, const char *root_name) { struct d_tm_shmem_hdr *new_shmem = NULL; key_t key; - int shmid; + int shmid = 0; int rc = DER_SUCCESS; if (root_name == NULL || strnlen(root_name, D_TM_MAX_NAME_LEN) == 0) { diff --git a/src/placement/tests/benchmark_util.h b/src/placement/tests/benchmark_util.h index f3ccc532a71f..9b325fb00b08 100644 --- a/src/placement/tests/benchmark_util.h +++ b/src/placement/tests/benchmark_util.h @@ -41,8 +41,7 @@ benchmark_alloc(void) { struct benchmark_handle *hdl; - hdl = (struct benchmark_handle *)calloc(sizeof(struct benchmark_handle), - 1); + hdl = (struct benchmark_handle *)calloc(1, sizeof(struct benchmark_handle)); if (hdl == NULL) return NULL; diff --git a/src/placement/tests/jump_map_place_obj.c b/src/placement/tests/jump_map_place_obj.c index 158292e2e34c..639d1cc8eb70 100644 --- a/src/placement/tests/jump_map_place_obj.c +++ b/src/placement/tests/jump_map_place_obj.c @@ -1441,7 +1441,7 @@ drain_target_same_shard_repeatedly_for_all_shards(void **state) int i; uint32_t shard_id = 0; uint32_t target; - uint32_t new_target; + uint32_t new_target = 0; for (shard_id = 0; shard_id < 18; shard_id++) { jtc_init_with_layout(&ctx, 18 * 2, 1, 4, OC_EC_16P2G1, diff --git a/src/utils/crt_launch/crt_launch.c b/src/utils/crt_launch/crt_launch.c index e2544d45c0b4..527aa5813996 100644 --- a/src/utils/crt_launch/crt_launch.c +++ b/src/utils/crt_launch/crt_launch.c @@ -281,13 +281,13 @@ int main(int argc, char **argv) par_rank(PAR_COMM_WORLD, &my_rank); par_size(PAR_COMM_WORLD, &world_size); - hostbuf = calloc(sizeof(*hostbuf), 1); + hostbuf = calloc(1, sizeof(*hostbuf)); if (!hostbuf) { D_ERROR("Failed to allocate hostbuf\n"); D_GOTO(exit, rc = -1); } - recv_buf = calloc(sizeof(struct host), world_size); + recv_buf = calloc(world_size, sizeof(*recv_buf)); if (!recv_buf) { D_ERROR("Failed to allocate recv_buf\n"); D_GOTO(exit, rc = -1);