From: Nathan Sidwell Date: Fri, 6 Sep 2019 11:22:09 +0000 (+0000) Subject: [C++ PATCH] Reserve a decl_lang bit X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=c0c2096fbada36fa26778bc02b32555150050d85;p=gcc.git [C++ PATCH] Reserve a decl_lang bit https://gcc.gnu.org/ml/gcc-patches/2019-09/msg00365.html Reserve TREE_LANG_FLAG_3 for modules. gcc/cp/ * cp-tree.h (DECL_CONSTRUCTION_VTABLE_P): Delete. (DECL_NON_TRIVIALLY_INITIALIZED_P): Move to TREE_LANG_FLAG_6. * class.c (build_ctor_vtbl_group): Don't set DECL_CONSTRUCTION_VTABLE_P. * decl2.c (determine_visibility_from_class): Don't check DECL_CONSTRUCTION_VTABLE_P anymore. From-SVN: r275455 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index c1c728210d7..28285d9e182 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,14 @@ +2019-09-06 Nathan Sidwell + + Reserve TREE_LANG_FLAG_3 for modules. + gcc/cp/ + * cp-tree.h (DECL_CONSTRUCTION_VTABLE_P): Delete. + (DECL_NON_TRIVIALLY_INITIALIZED_P): Move to TREE_LANG_FLAG_6. + * class.c (build_ctor_vtbl_group): Don't set + DECL_CONSTRUCTION_VTABLE_P. + * decl2.c (determine_visibility_from_class): Don't check + DECL_CONSTRUCTION_VTABLE_P anymore. + 2019-09-06 Martin Liska PR c++/91125 diff --git a/gcc/cp/class.c b/gcc/cp/class.c index 47350c26c22..20cfd10501a 100644 --- a/gcc/cp/class.c +++ b/gcc/cp/class.c @@ -9175,7 +9175,7 @@ build_ctor_vtbl_group (tree binfo, tree t) constructing the addresses of secondary vtables in the construction vtable group. */ vtbl = build_vtable (t, id, ptr_type_node); - DECL_CONSTRUCTION_VTABLE_P (vtbl) = 1; + /* Don't export construction vtables from shared libraries. Even on targets that don't support hidden visibility, this tells can_refer_decl_in_current_unit_p not to assume that it's safe to diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index a045214f7f9..60e0846020a 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -448,12 +448,12 @@ extern GTY(()) tree cp_global_trees[CPTI_MAX]; ICS_BAD_FLAG (in _CONV) FN_TRY_BLOCK_P (in TRY_BLOCK) BIND_EXPR_BODY_BLOCK (in BIND_EXPR) - DECL_NONTRIVIALLY_INITIALIZED_P (in VAR_DECL) CALL_EXPR_ORDERED_ARGS (in CALL_EXPR, AGGR_INIT_EXPR) DECLTYPE_FOR_REF_CAPTURE (in DECLTYPE_TYPE) CONSTRUCTOR_C99_COMPOUND_LITERAL (in CONSTRUCTOR) OVL_NESTED_P (in OVERLOAD) LAMBDA_EXPR_INSTANTIATED (in LAMBDA_EXPR) + Reserved for DECL_MODULE_EXPORT (in DECL_) 4: IDENTIFIER_MARKED (IDENTIFIER_NODEs) TREE_HAS_CONSTRUCTOR (in INDIRECT_REF, SAVE_EXPR, CONSTRUCTOR, CALL_EXPR, or FIELD_DECL). @@ -466,8 +466,8 @@ extern GTY(()) tree cp_global_trees[CPTI_MAX]; CALL_EXPR_REVERSE_ARGS (in CALL_EXPR, AGGR_INIT_EXPR) CONSTRUCTOR_PLACEHOLDER_BOUNDARY (in CONSTRUCTOR) 6: IDENTIFIER_REPO_CHOSEN (in IDENTIFIER_NODE) - DECL_CONSTRUCTION_VTABLE_P (in VAR_DECL) TYPE_MARKED_P (in _TYPE) + DECL_NON_TRIVIALLY_INITIALIZED_P (in VAR_DECL) RANGE_FOR_IVDEP (in RANGE_FOR_STMT) CALL_EXPR_OPERATOR_SYNTAX (in CALL_EXPR, AGGR_INIT_EXPR) CONSTRUCTOR_IS_DESIGNATED_INIT (in CONSTRUCTOR) @@ -3001,7 +3001,7 @@ struct GTY(()) lang_decl { /* Nonzero for a VAR_DECL iff an explicit initializer was provided or a non-trivial constructor is called. */ #define DECL_NONTRIVIALLY_INITIALIZED_P(NODE) \ - (TREE_LANG_FLAG_3 (VAR_DECL_CHECK (NODE))) + (TREE_LANG_FLAG_6 (VAR_DECL_CHECK (NODE))) /* Nonzero for a VAR_DECL that was initialized with a constant-expression. */ @@ -3270,12 +3270,6 @@ struct GTY(()) lang_decl { #define FUNCTION_RVALUE_QUALIFIED(NODE) \ TREE_LANG_FLAG_5 (FUNC_OR_METHOD_CHECK (NODE)) -/* Returns 1 iff VAR_DECL is a construction virtual table. - DECL_VTABLE_OR_VTT_P will be true in this case and must be checked - before using this macro. */ -#define DECL_CONSTRUCTION_VTABLE_P(NODE) \ - TREE_LANG_FLAG_6 (VAR_DECL_CHECK (NODE)) - /* 1 iff NODE is function-local, but for types. */ #define LOCAL_CLASS_P(NODE) \ (decl_function_context (TYPE_MAIN_DECL (NODE)) != NULL_TREE) diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index d4bb8814f14..8f935e8656d 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -2713,13 +2713,8 @@ determine_visibility_from_class (tree decl, tree class_type) /* Give the target a chance to override the visibility associated with DECL. */ if (VAR_P (decl) - && (DECL_TINFO_P (decl) - || (DECL_VTABLE_OR_VTT_P (decl) - /* Construction virtual tables are not exported because - they cannot be referred to from other object files; - their name is not standardized by the ABI. */ - && !DECL_CONSTRUCTION_VTABLE_P (decl))) && TREE_PUBLIC (decl) + && (DECL_TINFO_P (decl) || DECL_VTABLE_OR_VTT_P (decl)) && !DECL_REALLY_EXTERN (decl) && !CLASSTYPE_VISIBILITY_SPECIFIED (class_type)) targetm.cxx.determine_class_data_visibility (decl);