[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
obstack: Fix a clang warning
From: |
Bruno Haible |
Subject: |
obstack: Fix a clang warning |
Date: |
Sun, 18 Oct 2020 14:37:50 +0200 |
User-agent: |
KMail/5.1.3 (Linux/4.4.0-189-generic; KDE/5.18.0; x86_64; ; ) |
Building a gnulib testdir for module 'obstack' with clang, I get this warning:
../../gllib/obstack.c:351:31: warning: incompatible pointer types initializing
'void (*)(void) __attribute__((noreturn))' with an expression of type 'void
(void)' [-Wincompatible-pointer-types]
__attribute_noreturn__ void (*obstack_alloc_failed_handler) (void)
^
1 warning generated.
The reason is that _Noreturn and __attribute__((noreturn)) are different:
_Noreturn does not apply to function pointers, but __attribute__((noreturn))
does. See lib/noreturn.h lines 67..69.
This patch fixes it.
2020-10-18 Bruno Haible <bruno@clisp.org>
obstack: Fix a clang warning.
* lib/obstack.c (print_and_abort): Mark as __attribute_noreturn__.
diff --git a/lib/obstack.c b/lib/obstack.c
index 6e82da0..e6475a2 100644
--- a/lib/obstack.c
+++ b/lib/obstack.c
@@ -326,7 +326,7 @@ int obstack_exit_failure = EXIT_FAILURE;
# include <libio/iolibio.h>
# endif
-static _Noreturn void
+static __attribute_noreturn__ void
print_and_abort (void)
{
/* Don't change any of these strings. Yes, it would be possible to add
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- obstack: Fix a clang warning,
Bruno Haible <=