On 06/19/15 11:24, Dimitry Andric wrote:
On 19 Jun 2015, at 17:02, Pedro Giffuni <p...@freebsd.org> wrote:
On 19/06/2015 05:16 a.m., David Chisnall wrote:
I only just caught this (having seen the fallout from NetBSD doing the same
thing in a shipping release and the pain that it’s caused):
__weak is a reserved keyword in Objective-C, please pick another name for this.
This in cdefs.h makes it impossible to include any FreeBSD standard headers in
Objective-C programs (of which we have a couple of hundred in ports) if they
use any of the modern Objective-C language modes.
...
Closely related to this, we are redefining _Noreturn, which is a reserved
keyword in C11.
No, sys/cdefs.h has:
254 /*
255 * Keywords added in C11.
256 */
257
258 #if !defined(__STDC_VERSION__) || __STDC_VERSION__ < 201112L ||
defined(lint)
[...]
284 #if defined(__cplusplus) && __cplusplus >= 201103L
285 #define _Noreturn [[noreturn]]
286 #else
287 #define _Noreturn __dead2
288 #endif
[...]
320 #endif /* __STDC_VERSION__ || __STDC_VERSION__ < 201112L */
So the whole block redefining all the _Xxx identifiers is skipped for
C11 and higher.
Oh yes, I had missed line 258 (and 320), sorry for the false alarm.
FWIW, there is still a minor issue: older compilers aren't supposed
to take __dead2 at the beginning. When i was discussing the
attached patch, bde suggested we should resurrect __dead.
Pedro.
E.g.:
$ cpp -std=c99
#include <sys/cdefs.h>
_Noreturn void foo(void);
^D
# 1 "<stdin>"
# 1 "<built-in>" 1
# 1 "<built-in>" 3
# 306 "<built-in>" 3
# 1 "<command line>" 1
# 1 "<built-in>" 2
# 1 "<stdin>" 2
# 1 "/usr/include/sys/cdefs.h" 1 3 4
# 2 "<stdin>" 2
__attribute__((__noreturn__)) void foo(void);
$ cpp -std=c11
#include <sys/cdefs.h>
_Noreturn void foo(void);
^D
# 1 "<stdin>"
# 1 "<built-in>" 1
# 1 "<built-in>" 3
# 306 "<built-in>" 3
# 1 "<command line>" 1
# 1 "<built-in>" 2
# 1 "<stdin>" 2
# 1 "/usr/include/sys/cdefs.h" 1 3 4
# 2 "<stdin>" 2
_Noreturn void foo(void);
-Dimitry
Index: include/assert.h
===================================================================
--- include/assert.h (revision 284138)
+++ include/assert.h (working copy)
@@ -72,7 +72,7 @@
#endif
__BEGIN_DECLS
-void __assert(const char *, const char *, int, const char *) __dead2;
+_Noreturn void __assert(const char *, const char *, int, const char *);
__END_DECLS
#endif /* !_ASSERT_H_ */
Index: include/err.h
===================================================================
--- include/err.h (revision 284138)
+++ include/err.h (working copy)
@@ -44,21 +44,20 @@
#include <sys/_types.h>
__BEGIN_DECLS
-void err(int, const char *, ...) __dead2 __printf0like(2, 3);
-void verr(int, const char *, __va_list) __dead2 __printf0like(2, 0);
-void errc(int, int, const char *, ...) __dead2 __printf0like(3, 4);
-void verrc(int, int, const char *, __va_list) __dead2
- __printf0like(3, 0);
-void errx(int, const char *, ...) __dead2 __printf0like(2, 3);
-void verrx(int, const char *, __va_list) __dead2 __printf0like(2, 0);
-void warn(const char *, ...) __printf0like(1, 2);
-void vwarn(const char *, __va_list) __printf0like(1, 0);
-void warnc(int, const char *, ...) __printf0like(2, 3);
-void vwarnc(int, const char *, __va_list) __printf0like(2, 0);
-void warnx(const char *, ...) __printflike(1, 2);
-void vwarnx(const char *, __va_list) __printflike(1, 0);
-void err_set_file(void *);
-void err_set_exit(void (*)(int));
+_Noreturn void err(int, const char *, ...) __printf0like(2, 3);
+_Noreturn void verr(int, const char *, __va_list) __printf0like(2, 0);
+_Noreturn void errc(int, int, const char *, ...) __printf0like(3, 4);
+_Noreturn void verrc(int, int, const char *, __va_list) __printf0like(3, 0);
+_Noreturn void errx(int, const char *, ...) __printf0like(2, 3);
+_Noreturn void verrx(int, const char *, __va_list) __printf0like(2, 0);
+void warn(const char *, ...) __printf0like(1, 2);
+void vwarn(const char *, __va_list) __printf0like(1, 0);
+void warnc(int, const char *, ...) __printf0like(2, 3);
+void vwarnc(int, const char *, __va_list) __printf0like(2, 0);
+void warnx(const char *, ...) __printflike(1, 2);
+void vwarnx(const char *, __va_list) __printflike(1, 0);
+void err_set_file(void *);
+void err_set_exit(void (*)(int));
__END_DECLS
#endif /* !_ERR_H_ */
Index: include/pthread.h
===================================================================
--- include/pthread.h (revision 284138)
+++ include/pthread.h (working copy)
@@ -199,7 +199,7 @@
void *(*) (void *), void *);
int pthread_detach(pthread_t);
int pthread_equal(pthread_t, pthread_t);
-void pthread_exit(void *) __dead2;
+_Noreturn void pthread_exit(void *);
void *pthread_getspecific(pthread_key_t);
int pthread_getcpuclockid(pthread_t, clockid_t *);
int pthread_join(pthread_t, void **);
Index: include/setjmp.h
===================================================================
--- include/setjmp.h (revision 284138)
+++ include/setjmp.h (working copy)
@@ -45,17 +45,17 @@
__BEGIN_DECLS
#if __BSD_VISIBLE || __XSI_VISIBLE >= 600
-void _longjmp(jmp_buf, int) __dead2;
-int _setjmp(jmp_buf) __returns_twice;
+_Noreturn void _longjmp(jmp_buf, int);
+int _setjmp(jmp_buf) __returns_twice;
#endif
-void longjmp(jmp_buf, int) __dead2;
+_Noreturn void longjmp(jmp_buf, int);
#if __BSD_VISIBLE
-void longjmperror(void);
+void longjmperror(void);
#endif
-int setjmp(jmp_buf) __returns_twice;
+int setjmp(jmp_buf) __returns_twice;
#if __BSD_VISIBLE || __POSIX_VISIBLE || __XSI_VISIBLE
-void siglongjmp(sigjmp_buf, int) __dead2;
-int sigsetjmp(sigjmp_buf, int) __returns_twice;
+_Noreturn void siglongjmp(sigjmp_buf, int);
+int sigsetjmp(sigjmp_buf, int) __returns_twice;
#endif
__END_DECLS
Index: include/stdlib.h
===================================================================
--- include/stdlib.h (revision 284138)
+++ include/stdlib.h (working copy)
@@ -249,7 +249,7 @@
void *alloca(size_t);
#endif
-void abort2(const char *, int, void **) __dead2;
+_Noreturn void abort2(const char *, int, void **);
__uint32_t
arc4random(void);
void arc4random_addrandom(unsigned char *, int);
Index: include/unistd.h
===================================================================
--- include/unistd.h (revision 284138)
+++ include/unistd.h (working copy)
@@ -318,7 +318,7 @@
__BEGIN_DECLS
/* 1003.1-1990 */
-void _exit(int) __dead2;
+_Noreturn void _exit(int);
int access(const char *, int);
unsigned int alarm(unsigned int);
int chdir(const char *);
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"