aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/parser.c
diff options
context:
space:
mode:
authorJason Merrill <jason@gcc.gnu.org>2006-03-20 22:19:06 -0500
committerJason Merrill <jason@gcc.gnu.org>2006-03-20 22:19:06 -0500
commit0ed5edac59d8ee8ad66e9a92763257895008eb8c (patch)
tree6e55c5f98ba55a6fcaf4861b4df4e8d7233c36ef /gcc/cp/parser.c
parent29c14e849ec20e0e16fcd9822f50fa831204af60 (diff)
downloadgcc-0ed5edac59d8ee8ad66e9a92763257895008eb8c.zip
gcc-0ed5edac59d8ee8ad66e9a92763257895008eb8c.tar.gz
gcc-0ed5edac59d8ee8ad66e9a92763257895008eb8c.tar.bz2
re PR c++/21764 (visibility attributes on namespace scope)
PR c++/21764 * c-pragma.c (visstack): Move out of handle_pragma_visibility. (push_visibility, pop_visibility): Likewise. * c-pragma.h: Declare them. * cp/name-lookup.h (struct cp_binding_level): Add has_visibility bitfield. * cp/name-lookup.c: Include c-pragma.h. (push_namespace_with_attribs): Split out from push_namespace. Push visibility if appropriate. Set TREE_PUBLIC on namespaces. (leave_scope): Pop visibility if appropriate. * cp/parser.c (cp_parser_declaration, cp_parser_namespace_name): Allow attributes on namespace declarations. PR c++/19238 * cp/decl.c (cp_finish_decl): Call determine_visibility later. (start_preparsed_function): Likewise. * cp/cp-tree.h (CP_TYPE_CONTEXT, TYPE_NAMESPACE_SCOPE_P): New macros. (TYPE_CLASS_SCOPE_P, TYPE_FUNCTION_SCOPE_P): New macros. * cp/decl2.c (determine_visibility_from_class): Split out from... (determine_visibility): ...here. Handle function scope and nested classes. (import_export_decl): Move visibility handling to determine_visibility_from_class. From-SVN: r112239
Diffstat (limited to 'gcc/cp/parser.c')
-rw-r--r--gcc/cp/parser.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index b5c7fc0..e04a8e7 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -7064,7 +7064,7 @@ cp_parser_declaration (cp_parser* parser)
&& (/* A named namespace definition. */
(token2.type == CPP_NAME
&& (cp_lexer_peek_nth_token (parser->lexer, 3)->type
- == CPP_OPEN_BRACE))
+ != CPP_EQ))
/* An unnamed namespace definition. */
|| token2.type == CPP_OPEN_BRACE))
cp_parser_namespace_definition (parser);
@@ -10470,7 +10470,7 @@ cp_parser_namespace_name (cp_parser* parser)
static void
cp_parser_namespace_definition (cp_parser* parser)
{
- tree identifier;
+ tree identifier, attribs;
/* Look for the `namespace' keyword. */
cp_parser_require_keyword (parser, RID_NAMESPACE, "`namespace'");
@@ -10484,10 +10484,13 @@ cp_parser_namespace_definition (cp_parser* parser)
else
identifier = NULL_TREE;
+ /* Parse any specified attributes. */
+ attribs = cp_parser_attributes_opt (parser);
+
/* Look for the `{' to start the namespace. */
cp_parser_require (parser, CPP_OPEN_BRACE, "`{'");
/* Start the namespace. */
- push_namespace (identifier);
+ push_namespace_with_attribs (identifier, attribs);
/* Parse the body of the namespace. */
cp_parser_namespace_body (parser);
/* Finish the namespace. */