Skip to content

Commit

Permalink
common: fix clang '-Wcast-function-type-strict' issue
Browse files Browse the repository at this point in the history
Signed-off-by: Tomasz Gromadzki <[email protected]>
  • Loading branch information
grom72 committed Jan 17, 2025
1 parent 724b20b commit 51f7cb2
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/libpmem/libpmem.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// SPDX-License-Identifier: BSD-3-Clause
/* Copyright 2014-2024, Intel Corporation */
/* Copyright 2025 Hewlett Packard Enterprise Development LP */

/*
* libpmem.c -- pmem entry points for libpmem
Expand Down Expand Up @@ -128,6 +129,10 @@ pmem_log_get_threshold(enum pmem_log_threshold threshold,
int
pmem_log_set_function(pmem_log_function *log_function)
{

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wcast-function-type"
int ret = core_log_set_function((core_log_function *)log_function);
#pragma GCC diagnostic pop
return core_log_error_translate(ret);
}
7 changes: 7 additions & 0 deletions src/libpmemobj/lane.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// SPDX-License-Identifier: BSD-3-Clause
/* Copyright 2015-2024, Intel Corporation */
/* Copyright 2025 Hewlett Packard Enterprise Development LP */

/*
* lane.c -- lane implementation
Expand Down Expand Up @@ -215,17 +216,23 @@ lane_init(PMEMobjpool *pop, struct lane *lane, struct lane_layout *layout)
if (lane->internal == NULL)
goto error_internal_new;

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wcast-function-type"
lane->external = operation_new((struct ulog *)&layout->external,
LANE_REDO_EXTERNAL_SIZE,
lane_redo_extend, (ulog_free_fn)pfree, &pop->p_ops,
LOG_TYPE_REDO);
#pragma GCC diagnostic pop
if (lane->external == NULL)
goto error_external_new;

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wcast-function-type"
lane->undo = operation_new((struct ulog *)&layout->undo,
LANE_UNDO_SIZE,
lane_undo_extend, (ulog_free_fn)pfree, &pop->p_ops,
LOG_TYPE_UNDO);
#pragma GCC diagnostic pop
if (lane->undo == NULL)
goto error_undo_new;

Expand Down
4 changes: 4 additions & 0 deletions src/libpmemobj/obj_log.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// SPDX-License-Identifier: BSD-3-Clause
/* Copyright 2024, Intel Corporation */
/* Copyright 2025 Hewlett Packard Enterprise Development LP */

/*
* obj_log.c -- the public interface to control the logging output
Expand Down Expand Up @@ -40,6 +41,9 @@ pmemobj_log_get_threshold(enum pmemobj_log_threshold threshold,
int
pmemobj_log_set_function(pmemobj_log_function *log_function)
{
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wcast-function-type"
int ret = core_log_set_function((core_log_function *)log_function);
#pragma GCC diagnostic pop
return core_log_error_translate(ret);
}

0 comments on commit 51f7cb2

Please sign in to comment.