tree.h (merge_dllimport_decl_attributes, [...]): Remove conditional exposure of prototypes.

* tree.h (merge_dllimport_decl_attributes, handle_dll_attribute):
	Remove conditional exposure of prototypes.
	(ANON_AGGRNAME_FORMAT, ANON_AGGRNAME_P): Delete.
	* tree.c (anon_aggrname_format, anon_aggrname_p): New.  Replace macro
	definitions in tree.h with functions.
	* lto-streamer-out.c (DFS_write_tree_body, hash_tree): Use
	anon_aggrname_p.
	* tree-streamer-out.c (write_ts_decl_minimal_tree_pointers): Likewise.

	* cp/cp-lang.c (cxx_dwarf_name): Use anon_aggrname_p.
	* cp/cp-tree.h (TYPE_ANONYMOUS_P): Likewise.
	* cp/decl.c (grokdeclarator, xref_tag_1): Likewise.
	* cp/error.c (dump_aggr_type): likewise.
	* cp/pt.c (push_template_decl_real): Likewise.
	* cp/name-lookup.c (make_anon_name): Use anon_aggrname_format.

From-SVN: r224564
This commit is contained in:
Andrew MacLeod 2015-06-17 15:36:02 +00:00 committed by Andrew Macleod
parent 82ba6a8e7e
commit ee47f74ef0
12 changed files with 69 additions and 29 deletions

View File

@ -1,3 +1,14 @@
2015-06-17 Andrew MacLeod <amacleod@redhat.com>
* tree.h (merge_dllimport_decl_attributes, handle_dll_attribute):
Remove conditional exposure of prototypes.
(ANON_AGGRNAME_FORMAT, ANON_AGGRNAME_P): Delete.
* tree.c (anon_aggrname_format, anon_aggrname_p): New. Replace macro
definitions in tree.h with functions.
* lto-streamer-out.c (DFS_write_tree_body, hash_tree): Use
anon_aggrname_p.
* tree-streamer-out.c (write_ts_decl_minimal_tree_pointers): Likewise.
2015-06-17 Segher Boessenkool <segher@kernel.crashing.org>
* config/rs6000/rs6000.md (*cmp<mode>_internal1): Rename to...

View File

@ -1,3 +1,13 @@
2015-06-17 Andrew MacLeod <amacleod@redhat.com>
* cp-lang.c (cxx_dwarf_name): Use anon_aggrname_p.
* cp-tree.h (TYPE_ANONYMOUS_P): Likewise.
* decl.c (grokdeclarator, xref_tag_1): Likewise.
* error.c (dump_aggr_type): likewise.
* pt.c (push_template_decl_real): Likewise.
* name-lookup.c (make_anon_name): Use anon_aggrname_format.
2015-06-17 Andrew MacLeod <amacleod@redhat.com>
* call.c: Do not include input.h, line-map.h or is-a.h.

View File

@ -119,7 +119,7 @@ cxx_dwarf_name (tree t, int verbosity)
gcc_assert (DECL_P (t));
if (DECL_NAME (t)
&& (ANON_AGGRNAME_P (DECL_NAME (t)) || LAMBDA_TYPE_P (t)))
&& (anon_aggrname_p (DECL_NAME (t)) || LAMBDA_TYPE_P (t)))
return NULL;
if (verbosity >= 2)
return decl_as_dwarf_string (t,

View File

@ -1335,7 +1335,7 @@ enum languages { lang_c, lang_cplusplus, lang_java };
/* Nonzero if NODE has no name for linkage purposes. */
#define TYPE_ANONYMOUS_P(NODE) \
(OVERLOAD_TYPE_P (NODE) && ANON_AGGRNAME_P (TYPE_LINKAGE_IDENTIFIER (NODE)))
(OVERLOAD_TYPE_P (NODE) && anon_aggrname_p (TYPE_LINKAGE_IDENTIFIER (NODE)))
/* The _DECL for this _TYPE. */
#define TYPE_MAIN_DECL(NODE) (TYPE_STUB_DECL (TYPE_MAIN_VARIANT (NODE)))

View File

@ -10389,7 +10389,7 @@ grokdeclarator (const cp_declarator *declarator,
/* Replace the anonymous name with the real name everywhere. */
for (t = TYPE_MAIN_VARIANT (type); t; t = TYPE_NEXT_VARIANT (t))
{
if (ANON_AGGRNAME_P (TYPE_IDENTIFIER (t)))
if (anon_aggrname_p (TYPE_IDENTIFIER (t)))
/* We do not rename the debug info representing the
anonymous tagged type because the standard says in
[dcl.typedef] that the naming applies only for
@ -12290,7 +12290,7 @@ xref_tag_1 (enum tag_types tag_code, tree name,
/* In case of anonymous name, xref_tag is only called to
make type node and push name. Name lookup is not required. */
if (ANON_AGGRNAME_P (name))
if (anon_aggrname_p (name))
t = NULL_TREE;
else
t = lookup_and_check_tag (tag_code, name,

View File

@ -677,7 +677,7 @@ dump_aggr_type (cxx_pretty_printer *pp, tree t, int flags)
name = DECL_NAME (name);
}
if (name == 0 || ANON_AGGRNAME_P (name))
if (name == 0 || anon_aggrname_p (name))
{
if (flags & TFF_CLASS_KEY_OR_ENUM)
pp_string (pp, M_("<anonymous>"));

View File

@ -2096,7 +2096,7 @@ make_anon_name (void)
{
char buf[32];
sprintf (buf, ANON_AGGRNAME_FORMAT, anon_cnt++);
sprintf (buf, anon_aggrname_format (), anon_cnt++);
return get_identifier (buf);
}

View File

@ -4794,7 +4794,7 @@ push_template_decl_real (tree decl, bool is_friend)
if (DECL_CLASS_SCOPE_P (decl))
member_template_p = true;
if (TREE_CODE (decl) == TYPE_DECL
&& ANON_AGGRNAME_P (DECL_NAME (decl)))
&& anon_aggrname_p (DECL_NAME (decl)))
{
error ("template class without a name");
return error_mark_node;

View File

@ -738,7 +738,7 @@ DFS::DFS_write_tree_body (struct output_block *ob,
/* Drop names that were created for anonymous entities. */
if (DECL_NAME (expr)
&& TREE_CODE (DECL_NAME (expr)) == IDENTIFIER_NODE
&& ANON_AGGRNAME_P (DECL_NAME (expr)))
&& anon_aggrname_p (DECL_NAME (expr)))
;
else
DFS_follow_tree_edge (DECL_NAME (expr));
@ -1179,7 +1179,7 @@ hash_tree (struct streamer_tree_cache_d *cache, hash_map<tree, hashval_t> *map,
/* Drop names that were created for anonymous entities. */
if (DECL_NAME (t)
&& TREE_CODE (DECL_NAME (t)) == IDENTIFIER_NODE
&& ANON_AGGRNAME_P (DECL_NAME (t)))
&& anon_aggrname_p (DECL_NAME (t)))
;
else
visit (DECL_NAME (t));

View File

@ -601,7 +601,7 @@ write_ts_decl_minimal_tree_pointers (struct output_block *ob, tree expr,
/* Drop names that were created for anonymous entities. */
if (DECL_NAME (expr)
&& TREE_CODE (DECL_NAME (expr)) == IDENTIFIER_NODE
&& ANON_AGGRNAME_P (DECL_NAME (expr)))
&& anon_aggrname_p (DECL_NAME (expr)))
stream_write_tree (ob, NULL_TREE, ref_p);
else
stream_write_tree (ob, DECL_NAME (expr), ref_p);

View File

@ -9256,6 +9256,42 @@ clean_symbol_name (char *p)
*p = '_';
}
/* For anonymous aggregate types, we need some sort of name to
hold on to. In practice, this should not appear, but it should
not be harmful if it does. */
bool
anon_aggrname_p(const_tree id_node)
{
#ifndef NO_DOT_IN_LABEL
return (IDENTIFIER_POINTER (id_node)[0] == '.'
&& IDENTIFIER_POINTER (id_node)[1] == '_');
#else /* NO_DOT_IN_LABEL */
#ifndef NO_DOLLAR_IN_LABEL
return (IDENTIFIER_POINTER (id_node)[0] == '$' \
&& IDENTIFIER_POINTER (id_node)[1] == '_');
#else /* NO_DOLLAR_IN_LABEL */
#define ANON_AGGRNAME_PREFIX "__anon_"
return (!strncmp (IDENTIFIER_POINTER (id_node), ANON_AGGRNAME_PREFIX,
sizeof (ANON_AGGRNAME_PREFIX) - 1));
#endif /* NO_DOLLAR_IN_LABEL */
#endif /* NO_DOT_IN_LABEL */
}
/* Return a format for an anonymous aggregate name. */
const char *
anon_aggrname_format()
{
#ifndef NO_DOT_IN_LABEL
return "._%d";
#else /* NO_DOT_IN_LABEL */
#ifndef NO_DOLLAR_IN_LABEL
return "$_%d";
#else /* NO_DOLLAR_IN_LABEL */
return "__anon_%d";
#endif /* NO_DOLLAR_IN_LABEL */
#endif /* NO_DOT_IN_LABEL */
}
/* Generate a name for a special-purpose function.
The generated name may need to be unique across the whole link.
Changes to this function may also require corresponding changes to

View File

@ -3988,14 +3988,12 @@ extern tree remove_attribute (const char *, tree);
extern tree merge_attributes (tree, tree);
#if TARGET_DLLIMPORT_DECL_ATTRIBUTES
/* Given two Windows decl attributes lists, possibly including
dllimport, return a list of their union . */
extern tree merge_dllimport_decl_attributes (tree, tree);
/* Handle a "dllimport" or "dllexport" attribute. */
extern tree handle_dll_attribute (tree *, tree, tree, int, bool *);
#endif
/* Returns true iff unqualified CAND and BASE are equivalent. */
@ -4899,23 +4897,8 @@ target_opts_for_fn (const_tree fndecl)
/* For anonymous aggregate types, we need some sort of name to
hold on to. In practice, this should not appear, but it should
not be harmful if it does. */
#ifndef NO_DOT_IN_LABEL
#define ANON_AGGRNAME_FORMAT "._%d"
#define ANON_AGGRNAME_P(ID_NODE) (IDENTIFIER_POINTER (ID_NODE)[0] == '.' \
&& IDENTIFIER_POINTER (ID_NODE)[1] == '_')
#else /* NO_DOT_IN_LABEL */
#ifndef NO_DOLLAR_IN_LABEL
#define ANON_AGGRNAME_FORMAT "$_%d"
#define ANON_AGGRNAME_P(ID_NODE) (IDENTIFIER_POINTER (ID_NODE)[0] == '$' \
&& IDENTIFIER_POINTER (ID_NODE)[1] == '_')
#else /* NO_DOLLAR_IN_LABEL */
#define ANON_AGGRNAME_PREFIX "__anon_"
#define ANON_AGGRNAME_P(ID_NODE) \
(!strncmp (IDENTIFIER_POINTER (ID_NODE), ANON_AGGRNAME_PREFIX, \
sizeof (ANON_AGGRNAME_PREFIX) - 1))
#define ANON_AGGRNAME_FORMAT "__anon_%d"
#endif /* NO_DOLLAR_IN_LABEL */
#endif /* NO_DOT_IN_LABEL */
extern const char *anon_aggrname_format();
extern bool anon_aggrname_p (const_tree);
/* The tree and const_tree overload templates. */
namespace wi