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

jahanian fjahanian at apple.com
Mon Jun 3 08:18:58 PDT 2013


__weak is always defined for use in blocks. It is unfortunate though that it is def’ed to
objc_gc(weak) though. But for the purpose of use, it doesn’t really matter.

- Fariborz

On Jun 2, 2013, at 4:57 AM, Frank Rehwinkel <frankrehwinkel at gmail.com> wrote:

> This is with a clang built from trunk head a couple of days ago.
> 
> When clang is run without objc-gc mode,
> clang defines the symbol __weak as if -fobjc-gc were specified,
> clang defines the symbol __strong as empty.
> 
> Here are two commands, the first shows the clang symbols, 
> the second shows the warning when a source file wants to define
> __strong and __weak itself.
> 
> $ echo | clang -E - -dM | egrep "strong|weak"
> 
> #define __strong 
> #define __weak __attribute__((objc_gc(weak)))
> 
> $ clang -E - <<EOF
> #define __strong
> #define __weak
> EOF
> <stdin>:2:9: warning: '__weak' macro redefined
> #define __weak
>         ^
> <built-in>:158:9: note: previous definition is here
> #define __weak __attribute__((objc_gc(weak)))
>         ^
> 
> 1 warning generated.
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev

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


More information about the cfe-dev mailing list