aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Malcolm <dmalcolm@redhat.com>2013-08-16 19:46:12 +0000
committerDavid Malcolm <dmalcolm@gcc.gnu.org>2013-08-16 19:46:12 +0000
commitc74f54a0c159e78d39dc2c68f87ac7dda139f4d6 (patch)
tree5b8db48b00e81d299d152b6d3de12ccd86afc2e4
parentf758f2992f61a18b961a151e0e8b7bac68310356 (diff)
downloadgcc-c74f54a0c159e78d39dc2c68f87ac7dda139f4d6.zip
gcc-c74f54a0c159e78d39dc2c68f87ac7dda139f4d6.tar.gz
gcc-c74f54a0c159e78d39dc2c68f87ac7dda139f4d6.tar.bz2
Support "gcc" namespace in gengtype
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. From-SVN: r201800
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/gengtype.c17
2 files changed, 23 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index abe0d43..f4d9ce3 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -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
diff --git a/gcc/gengtype.c b/gcc/gengtype.c
index 9c12752..c12a4e2 100644
--- a/gcc/gengtype.c
+++ b/gcc/gengtype.c
@@ -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");
}
}