]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Support "gcc" namespace in gengtype
authordmalcolm <dmalcolm@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 16 Aug 2013 19:46:12 +0000 (19:46 +0000)
committerdmalcolm <dmalcolm@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 16 Aug 2013 19:46:12 +0000 (19:46 +0000)
gcc/
* gengtype.c (type_for_name): Add special-case support for
locating types within the "gcc::" namespace.
(open_base_files): Emit a "using namespace gcc" directive.

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

gcc/ChangeLog
gcc/gengtype.c

index abe0d43d2bbccce2924914b71a2bf8a9f0cc4553..f4d9ce3c3360e4977cf221c15004a60a0f792f63 100644 (file)
@@ -1,3 +1,9 @@
+2013-08-16  David Malcolm  <dmalcolm@redhat.com>
+
+       * gengtype.c (type_for_name): Add special-case support for
+       locating types within the "gcc::" namespace.
+       (open_base_files): Emit a "using namespace gcc" directive.
+
 2013-08-16  Michael Meissner  <meissner@linux.vnet.ibm.com>
 
        PR target/58160
index 9c127522733163bfb58974ba42925a21b516ef7b..c12a4e2393d750da08a1acc3e89d34a6b8ca6da9 100644 (file)
@@ -610,6 +610,16 @@ static type_p
 type_for_name (const char *s)
 {
   pair_p p;
+
+  /* Special-case support for types within a "gcc::" namespace.  Rather
+     than fully-supporting namespaces, simply strip off the "gcc::" prefix
+     where present.  This allows us to have GTY roots of this form:
+         extern GTY(()) gcc::some_type *some_ptr;
+     where the autogenerated functions will refer to simply "some_type",
+     where they can be resolved into their namespace.  */
+  if (0 == strncmp(s, "gcc::", 5))
+    s += 5;
+
   for (p = typedefs; p != NULL; p = p->next)
     if (strcmp (p->name, s) == 0)
       return p->type;
@@ -1741,6 +1751,13 @@ open_base_files (void)
     /* Make sure we handle "cfun" specially.  */
     oprintf (gtype_desc_c, "\n/* See definition in function.h.  */\n");
     oprintf (gtype_desc_c, "#undef cfun\n");
+
+    oprintf (gtype_desc_c,
+            "\n"
+            "/* Types with a \"gcc::\" namespace have it stripped\n"
+            "   during gengtype parsing.  Provide a \"using\" directive\n"
+            "   to ensure that the fully-qualified types are found.  */\n"
+            "using namespace gcc;\n");
   }
 }