freebsd-dev/cmd
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
..
arc_summary Removed Python 2 and Python 3.5- support 2022-01-13 09:51:12 -07:00
arcstat Removed Python 2 and Python 3.5- support 2022-01-13 09:51:12 -07:00
dbufstat Removed Python 2 and Python 3.5- support 2022-01-13 09:51:12 -07:00
fsck_zfs Add --enable=all to ShellCheck by default 2022-02-07 11:59:09 -08:00
mount_zfs Rename fallthrough to zfs_fallthrough 2022-02-15 08:58:59 -08:00
raidz_test Use _Noreturn (C11; GNU89) properly 2022-03-04 16:25:22 -08:00
vdev_id Remove basename(1). Clean up/shorten some coreutils pipelines 2021-11-11 13:27:37 -07:00
zdb log xattr=sa create/remove/update to ZIL 2022-02-22 13:06:43 -08:00
zed zed: Misc multipath autoreplace fixes 2022-02-24 11:43:39 -08:00
zfs Correct compilation errors reported by GCC 10/11 2022-02-20 19:20:00 -08:00
zfs_ids_to_path zfs_ids_to_path: print correct wrong values 2021-04-11 11:58:16 -07:00
zgenhostid Use _Noreturn (C11; GNU89) properly 2022-03-04 16:25:22 -08:00
zhack Use _Noreturn (C11; GNU89) properly 2022-03-04 16:25:22 -08:00
zinject zinject: cancel_one_handler: fix unused, remove argsused 2021-12-21 12:05:11 -08:00
zpool zpool: main: list: don't pay for printf 2022-03-04 12:08:34 -08:00
zpool_influxdb Correct compilation errors reported by GCC 10/11 2022-02-20 19:20:00 -08:00
zstream Fix erroneous zstreamdump warning 2022-02-26 11:24:27 -08:00
ztest Use _Noreturn (C11; GNU89) properly 2022-03-04 16:25:22 -08:00
zvol_id Add --enable-asan and --enable-ubsan switches 2022-02-03 14:35:38 -08:00
zvol_wait Add --enable=all to ShellCheck by default 2022-02-07 11:59:09 -08:00
Makefile.am Add --enable=all to ShellCheck by default 2022-02-07 11:59:09 -08:00