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. 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
signature.asc
Description: Message signed with OpenPGP using GPGMail