[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] openat-die: use _Noreturn markup
From: |
Eric Blake |
Subject: |
[PATCH] openat-die: use _Noreturn markup |
Date: |
Wed, 30 Jul 2014 15:25:27 -0600 |
Compiling coreutils.git on cygwin with gcc 4.8.3, I got:
lib/openat-die.c:34:1: error: function might be candidate for attribute
'noreturn' [-Werror=suggest-attribute=noreturn]
openat_save_fail (int errnum)
^
* modules/openat-die (Depends-on): Add stdnoreturn.
* lib/openat-die.c (openat_save_fail, openat_restore_fail): Mark
_Noreturn.
Signed-off-by: Eric Blake <address@hidden>
---
I noticed that the c-stack module does NOT depend on the stdnoreturn
modules, and that lib/c-stack.c does not include <stdnoreturn.h> but
DOES use _Noreturn. Therefore, I'm not 100% sure that this patch is
right, and if we need to touch up other modules that are using
_Noreturn improperly; vs. this patch being too complex and I could
just simplify it to be more like c-stack.c. I _think_ c-stack.c was
getting a guaranteed _Noreturn by virtue of (indirectly) getting
a definition from the stdlib module using snippet/_Noreturn.
ChangeLog | 7 +++++++
lib/openat-die.c | 5 +++--
modules/openat-die | 1 +
3 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 73a6c03..62025f2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2014-07-30 Eric Blake <address@hidden>
+
+ openat-die: use _Noreturn markup
+ * modules/openat-die (Depends-on): Add stdnoreturn.
+ * lib/openat-die.c (openat_save_fail, openat_restore_fail): Mark
+ _Noreturn.
+
2014-07-19 Eli Zaretskii <address@hidden>
localename: Enforce declarations before statements.
diff --git a/lib/openat-die.c b/lib/openat-die.c
index 02f1fd7..cfd65af 100644
--- a/lib/openat-die.c
+++ b/lib/openat-die.c
@@ -20,6 +20,7 @@
#include "openat.h"
#include <stdlib.h>
+#include <stdnoreturn.h>
#ifndef GNULIB_LIBPOSIX
# include "error.h"
@@ -30,7 +31,7 @@
#include "gettext.h"
#define _(msgid) gettext (msgid)
-void
+void _Noreturn
openat_save_fail (int errnum)
{
#ifndef GNULIB_LIBPOSIX
@@ -49,7 +50,7 @@ openat_save_fail (int errnum)
during an openat emulation. The caller must ensure that fd 2 is
not a just-opened fd, even when openat_safer is not in use. */
-void
+void _Noreturn
openat_restore_fail (int errnum)
{
#ifndef GNULIB_LIBPOSIX
diff --git a/modules/openat-die b/modules/openat-die
index 08bef77..c215f56 100644
--- a/modules/openat-die
+++ b/modules/openat-die
@@ -9,6 +9,7 @@ openat-h
error
exitfail
gettext-h
+stdnoreturn
configure.ac:
--
1.9.3
- [PATCH] openat-die: use _Noreturn markup,
Eric Blake <=