diff mbox

[4.5] ObjC/C++ back-port of fix for PR35996

Message ID DA9FC9B1-87A2-4362-A9E3-348B039AA9DF@sandoe-acoustics.co.uk
State New
Headers show

Commit Message

Iain Sandoe June 8, 2010, 2:23 p.m. UTC
tested on i686-apple-darwin9, i686-pc-linux-gnu,
OK for 4.5?

Iain

gcc/objc/ChangeLog:

  	Backport from mainline:
	PR objc/35996
	* objc-act.c (objc_init): Warn that -fobjc-gc is ignored for
	-fgnu-runtime and set flag_objc_gc to zero.

gcc/testsuite/ChangeLog:

	Backport from mainline:
	2010-04-07  Iain Sandoe <iains@gcc.gnu.org>
	PR objc/35996
	* objc.dg/objc-gc-4.m: Run for all targets, prune new warning.
	* obj-c++.dg/objc-gc-3.mm: Ditto.
	2010-04-30  Iain Sandoe <iains@gcc.gnu.org>

Comments

Iain Sandoe June 10, 2010, 1:08 p.m. UTC | #1
On 8 Jun 2010, at 15:23, IainS wrote:

> gcc/objc/ChangeLog:
>
> 	Backport from mainline:
> 	PR objc/35996
> 	* objc-act.c (objc_init): Warn that -fobjc-gc is ignored for
> 	-fgnu-runtime and set flag_objc_gc to zero.
>
> gcc/testsuite/ChangeLog:
>
> 	Backport from mainline:
> 	2010-04-07  Iain Sandoe <iains@gcc.gnu.org>
> 	PR objc/35996
> 	* objc.dg/objc-gc-4.m: Run for all targets, prune new warning.
> 	* obj-c++.dg/objc-gc-3.mm: Ditto.
> 	2010-04-30  Iain Sandoe <iains@gcc.gnu.org>
>
> <160426-4-5-PR35996-diff.txt>

committed to 4.5 branch as r160546.
Iain
Mike Stump June 10, 2010, 10:33 p.m. UTC | #2
On Jun 8, 2010, at 7:23 AM, IainS wrote:
> tested on i686-apple-darwin9, i686-pc-l
> inux-gnu,
> OK for 4.5?

Ok.
diff mbox

Patch

Index: gcc/objc/objc-act.c
===================================================================
--- gcc/objc/objc-act.c	(revision 160431)
+++ gcc/objc/objc-act.c	(working copy)
@@ -545,6 +545,13 @@  objc_init (void)
 	 structure-returning methods.  */
       default_constant_string_class_name = "NXConstantString";
       flag_typed_selectors = 1;
+      /* GNU runtime does not need the compiler to change code
+         in order to do GC. */
+      if (flag_objc_gc)
+	{
+	  warning_at (0, 0, "%<-fobjc-gc%> is ignored for %<-fgnu-runtime%>");
+	  flag_objc_gc=0;
+	}
     }
 
   init_objc ();
Index: gcc/testsuite/objc.dg/objc-gc-4.m
===================================================================
--- gcc/testsuite/objc.dg/objc-gc-4.m	(revision 160431)
+++ gcc/testsuite/objc.dg/objc-gc-4.m	(working copy)
@@ -2,8 +2,9 @@ 
    (where component references get rewritten).  */
 /* Contributed by Ziemowit Laski <zlaski@apple.com>  */
 
-/* { dg-do compile { target *-*-darwin* } } */
+/* { dg-do compile } */
 /* { dg-options "-fobjc-gc" } */
+/* { dg-prune-output "cc1obj: warning: '-fobjc-gc' is ignored for '-fgnu-runtime'" } */
 
 #include "../objc-obj-c++-shared/Object1.h"
 
Index: gcc/testsuite/obj-c++.dg/objc-gc-3.mm
===================================================================
--- gcc/testsuite/obj-c++.dg/objc-gc-3.mm	(revision 160431)
+++ gcc/testsuite/obj-c++.dg/objc-gc-3.mm	(working copy)
@@ -2,8 +2,9 @@ 
    (where component references get rewritten).  */
 /* Contributed by Ziemowit Laski <zlaski@apple.com>  */
 
-/* { dg-do compile { target *-*-darwin* } } */
+/* { dg-do compile } */
 /* { dg-options "-fobjc-gc" } */
+/* { dg-prune-output "cc1objplus: warning: '-fobjc-gc' is ignored for '-fgnu-runtime'" } */
 
 #include "../objc-obj-c++-shared/Object1.h"