Date: Sat, 20 Jun 2015 03:23:03 +1000 (EST) From: Bruce Evans <brde@optusnet.com.au> To: Dimitry Andric <dim@freebsd.org> Cc: Pedro Giffuni <pfg@freebsd.org>, David Chisnall <theraven@freebsd.org>, src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r268137 - head/sys/sys Message-ID: <20150620023835.N2562@besplex.bde.org> In-Reply-To: <D58BE060-870A-4D5E-AE46-D915D9CD6A0C@FreeBSD.org> References: <201407020845.s628jRG5031824@svn.freebsd.org> <5BE3492F-86A0-4CE3-A27C-8DB5EB662C64@FreeBSD.org> <55842F16.5040608@FreeBSD.org> <D58BE060-870A-4D5E-AE46-D915D9CD6A0C@FreeBSD.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, 19 Jun 2015, Dimitry Andric wrote: > On 19 Jun 2015, at 17:02, Pedro Giffuni <pfg@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=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 <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); 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 <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); 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-head@FreeBSD.ORG Fri Jun 19 17:35:00 2015 Return-Path: <owner-svn-src-head@FreeBSD.ORG> Delivered-To: svn-src-head@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" <sjg@FreeBSD.org> 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-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <http://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=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); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20150620023835.N2562>