Current-Users archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: __weak definition and problems with Obj-C
In article <552D446F.7000201%libero.it@localhost>,
Riccardo Mottola <riccardo.mottola%libero.it@localhost> wrote:
>Hi,
>
>christos%astron.com@localhost (Christos Zoulas) wrote:
>> I sympathize about __weak, but I don't understand what is it trying to
>> do here because I don't have the context in GSConfig.h. It looks to
>> me like it is part of a nested cpp if statement, which perhaps is going
>> the wrong way because it does not know how to handle NetBSD or it fails
>> to detect NetBSD. Nevertheless, defining symbols in the __ space should
>> be protected or avoided.
>>
>> Don't blame NetBSD though, because these are system headers...
>
>after some research, I carry the proof. __weak (and __strong) is an
>Objective-C keyword instroduced when Apple introduced garbage collection.
>Thus the change from 6.1.5 header to current header essentially breaks
>objective-c.
>
>Here it is not a matter of "GNUstep" or not, that part is runtime suppport.
>
>Check here:
>https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/ProgrammingWithObjectiveC/EncapsulatingData/EncapsulatingData.html
>
>
>I voice thus for changing NetBSD system header or you mine support for a
>language.
>
>What was wrong with the harmless?
>
>#define __weak_reference(sym) __attribute__((__weakref__(#sym)))
>
>Riccardo
Can you try changing <sys/cdefs_elf.h> like that:
--- cdefs_elf.h.orig 2015-04-14 14:48:37.000000000 -0400
+++ cdefs_elf.h 2015-04-14 14:49:04.000000000 -0400
@@ -64,11 +64,13 @@
#define __weak_extern(sym) \
__asm(".weak " _C_LABEL_STRING(#sym));
+#ifndef __OBJC__
#if __GNUC_PREREQ__(4, 0)
#define __weak __attribute__((__weak__))
#else
#define __weak
#endif
+#endif
#if __GNUC_PREREQ__(4, 0)
#define __weak_reference(sym) __attribute__((__weakref__(#sym)))
and see if it works for you?
christos
Home |
Main Index |
Thread Index |
Old Index