* c-pragma.c (add_weak); Delete. Moved into...

* varasm.c (add_weak): New external function.
        (declare_weak): If HANDLE_PRAGMA_WEAK, then add the function to
        the list of weak functions.
        * c-pragma (add_weak): Declare.

From-SVN: r25454
This commit is contained in:
Jeffrey A Law 1999-02-26 01:29:21 +00:00 committed by Jeff Law
parent cdf62c5474
commit 0e9264a2d4
4 changed files with 38 additions and 24 deletions

View File

@ -1,3 +1,11 @@
Fri Feb 26 02:24:57 1999 Jeffrey A Law (law@cygnus.com)
* c-pragma.c (add_weak); Delete. Moved into...
* varasm.c (add_weak): New external function.
(declare_weak): If HANDLE_PRAGMA_WEAK, then add the function to
the list of weak functions.
* c-pragma (add_weak): Declare.
Thu Feb 25 23:43:59 1999 Richard Henderson <rth@cygnus.com>
Flow rewrite to use basic block structures and edge lists:

View File

@ -192,30 +192,6 @@ insert_pack_attributes (node, attributes, prefix)
}
#endif /* HANDLE_PRAGMA_PACK_PUSH_POP */
#ifdef HANDLE_PRAGMA_WEAK
static int add_weak PROTO((char *, char *));
static int
add_weak (name, value)
char * name;
char * value;
{
struct weak_syms * weak;
weak = (struct weak_syms *) permalloc (sizeof (struct weak_syms));
if (weak == NULL)
return 0;
weak->next = weak_decls;
weak->name = name;
weak->value = value;
weak_decls = weak;
return 1;
}
#endif /* HANDLE_PRAGMA_WEAK */
/* Handle one token of a pragma directive. TOKEN is the current token, and
STRING is its printable form. Some front ends do not support generating
tokens, and will only pass in a STRING. Also some front ends will reuse

View File

@ -56,6 +56,8 @@ struct weak_syms
/* Declared in varasm.c */
extern struct weak_syms * weak_decls;
extern int add_weak PROTO((char *, char *));
#endif /* HANDLE_PRAGMA_WEAK */

View File

@ -4269,6 +4269,31 @@ output_constructor (exp, size)
assemble_zeros (size - total_bytes);
}
#ifdef HANDLE_PRAGMA_WEAK
/* Add function NAME to the weak symbols list. VALUE is a weak alias
associatd with NAME. */
int
add_weak (name, value)
char *name;
char *value;
{
struct weak_syms *weak;
weak = (struct weak_syms *) permalloc (sizeof (struct weak_syms));
if (weak == NULL)
return 0;
weak->next = weak_decls;
weak->name = name;
weak->value = value;
weak_decls = weak;
return 1;
}
#endif /* HANDLE_PRAGMA_WEAK */
/* Declare DECL to be a weak symbol. */
void
@ -4281,6 +4306,9 @@ declare_weak (decl)
error_with_decl (decl, "weak declaration of `%s' must precede definition");
else if (SUPPORTS_WEAK)
DECL_WEAK (decl) = 1;
#ifdef HANDLE_PRAGMA_WEAK
add_weak (IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl)), NULL);
#endif
}
/* Emit any pending weak declarations. */