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

Frank Rehwinkel frankrehwinkel at gmail.com
Sun Jun 2 04:57:42 PDT 2013


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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20130602/a8f40400/attachment.html>


More information about the cfe-dev mailing list