From owner-svn-src-all@FreeBSD.ORG Tue Jan 3 23:05:24 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0E09B1065670; Tue, 3 Jan 2012 23:05:24 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id F14FA8FC14; Tue, 3 Jan 2012 23:05:23 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q03N5NVe047349; Tue, 3 Jan 2012 23:05:23 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q03N5NWH047347; Tue, 3 Jan 2012 23:05:23 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <201201032305.q03N5NWH047347@svn.freebsd.org> From: Ed Schouten Date: Tue, 3 Jan 2012 23:05:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229437 - head/include X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Jan 2012 23:05:24 -0000 Author: ed Date: Tue Jan 3 23:05:23 2012 New Revision: 229437 URL: http://svn.freebsd.org/changeset/base/229437 Log: Simply disallow to be used in combination with C++. There is no way one could possibly use this header file in combination with C++ code. The problem is that in C11 the `noreturn' macro expands to the `_Noreturn' function specifier, while in C++11 the `noreturn' keyword is an attribute. So in C11 you have to write: noreturn void exit(int status); While in C++11 you have to write: [[noreturn]] void exit(int status); It is impossible to #define noreturn for C++ in such a way that it allows both conventions. By intentionally breaking this header this way, we prevent people from using this header in their C++<11 sources. Modified: head/include/stdnoreturn.h Modified: head/include/stdnoreturn.h ============================================================================== --- head/include/stdnoreturn.h Tue Jan 3 22:52:29 2012 (r229436) +++ head/include/stdnoreturn.h Tue Jan 3 23:05:23 2012 (r229437) @@ -26,11 +26,13 @@ * $FreeBSD$ */ +#ifdef __cplusplus +#error " cannot be used in combination with C++11." +#endif + #ifndef noreturn -#if !defined(__cplusplus) || __cplusplus < 201103L #include #define noreturn _Noreturn -#endif #endif /* !noreturn */