OSDN Git Service

In gcc/cp/:
authornicola <nicola@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 7 Oct 2010 17:17:22 +0000 (17:17 +0000)
committernicola <nicola@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 7 Oct 2010 17:17:22 +0000 (17:17 +0000)
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.

In gcc/testsuite/:
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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@165125 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/cp/ChangeLog
gcc/cp/parser.c
gcc/testsuite/ChangeLog
gcc/testsuite/obj-c++.dg/method-namespace-1.mm [new file with mode: 0644]

index ac07e63..7e6bdda 100644 (file)
@@ -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 6c842df..f5fa793 100644 (file)
@@ -21635,6 +21635,8 @@ cp_parser_objc_interstitial_code (cp_parser* parser)
       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)
     {
index 12be369..c8f841e 100644 (file)
@@ -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.
diff --git a/gcc/testsuite/obj-c++.dg/method-namespace-1.mm b/gcc/testsuite/obj-c++.dg/method-namespace-1.mm
new file mode 100644 (file)
index 0000000..6095f57
--- /dev/null
@@ -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