From patchwork Tue Jun 8 14:23:06 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [4.5] ObjC/C++ back-port of fix for PR35996 Date: Tue, 08 Jun 2010 04:23:06 -0000 From: IainS X-Patchwork-Id: 54985 Message-Id: To: GCC Patches Cc: Richard Guenther , Mike Stump 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 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 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 */ -/* { 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 */ -/* { 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"