diff mbox

[ObjC/Darwin,committed] partial merge of objc gc from branch.

Message ID D011D20B-E4F6-4762-B00F-641BB7A268C9@sandoe-acoustics.co.uk
State New
Headers show

Commit Message

Iain Sandoe Oct. 14, 2010, 1:47 p.m. UTC
Hi,
this is another piece of the jigsaw towards being able to parse NeXT  
headers on Darwin >= 9.

This shifts a parse error from a valid supported case to the  
unsupported case...
r165469
Iain

gcc:

	Partial merge of 'ObjC GC' from FSF apple 'trunk' branch.
	* config/darwin-c.c (darwin_cpp_builtins): Define __weak and
	__strong macros.
diff mbox

Patch

Index: gcc/config/darwin-c.c
===================================================================
--- gcc/config/darwin-c.c	(revision 165465)
+++ gcc/config/darwin-c.c	(working copy)
@@ -610,6 +610,22 @@  darwin_cpp_builtins (cpp_reader *pfile)
 
   builtin_define_with_value ("__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__",
 			     version_as_macro(), false);
+
+  /* Since we do not (at 4.6) support ObjC gc for the NeXT runtime, the
+     following will cause a syntax error if one tries to compile gc attributed
+     items.  However, without this, NeXT system headers cannot be parsed 
+     properly (on systems >= darwin 9).  */
+  if (flag_objc_gc)
+    {
+      builtin_define ("__strong=__attribute__((objc_gc(strong)))");
+      builtin_define ("__weak=__attribute__((objc_gc(weak)))");
+      builtin_define ("__OBJC_GC__");
+    }
+  else
+    {
+      builtin_define ("__strong=");
+      builtin_define ("__weak=");
+    }
 }
 
 /* Handle C family front-end options.  */