From 0c8feefe300038d33498ad1d956981310b3d1823 Mon Sep 17 00:00:00 2001 From: Mark Mitchell Date: Tue, 8 Sep 1998 11:37:48 +0000 Subject: [PATCH] cp-tree.h (anonymous_namespace_name): Declare. * cp-tree.h (anonymous_namespace_name): Declare. * decl.c: Define it. (push_namespace): Use anonymous_namespace_name, rather than local static anon_name. * error.c (dump_decl): If a namespace is named anonymous_namespace_name, call it {anonymous}. From-SVN: r22329 --- gcc/cp/ChangeLog | 7 +++++++ gcc/cp/cp-tree.h | 2 ++ gcc/cp/decl.c | 11 +++++++---- gcc/cp/error.c | 5 ++++- 4 files changed, 20 insertions(+), 5 deletions(-) diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 27c37260cb9..c1ab0e4080a 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,12 @@ 1998-09-08 Mark Mitchell + * cp-tree.h (anonymous_namespace_name): Declare. + * decl.c: Define it. + (push_namespace): Use anonymous_namespace_name, rather than local + static anon_name. + * error.c (dump_decl): If a namespace is named + anonymous_namespace_name, call it {anonymous}. + * decl.c (grokparms): Distinguish between references and pointers in error message. diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index 3c3a8588139..2939275d859 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -1924,6 +1924,8 @@ extern tree boolean_type_node, boolean_true_node, boolean_false_node; extern tree null_node; +extern tree anonymous_namespace_name; + /* in pt.c */ /* These values are used for the `STRICT' parameter to type_unfication and diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index bbe7b9d7e34..488cd0bc6b4 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -559,6 +559,10 @@ extern tree previous_class_values; node, but signed. */ tree signed_size_zero_node; +/* The name of the anonymous namespace, throughout this translation + unit. */ +tree anonymous_namespace_name; + /* Allocate a level of searching. */ @@ -1783,10 +1787,9 @@ push_namespace (name) { /* The name of anonymous namespace is unique for the translation unit. */ - static tree anon_name = NULL_TREE; - if (!anon_name) - anon_name = get_file_function_name ('N'); - name = anon_name; + if (!anonymous_namespace_name) + anonymous_namespace_name = get_file_function_name ('N'); + name = anonymous_namespace_name; d = IDENTIFIER_NAMESPACE_VALUE (name); if (d) /* Reopening anonymous namespace. */ diff --git a/gcc/cp/error.c b/gcc/cp/error.c index dd3f9523562..3a505c4f0eb 100644 --- a/gcc/cp/error.c +++ b/gcc/cp/error.c @@ -733,7 +733,10 @@ dump_decl (t, v) dump_decl (DECL_CONTEXT (t), v); OB_PUTC2 (':',':'); } - OB_PUTID (DECL_NAME (t)); + if (DECL_NAME (t) == anonymous_namespace_name) + OB_PUTS ("{anonymous}"); + else + OB_PUTID (DECL_NAME (t)); break; case SCOPE_REF: