zfs/lib
Alejandro Colomar db7f1a91de
Use _Noreturn (C11; GNU89) properly
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 <behlendorf1@llnl.gov>
Co-authored-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Closes #13120
2022-03-04 16:25:22 -08:00
..
libavl lib{efi,avl,share,tpool,zfs_core,zfsbootenv,zutil}: -fvisibility=hidden 2021-06-09 17:04:32 -07:00
libefi libefi: remove efi_type() 2022-01-18 14:40:43 -08:00
libicp module: icp: rip out modhash. Replace the one user with AVL 2022-02-15 16:24:59 -08:00
libnvpair libnvpair: json: suppress wchar_t >=0 warnings 2022-02-18 09:34:43 -08:00
libshare userspace: mark arguments used 2022-02-18 09:34:08 -08:00
libspl Use _Noreturn (C11; GNU89) properly 2022-03-04 16:25:22 -08:00
libtpool libtpool: -Wno-clobbered 2022-02-18 09:34:25 -08:00
libunicode cppcheck: integrete cppcheck 2021-01-26 16:12:26 -08:00
libuutil Use _Noreturn (C11; GNU89) properly 2022-03-04 16:25:22 -08:00
libzfs libzfs: util: don't check for allocation errors from infallible zfs_*() 2022-03-04 12:08:33 -08:00
libzfs_core Add `--enable-asan` and `--enable-ubsan` switches 2022-02-03 14:35:38 -08:00
libzfsbootenv Rename fallthrough to zfs_fallthrough 2022-02-15 08:58:59 -08:00
libzpool Use _Noreturn (C11; GNU89) properly 2022-03-04 16:25:22 -08:00
libzstd Explode zstd 1.4.5 into separate upstream files 2022-03-01 13:55:12 -08:00
libzutil zed: Misc multipath autoreplace fixes 2022-02-24 11:43:39 -08:00
Makefile.am Simplify and document OpenZFS library dependencies 2021-10-07 11:31:26 -06:00