summaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>2016-08-04 16:06:17 +0000
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>2016-08-04 16:06:17 +0000
commit4f86cbb05335c51e80af8706b209c2024592cda0 (patch)
tree79571d9ae93c399c9bb5811df44a004398233e6c /gcc/cp
parent4e6d68ba72c5e92843280f92c208f967984f648d (diff)
downloadgcc-4f86cbb05335c51e80af8706b209c2024592cda0.tar.gz
Rename TYPE_ANONYMOUS_P to TYPE_UNNAMED_P.
* cp-tree.h (TYPE_UNNAMED_P): Rename from TYPE_ANONYMOUS_P. (TYPE_WAS_UNNAMED): Rename from TYPE_WAS_ANONYMOUS. * class.c, decl.c, decl2.c, error.c, lambda.c, mangle.c, name-lookup.c, parser.c, pt.c, semantics.c, tree.c: Adjust. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@239137 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog5
-rw-r--r--gcc/cp/class.c8
-rw-r--r--gcc/cp/cp-tree.h11
-rw-r--r--gcc/cp/decl.c10
-rw-r--r--gcc/cp/decl2.c12
-rw-r--r--gcc/cp/error.c6
-rw-r--r--gcc/cp/lambda.c2
-rw-r--r--gcc/cp/mangle.c10
-rw-r--r--gcc/cp/name-lookup.c4
-rw-r--r--gcc/cp/parser.c16
-rw-r--r--gcc/cp/pt.c4
-rw-r--r--gcc/cp/semantics.c2
-rw-r--r--gcc/cp/tree.c4
13 files changed, 50 insertions, 44 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index f8de78c97fa..e7854f7505e 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,10 @@
2016-08-04 Jason Merrill <jason@redhat.com>
+ * cp-tree.h (TYPE_UNNAMED_P): Rename from TYPE_ANONYMOUS_P.
+ (TYPE_WAS_UNNAMED): Rename from TYPE_WAS_ANONYMOUS.
+ * class.c, decl.c, decl2.c, error.c, lambda.c, mangle.c,
+ name-lookup.c, parser.c, pt.c, semantics.c, tree.c: Adjust.
+
PR c++/72796
* typeck.c (finish_class_member_access_expr): Avoid stripping
SCOPE_REF to dependent base.
diff --git a/gcc/cp/class.c b/gcc/cp/class.c
index b537b7e634c..f8349650fe6 100644
--- a/gcc/cp/class.c
+++ b/gcc/cp/class.c
@@ -3077,11 +3077,11 @@ finish_struct_anon_r (tree field, bool complain)
the TYPE_DECL that we create implicitly. You're
allowed to put one anonymous union inside another,
though, so we explicitly tolerate that. We use
- TYPE_ANONYMOUS_P rather than ANON_AGGR_TYPE_P so that
+ TYPE_UNNAMED_P rather than ANON_AGGR_TYPE_P so that
we also allow unnamed types used for defining fields. */
if (DECL_ARTIFICIAL (elt)
&& (!DECL_IMPLICIT_TYPEDEF_P (elt)
- || TYPE_ANONYMOUS_P (TREE_TYPE (elt))))
+ || TYPE_UNNAMED_P (TREE_TYPE (elt))))
continue;
if (TREE_CODE (elt) != FIELD_DECL)
@@ -6718,7 +6718,7 @@ find_flexarrays (tree t, flexmems_t *fmem)
tree fldtype = TREE_TYPE (fld);
if (TREE_CODE (fld) != TYPE_DECL
&& RECORD_OR_UNION_TYPE_P (fldtype)
- && TYPE_ANONYMOUS_P (fldtype))
+ && TYPE_UNNAMED_P (fldtype))
{
/* Members of anonymous structs and unions are treated as if
they were members of the containing class. Descend into
@@ -6798,7 +6798,7 @@ diagnose_flexarrays (tree t, const flexmems_t *fmem)
{
/* Members of anonymous structs and unions are considered to be members
of the containing struct or union. */
- if (TYPE_ANONYMOUS_P (t) || !fmem->array)
+ if (TYPE_UNNAMED_P (t) || !fmem->array)
return;
const char *msg = 0;
diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h
index 76616c611d8..d6fb387aced 100644
--- a/gcc/cp/cp-tree.h
+++ b/gcc/cp/cp-tree.h
@@ -761,7 +761,7 @@ struct GTY (()) tree_trait_expr {
enum cp_trait_kind kind;
};
-/* Based off of TYPE_ANONYMOUS_P. */
+/* Based off of TYPE_UNNAMED_P. */
#define LAMBDA_TYPE_P(NODE) \
(CLASS_TYPE_P (NODE) && CLASSTYPE_LAMBDA_EXPR (NODE))
@@ -1553,7 +1553,7 @@ enum languages { lang_c, lang_cplusplus, lang_java };
#define TYPE_NAME_LENGTH(NODE) (IDENTIFIER_LENGTH (TYPE_IDENTIFIER (NODE)))
/* Nonzero if NODE has no name for linkage purposes. */
-#define TYPE_ANONYMOUS_P(NODE) \
+#define TYPE_UNNAMED_P(NODE) \
(OVERLOAD_TYPE_P (NODE) && anon_aggrname_p (TYPE_LINKAGE_IDENTIFIER (NODE)))
/* The _DECL for this _TYPE. */
@@ -4116,7 +4116,8 @@ more_aggr_init_expr_args_p (const aggr_init_expr_arg_iterator *iter)
/* Define fields and accessors for nodes representing declared names. */
-#define TYPE_WAS_ANONYMOUS(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->was_anonymous)
+/* Nonzero if TYPE is an unnamed class with a typedef for linkage purposes. */
+#define TYPE_WAS_UNNAMED(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->was_anonymous)
/* C++: all of these are overloaded! These apply only to TYPE_DECLs. */
@@ -4270,8 +4271,8 @@ more_aggr_init_expr_args_p (const aggr_init_expr_arg_iterator *iter)
equivalent to `struct S {}; typedef struct S S;' in C.
DECL_IMPLICIT_TYPEDEF_P will hold for the typedef indicated in this
example. In C++, there is a second implicit typedef for each
- class, in the scope of `S' itself, so that you can say `S::S'.
- DECL_SELF_REFERENCE_P will hold for that second typedef. */
+ class, called the injected-class-name, in the scope of `S' itself, so that
+ you can say `S::S'. DECL_SELF_REFERENCE_P will hold for that typedef. */
#define DECL_IMPLICIT_TYPEDEF_P(NODE) \
(TREE_CODE (NODE) == TYPE_DECL && DECL_LANG_FLAG_2 (NODE))
#define SET_DECL_IMPLICIT_TYPEDEF_P(NODE) \
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index d2ba7baadc7..04a0df6414d 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -4614,7 +4614,7 @@ check_tag_decl (cp_decl_specifier_seq *declspecs,
}
/* Check for an anonymous union. */
else if (declared_type && RECORD_OR_UNION_CODE_P (TREE_CODE (declared_type))
- && TYPE_ANONYMOUS_P (declared_type))
+ && TYPE_UNNAMED_P (declared_type))
{
/* 7/3 In a simple-declaration, the optional init-declarator-list
can be omitted only when declaring a class (clause 9) or
@@ -10773,7 +10773,7 @@ grokdeclarator (const cp_declarator *declarator,
&& unqualified_id
&& TYPE_NAME (type)
&& TREE_CODE (TYPE_NAME (type)) == TYPE_DECL
- && TYPE_ANONYMOUS_P (type)
+ && TYPE_UNNAMED_P (type)
&& declspecs->type_definition_p
&& attributes_naming_typedef_ok (*attrlist)
&& cp_type_quals (type) == TYPE_UNQUALIFIED)
@@ -10785,7 +10785,7 @@ grokdeclarator (const cp_declarator *declarator,
{
if (anon_aggrname_p (TYPE_IDENTIFIER (t)))
/* We do not rename the debug info representing the
- anonymous tagged type because the standard says in
+ unnamed tagged type because the standard says in
[dcl.typedef] that the naming applies only for
linkage purposes. */
/*debug_hooks->set_name (t, decl);*/
@@ -10793,7 +10793,7 @@ grokdeclarator (const cp_declarator *declarator,
}
if (TYPE_LANG_SPECIFIC (type))
- TYPE_WAS_ANONYMOUS (type) = 1;
+ TYPE_WAS_UNNAMED (type) = 1;
/* If this is a typedef within a template class, the nested
type is a (non-primary) template. The name for the
@@ -10802,7 +10802,7 @@ grokdeclarator (const cp_declarator *declarator,
DECL_NAME (CLASSTYPE_TI_TEMPLATE (type))
= TYPE_IDENTIFIER (type);
- /* Adjust linkage now that we aren't anonymous anymore. */
+ /* Adjust linkage now that we aren't unnamed anymore. */
reset_type_linkage (type);
/* FIXME remangle member functions; member functions of a
diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c
index 2ff6f53ba4f..1daa9f525d6 100644
--- a/gcc/cp/decl2.c
+++ b/gcc/cp/decl2.c
@@ -838,7 +838,7 @@ finish_static_data_member_decl (tree decl,
else
for (tree t = current_class_type; TYPE_P (t);
t = CP_TYPE_CONTEXT (t))
- if (TYPE_ANONYMOUS_P (t))
+ if (TYPE_UNNAMED_P (t))
{
if (permerror (DECL_SOURCE_LOCATION (decl),
"static data member %qD in unnamed class", decl))
@@ -1306,7 +1306,7 @@ save_template_attributes (tree *attr_p, tree *decl_p)
}
/* Return true iff ATTRS are acceptable attributes to be applied in-place
- to a typedef which gives a previously anonymous class or enum a name for
+ to a typedef which gives a previously unnamed class or enum a name for
linkage purposes. */
bool
@@ -4257,12 +4257,12 @@ no_linkage_error (tree decl)
else if (CLASS_TYPE_P (t) && TYPE_BEING_DEFINED (t))
/* The type might end up having a typedef name for linkage purposes. */
vec_safe_push (no_linkage_decls, decl);
- else if (TYPE_ANONYMOUS_P (t))
+ else if (TYPE_UNNAMED_P (t))
{
bool d = false;
if (cxx_dialect >= cxx11)
d = permerror (DECL_SOURCE_LOCATION (decl), "%q#D, declared using "
- "anonymous type, is used but never defined", decl);
+ "unnamed type, is used but never defined", decl);
else if (DECL_EXTERN_C_P (decl))
/* Allow this; it's pretty common in C. */;
else if (VAR_P (decl))
@@ -4270,11 +4270,11 @@ no_linkage_error (tree decl)
no linkage can only be used to declare extern "C"
entities. Since it's not always an error in the
ISO C++ 90 Standard, we only issue a warning. */
- d = warning_at (DECL_SOURCE_LOCATION (decl), 0, "anonymous type "
+ d = warning_at (DECL_SOURCE_LOCATION (decl), 0, "unnamed type "
"with no linkage used to declare variable %q#D with "
"linkage", decl);
else
- d = permerror (DECL_SOURCE_LOCATION (decl), "anonymous type with no "
+ d = permerror (DECL_SOURCE_LOCATION (decl), "unnamed type with no "
"linkage used to declare function %q#D with linkage",
decl);
if (d && is_typedef_decl (TYPE_NAME (t)))
diff --git a/gcc/cp/error.c b/gcc/cp/error.c
index 69a40cc7950..36e26cc1b1d 100644
--- a/gcc/cp/error.c
+++ b/gcc/cp/error.c
@@ -679,9 +679,9 @@ dump_aggr_type (cxx_pretty_printer *pp, tree t, int flags)
if (name == 0 || anon_aggrname_p (name))
{
if (flags & TFF_CLASS_KEY_OR_ENUM)
- pp_string (pp, M_("<anonymous>"));
+ pp_string (pp, M_("<unnamed>"));
else
- pp_printf (pp, M_("<anonymous %s>"), variety);
+ pp_printf (pp, M_("<unnamed %s>"), variety);
}
else if (LAMBDA_TYPE_P (t))
{
@@ -1745,7 +1745,7 @@ dump_function_name (cxx_pretty_printer *pp, tree t, int flags)
{
if (LAMBDA_TYPE_P (DECL_CONTEXT (t)))
name = get_identifier ("<lambda>");
- else if (TYPE_ANONYMOUS_P (DECL_CONTEXT (t)))
+ else if (TYPE_UNNAMED_P (DECL_CONTEXT (t)))
name = get_identifier ("<constructor>");
else
name = constructor_name (DECL_CONTEXT (t));
diff --git a/gcc/cp/lambda.c b/gcc/cp/lambda.c
index 9bf8a560d02..abb967a9aae 100644
--- a/gcc/cp/lambda.c
+++ b/gcc/cp/lambda.c
@@ -134,7 +134,7 @@ begin_lambda_type (tree lambda)
{
/* Unique name. This is just like an unnamed class, but we cannot use
- make_anon_name because of certain checks against TYPE_ANONYMOUS_P. */
+ make_anon_name because of certain checks against TYPE_UNNAMED_P. */
tree name;
name = make_lambda_name ();
diff --git a/gcc/cp/mangle.c b/gcc/cp/mangle.c
index d1bf3effbd2..b6c96283f4f 100644
--- a/gcc/cp/mangle.c
+++ b/gcc/cp/mangle.c
@@ -1320,7 +1320,7 @@ write_unqualified_name (tree decl)
tree type = TREE_TYPE (decl);
if (TREE_CODE (decl) == TYPE_DECL
- && TYPE_ANONYMOUS_P (type))
+ && TYPE_UNNAMED_P (type))
write_unnamed_type_name (type);
else if (TREE_CODE (decl) == TYPE_DECL
&& LAMBDA_TYPE_P (type))
@@ -1449,7 +1449,7 @@ nested_anon_class_index (tree type)
tree memtype = TREE_TYPE (member);
if (memtype == type)
return index;
- else if (TYPE_ANONYMOUS_P (memtype))
+ else if (TYPE_UNNAMED_P (memtype))
++index;
}
@@ -1734,7 +1734,7 @@ static int
local_class_index (tree entity)
{
int ix, discriminator = 0;
- tree name = (TYPE_ANONYMOUS_P (entity) ? NULL_TREE
+ tree name = (TYPE_UNNAMED_P (entity) ? NULL_TREE
: TYPE_IDENTIFIER (entity));
tree ctx = TYPE_CONTEXT (entity);
for (ix = 0; ; ix++)
@@ -1744,7 +1744,7 @@ local_class_index (tree entity)
return discriminator;
if (TYPE_CONTEXT (type) == ctx
&& (name ? TYPE_IDENTIFIER (type) == name
- : TYPE_ANONYMOUS_P (type)))
+ : TYPE_UNNAMED_P (type)))
++discriminator;
}
gcc_unreachable ();
@@ -1772,7 +1772,7 @@ discriminator_for_local_entity (tree entity)
entity = TREE_TYPE (entity);
/* Lambdas and unnamed types have their own discriminators. */
- if (LAMBDA_TYPE_P (entity) || TYPE_ANONYMOUS_P (entity))
+ if (LAMBDA_TYPE_P (entity) || TYPE_UNNAMED_P (entity))
return 0;
return local_class_index (entity);
diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c
index 7c3942a5293..11957fd2806 100644
--- a/gcc/cp/name-lookup.c
+++ b/gcc/cp/name-lookup.c
@@ -2089,7 +2089,7 @@ constructor_name_p (tree name, tree type)
static GTY(()) int anon_cnt;
/* Return an IDENTIFIER which can be used as a name for
- anonymous structs and unions. */
+ unnamed structs and unions. */
tree
make_anon_name (void)
@@ -2103,7 +2103,7 @@ make_anon_name (void)
/* This code is practically identical to that for creating
anonymous names, but is just used for lambdas instead. This isn't really
necessary, but it's convenient to avoid treating lambdas like other
- anonymous types. */
+ unnamed types. */
static GTY(()) int lambda_cnt = 0;
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index fdb0ab0b035..72a494dae9e 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -17043,7 +17043,7 @@ cp_parser_enum_specifier (cp_parser* parser)
bool nested_being_defined = false;
bool new_value_list = false;
bool is_new_type = false;
- bool is_anonymous = false;
+ bool is_unnamed = false;
tree underlying_type = NULL_TREE;
cp_token *type_start_token = NULL;
bool saved_colon_corrects_to_scope_p = parser->colon_corrects_to_scope_p;
@@ -17137,10 +17137,10 @@ cp_parser_enum_specifier (cp_parser* parser)
else
{
identifier = make_anon_name ();
- is_anonymous = true;
+ is_unnamed = true;
if (scoped_enum_p)
error_at (type_start_token->location,
- "anonymous scoped enum is not allowed");
+ "unnamed scoped enum is not allowed");
}
}
pop_deferring_access_checks ();
@@ -17321,9 +17321,9 @@ cp_parser_enum_specifier (cp_parser* parser)
/* If the next token is not '}', then there are some enumerators. */
else if (cp_lexer_next_token_is (parser->lexer, CPP_CLOSE_BRACE))
{
- if (is_anonymous && !scoped_enum_p)
+ if (is_unnamed && !scoped_enum_p)
pedwarn (type_start_token->location, OPT_Wpedantic,
- "ISO C++ forbids empty anonymous enum");
+ "ISO C++ forbids empty unnamed enum");
}
else
cp_parser_enumerator_list (parser, type);
@@ -17341,7 +17341,7 @@ cp_parser_enum_specifier (cp_parser* parser)
and additional restrictions apply. */
if (cp_lexer_next_token_is (parser->lexer, CPP_SEMICOLON))
{
- if (is_anonymous)
+ if (is_unnamed)
error_at (type_start_token->location,
"opaque-enum-specifier without name");
else if (nested_name_specifier)
@@ -19347,9 +19347,9 @@ cp_parser_direct_declarator (cp_parser* parser,
else if (IDENTIFIER_TYPENAME_P (unqualified_name))
sfk = sfk_conversion;
else if (/* There's no way to declare a constructor
- for an anonymous type, even if the type
+ for an unnamed type, even if the type
got a name for linkage purposes. */
- !TYPE_WAS_ANONYMOUS (class_type)
+ !TYPE_WAS_UNNAMED (class_type)
/* Handle correctly (c++/19200):
struct S {
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index a23a05aff35..bf729ea3107 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -17340,8 +17340,8 @@ check_instantiated_arg (tree tmpl, tree t, tsubst_flags_t complain)
type deduction to fail. */
if (complain & tf_error)
{
- if (TYPE_ANONYMOUS_P (nt))
- error ("%qT is/uses anonymous type", t);
+ if (TYPE_UNNAMED_P (nt))
+ error ("%qT is/uses unnamed type", t);
else
error ("template argument for %qD uses local type %qT",
tmpl, t);
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c
index 2fe2d091a3a..4bffe6dc851 100644
--- a/gcc/cp/semantics.c
+++ b/gcc/cp/semantics.c
@@ -2916,7 +2916,7 @@ begin_class_definition (tree t)
/* Reset the interface data, at the earliest possible
moment, as it might have been set via a class foo;
before. */
- if (! TYPE_ANONYMOUS_P (t))
+ if (! TYPE_UNNAMED_P (t))
{
struct c_fileinfo *finfo = \
get_fileinfo (LOCATION_FILE (input_location));
diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c
index 6adeb63dd06..2e58615e1d7 100644
--- a/gcc/cp/tree.c
+++ b/gcc/cp/tree.c
@@ -2353,9 +2353,9 @@ no_linkage_check (tree t, bool relaxed_p)
return NULL_TREE;
/* Fall through. */
case ENUMERAL_TYPE:
- /* Only treat anonymous types as having no linkage if they're at
+ /* Only treat unnamed types as having no linkage if they're at
namespace scope. This is core issue 966. */
- if (TYPE_ANONYMOUS_P (t) && TYPE_NAMESPACE_SCOPE_P (t))
+ if (TYPE_UNNAMED_P (t) && TYPE_NAMESPACE_SCOPE_P (t))
return t;
for (r = CP_TYPE_CONTEXT (t); ; )