Date: Fri, 19 Jun 2015 15:22:49 +0100 From: David Chisnall <theraven@FreeBSD.org> To: Hans Petter Selasky <hps@selasky.org> Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r268137 - head/sys/sys Message-ID: <74BE6DD6-1C0F-4E59-8913-CFCE7DD744CB@FreeBSD.org> In-Reply-To: <55841BF3.8010205@selasky.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> <FE96503D-D821-4B7F-8AA5-7A80E4051CFA@FreeBSD.org> <55841BF3.8010205@selasky.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On 19 Jun 2015, at 14:41, Hans Petter Selasky <hps@selasky.org> 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 <stdio.h> __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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?74BE6DD6-1C0F-4E59-8913-CFCE7DD744CB>