diff mbox

=?UTF-8?Q?ObjC++=20merge=20(namespaces=20inside=20@implementation=20cont?= =?UTF-8?Q?ext)?=

Message ID 1286471934.410425039@192.168.2.231
State New
Headers show

Commit Message

Nicola Pero Oct. 7, 2010, 5:18 p.m. UTC
I merged this improvement from the apple/trunk branch (preapproved by Mike).

Thanks
diff mbox

Patch

Index: testsuite/ChangeLog
===================================================================
--- testsuite/ChangeLog (revision 165124)
+++ testsuite/ChangeLog (working copy)
@@ -1,3 +1,12 @@ 
+2010-10-07  Nicola Pero  <nicola.pero@meta-innovation.com>
+
+       Merge from 'apple/trunk' branch on FSF servers.
+       
+       2006-04-26  Fariborz Jahanian <fjahanian@apple.com>
+
+       Radar 4508851
+       * obj-c++.dg/method-namespace-1.mm: New.
+
 2010-10-07  Martin Jambor  <mjambor@suse.cz>
 
        * gcc.dg/tree-ssa/sra-11.c: New test.
Index: testsuite/obj-c++.dg/method-namespace-1.mm
===================================================================
--- testsuite/obj-c++.dg/method-namespace-1.mm  (revision 0)
+++ testsuite/obj-c++.dg/method-namespace-1.mm  (revision 0)
@@ -0,0 +1,29 @@ 
+/* Test for usage of namespace inside @implementation. */
+/* { dg-do compile } */
+@interface MyDocument
+@end
+
+@implementation MyDocument
+
+// This deprecated usage works
+static void foo1() { }
+
+// This preferred usage does _not_ work
+namespace
+    {
+    void foo2() { }
+    }
+
+namespace STD 
+    {
+       void foo3 () {}
+    }
+
+using namespace STD;
+
+- (void) GARF {
+  foo2();
+  foo3();
+}
+
+@end
Index: cp/ChangeLog
===================================================================
--- cp/ChangeLog        (revision 165124)
+++ cp/ChangeLog        (working copy)
@@ -1,6 +1,16 @@ 
+2010-10-07  Nicola Pero  <nicola@nicola.brainstorm.co.uk>
+
+       Merge from apple/trunk branch on FSF servers.
+
+       2006-04-26  Fariborz Jahanian <fjahanian@apple.com>
+
+        Radar 4508851
+       * parser.c (cp_parser_objc_interstitial_code): Recognize
+       and parse RID_NAMESPACE keyword.
+
 2010-10-07  Iain Sandoe  <iains@gcc.gnu.org>
 
-       parser.c (cp_parser_objc_method_tail_params_opt): Peek new token after
+       * parser.c (cp_parser_objc_method_tail_params_opt): Peek new token after
        finding ellipsis, before checking for attributes.
 
 2010-10-06  Nicola Pero  <nicola.pero@meta-innovation.com>
Index: cp/parser.c
===================================================================
--- cp/parser.c (revision 165124)
+++ cp/parser.c (working copy)
@@ -21635,6 +21635,8 @@  cp_parser_objc_interstitial_code (cp_par
       cp_lexer_consume_token (parser->lexer);
       objc_set_method_opt (false);
     }
+  else if (token->keyword == RID_NAMESPACE)
+    cp_parser_namespace_definition (parser);
   /* Other stray characters must generate errors.  */
   else if (token->type == CPP_OPEN_BRACE || token->type == CPP_CLOSE_BRACE)
     {