aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Merrill <jason@gcc.gnu.org>2003-12-08 15:29:15 -0500
committerJason Merrill <jason@gcc.gnu.org>2003-12-08 15:29:15 -0500
commited36980c2256c731fd348fbe13c61a52bd7c32a2 (patch)
treef26daf46f4eda155a0360bde32fbd2e8f0259682
parent4e8537aea1415315c858401000dec14a03f00280 (diff)
downloadgcc-ed36980c2256c731fd348fbe13c61a52bd7c32a2.zip
gcc-ed36980c2256c731fd348fbe13c61a52bd7c32a2.tar.gz
gcc-ed36980c2256c731fd348fbe13c61a52bd7c32a2.tar.bz2
Give the anonymous namespace a null DECL_NAME.
* cp-tree.h: Don't declare anonymous_namespace_name. * decl.c: Don't define it. * dump.c (cp_dump_tree): Don't check for it. * cxx-pretty-print.c (pp_cxx_original_namespace_definition): Likewise. * error.c (dump_decl): Likewise. * name-lookup.c: Define it here. (push_namespace): Put it in DECL_ASSEMBLER_NAME instead. * mangle.c (write_unqualified_name): Adjust. From-SVN: r74433
-rw-r--r--gcc/cp/ChangeLog32
-rw-r--r--gcc/cp/cp-tree.h2
-rw-r--r--gcc/cp/cxx-pretty-print.c2
-rw-r--r--gcc/cp/decl.c4
-rw-r--r--gcc/cp/dump.c5
-rw-r--r--gcc/cp/error.c2
-rw-r--r--gcc/cp/mangle.c2
-rw-r--r--gcc/cp/name-lookup.c13
8 files changed, 38 insertions, 24 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 8105bfc..3fa1392 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,13 +1,25 @@
-2003-12-07 Giovanni Bajo <giovannibajo@gcc.gnu.org>
-
- PR c++/2294
- * name-lookup.c (push_overloaded_decl): Always construct an
- OVERLOAD unless the declaration is a built-in.
- (set_namespace_binding): While binding OVERLOADs with only one
- declaration, we still need to call supplement_binding.
- * init.c (build_new_1): Deal with an OVERLOAD set when
- looking up for _Jv_AllocObject.
- * except.c (build_throw): Likewise for _Jv_Throw.
+2003-12-08 Jason Merrill <jason@redhat.com>
+
+ Give the anonymous namespace a null DECL_NAME.
+ * cp-tree.h: Don't declare anonymous_namespace_name.
+ * decl.c: Don't define it.
+ * dump.c (cp_dump_tree): Don't check for it.
+ * cxx-pretty-print.c (pp_cxx_original_namespace_definition): Likewise.
+ * error.c (dump_decl): Likewise.
+ * name-lookup.c: Define it here.
+ (push_namespace): Put it in DECL_ASSEMBLER_NAME instead.
+ * mangle.c (write_unqualified_name): Adjust.
+
+2003-12-07 Giovanni Bajo <giovannibajo@gcc.gnu.org>
+
+ PR c++/2294
+ * name-lookup.c (push_overloaded_decl): Always construct an
+ OVERLOAD unless the declaration is a built-in.
+ (set_namespace_binding): While binding OVERLOADs with only one
+ declaration, we still need to call supplement_binding.
+ * init.c (build_new_1): Deal with an OVERLOAD set when
+ looking up for _Jv_AllocObject.
+ * except.c (build_throw): Likewise for _Jv_Throw.
2003-12-06 Mark Mitchell <mark@codesourcery.com>
diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h
index b02fb56..b1a434e 100644
--- a/gcc/cp/cp-tree.h
+++ b/gcc/cp/cp-tree.h
@@ -3085,8 +3085,6 @@ extern GTY(()) tree error_mark_list;
extern GTY(()) tree integer_two_node;
extern GTY(()) tree integer_three_node;
-extern GTY(()) tree anonymous_namespace_name;
-
/* The number of function bodies which we are currently processing.
(Zero if we are at namespace scope, one inside the body of a
function, two inside the body of a function in a local class, etc.) */
diff --git a/gcc/cp/cxx-pretty-print.c b/gcc/cp/cxx-pretty-print.c
index ca8c603..a27e258 100644
--- a/gcc/cp/cxx-pretty-print.c
+++ b/gcc/cp/cxx-pretty-print.c
@@ -1479,7 +1479,7 @@ static void
pp_cxx_original_namespace_definition (cxx_pretty_printer *pp, tree t)
{
pp_cxx_identifier (pp, "namespace");
- if (DECL_NAME (t) != anonymous_namespace_name)
+ if (DECL_NAME (t))
pp_cxx_unqualified_id (pp, t);
pp_cxx_whitespace (pp);
pp_cxx_left_brace (pp);
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index a1b320f..9c6379f 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -228,10 +228,6 @@ struct named_label_list GTY(())
#define named_labels cp_function_chain->x_named_labels
-/* The name of the anonymous namespace, throughout this translation
- unit. */
-tree anonymous_namespace_name;
-
/* The number of function bodies which we are currently processing.
(Zero if we are at namespace scope, one inside the body of a
function, two inside the body of a function in a local class, etc.) */
diff --git a/gcc/cp/dump.c b/gcc/cp/dump.c
index b48f25b..17b30c9 100644
--- a/gcc/cp/dump.c
+++ b/gcc/cp/dump.c
@@ -230,11 +230,6 @@ cp_dump_tree (void* dump_info, tree t)
dump_child ("tynm", TREE_TYPE (t));
return true;
}
- else if (t == anonymous_namespace_name)
- {
- dump_string (di, "unnamed");
- return true;
- }
break;
case OFFSET_TYPE:
diff --git a/gcc/cp/error.c b/gcc/cp/error.c
index 1c44324..dab0f2e 100644
--- a/gcc/cp/error.c
+++ b/gcc/cp/error.c
@@ -805,7 +805,7 @@ dump_decl (tree t, int flags)
else
{
dump_scope (CP_DECL_CONTEXT (t), flags);
- if (DECL_NAME (t) == anonymous_namespace_name)
+ if (DECL_NAME (t) == NULL_TREE)
pp_identifier (cxx_pp, "<unnamed>");
else
pp_tree_identifier (cxx_pp, DECL_NAME (t));
diff --git a/gcc/cp/mangle.c b/gcc/cp/mangle.c
index 15334f3..94c885c 100644
--- a/gcc/cp/mangle.c
+++ b/gcc/cp/mangle.c
@@ -991,6 +991,8 @@ write_unqualified_name (const tree decl)
write_special_name_constructor (decl);
else if (DECL_LANG_SPECIFIC (decl) != NULL && DECL_DESTRUCTOR_P (decl))
write_special_name_destructor (decl);
+ else if (DECL_NAME (decl) == NULL_TREE)
+ write_source_name (DECL_ASSEMBLER_NAME (decl));
else if (DECL_CONV_FN_P (decl))
{
/* Conversion operator. Handle it right here.
diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c
index 203cb1b..7446b30 100644
--- a/gcc/cp/name-lookup.c
+++ b/gcc/cp/name-lookup.c
@@ -48,6 +48,10 @@ static tree push_using_directive (tree);
tree global_namespace;
+/* The name of the anonymous namespace, throughout this translation
+ unit. */
+GTY(()) tree anonymous_namespace_name;
+
/* Compute the chain index of a binding_entry given the HASH value of its
name and the total COUNT of chains. COUNT is assumed to be a power
@@ -2990,6 +2994,7 @@ push_namespace (tree name)
tree d = NULL_TREE;
int need_new = 1;
int implicit_use = 0;
+ bool anon = !name;
timevar_push (TV_NAME_LOOKUP);
@@ -2999,7 +3004,7 @@ push_namespace (tree name)
my_friendly_assert (global_namespace != NULL && name != global_scope_name,
20030531);
- if (!name)
+ if (anon)
{
/* The name of anonymous namespace is unique for the translation
unit. */
@@ -3034,6 +3039,12 @@ push_namespace (tree name)
d = build_lang_decl (NAMESPACE_DECL, name, void_type_node);
DECL_CONTEXT (d) = FROB_CONTEXT (current_namespace);
d = pushdecl (d);
+ if (anon)
+ {
+ /* Clear DECL_NAME for the benefit of debugging back ends. */
+ SET_DECL_ASSEMBLER_NAME (d, name);
+ DECL_NAME (d) = NULL_TREE;
+ }
begin_scope (sk_namespace, d);
}
else