Commit b4d456ff by Olivier Hainque Committed by Olivier Hainque

tree.h (alias_diag_flags): New enum.

        * tree.h (alias_diag_flags): New enum.
        (alias_pair): Add an 'emitted_diags' field.
        * varasm.c (finish_aliases_1): Honor and update
        * p->emitted_diags.
        (assemble_alias): Initialize emitted_diags of new pairs.

From-SVN: r163425
parent 39acb18f
2010-08-20 Olivier Hainque <hainque@adacore.com>
* tree.h (alias_diag_flags): New enum.
(alias_pair): Add an 'emitted_diags' field.
* varasm.c (finish_aliases_1): Honor and update p->emitted_diags.
(assemble_alias): Initialize emitted_diags of new pairs.
2010-08-20 Eric Botcazou <ebotcazou@adacore.com> 2010-08-20 Eric Botcazou <ebotcazou@adacore.com>
* config/rs6000/aix.h (STACK_CHECK_STATIC_BUILTIN): Define to 1. * config/rs6000/aix.h (STACK_CHECK_STATIC_BUILTIN): Define to 1.
......
...@@ -184,10 +184,21 @@ extern const char *const tree_code_name[]; ...@@ -184,10 +184,21 @@ extern const char *const tree_code_name[];
of an alias. This requires that the decl have been defined. Aliases of an alias. This requires that the decl have been defined. Aliases
that precede their definition have to be queued for later processing. */ that precede their definition have to be queued for later processing. */
/* The deferred processing proceeds in several passes. We memorize the
diagnostics emitted for a pair to prevent repeating messages when the
queue gets re-scanned after possible updates. */
typedef enum {
ALIAS_DIAG_NONE = 0x0,
ALIAS_DIAG_TO_UNDEF = 0x1,
ALIAS_DIAG_TO_EXTERN = 0x2
} alias_diag_flags;
typedef struct GTY(()) alias_pair typedef struct GTY(()) alias_pair
{ {
tree decl; tree decl;
tree target; tree target;
int emitted_diags; /* alias_diags already emitted for this pair. */
} alias_pair; } alias_pair;
/* Define gc'd vector type. */ /* Define gc'd vector type. */
......
...@@ -5444,19 +5444,27 @@ finish_aliases_1 (void) ...@@ -5444,19 +5444,27 @@ finish_aliases_1 (void)
target_decl = find_decl_and_mark_needed (p->decl, p->target); target_decl = find_decl_and_mark_needed (p->decl, p->target);
if (target_decl == NULL) if (target_decl == NULL)
{ {
if (! lookup_attribute ("weakref", DECL_ATTRIBUTES (p->decl))) if (! (p->emitted_diags & ALIAS_DIAG_TO_UNDEF)
error ("%q+D aliased to undefined symbol %qE", && ! lookup_attribute ("weakref", DECL_ATTRIBUTES (p->decl)))
p->decl, p->target); {
error ("%q+D aliased to undefined symbol %qE",
p->decl, p->target);
p->emitted_diags |= ALIAS_DIAG_TO_UNDEF;
}
} }
else if (DECL_EXTERNAL (target_decl) else if (! (p->emitted_diags & ALIAS_DIAG_TO_EXTERN)
/* We use local aliases for C++ thunks to force the tailcall && DECL_EXTERNAL (target_decl)
to bind locally. Of course this is a hack - to keep it /* We use local aliases for C++ thunks to force the tailcall
working do the following (which is not strictly correct). */ to bind locally. This is a hack - to keep it working do
&& (! TREE_CODE (target_decl) == FUNCTION_DECL the following (which is not strictly correct). */
|| ! DECL_VIRTUAL_P (target_decl)) && (! TREE_CODE (target_decl) == FUNCTION_DECL
|| ! DECL_VIRTUAL_P (target_decl))
&& ! lookup_attribute ("weakref", DECL_ATTRIBUTES (p->decl))) && ! lookup_attribute ("weakref", DECL_ATTRIBUTES (p->decl)))
error ("%q+D aliased to external symbol %qE", {
p->decl, p->target); error ("%q+D aliased to external symbol %qE",
p->decl, p->target);
p->emitted_diags |= ALIAS_DIAG_TO_EXTERN;
}
} }
} }
...@@ -5549,6 +5557,7 @@ assemble_alias (tree decl, tree target) ...@@ -5549,6 +5557,7 @@ assemble_alias (tree decl, tree target)
alias_pair *p = VEC_safe_push (alias_pair, gc, alias_pairs, NULL); alias_pair *p = VEC_safe_push (alias_pair, gc, alias_pairs, NULL);
p->decl = decl; p->decl = decl;
p->target = target; p->target = target;
p->emitted_diags = ALIAS_DIAG_NONE;
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment