[cfe-dev] clang defines __weak as if -fobjc-gc were specified

John McCall rjmccall at apple.com
Wed Jun 5 10:09:33 PDT 2013


On Jun 5, 2013, at 10:06 AM, John McCall <rjmccall at apple.com> wrote:
> On Jun 5, 2013, at 10:04 AM, Frank Rehwinkel <frankrehwinkel at gmail.com> wrote:
>> Thanks for asking.  I just want to make sure I understand your statement and question.  On Darwin, you've always had __weak defined as __attribute__((objc_gc(weak))), even when __strong is defined as <empty>?
>> 
>> If it is intentional, then I would say there is no specific problem.  We can put a comment into the header file for GNUstep to explain why __weak is being undef'ed before it is defined as <empty>.  (Without the undef, the build generates seemingly hundreds of warnings, obscuring other warnings that might be more meaningful.)
>> 
>> If it is unintentional, then a change to clang would obviate the additional code in the GNUstep header and save a few seconds every time someone went to read through the logic of those __strong and __weak macro definitions.
> 
> Why don't you just not #define __weak and __strong on Darwin?

Or, for that matter, if they're already defined?

Headers that randomly change macro state are somewhat evil;  among other things, they tend to introduce nasty order-of-inclusion bugs.

John.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20130605/2a969ccd/attachment.html>


More information about the cfe-dev mailing list