From owner-svn-src-all@FreeBSD.ORG Fri Jun 19 17:23:20 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 C577AF3A; Fri, 19 Jun 2015 17:23:20 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail109.syd.optusnet.com.au (mail109.syd.optusnet.com.au [211.29.132.80]) by mx1.freebsd.org (Postfix) with ESMTP id 6FD58E15; Fri, 19 Jun 2015 17:23:19 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from c211-30-166-197.carlnfd1.nsw.optusnet.com.au (c211-30-166-197.carlnfd1.nsw.optusnet.com.au [211.30.166.197]) by mail109.syd.optusnet.com.au (Postfix) with ESMTPS id 5FDE7D65CC1; Sat, 20 Jun 2015 03:23:11 +1000 (AEST) Date: Sat, 20 Jun 2015 03:23:03 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Dimitry Andric cc: Pedro Giffuni , David Chisnall , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r268137 - head/sys/sys In-Reply-To: Message-ID: <20150620023835.N2562@besplex.bde.org> References: <201407020845.s628jRG5031824@svn.freebsd.org> <5BE3492F-86A0-4CE3-A27C-8DB5EB662C64@FreeBSD.org> <55842F16.5040608@FreeBSD.org> MIME-Version: 1.0 X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.1 cv=eZjABOwH c=1 sm=1 tr=0 a=KA6XNC2GZCFrdESI5ZmdjQ==:117 a=PO7r1zJSAAAA:8 a=JzwRw_2MAAAA:8 a=nlC_4_pT8q9DhB4Ho9EA:9 a=cz2ZRIgtxKwA:10 a=wJWlkF7cXJYA:10 a=c3-DdYJoA5YA:10 a=6I5d2MoRAAAA:8 a=NodfLX1Nme-3sEpuAS0A:9 a=45ClL6m2LaAA:10 Content-Type: TEXT/PLAIN; charset=X-UNKNOWN; format=flowed Content-Transfer-Encoding: QUOTED-PRINTABLE X-Content-Filtered-By: Mailman/MimeDel 2.1.20 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: Fri, 19 Jun 2015 17:23:20 -0000 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=E2=80=99s 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 stand= ard headers in Objective-C programs (of which we have a couple of hundred i= n ports) if they use any of the modern Objective-C language modes. > ... >> Closely related to this, we are redefining _Noreturn, which is a reserve= d keyword in C11. > > No, sys/cdefs.h has: > > 254 /* > 255 * Keywords added in C11. > 256 */ > 257 > 258 #if !defined(__STDC_VERSION__) || __STDC_VERSION__ < 201112L || de= fined(lint) > [...] > 284 #if defined(__cplusplus) && __cplusplus >=3D 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. > E.g.: > > $ cpp -std=3Dc99 > #include > _Noreturn void foo(void); > ^D > # 1 "" > # 1 "" 1 > # 1 "" 3 > # 306 "" 3 > # 1 "" 1 > # 1 "" 2 > # 1 "" 2 > # 1 "/usr/include/sys/cdefs.h" 1 3 4 > # 2 "" 2 > __attribute__((__noreturn__)) void foo(void); Syntax error with older versions of gcc that cdefs.h is supposed to support= =2E Thee versions that don't support attributes in the declarator also don't support c99, so the order can be anything with them, but this doesn't simplify fixing the problem -- you still need massive ifdefs or ugly declarations. > $ cpp -std=3Dc11 > #include > _Noreturn void foo(void); > ^D > # 1 "" > # 1 "" 1 > # 1 "" 3 > # 306 "" 3 > # 1 "" 1 > # 1 "" 2 > # 1 "" 2 > # 1 "/usr/include/sys/cdefs.h" 1 3 4 > # 2 "" 2 > _Noreturn void foo(void); Correct version with ugly declarations: __dead void =09foo(void) __dead2; where: 1. __dead is the gcc-1 compatible macro restored to handle the different spelling in C11. Direct spellings should not be used, since they cause namespace bugs like the current ones for __weak. 2. __dead2 is the gcc-2 compatible macro. It also works for later gcc's and clang, perhaps even in C11. 3. __dead is defined as follows: a. for gcc-1, either leave it undefined (to keep its current behaviour of breaking any use of it), or define as its gcc-1 value again. b. for C11, define it as _Noreturn c. otherwise, define it as empty 4. __dead2 is defined the same as now. Hopefully it is just redundant of __dead is defined as _Noreturn for C11. 5. the style of the above is taken from 4.4BSD-Lite2, which still has __dea= d and still defines it as __volatile and still has almost no support for gcc-2. From Lite2 stdlib.h: __dead void =09 abort __P((void)); =2E... __dead void =09 exit __P((int)); Putting __dead first messes up the formatting by requiring an extra line to keep the function names lined up. When I cleaned this up in FreeBSD, the first stage was to add __dead2 while keeping __dead in 1994, the second stage was to remove __dead from everywhere in the source tree except cdefs.h in 1996, and the "final" stage was to remove the definition of __dead from cdefs.h in 1998. The current breakage shows that this was not even the final stage. Bruce From owner-svn-src-all@FreeBSD.ORG Fri Jun 19 17:35:00 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 9B3A4293; Fri, 19 Jun 2015 17:35:00 +0000 (UTC) (envelope-from sjg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8981E113; Fri, 19 Jun 2015 17:35:00 +0000 (UTC) (envelope-from sjg@FreeBSD.org) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t5JHZ0xL054817; Fri, 19 Jun 2015 17:35:00 GMT (envelope-from sjg@FreeBSD.org) Received: (from sjg@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t5JHZ0IF054816; Fri, 19 Jun 2015 17:35:00 GMT (envelope-from sjg@FreeBSD.org) Message-Id: <201506191735.t5JHZ0IF054816@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: sjg set sender to sjg@FreeBSD.org using -f From: "Simon J. Gerraty" Date: Fri, 19 Jun 2015 17:35:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r284601 - head/sys/dev/filemon X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 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: Fri, 19 Jun 2015 17:35:00 -0000 Author: sjg Date: Fri Jun 19 17:34:59 2015 New Revision: 284601 URL: https://svnweb.freebsd.org/changeset/base/284601 Log: sx_sunlock for sx_slock Modified: head/sys/dev/filemon/filemon_wrapper.c Modified: head/sys/dev/filemon/filemon_wrapper.c ============================================================================== --- head/sys/dev/filemon/filemon_wrapper.c Fri Jun 19 17:19:20 2015 (r284600) +++ head/sys/dev/filemon/filemon_wrapper.c Fri Jun 19 17:34:59 2015 (r284601) @@ -90,13 +90,13 @@ filemon_pid_check(struct proc *p) while (p != initproc) { TAILQ_FOREACH(filemon, &filemons_inuse, link) { if (p->p_pid == filemon->pid) { - sx_xunlock(&proctree_lock); + sx_sunlock(&proctree_lock); return (filemon); } } p = proc_realparent(p); } - sx_xunlock(&proctree_lock); + sx_sunlock(&proctree_lock); return (NULL); }