aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/class.c
diff options
context:
space:
mode:
authorMark Mitchell <mark@codesourcery.com>2004-08-04 05:27:52 +0000
committerMark Mitchell <mmitchel@gcc.gnu.org>2004-08-04 05:27:52 +0000
commit73a8adb62e1609c94e21903fe9c261b6d30a8415 (patch)
treedc4c187d7c4a64c15aab2950413405f2b750eaf1 /gcc/cp/class.c
parentaed6152d8c55eb6e756b7459733a8bfda3dd00a3 (diff)
downloadgcc-73a8adb62e1609c94e21903fe9c261b6d30a8415.zip
gcc-73a8adb62e1609c94e21903fe9c261b6d30a8415.tar.gz
gcc-73a8adb62e1609c94e21903fe9c261b6d30a8415.tar.bz2
class.c (build_vtable): Do not set DECL_VISIBILITY here.
* class.c (build_vtable): Do not set DECL_VISIBILITY here. (check_field_decls): Or here. (check_methods): Or here. (initialize_array): Don't mess with DECL_CONTEXT. * cp-tree.h (start_decl): Adjust prototype. (determine_visibility): New function. * decl.c (duplicate_decls): Remove checks for hidden "operator new". (build_library_fn_1): Give all library functions default visibility. (start_decl): Add pop_scope_p parameter. Tidy. (cp_finish_decl): Do not pop scopes here. Call determine_visibility for variable definitions. (start_preparsed_function): Call determine_visibility. * decl2.c (determine_visibility): New function. * method.c (use_thunk): Fix formatting. * parser.c (cp_parser_condition): Adjust calls to start_decl. (cp_parser_init_declarator): Likewise. * pt.c (instantiate_decl): Always call pop_nested_class. * rtti.c (get_tinfo_decl): Do not set DECL_VISIBILITY. (tinfo_base_init): Likewise. * g++.dg/ext/visibility/assign1.C: New test. * g++.dg/ext/visibility/new1.C: Likewise. From-SVN: r85543
Diffstat (limited to 'gcc/cp/class.c')
-rw-r--r--gcc/cp/class.c47
1 files changed, 1 insertions, 46 deletions
diff --git a/gcc/cp/class.c b/gcc/cp/class.c
index 365febb..e0bae52 100644
--- a/gcc/cp/class.c
+++ b/gcc/cp/class.c
@@ -659,11 +659,6 @@ build_vtable (tree class_type, tree name, tree vtable_type)
require more intrusive changes to the g++ front end. */
DECL_IGNORED_P (decl) = 1;
- /* The vtable's visibility is the class visibility. There is no way
- to override the visibility for just the vtable. */
- DECL_VISIBILITY (decl) = CLASSTYPE_VISIBILITY (class_type);
- DECL_VISIBILITY_SPECIFIED (decl) = CLASSTYPE_VISIBILITY_SPECIFIED (class_type);
-
return decl;
}
@@ -2971,25 +2966,7 @@ check_field_decls (tree t, tree *access_decls,
continue;
if (TREE_CODE (x) == CONST_DECL || TREE_CODE (x) == VAR_DECL)
- {
- /* Apply the class's visibility attribute to static members
- which do not have a visibility attribute. */
- if (! lookup_attribute ("visibility", DECL_ATTRIBUTES (x)))
- {
- if (visibility_options.inlines_hidden && DECL_INLINE (x))
- {
- DECL_VISIBILITY (x) = VISIBILITY_HIDDEN;
- DECL_VISIBILITY_SPECIFIED (x) = 1;
- }
- else
- {
- DECL_VISIBILITY (x) = CLASSTYPE_VISIBILITY (current_class_type);
- DECL_VISIBILITY_SPECIFIED (x) = CLASSTYPE_VISIBILITY_SPECIFIED (current_class_type);
- }
- }
-
- continue;
- }
+ continue;
/* Now it can only be a FIELD_DECL. */
@@ -3744,23 +3721,6 @@ check_methods (tree t)
check_for_override (x, t);
if (DECL_PURE_VIRTUAL_P (x) && ! DECL_VINDEX (x))
cp_error_at ("initializer specified for non-virtual method `%D'", x);
-
- /* Apply the class's visibility attribute to methods which do
- not have a visibility attribute. */
- if (! lookup_attribute ("visibility", DECL_ATTRIBUTES (x)))
- {
- if (visibility_options.inlines_hidden && DECL_INLINE (x))
- {
- DECL_VISIBILITY (x) = VISIBILITY_HIDDEN;
- DECL_VISIBILITY_SPECIFIED (x) = 1;
- }
- else
- {
- DECL_VISIBILITY (x) = CLASSTYPE_VISIBILITY (current_class_type);
- DECL_VISIBILITY_SPECIFIED (x) = CLASSTYPE_VISIBILITY_SPECIFIED (current_class_type);
- }
- }
-
/* The name of the field is the original field name
Save this in auxiliary field for later overloading. */
if (DECL_VINDEX (x))
@@ -6740,13 +6700,8 @@ initialize_vtable (tree binfo, tree inits)
static void
initialize_array (tree decl, tree inits)
{
- tree context;
-
- context = DECL_CONTEXT (decl);
- DECL_CONTEXT (decl) = NULL_TREE;
DECL_INITIAL (decl) = build_constructor (NULL_TREE, inits);
cp_finish_decl (decl, DECL_INITIAL (decl), NULL_TREE, 0);
- DECL_CONTEXT (decl) = context;
}
/* Build the VTT (virtual table table) for T.