patches and low-level development discussion
 help / color / mirror / code / Atom feed
* [PATCH ucspi-vsock] Use C11 noreturn instead of GNU attribute extension
@ 2021-03-18  0:12 Alyssa Ross
  2021-03-18  0:15 ` Cole Helbling
  0 siblings, 1 reply; 3+ messages in thread
From: Alyssa Ross @ 2021-03-18  0:12 UTC (permalink / raw)
  To: devel

---
 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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH ucspi-vsock] Use C11 noreturn instead of GNU attribute extension
  2021-03-18  0:12 [PATCH ucspi-vsock] Use C11 noreturn instead of GNU attribute extension Alyssa Ross
@ 2021-03-18  0:15 ` Cole Helbling
  2021-03-18  0:42   ` Alyssa Ross
  0 siblings, 1 reply; 3+ messages in thread
From: Cole Helbling @ 2021-03-18  0:15 UTC (permalink / raw)
  To: Alyssa Ross, devel

On Wed Mar 17, 2021 at 5:12 PM PDT, Alyssa Ross wrote:
> ---
> log.h | 4 ++--
> vsockclient.c | 8 ++++----
> vsockserver.c | 6 +++---
> 3 files changed, 9 insertions(+), 9 deletions(-)

More portability (I assume)!

Reviewed-by: Cole Helbling <cole.e.helbling@outlook.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH ucspi-vsock] Use C11 noreturn instead of GNU attribute extension
  2021-03-18  0:15 ` Cole Helbling
@ 2021-03-18  0:42   ` Alyssa Ross
  0 siblings, 0 replies; 3+ messages in thread
From: Alyssa Ross @ 2021-03-18  0:42 UTC (permalink / raw)
  To: Cole Helbling; +Cc: devel

[-- Attachment #1: Type: text/plain, Size: 376 bytes --]

>> ---
>> 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. :)

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-03-18  0:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-18  0:12 [PATCH ucspi-vsock] Use C11 noreturn instead of GNU attribute extension Alyssa Ross
2021-03-18  0:15 ` Cole Helbling
2021-03-18  0:42   ` Alyssa Ross

Code repositories for project(s) associated with this public inbox

	https://spectrum-os.org/git/crosvm
	https://spectrum-os.org/git/doc
	https://spectrum-os.org/git/mktuntap
	https://spectrum-os.org/git/nixpkgs
	https://spectrum-os.org/git/spectrum
	https://spectrum-os.org/git/ucspi-vsock
	https://spectrum-os.org/git/www

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).