[PATCH ucspi-vsock] Use C11 noreturn instead of GNU attribute extension
--- log.h | 4 ++-- vsockclient.c | 8 ++++---- vsockserver.c | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/log.h b/log.h index a1b0c16..ea9e9cf 100644 --- a/log.h +++ b/log.h @@ -1,5 +1,5 @@ // SPDX-License-Identifier: GPL-2.0-or-later -// SPDX-FileCopyrightText: 2020 Alyssa Ross <hi@alyssa.is> +// SPDX-FileCopyrightText: 2020-2021 Alyssa Ross <hi@alyssa.is> #include <stdarg.h> @@ -13,7 +13,7 @@ extern enum verbosity verbosity; // Log an error message, followed by strerrno(errno), then exit with // status eval. -void diee(int eval, const char *fmt, ...) __attribute__((noreturn)); +_Noreturn void diee(int eval, const char *fmt, ...); // Log an error message. void elog(const char *fmt, ...); diff --git a/vsockclient.c b/vsockclient.c index ff8b7dc..91e1320 100644 --- a/vsockclient.c +++ b/vsockclient.c @@ -1,5 +1,5 @@ // SPDX-License-Identifier: GPL-2.0-or-later -// SPDX-FileCopyrightText: 2020 Alyssa Ross <hi@alyssa.is> +// SPDX-FileCopyrightText: 2020-2021 Alyssa Ross <hi@alyssa.is> #define _GNU_SOURCE @@ -7,9 +7,10 @@ #include <inttypes.h> #include <stdio.h> #include <stdlib.h> +#include <stdnoreturn.h> +#include <sys/socket.h> #include <sysexits.h> #include <unistd.h> -#include <sys/socket.h> #include <linux/vm_sockets.h> @@ -18,8 +19,7 @@ #include "util.h" #include "vsock.h" -static void ex_usage(void) __attribute__((noreturn)); -static void ex_usage(void) +noreturn static void ex_usage(void) { if (verbosity) fprintf(stderr, "Usage: %s [ -q | -Q | -v ] cid port prog...\n", diff --git a/vsockserver.c b/vsockserver.c index 2fb4f8e..0317cd4 100644 --- a/vsockserver.c +++ b/vsockserver.c @@ -1,5 +1,5 @@ // SPDX-License-Identifier: GPL-2.0-or-later -// SPDX-FileCopyrightText: 2020 Alyssa Ross <hi@alyssa.is> +// SPDX-FileCopyrightText: 2020-2021 Alyssa Ross <hi@alyssa.is> #define _GNU_SOURCE @@ -9,6 +9,7 @@ #include <stdbool.h> #include <stdio.h> #include <stdlib.h> +#include <stdnoreturn.h> #include <string.h> #include <sys/socket.h> #include <sys/wait.h> @@ -22,8 +23,7 @@ #include "util.h" #include "vsock.h" -static void ex_usage(void) __attribute__((noreturn)); -static void ex_usage(void) +noreturn static void ex_usage(void) { if (verbosity) fprintf(stderr, "Usage: %s [ -1 ] [ -q | -Q | -v ] cid port prog...\n", -- 2.30.0
--- log.h | 4 ++-- vsockclient.c | 8 ++++---- vsockserver.c | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-)
More portability (I assume)!
TBH, probably less, because everybody implements the GNU extensions anyway, and this is newer. But it sure looks nicer!
Reviewed-by: Cole Helbling <cole.e.helbling@outlook.com>
Committed as f778666. :)
participants (2)
-
Alyssa Ross -
Cole Helbling