From owner-svn-src-all@FreeBSD.ORG Sun Jun 21 14:35:51 2015 Return-Path: Delivered-To: svn-src-all@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id D8366BA1 for ; Sun, 21 Jun 2015 14:35:51 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from nm7.bullet.mail.bf1.yahoo.com (nm7.bullet.mail.bf1.yahoo.com [98.139.212.166]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 87022CB for ; Sun, 21 Jun 2015 14:35:51 +0000 (UTC) (envelope-from pfg@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1434897344; bh=6kKyHkTCmrBom2vycpNAmCcnP2p3TtULgrQsNk+MP90=; h=Date:From:To:CC:Subject:References:In-Reply-To:From:Subject; b=m7xcS9jst9ucBszj3b1YLES64HCAURN2XpxiCbsIW/JgiCdoMxaTVCtgbXVnBniUUAYf6dNDdL6zYvmFxP7xZJZNeMX3xVf3XIYZwTGxPMt3DGo25Roo4ABon8S1jLY/M/UNUrKAAKsCY1Fw13OQXXsguebtZEO3VhcpQuG1VAtfsmautFoMhE3I98cK21bTiJYKiu+Qm4t35shA3rfn/g3z7mJT6wlRSm3ZpC7SMbU832XKW78vDI5JugPD9FTdPhlZFjy3GuubT55AdHh5dC99IAK8qUQezLg8HNEiYY1MxVk+nlGk/TaPeaeZHnHQpIf0v1K4kP6VAFujZawPrw== Received: from [98.139.170.180] by nm7.bullet.mail.bf1.yahoo.com with NNFMP; 21 Jun 2015 14:35:44 -0000 Received: from [98.139.213.15] by tm23.bullet.mail.bf1.yahoo.com with NNFMP; 21 Jun 2015 14:35:44 -0000 Received: from [127.0.0.1] by smtp115.mail.bf1.yahoo.com with NNFMP; 21 Jun 2015 14:35:44 -0000 X-Yahoo-Newman-Id: 603517.91100.bm@smtp115.mail.bf1.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: H_gJK4UVM1laKl9nzaMAoOxEcoCgKZtuZcNljluVZ3sGfqb 7z5d8COliqsh6ShxSCWhPBQK4gvPXn3hgKHV5AsaRVOndZDbB7l4FVq0Jgel zdkkSB3NkEZEVbxAJaMBQvMopYsrsJuwSY3nksqQyaKUZutechGk5Fx2wHfT oi2r9rsBO1snBLHkPFz_Wen5pKk5dZSi5m4z8hS4M7wb1C_hWHfwYUPIfK_N nFV0cpk116cF2BHLkdJeVSebKaX32Gt0C15JQRyv8.F0Ze_cbQps8hUj_.EW JnHBXJ.ENCEMykXsip800PESSgQr1iqkeWDjw5CX4Fvx90RUEpDRIRoOfls8 A7U70t0NVeIaLthZycYXgdUThlHEzHYyTWb6HujcLF5D_ClwAP3KWkjLdwlP vM.bxEQ8mKOI2_sdj6qe9ALVQXa5AKbfcCMRYSwScMTR_ZIhm.xPTcvly9DW fEFS6hkkbNQJL7XLmxOsL8DtdfkTQq2eLMc4L5VubfLfMIB07zzsL8WknmdG AQqL6rNUgDazTsDaUnrqJjuJnbO.JYPcx X-Yahoo-SMTP: xcjD0guswBAZaPPIbxpWwLcp9Unf Message-ID: <5586CBCE.2010608@FreeBSD.org> Date: Sun, 21 Jun 2015 09:35:58 -0500 From: Pedro Giffuni User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: Bruce Evans CC: Dimitry Andric , David Chisnall , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r268137 - head/sys/sys References: <201407020845.s628jRG5031824@svn.freebsd.org> <5BE3492F-86A0-4CE3-A27C-8DB5EB662C64@FreeBSD.org> <55842F16.5040608@FreeBSD.org> <20150620023835.N2562@besplex.bde.org> <55861046.4050501@FreeBSD.org> <20150621154332.U976@besplex.bde.org> In-Reply-To: <20150621154332.U976@besplex.bde.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 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: Sun, 21 Jun 2015 14:35:51 -0000 On 06/21/15 01:09, Bruce Evans wrote: > On Sat, 20 Jun 2015, Pedro Giffuni wrote: > >> On 06/19/15 12:23, Bruce Evans wrote: >>> On Fri, 19 Jun 2015, Dimitry Andric wrote: >>> >>>> On 19 Jun 2015, at 17:02, Pedro Giffuni 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. >>> >>> I probably pointed this out incorrectly to Pedro. >>> >>> All uses of _Noreturn are still broken, and also ugly. __dead2 is the >>> gcc-2 compatible version of the gcc-1 compatible macro __dead. It is >>> syntactically different from __dead and _Noreturn. It must be placed >>> after the function parameter list instead of in the function type >>> declarator because old versions of gcc only accept attributes there. >>> __dead and presumably _Noreturn must be placed in the function type >>> declarator. This is incompatible, and also uglier. >>> >> I was thinking that _Noreturn can be fixed for older compilers >> less disruptively. >> >> I haven't tested the attached patch the idea is to resurrect >> __dead and use it for _Noreturn. >> >>> Correct version with ugly declarations: >>> >>> __dead void >>> foo(void) __dead2; >>> >> >> With the patch we would use: >> >> __Noreturn void >> foo(void) _dead2; >> >> Which is still ugly but C11-ish. > > That asks for the same problems as defining __weak. > > Why not just don't use _Noreturn? It is an unimprovement on the gcc > attribute. The attribute works at the beginning or end, while Noreturn > only works at the end. As I see it, newer (C11) software is likely to use _Noreturn in their headers > I checked this: > > pts/23:bde@freefall:~/s> cc -O -S a.c -std=c11 > a.c:3:26: error: '_Noreturn' keyword must precede function declarator > _Noreturn void bar(void) _Noreturn; > ^ > > I also checked if __dead2 works at the beginning in gcc-2.95.4. It > does, but other headers are broken, so the support for gcc-2.95.4 in > sys/cdefs.h is almost useless: > > pts/23:bde@freefall:~/s> gcc295 -O -S a.c > In file included from /usr/include/machine/_types.h:6, > from /usr/include/sys/_types.h:33, > from /usr/include/x86/endian.h:37, > from /usr/include/machine/endian.h:6, > from /usr/include/sys/types.h:44, > from a.c:1: > /usr/include/x86/_types.h:161: syntax error before `__gnuc_va_list' > /usr/include/x86/_types.h:161: warning: data definition has no type or > storage c > lass > > Here is the broken part of x86/_types.h: > > %%% > #ifdef __GNUCLIKE_BUILTIN_VARARGS > typedef __builtin_va_list __va_list; /* internally known to gcc */ > #elif defined(lint) > typedef char * __va_list; /* pretend */ > #endif > #if defined(__GNUC_VA_LIST_COMPATIBILITY) && !defined(__GNUC_VA_LIST) \ > && !defined(__NO_GNUC_VA_LIST) > #define __GNUC_VA_LIST > meta: next is line 161: > typedef __va_list __gnuc_va_list; /* compatibility w/GNU headers*/ > #endif > %%% > > Despite (rather, because of) mounds of ifdefs to support old gcc, it > doesn't > actually work. > > is honestly broken. It knows that it depends on the gcc > feature > __GNUCLIKE_BUILTIN_STDARG, and aborts with an #error when it is not > available. > All of the _GNUCLIKE_BUILTIN_* macros for variadic args are controlled by > sys/cdefs.h. They are defined when the compiler is either gcc newer than > gcc-2.95 or is icc. > You have a point there: I tried to get the core team to at least deprecate gcc <= 2.8.1 and they didn't reach an agreement. :( I still think we could have older gcc work fine with _Noreturn and that would be a step forward. Pedro.