From db7f1a91def6bbaf72dd3e9ad31255efb0bf81ab Mon Sep 17 00:00:00 2001 From: Alejandro Colomar Date: Sat, 5 Mar 2022 01:25:22 +0100 Subject: Use _Noreturn (C11; GNU89) properly MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A function that returns with no value is a different thing from a function that doesn't return at all. Those are two orthogonal concepts, commonly confused. pthread_create(3) expects a pointer to a start routine that has a very precise prototype: void *(*start_routine)(void *); However, other thread functions, such as kernel ones, expect: void (*start_routine)(void *); Providing a different one is incorrect, and has only been working because the ABIs happen to produce a compatible function. We should use '_Noreturn void', since it's the natural type, and then provide a '_Noreturn void *' wrapper for pthread functions. For consistency, replace most cases of __NORETURN or __attribute__((noreturn)) by _Noreturn. _Noreturn is understood by -std=gnu89, so it should be safe to use everywhere. Ref: https://github.com/openzfs/zfs/pull/13110#discussion_r808450136 Ref: https://software.codidact.com/posts/285972 Reviewed-by: Brian Behlendorf Co-authored-by: Ahelenia ZiemiaƄska Signed-off-by: Alejandro Colomar Closes #13120 --- module/zfs/vdev_removal.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/zfs/vdev_removal.c') diff --git a/module/zfs/vdev_removal.c b/module/zfs/vdev_removal.c index 64be84edd..6887b2f52 100644 --- a/module/zfs/vdev_removal.c +++ b/module/zfs/vdev_removal.c @@ -140,7 +140,7 @@ int zfs_removal_suspend_progress = 0; #define VDEV_REMOVAL_ZAP_OBJS "lzap" -static void spa_vdev_remove_thread(void *arg); +static _Noreturn void spa_vdev_remove_thread(void *arg); static int spa_vdev_remove_cancel_impl(spa_t *spa); static void @@ -1589,7 +1589,7 @@ spa_remove_max_segment(spa_t *spa) * TXG have completed (see spa_txg_zio) and writes the new mappings to disk * (see vdev_mapping_sync()). */ -static void +static _Noreturn void spa_vdev_remove_thread(void *arg) { spa_t *spa = arg; -- cgit v1.2.3