[cfe-dev] Should clang be defining __weak when no ARC and no GC is enabled?

Frank Rehwinkel frankrehwinkel at gmail.com
Fri May 31 13:37:55 PDT 2013

Am using the latest clang, checked out today, built on OS X 10.8.  Am using
it to compile GNUstep.  The GNUstep header files implement their own macros
for __strong and __weak.  clang is being called with
-fobjc-runtime=gnustep-1.7 but without -fobjc-arc and without -fobjc-gc.

Why does clang have a builtin definition for __weak in this case?  Here is
an example of a call to clang and the typical warning message being emitted.

clang GSSSLHandle.m -c -MMD -MP -Wall -Wdeclaration-after-statement
-DGNUSTEP -DGNUSTEP_BASE_LIBRARY=1 -DGNUSTEP -Wdeprecated-objc-isa-usage
-DGNUSTEP_BASE_LIBRARY=1 -fno-strict-aliasing -fexceptions
-fobjc-exceptions -D_NATIVE_OBJC_EXCEPTIONS -pthread -dynamic -fno-common
-Wall -DGSWARN -DGSDIAGNOSE -Wno-import -g -O2 -fobjc-runtime=gnustep-1.7
-fobjc-runtime=gnustep-1.7 -integrated-as
-fconstant-string-class=NSConstantString -I. -I../Source/. -I../Source
-I../Headers -I. -I/Users/frank/local/GNUstep/standalone/include
-I/Users/frank/local/GNUstep/standalone/include -I/usr/include/libxml2
-I/Users/frank/local/GNUstep/standalone/include/ -o

.././GNUstepBase/GSConfig.h:403:13: warning: '__weak' macro redefined
#    define __weak
<built-in>:164:9: note: previous definition is here
#define __weak __attribute__((objc_gc(weak)))
1 warning generated.

Thank you,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20130531/f5680966/attachment.html>

More information about the cfe-dev mailing list