bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

clang and _Noreturn


From: Bruno Haible
Subject: clang and _Noreturn
Date: Sat, 22 Apr 2017 14:05:59 +0200
User-agent: KMail/5.1.3 (Linux/4.4.0-72-generic; KDE/5.18.0; x86_64; ; )

On Mac OS X 10.12 (with gcc -> clang), with CPPFLAGS=-Wall, I get this
warning:

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

This patch gets rid of the warning:

diff --git a/lib/obstack.c b/lib/obstack.c
index 1c7e069..49a846c 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


But I'm wondering: What is the semantic difference between _Noreturn and
__attribute_noreturn__?
In the "gcc -E" output, I can see that _Noreturn is present, i.e. is a keyword,
and __attribute_noreturn__ expands to __attribute__ ((__noreturn__)).

Bruno




reply via email to

[Prev in Thread] Current Thread [Next in Thread]