[gcc r11-4971] Objective-C [3/3] : Implement Wobjc-root-class [PR77404].

Iain D Sandoe iains@gcc.gnu.org
Fri Nov 13 10:41:18 GMT 2020


https://gcc.gnu.org/g:64f191b152cb1df0e108a91880cb415e413bad56

commit r11-4971-g64f191b152cb1df0e108a91880cb415e413bad56
Author: Iain Sandoe <iain@sandoe.co.uk>
Date:   Sun Oct 25 09:54:21 2020 +0000

    Objective-C [3/3] : Implement Wobjc-root-class [PR77404].
    
    Add Wno-objc-root-class where needed to the objective-c++
    tests.
    
    gcc/testsuite/ChangeLog:
    
            PR objc/77404
            * obj-c++.dg/attributes/class-attribute-1.mm:
            Add Wno-objc-root-class.
            * obj-c++.dg/attributes/class-attribute-2.mm: Likewise.
            * obj-c++.dg/attributes/class-attribute-3.mm: Likewise.
            * obj-c++.dg/attributes/method-deprecated-1.mm: Likewise.
            * obj-c++.dg/attributes/method-deprecated-2.mm: Likewise.
            * obj-c++.dg/attributes/method-deprecated-3.mm: Likewise.
            * obj-c++.dg/attributes/method-format-1.mm: Likewise.
            * obj-c++.dg/attributes/method-nonnull-1.mm: Likewise.
            * obj-c++.dg/attributes/method-noreturn-1.mm: Likewise.
            * obj-c++.dg/attributes/method-sentinel-1.mm: Likewise.
            * obj-c++.dg/attributes/nsobject-01.mm: Likewise.
            * obj-c++.dg/attributes/parameter-attribute-1.mm: Likewise.
            * obj-c++.dg/attributes/parameter-attribute-2.mm: Likewise.
            * obj-c++.dg/attributes/proto-attribute-1.mm: Likewise.
            * obj-c++.dg/attributes/proto-attribute-3.mm: Likewise.
            * obj-c++.dg/attributes/proto-attribute-4.mm: Likewise.
            * obj-c++.dg/attributes/unused-parameter-1.mm: Likewise.
            * obj-c++.dg/bad-receiver-type.mm: Likewise.
            * obj-c++.dg/bitfield-3.mm: Likewise.
            * obj-c++.dg/bitfield-5.mm: Likewise.
            * obj-c++.dg/class-extension-1.mm: Likewise.
            * obj-c++.dg/class-extension-2.mm: Likewise.
            * obj-c++.dg/class-extension-3.mm: Likewise.
            * obj-c++.dg/class-extension-4.mm: Likewise.
            * obj-c++.dg/class-protocol-1.mm: Likewise.
            * obj-c++.dg/comp-types-1.mm: Likewise.
            * obj-c++.dg/comp-types-10.mm: Likewise.
            * obj-c++.dg/comp-types-2.mm: Likewise.
            * obj-c++.dg/comp-types-3.mm: Likewise.
            * obj-c++.dg/comp-types-5.mm: Likewise.
            * obj-c++.dg/comp-types-6.mm: Likewise.
            * obj-c++.dg/comp-types-7.mm: Likewise.
            * obj-c++.dg/comp-types-8.mm: Likewise.
            * obj-c++.dg/demangle-2.mm: Likewise.
            * obj-c++.dg/demangle-3.mm: Likewise.
            * obj-c++.dg/duplicate-class-1.mm: Likewise.
            * obj-c++.dg/encode-1-next.mm: Likewise.
            * obj-c++.dg/encode-1.mm: Likewise.
            * obj-c++.dg/enhanced-proto-2.mm: Likewise.
            * obj-c++.dg/exceptions-1.mm: Likewise.
            * obj-c++.dg/exceptions-3.mm: Likewise.
            * obj-c++.dg/exceptions-4.mm: Likewise.
            * obj-c++.dg/exceptions-5.mm: Likewise.
            * obj-c++.dg/extern-c-1.mm: Likewise.
            * obj-c++.dg/fobjc-std-1.mm: Likewise.
            * obj-c++.dg/gnu-api-2-class-meta.mm: Likewise.
            * obj-c++.dg/gnu-api-2-class.mm: Likewise.
            * obj-c++.dg/gnu-api-2-ivar.mm: Likewise.
            * obj-c++.dg/gnu-api-2-method.mm: Likewise.
            * obj-c++.dg/gnu-api-2-objc.mm: Likewise.
            * obj-c++.dg/gnu-api-2-objc_msg_lookup.mm: Likewise.
            * obj-c++.dg/gnu-api-2-object.mm: Likewise.
            * obj-c++.dg/gnu-api-2-property.mm: Likewise.
            * obj-c++.dg/gnu-api-2-protocol.mm: Likewise.
            * obj-c++.dg/gnu-api-2-resolve-method.mm: Likewise.
            * obj-c++.dg/gnu-api-2-sel.mm: Likewise.
            * obj-c++.dg/invalid-method-2.mm: Likewise.
            * obj-c++.dg/ivar-invalid-type-1.mm: Likewise.
            * obj-c++.dg/ivar-problem-1.mm: Likewise.
            * obj-c++.dg/lto/lto.exp: Likewise.
            * obj-c++.dg/lto/trivial-1_0.mm: Likewise.
            * obj-c++.dg/method-1.mm: Likewise.
            * obj-c++.dg/method-12.mm: Likewise.
            * obj-c++.dg/method-18.mm: Likewise.
            * obj-c++.dg/method-19.mm: Likewise.
            * obj-c++.dg/method-20.mm: Likewise.
            * obj-c++.dg/method-3.mm: Likewise.
            * obj-c++.dg/method-4.mm: Likewise.
            * obj-c++.dg/method-5.mm: Likewise.
            * obj-c++.dg/method-8.mm: Likewise.
            * obj-c++.dg/method-9.mm: Likewise.
            * obj-c++.dg/method-namespace-1.mm: Likewise.
            * obj-c++.dg/plugin/diagnostic-test-expressions-1.mm:
            Likewise.
            * obj-c++.dg/pr23709.mm: Likewise.
            * obj-c++.dg/pragma-2.mm: Likewise.
            * obj-c++.dg/private-1.mm: Likewise.
            * obj-c++.dg/private-2.mm: Likewise.
            * obj-c++.dg/property/property.exp: Likewise.
            * obj-c++.dg/proto-lossage-1.mm: Likewise.
            * obj-c++.dg/proto-lossage-5.mm: Likewise.
            * obj-c++.dg/proto-qual-1.mm: Likewise.
            * obj-c++.dg/protocol-inheritance-1.mm: Likewise.
            * obj-c++.dg/protocol-inheritance-2.mm: Likewise.
            * obj-c++.dg/protocol-optional-1.mm: Likewise.
            * obj-c++.dg/selector-1.mm: Likewise.
            * obj-c++.dg/selector-2.mm: Likewise.
            * obj-c++.dg/selector-3.mm: Likewise.
            * obj-c++.dg/selector-4.mm: Likewise.
            * obj-c++.dg/strings/strings.exp: Likewise.
            * obj-c++.dg/stubify-1.mm: Likewise.
            * obj-c++.dg/stubify-2.mm: Likewise.
            * obj-c++.dg/super-dealloc-1.mm: Likewise.
            * obj-c++.dg/super-dealloc-2.mm: Likewise.
            * obj-c++.dg/sync-3.mm: Likewise.
            * obj-c++.dg/syntax-error-2.mm: Likewise.
            * obj-c++.dg/syntax-error-4.mm: Likewise.
            * obj-c++.dg/syntax-error-7.mm: Likewise.
            * obj-c++.dg/syntax-error-9.mm: Likewise.
            * obj-c++.dg/template-4.mm: Likewise.
            * obj-c++.dg/template-7.mm: Likewise.
            * obj-c++.dg/template-8.mm: Likewise.
            * obj-c++.dg/threedotthree-abi-1.mm: Likewise.
            * obj-c++.dg/torture/dg-torture.exp: Likewise.
            * obj-c++.dg/torture/strings/strings.exp: Likewise.
            * obj-c++.dg/try-catch-12.mm: Likewise.
            * obj-c++.dg/try-catch-13.mm: Likewise.

Diff:
---
 gcc/testsuite/obj-c++.dg/attributes/class-attribute-1.mm |  1 +
 gcc/testsuite/obj-c++.dg/attributes/class-attribute-2.mm |  1 +
 gcc/testsuite/obj-c++.dg/attributes/class-attribute-3.mm |  1 +
 .../obj-c++.dg/attributes/method-deprecated-1.mm         |  1 +
 .../obj-c++.dg/attributes/method-deprecated-2.mm         |  1 +
 .../obj-c++.dg/attributes/method-deprecated-3.mm         |  1 +
 gcc/testsuite/obj-c++.dg/attributes/method-format-1.mm   |  1 +
 gcc/testsuite/obj-c++.dg/attributes/method-nonnull-1.mm  |  1 +
 gcc/testsuite/obj-c++.dg/attributes/method-noreturn-1.mm |  1 +
 gcc/testsuite/obj-c++.dg/attributes/method-sentinel-1.mm |  1 +
 gcc/testsuite/obj-c++.dg/attributes/nsobject-01.mm       |  2 +-
 .../obj-c++.dg/attributes/parameter-attribute-1.mm       |  1 +
 .../obj-c++.dg/attributes/parameter-attribute-2.mm       |  1 +
 gcc/testsuite/obj-c++.dg/attributes/proto-attribute-1.mm |  1 +
 gcc/testsuite/obj-c++.dg/attributes/proto-attribute-3.mm |  2 +-
 gcc/testsuite/obj-c++.dg/attributes/proto-attribute-4.mm |  1 +
 .../obj-c++.dg/attributes/unused-parameter-1.mm          |  1 +
 gcc/testsuite/obj-c++.dg/bad-receiver-type.mm            |  1 +
 gcc/testsuite/obj-c++.dg/bitfield-3.mm                   |  1 +
 gcc/testsuite/obj-c++.dg/bitfield-5.mm                   |  1 +
 gcc/testsuite/obj-c++.dg/class-extension-1.mm            |  1 +
 gcc/testsuite/obj-c++.dg/class-extension-2.mm            |  1 +
 gcc/testsuite/obj-c++.dg/class-extension-3.mm            |  1 +
 gcc/testsuite/obj-c++.dg/class-extension-4.mm            |  1 +
 gcc/testsuite/obj-c++.dg/class-protocol-1.mm             |  1 +
 gcc/testsuite/obj-c++.dg/comp-types-1.mm                 |  1 +
 gcc/testsuite/obj-c++.dg/comp-types-10.mm                |  1 +
 gcc/testsuite/obj-c++.dg/comp-types-2.mm                 |  1 +
 gcc/testsuite/obj-c++.dg/comp-types-3.mm                 |  1 +
 gcc/testsuite/obj-c++.dg/comp-types-5.mm                 |  1 +
 gcc/testsuite/obj-c++.dg/comp-types-6.mm                 |  1 +
 gcc/testsuite/obj-c++.dg/comp-types-7.mm                 |  1 +
 gcc/testsuite/obj-c++.dg/comp-types-8.mm                 |  1 +
 gcc/testsuite/obj-c++.dg/demangle-2.mm                   |  1 +
 gcc/testsuite/obj-c++.dg/demangle-3.mm                   |  1 +
 gcc/testsuite/obj-c++.dg/duplicate-class-1.mm            |  1 +
 gcc/testsuite/obj-c++.dg/encode-1-next.mm                |  1 +
 gcc/testsuite/obj-c++.dg/encode-1.mm                     |  1 +
 gcc/testsuite/obj-c++.dg/enhanced-proto-2.mm             |  1 +
 gcc/testsuite/obj-c++.dg/exceptions-1.mm                 |  1 +
 gcc/testsuite/obj-c++.dg/exceptions-3.mm                 |  1 +
 gcc/testsuite/obj-c++.dg/exceptions-4.mm                 |  1 +
 gcc/testsuite/obj-c++.dg/exceptions-5.mm                 |  1 +
 gcc/testsuite/obj-c++.dg/extern-c-1.mm                   |  1 +
 gcc/testsuite/obj-c++.dg/fobjc-std-1.mm                  |  1 +
 gcc/testsuite/obj-c++.dg/gnu-api-2-class-meta.mm         |  1 +
 gcc/testsuite/obj-c++.dg/gnu-api-2-class.mm              |  1 +
 gcc/testsuite/obj-c++.dg/gnu-api-2-ivar.mm               |  1 +
 gcc/testsuite/obj-c++.dg/gnu-api-2-method.mm             |  1 +
 gcc/testsuite/obj-c++.dg/gnu-api-2-objc.mm               |  1 +
 gcc/testsuite/obj-c++.dg/gnu-api-2-objc_msg_lookup.mm    |  1 +
 gcc/testsuite/obj-c++.dg/gnu-api-2-object.mm             |  1 +
 gcc/testsuite/obj-c++.dg/gnu-api-2-property.mm           |  1 +
 gcc/testsuite/obj-c++.dg/gnu-api-2-protocol.mm           |  1 +
 gcc/testsuite/obj-c++.dg/gnu-api-2-resolve-method.mm     |  1 +
 gcc/testsuite/obj-c++.dg/gnu-api-2-sel.mm                |  1 +
 gcc/testsuite/obj-c++.dg/invalid-method-2.mm             |  1 +
 gcc/testsuite/obj-c++.dg/ivar-invalid-type-1.mm          |  1 +
 gcc/testsuite/obj-c++.dg/ivar-problem-1.mm               |  1 +
 gcc/testsuite/obj-c++.dg/lto/lto.exp                     | 16 ++++++++--------
 gcc/testsuite/obj-c++.dg/lto/trivial-1_0.mm              |  2 +-
 gcc/testsuite/obj-c++.dg/method-1.mm                     |  1 +
 gcc/testsuite/obj-c++.dg/method-12.mm                    |  1 +
 gcc/testsuite/obj-c++.dg/method-18.mm                    |  1 +
 gcc/testsuite/obj-c++.dg/method-19.mm                    |  1 +
 gcc/testsuite/obj-c++.dg/method-20.mm                    |  1 +
 gcc/testsuite/obj-c++.dg/method-3.mm                     |  1 +
 gcc/testsuite/obj-c++.dg/method-4.mm                     |  1 +
 gcc/testsuite/obj-c++.dg/method-5.mm                     |  1 +
 gcc/testsuite/obj-c++.dg/method-8.mm                     |  1 +
 gcc/testsuite/obj-c++.dg/method-9.mm                     |  1 +
 gcc/testsuite/obj-c++.dg/method-namespace-1.mm           |  1 +
 .../obj-c++.dg/plugin/diagnostic-test-expressions-1.mm   |  1 +
 gcc/testsuite/obj-c++.dg/pr23709.mm                      |  1 +
 gcc/testsuite/obj-c++.dg/pragma-2.mm                     |  1 +
 gcc/testsuite/obj-c++.dg/private-1.mm                    |  1 +
 gcc/testsuite/obj-c++.dg/private-2.mm                    |  1 +
 gcc/testsuite/obj-c++.dg/property/property.exp           |  4 ++--
 gcc/testsuite/obj-c++.dg/proto-lossage-1.mm              |  1 +
 gcc/testsuite/obj-c++.dg/proto-lossage-5.mm              |  1 +
 gcc/testsuite/obj-c++.dg/proto-qual-1.mm                 |  1 +
 gcc/testsuite/obj-c++.dg/protocol-inheritance-1.mm       |  1 +
 gcc/testsuite/obj-c++.dg/protocol-inheritance-2.mm       |  1 +
 gcc/testsuite/obj-c++.dg/protocol-optional-1.mm          |  1 +
 gcc/testsuite/obj-c++.dg/selector-1.mm                   |  1 +
 gcc/testsuite/obj-c++.dg/selector-2.mm                   |  1 +
 gcc/testsuite/obj-c++.dg/selector-3.mm                   |  1 +
 gcc/testsuite/obj-c++.dg/selector-4.mm                   |  1 +
 gcc/testsuite/obj-c++.dg/strings/strings.exp             |  4 ++--
 gcc/testsuite/obj-c++.dg/stubify-1.mm                    |  1 +
 gcc/testsuite/obj-c++.dg/stubify-2.mm                    |  1 +
 gcc/testsuite/obj-c++.dg/super-dealloc-1.mm              |  1 +
 gcc/testsuite/obj-c++.dg/super-dealloc-2.mm              |  1 +
 gcc/testsuite/obj-c++.dg/sync-3.mm                       |  1 +
 gcc/testsuite/obj-c++.dg/syntax-error-2.mm               |  1 +
 gcc/testsuite/obj-c++.dg/syntax-error-4.mm               |  1 +
 gcc/testsuite/obj-c++.dg/syntax-error-7.mm               |  1 +
 gcc/testsuite/obj-c++.dg/syntax-error-9.mm               |  1 +
 gcc/testsuite/obj-c++.dg/template-4.mm                   |  1 +
 gcc/testsuite/obj-c++.dg/template-7.mm                   |  1 +
 gcc/testsuite/obj-c++.dg/template-8.mm                   |  1 +
 gcc/testsuite/obj-c++.dg/threedotthree-abi-1.mm          |  1 +
 gcc/testsuite/obj-c++.dg/torture/dg-torture.exp          |  4 ++--
 gcc/testsuite/obj-c++.dg/torture/strings/strings.exp     |  4 ++--
 gcc/testsuite/obj-c++.dg/try-catch-12.mm                 |  1 +
 gcc/testsuite/obj-c++.dg/try-catch-13.mm                 |  1 +
 106 files changed, 117 insertions(+), 19 deletions(-)

diff --git a/gcc/testsuite/obj-c++.dg/attributes/class-attribute-1.mm b/gcc/testsuite/obj-c++.dg/attributes/class-attribute-1.mm
index f078339b867..7eafdbc926e 100644
--- a/gcc/testsuite/obj-c++.dg/attributes/class-attribute-1.mm
+++ b/gcc/testsuite/obj-c++.dg/attributes/class-attribute-1.mm
@@ -1,5 +1,6 @@
 /* { dg-do compile } */
 /* { dg-skip-if "No API#2 pre-Darwin9" { *-*-darwin[5-8]* } { "-fnext-runtime" } { "" } } */
+/* { dg-additional-options "-Wno-objc-root-class" } */
 
 /* Test deprecate attribute with an @interface declaration.  */
 
diff --git a/gcc/testsuite/obj-c++.dg/attributes/class-attribute-2.mm b/gcc/testsuite/obj-c++.dg/attributes/class-attribute-2.mm
index 35015c0370a..629ba864b94 100644
--- a/gcc/testsuite/obj-c++.dg/attributes/class-attribute-2.mm
+++ b/gcc/testsuite/obj-c++.dg/attributes/class-attribute-2.mm
@@ -1,4 +1,5 @@
 /* { dg-do compile } */
+/* { dg-additional-options "-Wno-objc-root-class" } */
 
 #include <objc/objc.h>
 
diff --git a/gcc/testsuite/obj-c++.dg/attributes/class-attribute-3.mm b/gcc/testsuite/obj-c++.dg/attributes/class-attribute-3.mm
index f96500de4dc..3b7c8c38481 100644
--- a/gcc/testsuite/obj-c++.dg/attributes/class-attribute-3.mm
+++ b/gcc/testsuite/obj-c++.dg/attributes/class-attribute-3.mm
@@ -1,5 +1,6 @@
 /* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, December 2010.  */
 /* { dg-do compile } */
+/* { dg-additional-options "-Wno-objc-root-class" } */
 
 /* Test that you get a warning when an unknown class attribute is ignored.  */
 
diff --git a/gcc/testsuite/obj-c++.dg/attributes/method-deprecated-1.mm b/gcc/testsuite/obj-c++.dg/attributes/method-deprecated-1.mm
index 8343856a5c6..68e8373920d 100644
--- a/gcc/testsuite/obj-c++.dg/attributes/method-deprecated-1.mm
+++ b/gcc/testsuite/obj-c++.dg/attributes/method-deprecated-1.mm
@@ -1,5 +1,6 @@
 /* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, October 2010.  */
 /* { dg-do compile } */
+/* { dg-additional-options "-Wno-objc-root-class" } */
 
 #include <objc/objc.h>
 
diff --git a/gcc/testsuite/obj-c++.dg/attributes/method-deprecated-2.mm b/gcc/testsuite/obj-c++.dg/attributes/method-deprecated-2.mm
index 1e5d87f3e63..8fb0e1510d0 100644
--- a/gcc/testsuite/obj-c++.dg/attributes/method-deprecated-2.mm
+++ b/gcc/testsuite/obj-c++.dg/attributes/method-deprecated-2.mm
@@ -1,5 +1,6 @@
 /* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, October 2010.  */
 /* { dg-do compile } */
+/* { dg-additional-options "-Wno-objc-root-class" } */
 
 #include <objc/objc.h>
 
diff --git a/gcc/testsuite/obj-c++.dg/attributes/method-deprecated-3.mm b/gcc/testsuite/obj-c++.dg/attributes/method-deprecated-3.mm
index 5c715a20b68..efa2d349557 100644
--- a/gcc/testsuite/obj-c++.dg/attributes/method-deprecated-3.mm
+++ b/gcc/testsuite/obj-c++.dg/attributes/method-deprecated-3.mm
@@ -1,5 +1,6 @@
 /* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, October 2010.  */
 /* { dg-do compile } */
+/* { dg-additional-options "-Wno-objc-root-class" } */
 
 #include <objc/objc.h>
 
diff --git a/gcc/testsuite/obj-c++.dg/attributes/method-format-1.mm b/gcc/testsuite/obj-c++.dg/attributes/method-format-1.mm
index 9ff34f92fb1..d3bb997b2aa 100644
--- a/gcc/testsuite/obj-c++.dg/attributes/method-format-1.mm
+++ b/gcc/testsuite/obj-c++.dg/attributes/method-format-1.mm
@@ -1,6 +1,7 @@
 /* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, October 2010.  */
 /* { dg-do compile } */
 /* { dg-options "-Wall" } */
+/* { dg-additional-options "-Wno-objc-root-class" } */
 
 #include <objc/objc.h>
 #include <stdlib.h>
diff --git a/gcc/testsuite/obj-c++.dg/attributes/method-nonnull-1.mm b/gcc/testsuite/obj-c++.dg/attributes/method-nonnull-1.mm
index 83f918c5a3f..af48787d765 100644
--- a/gcc/testsuite/obj-c++.dg/attributes/method-nonnull-1.mm
+++ b/gcc/testsuite/obj-c++.dg/attributes/method-nonnull-1.mm
@@ -1,6 +1,7 @@
 /* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, May 2011.  */
 /* { dg-do compile } */
 /* { dg-options "-Wall" } */
+/* { dg-additional-options "-Wno-objc-root-class" } */
 
 #include <objc/objc.h>
 #include <stdlib.h>
diff --git a/gcc/testsuite/obj-c++.dg/attributes/method-noreturn-1.mm b/gcc/testsuite/obj-c++.dg/attributes/method-noreturn-1.mm
index a83048bb7ed..413a0be4b2b 100644
--- a/gcc/testsuite/obj-c++.dg/attributes/method-noreturn-1.mm
+++ b/gcc/testsuite/obj-c++.dg/attributes/method-noreturn-1.mm
@@ -1,5 +1,6 @@
 /* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, October 2010.  */
 /* { dg-do compile } */
+/* { dg-additional-options "-Wno-objc-root-class" } */
 
 #include <objc/objc.h>
 #include <stdlib.h>
diff --git a/gcc/testsuite/obj-c++.dg/attributes/method-sentinel-1.mm b/gcc/testsuite/obj-c++.dg/attributes/method-sentinel-1.mm
index 2b8e6fd259d..ece7a9f9caa 100644
--- a/gcc/testsuite/obj-c++.dg/attributes/method-sentinel-1.mm
+++ b/gcc/testsuite/obj-c++.dg/attributes/method-sentinel-1.mm
@@ -1,6 +1,7 @@
 /* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, October 2010.  */
 /* { dg-do compile } */
 /* { dg-options "-Wall" } */
+/* { dg-additional-options "-Wno-objc-root-class" } */
 
 #include <objc/objc.h>
 #include <stdlib.h>
diff --git a/gcc/testsuite/obj-c++.dg/attributes/nsobject-01.mm b/gcc/testsuite/obj-c++.dg/attributes/nsobject-01.mm
index 498fbc7e8fd..3af785b9aef 100644
--- a/gcc/testsuite/obj-c++.dg/attributes/nsobject-01.mm
+++ b/gcc/testsuite/obj-c++.dg/attributes/nsobject-01.mm
@@ -1,5 +1,5 @@
 /* Test handling of the NSObject attribute.  */
-/*  { dg-additional-options "-fsyntax-only " } */
+/* { dg-additional-options "-fsyntax-only -Wno-objc-root-class" } */
 
 typedef struct AnObj * __attribute__ ((NSObject)) AnObjRef;
 typedef struct AnObj * __attribute__ ((__NSObject__)) AnotherObjRef;
diff --git a/gcc/testsuite/obj-c++.dg/attributes/parameter-attribute-1.mm b/gcc/testsuite/obj-c++.dg/attributes/parameter-attribute-1.mm
index a4ba25943ca..b4556ba0788 100644
--- a/gcc/testsuite/obj-c++.dg/attributes/parameter-attribute-1.mm
+++ b/gcc/testsuite/obj-c++.dg/attributes/parameter-attribute-1.mm
@@ -1,6 +1,7 @@
 /* Test __attribute__((unused)) for an Objective-C method parameter.  */
 /* { dg-do compile } */
 /* { dg-options "-Wunused-parameter" } */
+/* { dg-additional-options "-Wno-objc-root-class" } */
 
 #include <objc/objc.h>
 
diff --git a/gcc/testsuite/obj-c++.dg/attributes/parameter-attribute-2.mm b/gcc/testsuite/obj-c++.dg/attributes/parameter-attribute-2.mm
index 3908faf99d9..9d69e4209c8 100644
--- a/gcc/testsuite/obj-c++.dg/attributes/parameter-attribute-2.mm
+++ b/gcc/testsuite/obj-c++.dg/attributes/parameter-attribute-2.mm
@@ -1,5 +1,6 @@
 /* Test that we get warnings for unrecognized attributes.  */
 /* { dg-do compile } */
+/* { dg-additional-options "-Wno-objc-root-class" } */
 
 #include <objc/objc.h>
 
diff --git a/gcc/testsuite/obj-c++.dg/attributes/proto-attribute-1.mm b/gcc/testsuite/obj-c++.dg/attributes/proto-attribute-1.mm
index a852a7a6c2f..03726dc7bed 100644
--- a/gcc/testsuite/obj-c++.dg/attributes/proto-attribute-1.mm
+++ b/gcc/testsuite/obj-c++.dg/attributes/proto-attribute-1.mm
@@ -1,4 +1,5 @@
 /* { dg-do compile } */
+/* { dg-additional-options "-Wno-objc-root-class" } */
 
 #include <objc/objc.h>
 
diff --git a/gcc/testsuite/obj-c++.dg/attributes/proto-attribute-3.mm b/gcc/testsuite/obj-c++.dg/attributes/proto-attribute-3.mm
index fc5251eeea1..263f92757b0 100644
--- a/gcc/testsuite/obj-c++.dg/attributes/proto-attribute-3.mm
+++ b/gcc/testsuite/obj-c++.dg/attributes/proto-attribute-3.mm
@@ -1,7 +1,7 @@
 /* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, November 2010.  */
 /* { dg-do compile } */
 /* { dg-skip-if "No API#2 pre-Darwin9" { *-*-darwin[5-8]* } { "-fnext-runtime" } { "" } } */
-
+/* { dg-additional-options "-Wno-objc-root-class" } */
 
 /* Test deprecate attribute with normal @protocol declarations.  */
 
diff --git a/gcc/testsuite/obj-c++.dg/attributes/proto-attribute-4.mm b/gcc/testsuite/obj-c++.dg/attributes/proto-attribute-4.mm
index d2e5f28a1b4..665e13da643 100644
--- a/gcc/testsuite/obj-c++.dg/attributes/proto-attribute-4.mm
+++ b/gcc/testsuite/obj-c++.dg/attributes/proto-attribute-4.mm
@@ -1,5 +1,6 @@
 /* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, December 2010.  */
 /* { dg-do compile } */
+/* { dg-additional-options "-Wno-objc-root-class" } */
 
 /* Test that you get a warning when an unknown protocol attribute is ignored.  */
 
diff --git a/gcc/testsuite/obj-c++.dg/attributes/unused-parameter-1.mm b/gcc/testsuite/obj-c++.dg/attributes/unused-parameter-1.mm
index 8fbb11e2014..c56a7f7d68c 100644
--- a/gcc/testsuite/obj-c++.dg/attributes/unused-parameter-1.mm
+++ b/gcc/testsuite/obj-c++.dg/attributes/unused-parameter-1.mm
@@ -1,4 +1,5 @@
 /* { dg-do compile } */
+/* { dg-additional-options "-Wno-objc-root-class" } */
 
 #include <objc/objc.h>
 
diff --git a/gcc/testsuite/obj-c++.dg/bad-receiver-type.mm b/gcc/testsuite/obj-c++.dg/bad-receiver-type.mm
index 1d6699f99c5..9c00a068168 100644
--- a/gcc/testsuite/obj-c++.dg/bad-receiver-type.mm
+++ b/gcc/testsuite/obj-c++.dg/bad-receiver-type.mm
@@ -1,5 +1,6 @@
 // { dg-do compile } 
 // { dg-options "" }
+// { dg-additional-options "-Wno-objc-root-class" }
 
 @interface A
 
diff --git a/gcc/testsuite/obj-c++.dg/bitfield-3.mm b/gcc/testsuite/obj-c++.dg/bitfield-3.mm
index d81976ab624..c4ed984ef52 100644
--- a/gcc/testsuite/obj-c++.dg/bitfield-3.mm
+++ b/gcc/testsuite/obj-c++.dg/bitfield-3.mm
@@ -4,6 +4,7 @@
 /* { dg-do run { target *-*-darwin* } } */
 /* { dg-skip-if "" { *-*-* } { "-fgnu-runtime" } { "" } } */
 /* { dg-options "-fsigned-char" } */
+// { dg-additional-options "-Wno-objc-root-class" }
 
 typedef struct objc_object { struct objc_class *class_pointer; } *id;
 
diff --git a/gcc/testsuite/obj-c++.dg/bitfield-5.mm b/gcc/testsuite/obj-c++.dg/bitfield-5.mm
index 3b0065d7f61..d86c9b135d2 100644
--- a/gcc/testsuite/obj-c++.dg/bitfield-5.mm
+++ b/gcc/testsuite/obj-c++.dg/bitfield-5.mm
@@ -3,6 +3,7 @@
   (@interface vs. @implementation) checks take the bitfield width into account.  */
 /* Author: Ziemowit Laski   <zlaski@apple.com>  */
 /* { dg-do compile } */
+// { dg-additional-options "-Wno-objc-root-class" }
 
 @interface Base {
   int i;
diff --git a/gcc/testsuite/obj-c++.dg/class-extension-1.mm b/gcc/testsuite/obj-c++.dg/class-extension-1.mm
index 5c89a9838cf..c497c1d938d 100644
--- a/gcc/testsuite/obj-c++.dg/class-extension-1.mm
+++ b/gcc/testsuite/obj-c++.dg/class-extension-1.mm
@@ -1,5 +1,6 @@
 /* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, December 2010.  */
 /* { dg-do compile } */
+// { dg-additional-options "-Wno-objc-root-class" }
 
 /* This test tests the basic of class extensions.  */
 
diff --git a/gcc/testsuite/obj-c++.dg/class-extension-2.mm b/gcc/testsuite/obj-c++.dg/class-extension-2.mm
index 7f55b601fb3..108bc001d0e 100644
--- a/gcc/testsuite/obj-c++.dg/class-extension-2.mm
+++ b/gcc/testsuite/obj-c++.dg/class-extension-2.mm
@@ -1,5 +1,6 @@
 /* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, December 2010.  */
 /* { dg-do compile } */
+// { dg-additional-options "-Wno-objc-root-class" }
 
 /* This test tests class extensions and protocols.  */
 
diff --git a/gcc/testsuite/obj-c++.dg/class-extension-3.mm b/gcc/testsuite/obj-c++.dg/class-extension-3.mm
index 69e57053969..bed849030d6 100644
--- a/gcc/testsuite/obj-c++.dg/class-extension-3.mm
+++ b/gcc/testsuite/obj-c++.dg/class-extension-3.mm
@@ -1,5 +1,6 @@
 /* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, December 2010.  */
 /* { dg-do compile } */
+// { dg-additional-options "-Wno-objc-root-class" }
 
 /* This test tests warnings on class extensions.  */
 
diff --git a/gcc/testsuite/obj-c++.dg/class-extension-4.mm b/gcc/testsuite/obj-c++.dg/class-extension-4.mm
index 9e19aa70d3b..2cfbc5dd0e5 100644
--- a/gcc/testsuite/obj-c++.dg/class-extension-4.mm
+++ b/gcc/testsuite/obj-c++.dg/class-extension-4.mm
@@ -1,5 +1,6 @@
 /* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, December 2010.  */
 /* { dg-do compile } */
+// { dg-additional-options "-Wno-objc-root-class" }
 
 /* This test tests you can not declare a class extension after the class @implementation.  */
 
diff --git a/gcc/testsuite/obj-c++.dg/class-protocol-1.mm b/gcc/testsuite/obj-c++.dg/class-protocol-1.mm
index 78957cb061e..3b332643a60 100644
--- a/gcc/testsuite/obj-c++.dg/class-protocol-1.mm
+++ b/gcc/testsuite/obj-c++.dg/class-protocol-1.mm
@@ -1,6 +1,7 @@
 /* Check Class <protocol> types */
 /* Author: David Ayers <d.ayers@inode.at> */
 /* { dg-do compile } */
+// { dg-additional-options "-Wno-objc-root-class" }
 
 #include <objc/objc.h>
 #include "../objc-obj-c++-shared/runtime.h"
diff --git a/gcc/testsuite/obj-c++.dg/comp-types-1.mm b/gcc/testsuite/obj-c++.dg/comp-types-1.mm
index 6d4e86e4b2a..6402abc213b 100644
--- a/gcc/testsuite/obj-c++.dg/comp-types-1.mm
+++ b/gcc/testsuite/obj-c++.dg/comp-types-1.mm
@@ -1,4 +1,5 @@
 /* { dg-do compile } */
+// { dg-additional-options "-Wno-objc-root-class" }
 
 @interface A
 + new;
diff --git a/gcc/testsuite/obj-c++.dg/comp-types-10.mm b/gcc/testsuite/obj-c++.dg/comp-types-10.mm
index c7f0cb635c7..fdfd0933b89 100644
--- a/gcc/testsuite/obj-c++.dg/comp-types-10.mm
+++ b/gcc/testsuite/obj-c++.dg/comp-types-10.mm
@@ -2,6 +2,7 @@
 /* { dg-do compile } */
 /* { dg-prune-output ".*internal compiler error.*" } */
 /* { dg-options "-O3" } */
+// { dg-additional-options "-Wno-objc-root-class" }
 
 @class NSString;
 @protocol NSObject
diff --git a/gcc/testsuite/obj-c++.dg/comp-types-2.mm b/gcc/testsuite/obj-c++.dg/comp-types-2.mm
index 07043785a22..87750fd67df 100644
--- a/gcc/testsuite/obj-c++.dg/comp-types-2.mm
+++ b/gcc/testsuite/obj-c++.dg/comp-types-2.mm
@@ -1,6 +1,7 @@
 /* Test various ObjC types assignments and comparisons.  */
 /* Author: Nicola Pero <nicola@brainstorm.co.uk>.  */
 /* { dg-do compile } */
+// { dg-additional-options "-Wno-objc-root-class" }
 
 #include <objc/objc.h>
 
diff --git a/gcc/testsuite/obj-c++.dg/comp-types-3.mm b/gcc/testsuite/obj-c++.dg/comp-types-3.mm
index 2bea01534a7..d4d0790afcc 100644
--- a/gcc/testsuite/obj-c++.dg/comp-types-3.mm
+++ b/gcc/testsuite/obj-c++.dg/comp-types-3.mm
@@ -1,6 +1,7 @@
 /* Test simple ObjC types casts.  */
 /* Author: Nicola Pero <nicola@brainstorm.co.uk>.  */
 /* { dg-do compile } */
+// { dg-additional-options "-Wno-objc-root-class" }
 
 #include <objc/objc.h>
 
diff --git a/gcc/testsuite/obj-c++.dg/comp-types-5.mm b/gcc/testsuite/obj-c++.dg/comp-types-5.mm
index 99f6772bd42..2c4fc57f0ac 100644
--- a/gcc/testsuite/obj-c++.dg/comp-types-5.mm
+++ b/gcc/testsuite/obj-c++.dg/comp-types-5.mm
@@ -1,6 +1,7 @@
 /* Test errors for assignments and comparisons between ObjC and C++ types.  */
 /* Author: Nicola Pero <nicola@brainstorm.co.uk>.  */
 /* { dg-do compile } */
+// { dg-additional-options "-Wno-objc-root-class" }
 
 #include <objc/objc.h>
 
diff --git a/gcc/testsuite/obj-c++.dg/comp-types-6.mm b/gcc/testsuite/obj-c++.dg/comp-types-6.mm
index 23b84edd374..071a7563b89 100644
--- a/gcc/testsuite/obj-c++.dg/comp-types-6.mm
+++ b/gcc/testsuite/obj-c++.dg/comp-types-6.mm
@@ -1,6 +1,7 @@
 /* Test assignments and comparisons involving `one-off' protocols.  */
 /* Author: Nicola Pero <nicola@brainstorm.co.uk>.  */
 /* { dg-do compile } */
+// { dg-additional-options "-Wno-objc-root-class" }
 
 #include <objc/objc.h>
 
diff --git a/gcc/testsuite/obj-c++.dg/comp-types-7.mm b/gcc/testsuite/obj-c++.dg/comp-types-7.mm
index e23558114bc..628635575f5 100644
--- a/gcc/testsuite/obj-c++.dg/comp-types-7.mm
+++ b/gcc/testsuite/obj-c++.dg/comp-types-7.mm
@@ -1,6 +1,7 @@
 /* Test assignments and comparisons involving category protocols.  */
 /* Author: Nicola Pero <nicola@brainstorm.co.uk>.  */
 /* { dg-do compile } */
+// { dg-additional-options "-Wno-objc-root-class" }
 
 #include <objc/objc.h>
 
diff --git a/gcc/testsuite/obj-c++.dg/comp-types-8.mm b/gcc/testsuite/obj-c++.dg/comp-types-8.mm
index 6db76bb20f3..0221164ac85 100644
--- a/gcc/testsuite/obj-c++.dg/comp-types-8.mm
+++ b/gcc/testsuite/obj-c++.dg/comp-types-8.mm
@@ -1,5 +1,6 @@
 /* { dg-do compile } */
 /* { dg-additional-options "-Wno-return-type" } */
+// { dg-additional-options "-Wno-objc-root-class" }
 
 /* We used to ICE because we removed the cast to List_linked*
    in -[ListIndex_linked next]. */
diff --git a/gcc/testsuite/obj-c++.dg/demangle-2.mm b/gcc/testsuite/obj-c++.dg/demangle-2.mm
index f2820859137..14c7b3e18f8 100644
--- a/gcc/testsuite/obj-c++.dg/demangle-2.mm
+++ b/gcc/testsuite/obj-c++.dg/demangle-2.mm
@@ -1,6 +1,7 @@
 /* Test demangling an Objective-C method.  */
 /* { dg-do run } */
 /* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */
+// { dg-additional-options "-Wno-objc-root-class" }
 
 #include <cstring>
 #include <cstdlib>
diff --git a/gcc/testsuite/obj-c++.dg/demangle-3.mm b/gcc/testsuite/obj-c++.dg/demangle-3.mm
index afb83d75bfe..d8d81784f86 100644
--- a/gcc/testsuite/obj-c++.dg/demangle-3.mm
+++ b/gcc/testsuite/obj-c++.dg/demangle-3.mm
@@ -1,6 +1,7 @@
 /* Test demangling an Objective-C method in error messages.  */
 /* { dg-do compile } */
 /* { dg-additional-options "-Wno-return-type" } */
+// { dg-additional-options "-Wno-objc-root-class" }
 
 #include <objc/objc.h>
 
diff --git a/gcc/testsuite/obj-c++.dg/duplicate-class-1.mm b/gcc/testsuite/obj-c++.dg/duplicate-class-1.mm
index 3a5e5104faa..77e52c6893f 100644
--- a/gcc/testsuite/obj-c++.dg/duplicate-class-1.mm
+++ b/gcc/testsuite/obj-c++.dg/duplicate-class-1.mm
@@ -1,5 +1,6 @@
 /* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, November 2010.  */
 /* { dg-do compile } */
+// { dg-additional-options "-Wno-objc-root-class" }
 
 /* Test that a duplicated @implementation for the same class does not
    crash the compiler.  */
diff --git a/gcc/testsuite/obj-c++.dg/encode-1-next.mm b/gcc/testsuite/obj-c++.dg/encode-1-next.mm
index 47673f20cb2..854dd728691 100644
--- a/gcc/testsuite/obj-c++.dg/encode-1-next.mm
+++ b/gcc/testsuite/obj-c++.dg/encode-1-next.mm
@@ -5,6 +5,7 @@
 
 /* { dg-do compile } */
 /* { dg-skip-if "" { *-*-* } { "-fgnu-runtime" } { "" } } */
+// { dg-additional-options "-Wno-objc-root-class" }
 
 struct Cxx {
   const struct Cxx *next;
diff --git a/gcc/testsuite/obj-c++.dg/encode-1.mm b/gcc/testsuite/obj-c++.dg/encode-1.mm
index 5f5ba20139e..6247c648274 100644
--- a/gcc/testsuite/obj-c++.dg/encode-1.mm
+++ b/gcc/testsuite/obj-c++.dg/encode-1.mm
@@ -3,6 +3,7 @@
 
 /* { dg-do compile } */
 /* { dg-skip-if "" { *-*-* } { "-fnext-runtime" } { "" } } */
+// { dg-additional-options "-Wno-objc-root-class" }
 
 struct Cxx {
   const struct Cxx *next;
diff --git a/gcc/testsuite/obj-c++.dg/enhanced-proto-2.mm b/gcc/testsuite/obj-c++.dg/enhanced-proto-2.mm
index 31c2e509b7a..5964dfb0968 100644
--- a/gcc/testsuite/obj-c++.dg/enhanced-proto-2.mm
+++ b/gcc/testsuite/obj-c++.dg/enhanced-proto-2.mm
@@ -1,4 +1,5 @@
 /* { dg-do compile } */
+// { dg-additional-options "-Wno-objc-root-class" }
 
 @protocol MyProto1 
 @optional
diff --git a/gcc/testsuite/obj-c++.dg/exceptions-1.mm b/gcc/testsuite/obj-c++.dg/exceptions-1.mm
index 0f3b7e8ae14..75327ef7a9f 100644
--- a/gcc/testsuite/obj-c++.dg/exceptions-1.mm
+++ b/gcc/testsuite/obj-c++.dg/exceptions-1.mm
@@ -1,6 +1,7 @@
 /* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, November 2010.  */
 /* { dg-options "-fobjc-exceptions" } */
 /* { dg-do compile } */
+// { dg-additional-options "-Wno-objc-root-class" }
 
 /* This test checks the syntax @catch (...) which catches any
    exceptions.  At the moment, @catch (...) is identical to @catch (id
diff --git a/gcc/testsuite/obj-c++.dg/exceptions-3.mm b/gcc/testsuite/obj-c++.dg/exceptions-3.mm
index 622e4ca3b60..7cf77a7821a 100644
--- a/gcc/testsuite/obj-c++.dg/exceptions-3.mm
+++ b/gcc/testsuite/obj-c++.dg/exceptions-3.mm
@@ -1,6 +1,7 @@
 /* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, November 2010.  */
 /* { dg-options "-fobjc-exceptions" } */
 /* { dg-do compile } */
+// { dg-additional-options "-Wno-objc-root-class" }
 
 /* Test that the compiler is checking the argument of @catch(), and
    produce errors when invalid types are used.  */
diff --git a/gcc/testsuite/obj-c++.dg/exceptions-4.mm b/gcc/testsuite/obj-c++.dg/exceptions-4.mm
index 4aa00a6006f..1391c43b8e5 100644
--- a/gcc/testsuite/obj-c++.dg/exceptions-4.mm
+++ b/gcc/testsuite/obj-c++.dg/exceptions-4.mm
@@ -1,6 +1,7 @@
 /* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, November 2010.  */
 /* { dg-options "-fobjc-exceptions" } */
 /* { dg-do compile } */
+// { dg-additional-options "-Wno-objc-root-class" }
 
 /* Test warnings when parsing syntax errors in @catch().  */
 
diff --git a/gcc/testsuite/obj-c++.dg/exceptions-5.mm b/gcc/testsuite/obj-c++.dg/exceptions-5.mm
index 5aa08f35821..4547a756c74 100644
--- a/gcc/testsuite/obj-c++.dg/exceptions-5.mm
+++ b/gcc/testsuite/obj-c++.dg/exceptions-5.mm
@@ -1,6 +1,7 @@
 /* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, November 2010.  */
 /* { dg-options "-fobjc-exceptions" } */
 /* { dg-do compile } */
+// { dg-additional-options "-Wno-objc-root-class" }
 
 /* Test that you can use an unnamed argument with @catch.  This test is the same
    as exceptions-3.mm, but with no name for @catch arguments.  */
diff --git a/gcc/testsuite/obj-c++.dg/extern-c-1.mm b/gcc/testsuite/obj-c++.dg/extern-c-1.mm
index c5fec6fbe93..8b9147a807e 100644
--- a/gcc/testsuite/obj-c++.dg/extern-c-1.mm
+++ b/gcc/testsuite/obj-c++.dg/extern-c-1.mm
@@ -1,5 +1,6 @@
 /* Test extern c support inside @implementation */
 /* Devang Patel  <dpatel@apple.com>.  */
+// { dg-additional-options "-Wno-objc-root-class" }
 
 #include <objc/objc.h>
 
diff --git a/gcc/testsuite/obj-c++.dg/fobjc-std-1.mm b/gcc/testsuite/obj-c++.dg/fobjc-std-1.mm
index 59db95091db..f7f4a199dc0 100644
--- a/gcc/testsuite/obj-c++.dg/fobjc-std-1.mm
+++ b/gcc/testsuite/obj-c++.dg/fobjc-std-1.mm
@@ -1,6 +1,7 @@
 /* Test warnings when using -fobjc-std=objc1.  */
 /* { dg-do compile } */
 /* { dg-options "-fobjc-std=objc1" } */
+// { dg-additional-options "-Wno-objc-root-class" }
 
 #include <objc/objc.h>
 
diff --git a/gcc/testsuite/obj-c++.dg/gnu-api-2-class-meta.mm b/gcc/testsuite/obj-c++.dg/gnu-api-2-class-meta.mm
index bdaef9828ca..92852c3ecea 100644
--- a/gcc/testsuite/obj-c++.dg/gnu-api-2-class-meta.mm
+++ b/gcc/testsuite/obj-c++.dg/gnu-api-2-class-meta.mm
@@ -21,6 +21,7 @@
 /* { dg-skip-if "No API#2 pre-Darwin9" { *-*-darwin[5-8]* } { "-fnext-runtime" } { "" } } */
 /* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */
 /* { dg-additional-options "-DOBJC_OLD_DISPATCH_PROTOTYPES" { target { *-*-darwin* } } } */
+// { dg-additional-options "-Wno-objc-root-class" }
 
 /* To get the modern GNU Objective-C Runtime API, you include
    objc/runtime.h.  */
diff --git a/gcc/testsuite/obj-c++.dg/gnu-api-2-class.mm b/gcc/testsuite/obj-c++.dg/gnu-api-2-class.mm
index ae39026c2d3..f6e3d8d22e0 100644
--- a/gcc/testsuite/obj-c++.dg/gnu-api-2-class.mm
+++ b/gcc/testsuite/obj-c++.dg/gnu-api-2-class.mm
@@ -8,6 +8,7 @@
 /* { dg-skip-if "No API#2 pre-Darwin9" { *-*-darwin[5-8]* } { "-fnext-runtime" } { "" } } */
 /* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */
 /* { dg-additional-options "-DOBJC_OLD_DISPATCH_PROTOTYPES" { target { *-*-darwin* } } } */
+// { dg-additional-options "-Wno-objc-root-class" }
 
 /* To get the modern GNU Objective-C Runtime API, you include
    objc/runtime.h.  */
diff --git a/gcc/testsuite/obj-c++.dg/gnu-api-2-ivar.mm b/gcc/testsuite/obj-c++.dg/gnu-api-2-ivar.mm
index 1c85d238d60..991edc7271e 100644
--- a/gcc/testsuite/obj-c++.dg/gnu-api-2-ivar.mm
+++ b/gcc/testsuite/obj-c++.dg/gnu-api-2-ivar.mm
@@ -5,6 +5,7 @@
 /* { dg-do run } */
 /* { dg-skip-if "No API#2 pre-Darwin9" { *-*-darwin[5-8]* } { "-fnext-runtime" } { "" } } */
 /* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */
+// { dg-additional-options "-Wno-objc-root-class" }
 
 /* To get the modern GNU Objective-C Runtime API, you include
    objc/runtime.h.  */
diff --git a/gcc/testsuite/obj-c++.dg/gnu-api-2-method.mm b/gcc/testsuite/obj-c++.dg/gnu-api-2-method.mm
index 97bf84b6fc4..07c3a22ec32 100644
--- a/gcc/testsuite/obj-c++.dg/gnu-api-2-method.mm
+++ b/gcc/testsuite/obj-c++.dg/gnu-api-2-method.mm
@@ -5,6 +5,7 @@
 /* { dg-do run } */
 /* { dg-skip-if "No API#2 pre-Darwin9" { *-*-darwin[5-8]* } { "-fnext-runtime" } { "" } } */
 /* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */
+// { dg-additional-options "-Wno-objc-root-class" }
 
 /* To get the modern GNU Objective-C Runtime API, you include
    objc/runtime.h.  */
diff --git a/gcc/testsuite/obj-c++.dg/gnu-api-2-objc.mm b/gcc/testsuite/obj-c++.dg/gnu-api-2-objc.mm
index 201ab7e7af2..e68e7a899fc 100644
--- a/gcc/testsuite/obj-c++.dg/gnu-api-2-objc.mm
+++ b/gcc/testsuite/obj-c++.dg/gnu-api-2-objc.mm
@@ -9,6 +9,7 @@
    systems that don't have the V2 APis).  XFAILing the run is not useful
    since it will XPASS on the sub-set that works.  */
 /* { dg-skip-if "Incompatible" { *-*-darwin* } { "-fnext-runtime" } { "" } } */
+// { dg-additional-options "-Wno-objc-root-class" }
 
 /* To get the modern GNU Objective-C Runtime API, you include
    objc/runtime.h.  */
diff --git a/gcc/testsuite/obj-c++.dg/gnu-api-2-objc_msg_lookup.mm b/gcc/testsuite/obj-c++.dg/gnu-api-2-objc_msg_lookup.mm
index dcbf6d21f14..1fb56dcac90 100644
--- a/gcc/testsuite/obj-c++.dg/gnu-api-2-objc_msg_lookup.mm
+++ b/gcc/testsuite/obj-c++.dg/gnu-api-2-objc_msg_lookup.mm
@@ -5,6 +5,7 @@
 
 /* { dg-do run } */
 /* { dg-skip-if "" { *-*-* } { "-fnext-runtime" } { "" } } */
+// { dg-additional-options "-Wno-objc-root-class" }
 
 /* To get the modern GNU Objective-C Runtime API, you include
    objc/runtime.h.  */
diff --git a/gcc/testsuite/obj-c++.dg/gnu-api-2-object.mm b/gcc/testsuite/obj-c++.dg/gnu-api-2-object.mm
index a2702d64707..4d99053103c 100644
--- a/gcc/testsuite/obj-c++.dg/gnu-api-2-object.mm
+++ b/gcc/testsuite/obj-c++.dg/gnu-api-2-object.mm
@@ -5,6 +5,7 @@
 /* { dg-do run } */
 /* { dg-skip-if "No API#2 pre-Darwin9" { *-*-darwin[5-8]* } { "-fnext-runtime" } { "" } } */
 /* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */
+// { dg-additional-options "-Wno-objc-root-class" }
 
 /* To get the modern GNU Objective-C Runtime API, you include
    objc/runtime.h.  */
diff --git a/gcc/testsuite/obj-c++.dg/gnu-api-2-property.mm b/gcc/testsuite/obj-c++.dg/gnu-api-2-property.mm
index 953e9bb156b..601f39fa7e9 100644
--- a/gcc/testsuite/obj-c++.dg/gnu-api-2-property.mm
+++ b/gcc/testsuite/obj-c++.dg/gnu-api-2-property.mm
@@ -4,6 +4,7 @@
 
 /* { dg-do run } */
 /* { dg-skip-if "No API#2 pre-Darwin9" { *-*-darwin[5-8]* } { "-fnext-runtime" } { "" } } */
+// { dg-additional-options "-Wno-objc-root-class" }
 
 /* To get the modern GNU Objective-C Runtime API, you include
    objc/runtime.h.  */
diff --git a/gcc/testsuite/obj-c++.dg/gnu-api-2-protocol.mm b/gcc/testsuite/obj-c++.dg/gnu-api-2-protocol.mm
index 9a2ceca1353..21ae06bfd27 100644
--- a/gcc/testsuite/obj-c++.dg/gnu-api-2-protocol.mm
+++ b/gcc/testsuite/obj-c++.dg/gnu-api-2-protocol.mm
@@ -5,6 +5,7 @@
 /* { dg-do run } */
 /* { dg-skip-if "No API#2 pre-Darwin9" { *-*-darwin[5-8]* } { "-fnext-runtime" } { "" } } */
 /* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */
+// { dg-additional-options "-Wno-objc-root-class" }
 
 /* To get the modern GNU Objective-C Runtime API, you include
    objc/runtime.h.  */
diff --git a/gcc/testsuite/obj-c++.dg/gnu-api-2-resolve-method.mm b/gcc/testsuite/obj-c++.dg/gnu-api-2-resolve-method.mm
index f8a54d392c3..dc311324c08 100644
--- a/gcc/testsuite/obj-c++.dg/gnu-api-2-resolve-method.mm
+++ b/gcc/testsuite/obj-c++.dg/gnu-api-2-resolve-method.mm
@@ -5,6 +5,7 @@
 
 /* { dg-do run } */
 /* { dg-skip-if "" { *-*-* } { "-fnext-runtime" } { "" } } */
+// { dg-additional-options "-Wno-objc-root-class" }
 
 /* To get the modern GNU Objective-C Runtime API, you include
    objc/runtime.h.  */
diff --git a/gcc/testsuite/obj-c++.dg/gnu-api-2-sel.mm b/gcc/testsuite/obj-c++.dg/gnu-api-2-sel.mm
index ff50058566b..dd8ff3eeefe 100644
--- a/gcc/testsuite/obj-c++.dg/gnu-api-2-sel.mm
+++ b/gcc/testsuite/obj-c++.dg/gnu-api-2-sel.mm
@@ -4,6 +4,7 @@
 
 /* { dg-do run } */
 /* { dg-skip-if "No API#2 pre-Darwin9" { *-*-darwin[5-8]* } { "-fnext-runtime" } { "" } } */
+// { dg-additional-options "-Wno-objc-root-class" }
 
 /* To get the modern GNU Objective-C Runtime API, you include
    objc/runtime.h.  */
diff --git a/gcc/testsuite/obj-c++.dg/invalid-method-2.mm b/gcc/testsuite/obj-c++.dg/invalid-method-2.mm
index e3a8ed1ff17..8eee0ff6432 100644
--- a/gcc/testsuite/obj-c++.dg/invalid-method-2.mm
+++ b/gcc/testsuite/obj-c++.dg/invalid-method-2.mm
@@ -1,4 +1,5 @@
 /* { dg-do compile } */
+// { dg-additional-options "-Wno-objc-root-class" }
 
 /* Test that using an invalid type in a method declaration produces a
    friendly error without a compiler crash.  */
diff --git a/gcc/testsuite/obj-c++.dg/ivar-invalid-type-1.mm b/gcc/testsuite/obj-c++.dg/ivar-invalid-type-1.mm
index 4c1480a6be9..974e919d639 100644
--- a/gcc/testsuite/obj-c++.dg/ivar-invalid-type-1.mm
+++ b/gcc/testsuite/obj-c++.dg/ivar-invalid-type-1.mm
@@ -1,4 +1,5 @@
 /* { dg-do compile } */
+// { dg-additional-options "-Wno-objc-root-class" }
 #include <objc/objc.h>
 
 @interface MyRootClass
diff --git a/gcc/testsuite/obj-c++.dg/ivar-problem-1.mm b/gcc/testsuite/obj-c++.dg/ivar-problem-1.mm
index 4ed5afaf4ef..1736f9c445a 100644
--- a/gcc/testsuite/obj-c++.dg/ivar-problem-1.mm
+++ b/gcc/testsuite/obj-c++.dg/ivar-problem-1.mm
@@ -1,5 +1,6 @@
 /* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, November 2010.  */
 /* { dg-do compile } */
+// { dg-additional-options "-Wno-objc-root-class" }
 
 /* This test checks what happens if there are 16 instance variables.
    In that case, the class was not created correctly.  In this testcase,
diff --git a/gcc/testsuite/obj-c++.dg/lto/lto.exp b/gcc/testsuite/obj-c++.dg/lto/lto.exp
index 6ba5f9c48fd..936872a3bfe 100644
--- a/gcc/testsuite/obj-c++.dg/lto/lto.exp
+++ b/gcc/testsuite/obj-c++.dg/lto/lto.exp
@@ -41,10 +41,10 @@ if { ![check_effective_target_lto] } {
 global LTO_OPTIONS
 
 set LTO_OPTIONS [list	\
-  {-O0 -flto -fgnu-runtime}	\
-  {-O2 -flto -fgnu-runtime}	\
-  {-O0 -flto -flto-partition=none -fgnu-runtime} 	\
-  {-O2 -flto -flto-partition=none -fgnu-runtime}	\
+  {-O0 -flto -fgnu-runtime -Wno-objc-root-class}	\
+  {-O2 -flto -fgnu-runtime -Wno-objc-root-class}	\
+  {-O0 -flto -flto-partition=none -fgnu-runtime -Wno-objc-root-class} 	\
+  {-O2 -flto -flto-partition=none -fgnu-runtime -Wno-objc-root-class}	\
 ]
 
 obj-c++_init
@@ -67,10 +67,10 @@ foreach src $tests {
 # darwin targets can also run code with the NeXT runtime.
 if [istarget "*-*-darwin*" ] {
 set LTO_OPTIONS [list	\
-  {-O0 -flto -fnext-runtime}	\
-  {-O2 -flto -fnext-runtime}	\
-  {-O0 -flto -flto-partition=none -fnext-runtime} 	\
-  {-O2 -flto -flto-partition=none -fnext-runtime}	\
+  {-O0 -flto -fnext-runtime -Wno-objc-root-class}	\
+  {-O2 -flto -fnext-runtime -Wno-objc-root-class}	\
+  {-O0 -flto -flto-partition=none -fnext-runtime -Wno-objc-root-class} 	\
+  {-O2 -flto -flto-partition=none -fnext-runtime -Wno-objc-root-class}	\
 ]
   foreach src $tests {
     # If we're only testing specific files and this isn't one of them, skip it.
diff --git a/gcc/testsuite/obj-c++.dg/lto/trivial-1_0.mm b/gcc/testsuite/obj-c++.dg/lto/trivial-1_0.mm
index 55f62f03cfc..c3620c36025 100644
--- a/gcc/testsuite/obj-c++.dg/lto/trivial-1_0.mm
+++ b/gcc/testsuite/obj-c++.dg/lto/trivial-1_0.mm
@@ -1,5 +1,5 @@
 /* { dg-lto-do run } */
-/* { dg-skip-if "Needs OBJC2 ABI" { "*-*-darwin*" && lp64 } } */
+
 extern "C" {
 extern int printf (const char *,...) ;
 extern void abort (void) ;
diff --git a/gcc/testsuite/obj-c++.dg/method-1.mm b/gcc/testsuite/obj-c++.dg/method-1.mm
index 7317ae2aa87..5bb851ad5f6 100644
--- a/gcc/testsuite/obj-c++.dg/method-1.mm
+++ b/gcc/testsuite/obj-c++.dg/method-1.mm
@@ -3,6 +3,7 @@
 /* Author: Ziemowit Laski <zlaski@apple.com>.  */
 
 /* { dg-do compile } */
+// { dg-additional-options "-Wno-objc-root-class" }
 
 #include <objc/objc.h>
 
diff --git a/gcc/testsuite/obj-c++.dg/method-12.mm b/gcc/testsuite/obj-c++.dg/method-12.mm
index 45461445178..d3145abadb3 100644
--- a/gcc/testsuite/obj-c++.dg/method-12.mm
+++ b/gcc/testsuite/obj-c++.dg/method-12.mm
@@ -3,6 +3,7 @@
 /* { dg-options "-Wstrict-selector-match" } */
 /* { dg-do compile } */
 /* { dg-skip-if "Object interface removed" { *-*-darwin[1-2]* && { lp64 } } { "-fnext-runtime" } { "" } } */
+// { dg-additional-options "-Wno-objc-root-class" }
 
 #include <objc/Protocol.h>
 
diff --git a/gcc/testsuite/obj-c++.dg/method-18.mm b/gcc/testsuite/obj-c++.dg/method-18.mm
index 411caac111a..c753f33279d 100644
--- a/gcc/testsuite/obj-c++.dg/method-18.mm
+++ b/gcc/testsuite/obj-c++.dg/method-18.mm
@@ -1,5 +1,6 @@
 /* Contributed by Igor Seleznev <selez@mail.ru>.  */
 /* This used to be broken.  */
+// { dg-additional-options "-Wno-objc-root-class" }
 
 #include <objc/objc.h>
 
diff --git a/gcc/testsuite/obj-c++.dg/method-19.mm b/gcc/testsuite/obj-c++.dg/method-19.mm
index 225becae0f1..a3b977ef356 100644
--- a/gcc/testsuite/obj-c++.dg/method-19.mm
+++ b/gcc/testsuite/obj-c++.dg/method-19.mm
@@ -4,6 +4,7 @@
 /* Author: Ziemowit Laski <zlaski@apple.com>.  */
 /* { dg-do run } */
 /* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */
+// { dg-additional-options "-Wno-objc-root-class" }
 #include <objc/objc.h>
 #include "../objc-obj-c++-shared/runtime.h"
 
diff --git a/gcc/testsuite/obj-c++.dg/method-20.mm b/gcc/testsuite/obj-c++.dg/method-20.mm
index 96982254aa9..a7fe41d0905 100644
--- a/gcc/testsuite/obj-c++.dg/method-20.mm
+++ b/gcc/testsuite/obj-c++.dg/method-20.mm
@@ -2,6 +2,7 @@
    used as method selectors.  */
 /* Author: Ziemowit Laski <zlaski@apple.com>.  */
 /* { dg-do compile } */
+// { dg-additional-options "-Wno-objc-root-class" }
 
 @interface Foo
 - (void)insertNewButtonImage:(Foo *)newButtonImage in:(Foo *)buttonCell;
diff --git a/gcc/testsuite/obj-c++.dg/method-3.mm b/gcc/testsuite/obj-c++.dg/method-3.mm
index 9dab8c5b332..17b0c99fb96 100644
--- a/gcc/testsuite/obj-c++.dg/method-3.mm
+++ b/gcc/testsuite/obj-c++.dg/method-3.mm
@@ -3,6 +3,7 @@
 
 /* { dg-do compile } */
 /* { dg-options "-Wno-strict-selector-match" } */
+// { dg-additional-options "-Wno-objc-root-class" }
 
 #include <objc/objc.h>
 
diff --git a/gcc/testsuite/obj-c++.dg/method-4.mm b/gcc/testsuite/obj-c++.dg/method-4.mm
index e94f8f1b770..1f2f93eb93d 100644
--- a/gcc/testsuite/obj-c++.dg/method-4.mm
+++ b/gcc/testsuite/obj-c++.dg/method-4.mm
@@ -3,6 +3,7 @@
 
 /* { dg-do compile } */
 /* { dg-options "-Wstrict-selector-match" } */
+// { dg-additional-options "-Wno-objc-root-class" }
 
 #include <objc/objc.h>
 
diff --git a/gcc/testsuite/obj-c++.dg/method-5.mm b/gcc/testsuite/obj-c++.dg/method-5.mm
index 17c841a4661..10364cc3809 100644
--- a/gcc/testsuite/obj-c++.dg/method-5.mm
+++ b/gcc/testsuite/obj-c++.dg/method-5.mm
@@ -3,6 +3,7 @@
 
 /* { dg-do compile } */
 /* { dg-options "-Wno-strict-selector-match" } */
+// { dg-additional-options "-Wno-objc-root-class" }
 
 #include <objc/objc.h>
 
diff --git a/gcc/testsuite/obj-c++.dg/method-8.mm b/gcc/testsuite/obj-c++.dg/method-8.mm
index cde1bc27469..9c5c17a96b4 100644
--- a/gcc/testsuite/obj-c++.dg/method-8.mm
+++ b/gcc/testsuite/obj-c++.dg/method-8.mm
@@ -1,5 +1,6 @@
 /* Tests of duplication.  */
 /* { dg-do compile } */
+// { dg-additional-options "-Wno-objc-root-class" }
 
 @interface class1
 - (int) meth1;   /* { dg-message "previous declaration" } */
diff --git a/gcc/testsuite/obj-c++.dg/method-9.mm b/gcc/testsuite/obj-c++.dg/method-9.mm
index 787e25d67ff..bee076e7c98 100644
--- a/gcc/testsuite/obj-c++.dg/method-9.mm
+++ b/gcc/testsuite/obj-c++.dg/method-9.mm
@@ -1,6 +1,7 @@
 /* Test for lookup of class (factory) methods.  */
 /* Author: Ziemowit Laski <zlaski@apple.com>.  */
 /* { dg-do compile } */
+// { dg-additional-options "-Wno-objc-root-class" }
 
 @interface MyBase 
 - (void) rootInstanceMethod;
diff --git a/gcc/testsuite/obj-c++.dg/method-namespace-1.mm b/gcc/testsuite/obj-c++.dg/method-namespace-1.mm
index 6095f572cca..86006a73b8d 100644
--- a/gcc/testsuite/obj-c++.dg/method-namespace-1.mm
+++ b/gcc/testsuite/obj-c++.dg/method-namespace-1.mm
@@ -1,5 +1,6 @@
 /* Test for usage of namespace inside @implementation. */
 /* { dg-do compile } */
+// { dg-additional-options "-Wno-objc-root-class" }
 @interface MyDocument
 @end
 
diff --git a/gcc/testsuite/obj-c++.dg/plugin/diagnostic-test-expressions-1.mm b/gcc/testsuite/obj-c++.dg/plugin/diagnostic-test-expressions-1.mm
index 988b290ce69..128b3bd8fe9 100644
--- a/gcc/testsuite/obj-c++.dg/plugin/diagnostic-test-expressions-1.mm
+++ b/gcc/testsuite/obj-c++.dg/plugin/diagnostic-test-expressions-1.mm
@@ -1,6 +1,7 @@
 /* { dg-do compile } */
 /* { dg-options "-O -fdiagnostics-show-caret" } */
 /* { dg-excess-errors "tree range 0:0-0:0" { target { *-*-darwin* } } }  */
+// { dg-additional-options "-Wno-objc-root-class" }
 
 /* This file is similar to diagnostic-test-expressions-1.c
    (see the notes in that file); this file adds test
diff --git a/gcc/testsuite/obj-c++.dg/pr23709.mm b/gcc/testsuite/obj-c++.dg/pr23709.mm
index 018b53ac456..7936956854f 100644
--- a/gcc/testsuite/obj-c++.dg/pr23709.mm
+++ b/gcc/testsuite/obj-c++.dg/pr23709.mm
@@ -1,4 +1,5 @@
 /* { dg-do compile } */
+// { dg-additional-options "-Wno-objc-root-class" }
 
 @interface A
 +(void)method: (int)parameter {} /* { dg-error "expected" } */
diff --git a/gcc/testsuite/obj-c++.dg/pragma-2.mm b/gcc/testsuite/obj-c++.dg/pragma-2.mm
index 14c4d7928a2..09feac7971f 100644
--- a/gcc/testsuite/obj-c++.dg/pragma-2.mm
+++ b/gcc/testsuite/obj-c++.dg/pragma-2.mm
@@ -1,5 +1,6 @@
 /* It is OK to use #pragma inside @implementation body. This test checks that.  */
 /* Ziemowit Laski  <zlaski@apple.com>.  */
+// { dg-additional-options "-Wno-objc-root-class" }
 
 @interface A
 {
diff --git a/gcc/testsuite/obj-c++.dg/private-1.mm b/gcc/testsuite/obj-c++.dg/private-1.mm
index 0c25aea5566..2173b900530 100644
--- a/gcc/testsuite/obj-c++.dg/private-1.mm
+++ b/gcc/testsuite/obj-c++.dg/private-1.mm
@@ -1,6 +1,7 @@
 /* Test errors for accessing @private and @protected variables.  */
 /* Based on work by: Nicola Pero <nicola@brainstorm.co.uk>.  */
 /* { dg-do compile } */
+// { dg-additional-options "-Wno-objc-root-class" }
 #include <objc/objc.h>
 
 @interface MySuperClass
diff --git a/gcc/testsuite/obj-c++.dg/private-2.mm b/gcc/testsuite/obj-c++.dg/private-2.mm
index 3e6ff118d23..93b8a8fd5c5 100644
--- a/gcc/testsuite/obj-c++.dg/private-2.mm
+++ b/gcc/testsuite/obj-c++.dg/private-2.mm
@@ -2,6 +2,7 @@
 /* Based on work by: Nicola Pero <nicola@brainstorm.co.uk>.  */
 
 /* { dg-do compile } */
+// { dg-additional-options "-Wno-objc-root-class" }
 
 #include <objc/objc.h>
 
diff --git a/gcc/testsuite/obj-c++.dg/property/property.exp b/gcc/testsuite/obj-c++.dg/property/property.exp
index d18f6100fcf..31e683c5c00 100644
--- a/gcc/testsuite/obj-c++.dg/property/property.exp
+++ b/gcc/testsuite/obj-c++.dg/property/property.exp
@@ -31,12 +31,12 @@ dg-init
 set tests [lsort [glob -nocomplain $srcdir/$subdir/*.mm]]
 
 # Main loop.
-dg-runtest $tests "-fgnu-runtime" $DEFAULT_OBJCXXFLAGS
+dg-runtest $tests "-fgnu-runtime -Wno-objc-root-class" $DEFAULT_OBJCXXFLAGS
 
 # Darwin targets can also run code with the NeXT runtime.
 # but Properties are not supported by the runtime lib before Darwin 9.
 if [istarget "*-*-darwin\[9123\]*" ] {
-  dg-runtest $tests "-fnext-runtime" $DEFAULT_OBJCXXFLAGS
+  dg-runtest $tests "-fnext-runtime -Wno-objc-root-class" $DEFAULT_OBJCXXFLAGS
 }
 
 # All done.
diff --git a/gcc/testsuite/obj-c++.dg/proto-lossage-1.mm b/gcc/testsuite/obj-c++.dg/proto-lossage-1.mm
index 2f7eb986140..82cd05374b2 100644
--- a/gcc/testsuite/obj-c++.dg/proto-lossage-1.mm
+++ b/gcc/testsuite/obj-c++.dg/proto-lossage-1.mm
@@ -2,6 +2,7 @@
    may be lost, leading to superfluous warnings.  */
 /* Author: Ziemowit Laski <zlaski@apple.com>.  */
 /* { dg-do compile } */
+// { dg-additional-options "-Wno-objc-root-class" }
 
 /* One-line substitute for objc/objc.h */
 typedef struct objc_object { struct objc_class *class_pointer; } *id;
diff --git a/gcc/testsuite/obj-c++.dg/proto-lossage-5.mm b/gcc/testsuite/obj-c++.dg/proto-lossage-5.mm
index 35c0956ed8e..2a30bc2a9af 100644
--- a/gcc/testsuite/obj-c++.dg/proto-lossage-5.mm
+++ b/gcc/testsuite/obj-c++.dg/proto-lossage-5.mm
@@ -1,5 +1,6 @@
 /* Do not lose references to forward-declared protocols.  */
 /* { dg-do compile } */
+// { dg-additional-options "-Wno-objc-root-class" }
 @class MyBaseClass;
 @class MyClassThatFails;
 @protocol _MyProtocol;
diff --git a/gcc/testsuite/obj-c++.dg/proto-qual-1.mm b/gcc/testsuite/obj-c++.dg/proto-qual-1.mm
index 7ef0e9a98ef..b2350648f22 100644
--- a/gcc/testsuite/obj-c++.dg/proto-qual-1.mm
+++ b/gcc/testsuite/obj-c++.dg/proto-qual-1.mm
@@ -3,6 +3,7 @@
 
 /* { dg-do run } */
 /* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */
+// { dg-additional-options "-Wno-objc-root-class" }
 
 #include <stdio.h>
 #include <stdlib.h>
diff --git a/gcc/testsuite/obj-c++.dg/protocol-inheritance-1.mm b/gcc/testsuite/obj-c++.dg/protocol-inheritance-1.mm
index 5241b29abbd..c505c0083fa 100644
--- a/gcc/testsuite/obj-c++.dg/protocol-inheritance-1.mm
+++ b/gcc/testsuite/obj-c++.dg/protocol-inheritance-1.mm
@@ -1,6 +1,7 @@
 /* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, November 2010.  */
 /* { dg-do compile } */
 /* { dg-options "-Wno-protocol" } */
+// { dg-additional-options "-Wno-objc-root-class" }
 
 #include <objc/objc.h>
 
diff --git a/gcc/testsuite/obj-c++.dg/protocol-inheritance-2.mm b/gcc/testsuite/obj-c++.dg/protocol-inheritance-2.mm
index 74c9174b5de..f2bc1cadc18 100644
--- a/gcc/testsuite/obj-c++.dg/protocol-inheritance-2.mm
+++ b/gcc/testsuite/obj-c++.dg/protocol-inheritance-2.mm
@@ -1,5 +1,6 @@
 /* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, November 2010.  */
 /* { dg-do compile } */
+// { dg-additional-options "-Wno-objc-root-class" }
 
 #include <objc/objc.h>
 
diff --git a/gcc/testsuite/obj-c++.dg/protocol-optional-1.mm b/gcc/testsuite/obj-c++.dg/protocol-optional-1.mm
index bc4a3d07e97..4ecf43629b9 100644
--- a/gcc/testsuite/obj-c++.dg/protocol-optional-1.mm
+++ b/gcc/testsuite/obj-c++.dg/protocol-optional-1.mm
@@ -1,5 +1,6 @@
 /* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, November 2010.  */
 /* { dg-do compile } */
+// { dg-additional-options "-Wno-objc-root-class" }
 
 #include <objc/objc.h>
 
diff --git a/gcc/testsuite/obj-c++.dg/selector-1.mm b/gcc/testsuite/obj-c++.dg/selector-1.mm
index d34f8c89cd6..b0cdc9cc81b 100644
--- a/gcc/testsuite/obj-c++.dg/selector-1.mm
+++ b/gcc/testsuite/obj-c++.dg/selector-1.mm
@@ -3,6 +3,7 @@
 /* Author: Ziemowit Laski <zlaski@apple.com>.  */
 
 /* { dg-do compile } */
+// { dg-additional-options "-Wno-objc-root-class" }
 
 @interface Int1 
 + (int)and_eq:(int)arg1 and:(int)arg2;
diff --git a/gcc/testsuite/obj-c++.dg/selector-2.mm b/gcc/testsuite/obj-c++.dg/selector-2.mm
index 840ee19fee4..fa9ab4199f2 100644
--- a/gcc/testsuite/obj-c++.dg/selector-2.mm
+++ b/gcc/testsuite/obj-c++.dg/selector-2.mm
@@ -1,6 +1,7 @@
 /* Test that we don't ICE when issuing a -Wselector warning.  */
 /* { dg-options "-Wselector" } */
 /* { dg-do compile } */
+// { dg-additional-options "-Wno-objc-root-class" }
 
 #include <objc/objc.h>
 
diff --git a/gcc/testsuite/obj-c++.dg/selector-3.mm b/gcc/testsuite/obj-c++.dg/selector-3.mm
index a1321a7b741..0c9805626ed 100644
--- a/gcc/testsuite/obj-c++.dg/selector-3.mm
+++ b/gcc/testsuite/obj-c++.dg/selector-3.mm
@@ -2,6 +2,7 @@
 /* This is the "-fgnu-runtime" variant of objc.dg/selector-1.m.  */
 /* { dg-options "-Wselector -fgnu-runtime" } */
 /* { dg-do compile } */
+// { dg-additional-options "-Wno-objc-root-class" }
 
 typedef struct objc_object { struct objc_class *class_pointer; } *id;
 typedef const struct objc_selector    *SEL;
diff --git a/gcc/testsuite/obj-c++.dg/selector-4.mm b/gcc/testsuite/obj-c++.dg/selector-4.mm
index 690cc44b698..b6ddcbe43eb 100644
--- a/gcc/testsuite/obj-c++.dg/selector-4.mm
+++ b/gcc/testsuite/obj-c++.dg/selector-4.mm
@@ -3,6 +3,7 @@
 
 /* { dg-options "-Wselector -fnext-runtime" } */
 /* { dg-do compile } */
+// { dg-additional-options "-Wno-objc-root-class" }
 
 typedef struct objc_object { struct objc_class *class_pointer; } *id;
 typedef struct objc_selector *SEL;
diff --git a/gcc/testsuite/obj-c++.dg/strings/strings.exp b/gcc/testsuite/obj-c++.dg/strings/strings.exp
index 1bfb3be7e00..0243f24f306 100644
--- a/gcc/testsuite/obj-c++.dg/strings/strings.exp
+++ b/gcc/testsuite/obj-c++.dg/strings/strings.exp
@@ -34,11 +34,11 @@ dg-init
 set tests [lsort [glob -nocomplain $srcdir/$subdir/*.mm]]
 
 # Main loop.
-dg-runtest $tests "-fgnu-runtime" $DEFAULT_OBJCXXFLAGS
+dg-runtest $tests "-fgnu-runtime -Wno-objc-root-class" $DEFAULT_OBJCXXFLAGS
 
 # darwin targets can also run code with the NeXT runtime.
 if [istarget "*-*-darwin*" ] {
-  dg-runtest $tests "-fnext-runtime" $DEFAULT_OBJCXXFLAGS
+  dg-runtest $tests "-fnext-runtime -Wno-objc-root-class" $DEFAULT_OBJCXXFLAGS
 }
 
 # All done.
diff --git a/gcc/testsuite/obj-c++.dg/stubify-1.mm b/gcc/testsuite/obj-c++.dg/stubify-1.mm
index a32e282519c..21de46333fd 100644
--- a/gcc/testsuite/obj-c++.dg/stubify-1.mm
+++ b/gcc/testsuite/obj-c++.dg/stubify-1.mm
@@ -5,6 +5,7 @@
 /* { dg-skip-if "" { *-*-* } { "-fgnu-runtime" } { "" } } */
 /* { dg-require-effective-target ilp32 } */
 /* { dg-options "-Os -mdynamic-no-pic -fno-exceptions -mmacosx-version-min=10.4 -msymbol-stubs" } */
+// { dg-additional-options "-Wno-objc-root-class" }
 
 typedef struct objc_object { } *id ;
 int x = 41 ;
diff --git a/gcc/testsuite/obj-c++.dg/stubify-2.mm b/gcc/testsuite/obj-c++.dg/stubify-2.mm
index 69fea8def42..cbc52b1a9e5 100644
--- a/gcc/testsuite/obj-c++.dg/stubify-2.mm
+++ b/gcc/testsuite/obj-c++.dg/stubify-2.mm
@@ -5,6 +5,7 @@
 /* { dg-skip-if "" { *-*-* } { "-fgnu-runtime" } { "" } } */
 /* { dg-require-effective-target ilp32 } */
 /* { dg-options "-mdynamic-no-pic -fdump-rtl-jump -mmacosx-version-min=10.4 -msymbol-stubs" } */
+// { dg-additional-options "-Wno-objc-root-class" }
 
 typedef struct objc_object { } *id ;
 int x = 41 ;
diff --git a/gcc/testsuite/obj-c++.dg/super-dealloc-1.mm b/gcc/testsuite/obj-c++.dg/super-dealloc-1.mm
index 0ab177bb73c..39ddd01f694 100644
--- a/gcc/testsuite/obj-c++.dg/super-dealloc-1.mm
+++ b/gcc/testsuite/obj-c++.dg/super-dealloc-1.mm
@@ -2,6 +2,7 @@
 /* Author: Ziemowit Laski <zlaski@apple.com>  */
 
 /* { dg-do compile } */
+// { dg-additional-options "-Wno-objc-root-class" }
 
 @interface Foo {
   void *isa;
diff --git a/gcc/testsuite/obj-c++.dg/super-dealloc-2.mm b/gcc/testsuite/obj-c++.dg/super-dealloc-2.mm
index 80dcf495062..6dac31c17f4 100644
--- a/gcc/testsuite/obj-c++.dg/super-dealloc-2.mm
+++ b/gcc/testsuite/obj-c++.dg/super-dealloc-2.mm
@@ -2,6 +2,7 @@
 /* Author: Ziemowit Laski <zlaski@apple.com>  */
 
 /* { dg-do compile } */
+// { dg-additional-options "-Wno-objc-root-class" }
 
 @interface Foo {
   void *isa;
diff --git a/gcc/testsuite/obj-c++.dg/sync-3.mm b/gcc/testsuite/obj-c++.dg/sync-3.mm
index 95def43d05d..2949d6a8a13 100644
--- a/gcc/testsuite/obj-c++.dg/sync-3.mm
+++ b/gcc/testsuite/obj-c++.dg/sync-3.mm
@@ -1,6 +1,7 @@
 /* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, December 2010.  */
 /* { dg-options "-fobjc-exceptions" } */
 /* { dg-do compile } */
+// { dg-additional-options "-Wno-objc-root-class" }
 
 /* Test that the compiler is checking the argument of @synchronized(),
    and produce errors when invalid types are used.  */
diff --git a/gcc/testsuite/obj-c++.dg/syntax-error-2.mm b/gcc/testsuite/obj-c++.dg/syntax-error-2.mm
index ba8804a89e2..bf4d5ffb4a7 100644
--- a/gcc/testsuite/obj-c++.dg/syntax-error-2.mm
+++ b/gcc/testsuite/obj-c++.dg/syntax-error-2.mm
@@ -1,4 +1,5 @@
 /* Recover gracefully from a syntax error.  */
+// { dg-additional-options "-Wno-objc-root-class" }
 
 @implementation Whatever  /* { dg-warning "cannot find interface declaration for .Whatever." } */
 
diff --git a/gcc/testsuite/obj-c++.dg/syntax-error-4.mm b/gcc/testsuite/obj-c++.dg/syntax-error-4.mm
index 0df061839b4..97587f98495 100644
--- a/gcc/testsuite/obj-c++.dg/syntax-error-4.mm
+++ b/gcc/testsuite/obj-c++.dg/syntax-error-4.mm
@@ -1,5 +1,6 @@
 /* Yet another stray infinite loop... */
 /* { dg-do compile } */
+// { dg-additional-options "-Wno-objc-root-class" }
 
 @interface t
 {
diff --git a/gcc/testsuite/obj-c++.dg/syntax-error-7.mm b/gcc/testsuite/obj-c++.dg/syntax-error-7.mm
index 5bdccc7b05f..c406d8fe769 100644
--- a/gcc/testsuite/obj-c++.dg/syntax-error-7.mm
+++ b/gcc/testsuite/obj-c++.dg/syntax-error-7.mm
@@ -1,4 +1,5 @@
 /* { dg-do compile } */
+// { dg-additional-options "-Wno-objc-root-class" }
 
 @interface Foo
 -(void) someMethod;
diff --git a/gcc/testsuite/obj-c++.dg/syntax-error-9.mm b/gcc/testsuite/obj-c++.dg/syntax-error-9.mm
index 1876c32dd20..ad8837c28af 100644
--- a/gcc/testsuite/obj-c++.dg/syntax-error-9.mm
+++ b/gcc/testsuite/obj-c++.dg/syntax-error-9.mm
@@ -1,3 +1,4 @@
+// { dg-additional-options "-Wno-objc-root-class" }
 @implementation SaturnDoc /* { dg-warning "cannot find interface declaration" } */
 - read: (void*)aStream ggg /* { dg-error "expected .:. at end of input" } */
 /* { dg-error "-:expected ..*. at end of input" "" { target *-*-* } .+1 } */
diff --git a/gcc/testsuite/obj-c++.dg/template-4.mm b/gcc/testsuite/obj-c++.dg/template-4.mm
index 5301df5c0e0..02795e76e28 100644
--- a/gcc/testsuite/obj-c++.dg/template-4.mm
+++ b/gcc/testsuite/obj-c++.dg/template-4.mm
@@ -4,6 +4,7 @@
 /* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */
 /* { dg-options "-mno-constant-cfstrings" { target *-*-darwin* } } */
 /* { dg-additional-sources "../objc-obj-c++-shared/nsconstantstring-class-impl.mm" } */
+// { dg-additional-options "-Wno-objc-root-class" }
 
 #include <stdarg.h>
 #include <stdlib.h>
diff --git a/gcc/testsuite/obj-c++.dg/template-7.mm b/gcc/testsuite/obj-c++.dg/template-7.mm
index 8621abebaf1..b3697a584a0 100644
--- a/gcc/testsuite/obj-c++.dg/template-7.mm
+++ b/gcc/testsuite/obj-c++.dg/template-7.mm
@@ -3,6 +3,7 @@
 // Author: Fariborz Jahanian <fjahanian@apple.com>
 // { dg-do compile }
 // { dg-options "" }
+// { dg-additional-options "-Wno-objc-root-class" }
 typedef struct objc_class *Class;
 
 @interface Object
diff --git a/gcc/testsuite/obj-c++.dg/template-8.mm b/gcc/testsuite/obj-c++.dg/template-8.mm
index df215b8525d..1b9f4d16ae9 100644
--- a/gcc/testsuite/obj-c++.dg/template-8.mm
+++ b/gcc/testsuite/obj-c++.dg/template-8.mm
@@ -5,6 +5,7 @@
 /* { dg-do run } */
 /* { dg-skip-if "No API#2 pre-Darwin9" { *-*-darwin[5-8]* } { "-fnext-runtime" } { "" } } */
 /* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */
+// { dg-additional-options "-Wno-objc-root-class" }
 
 #include <objc/objc.h>
 #include <objc/runtime.h>
diff --git a/gcc/testsuite/obj-c++.dg/threedotthree-abi-1.mm b/gcc/testsuite/obj-c++.dg/threedotthree-abi-1.mm
index c48181049f1..32f4fd84e88 100644
--- a/gcc/testsuite/obj-c++.dg/threedotthree-abi-1.mm
+++ b/gcc/testsuite/obj-c++.dg/threedotthree-abi-1.mm
@@ -3,6 +3,7 @@
 /* { dg-do run { target *-*-darwin* } } */
 /* { dg-require-effective-target ilp32 } */
 /* { dg-skip-if "" { *-*-* } { "-fgnu-runtime" } { "" } } */
+// { dg-additional-options "-Wno-objc-root-class" }
 
 #include <stdio.h>
 #include <string.h>
diff --git a/gcc/testsuite/obj-c++.dg/torture/dg-torture.exp b/gcc/testsuite/obj-c++.dg/torture/dg-torture.exp
index c3d3f8e29fd..4e4620791e8 100644
--- a/gcc/testsuite/obj-c++.dg/torture/dg-torture.exp
+++ b/gcc/testsuite/obj-c++.dg/torture/dg-torture.exp
@@ -7,11 +7,11 @@ dg-init
 # Gather a list of all tests.
 set tests [lsort [glob -nocomplain $srcdir/$subdir/*.mm]]
  
-obj-c++-dg-runtest $tests "" "-fgnu-runtime"
+obj-c++-dg-runtest $tests "" "-fgnu-runtime  -Wno-objc-root-class"
 
 # darwin targets can also run code with the NeXT runtime.
 if [istarget "*-*-darwin*" ] {
-  obj-c++-dg-runtest $tests "" "-fnext-runtime"
+  obj-c++-dg-runtest $tests "" "-fnext-runtime  -Wno-objc-root-class"
 }
 
 dg-finish
diff --git a/gcc/testsuite/obj-c++.dg/torture/strings/strings.exp b/gcc/testsuite/obj-c++.dg/torture/strings/strings.exp
index 401bc5856bf..6181c30b198 100644
--- a/gcc/testsuite/obj-c++.dg/torture/strings/strings.exp
+++ b/gcc/testsuite/obj-c++.dg/torture/strings/strings.exp
@@ -24,11 +24,11 @@ dg-init
 # Gather a list of all tests.
 set tests [lsort [glob -nocomplain $srcdir/$subdir/*.mm]]
 
-obj-c++-dg-runtest $tests "" "-fgnu-runtime"
+obj-c++-dg-runtest $tests "" "-fgnu-runtime  -Wno-objc-root-class"
 
 # Darwin targets can also run code with the NeXT runtime.
 if [istarget "*-*-darwin*" ] {
-  obj-c++-dg-runtest $tests "" "-fnext-runtime"
+  obj-c++-dg-runtest $tests "" "-fnext-runtime  -Wno-objc-root-class"
 }
 
 dg-finish
diff --git a/gcc/testsuite/obj-c++.dg/try-catch-12.mm b/gcc/testsuite/obj-c++.dg/try-catch-12.mm
index e08f321e8c7..6a608055784 100644
--- a/gcc/testsuite/obj-c++.dg/try-catch-12.mm
+++ b/gcc/testsuite/obj-c++.dg/try-catch-12.mm
@@ -4,6 +4,7 @@
 
 /* { dg-options "-fobjc-exceptions" } */
 /* { dg-do compile } */
+// { dg-additional-options "-Wno-objc-root-class" }
 
 typedef volatile int IOSharedLockData;
 
diff --git a/gcc/testsuite/obj-c++.dg/try-catch-13.mm b/gcc/testsuite/obj-c++.dg/try-catch-13.mm
index 050d8113555..0e6f01b23e9 100644
--- a/gcc/testsuite/obj-c++.dg/try-catch-13.mm
+++ b/gcc/testsuite/obj-c++.dg/try-catch-13.mm
@@ -4,6 +4,7 @@
 
 /* { dg-options "-fobjc-exceptions" } */
 /* { dg-do compile } */
+// { dg-additional-options "-Wno-objc-root-class" }
 
 @interface TestMyTests
 - (void) testSpoon;


More information about the Gcc-cvs mailing list