From owner-svn-src-head@FreeBSD.ORG Fri Jun 19 14:22:54 2015 Return-Path: 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 DD641CBE; Fri, 19 Jun 2015 14:22:53 +0000 (UTC) (envelope-from theraven@FreeBSD.org) Received: from theravensnest.org (theraven.freebsd.your.org [216.14.102.27]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "cloud.theravensnest.org", Issuer "StartCom Class 1 Primary Intermediate Server CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 9C776ADF; Fri, 19 Jun 2015 14:22:53 +0000 (UTC) (envelope-from theraven@FreeBSD.org) Received: from c124.sec.cl.cam.ac.uk (c124.sec.cl.cam.ac.uk [128.232.18.124]) (authenticated bits=0) by theravensnest.org (8.15.1/8.15.1) with ESMTPSA id t5JEMo4t067462 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 19 Jun 2015 14:22:51 GMT (envelope-from theraven@FreeBSD.org) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 8.2 \(2098\)) Subject: Re: svn commit: r268137 - head/sys/sys From: David Chisnall In-Reply-To: <55841BF3.8010205@selasky.org> Date: Fri, 19 Jun 2015 15:22:49 +0100 Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: <74BE6DD6-1C0F-4E59-8913-CFCE7DD744CB@FreeBSD.org> References: <201407020845.s628jRG5031824@svn.freebsd.org> <5BE3492F-86A0-4CE3-A27C-8DB5EB662C64@FreeBSD.org> <5583F2C9.1030409@selasky.org> <1EB851FC-CA78-4A7B-BE5D-4F050C61A14C@FreeBSD.org> <558403C4.4040500@selasky.org> <55841BF3.8010205@selasky.org> To: Hans Petter Selasky X-Mailer: Apple Mail (2.2098) 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Jun 2015 14:22:54 -0000 On 19 Jun 2015, at 14:41, Hans Petter Selasky wrote: >=20 > On 06/19/15 14:54, David Chisnall wrote: >> I definitely know of people building out-of-ports programs on FreeBSD = whose code you have just broken (including myself, > > though I do Objective-C stuff on 10, so haven=E2=80=99t yet = encountered the breakage). >=20 > Hi David, >=20 > r268137 has been in 11-current for a long time (11 months) and was = MFC'ed to 10-stable not long ago.=20 We have not yet done a release from 10 with this breakage, so I=E2=80=99ve= not yet seen it in the wild. Most people doing Objective-C development = do not develop on FreeBSD -HEAD. The majority develop on OS X and port = to FreeBSD releases. I am anxious to get this fixed before the next = 10.x release is out so that we are not shipping something that is going = to force people wanting to ship Objective-C code to have to have = FreeBSD-specific work-arounds for the next few years. > I understand that including "sys/cdefs.h" breaks objective C-code in = the kernel, but we don't have any such code, do we? You fundamentally misunderstand what cdefs.h is. It is not a kernel = header, it is the header that provides all of the definitions required = for all system headers. All libc headers expect cdefs.h to be included = (either directly or indirectly) before anything else in the file. > Multiple systems are defining __weak for C and C++ : >=20 > Linux: >> include/linux/compiler-gcc.h: > #define __weak __attribute__((weak)) >=20 > NetBSD: > > sys/cdefs_elf.h > #define __weak __attribute__((__weak__)) >=20 > FreeBSD: > > sys/cdefs.h > #define __weak __attribute__((__weak__)) NetBSD is the only system that I=E2=80=99m aware of that has actually = shipped this, and it broke a lot of things. Spot the odd one out: $ cat tmp.m #include __weak id x; # FreeBSD 10.1: $ cc -E tmp.m -fobjc-arc | tail -1 __attribute__((objc_ownership(weak))) id x; # Linux $ clang -E tmp.m -fobjc-runtime=3Dgnustep-1.7 -fobjc-arc | tail -1 __attribute__((objc_ownership(weak))) id x; # FreeBSD Head: $ cc -E tmp.m -fobjc-arc | tail -1 __attribute__((__weak__)) id x; The worst thing about this is that you have broken it so that it = silently does the wrong thing, rather than raising a warning with the = default warnings enabled. >> Portable code should not rely on anything in cdefs.h. >=20 > Right - can you explain why it is ending up in your ObjC code? Because it=E2=80=99s in cdefs.h, which is included by *every single = userspace C header*. cdefs.h must work with all C-family languages. David