diff options
author | merrill <merrill@138bc75d-0d04-0410-961f-82ee72b054a4> | 1994-10-20 22:06:20 +0000 |
---|---|---|
committer | merrill <merrill@138bc75d-0d04-0410-961f-82ee72b054a4> | 1994-10-20 22:06:20 +0000 |
commit | b821b8366cf7b21f6c5ee7a289efa54749446751 (patch) | |
tree | 8f344264758347b3f07a447fb40c82ae42769e3e /gcc/collect2.c | |
parent | 6eecbbf4fefcda542a30ec4c482afbfe1624c177 (diff) | |
download | gcc-b821b8366cf7b21f6c5ee7a289efa54749446751.tar.gz |
(add_to_list): Check for duplicates.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@8328 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/collect2.c')
-rw-r--r-- | gcc/collect2.c | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/gcc/collect2.c b/gcc/collect2.c index e0a2d7ebf22..356bad03b3e 100644 --- a/gcc/collect2.c +++ b/gcc/collect2.c @@ -1372,9 +1372,10 @@ add_to_list (head_ptr, name) struct head *head_ptr; char *name; { - struct id *newid = (struct id *) xcalloc (sizeof (*newid) + strlen (name), 1); + struct id *newid + = (struct id *) xcalloc (sizeof (struct id) + strlen (name), 1); + struct id *p; static long sequence_number = 0; - newid->sequence = ++sequence_number; strcpy (newid->name, name); if (head_ptr->first) @@ -1382,6 +1383,19 @@ add_to_list (head_ptr, name) else head_ptr->first = newid; + /* Check for duplicate symbols. */ + for (p = head_ptr->first; + strcmp (name, p->name) != 0; + p = p->next) + ; + if (p != newid) + { + head_ptr->last->next = 0; + free (newid); + return; + } + + newid->sequence = ++sequence_number; head_ptr->last = newid; head_ptr->number++; } @@ -1568,9 +1582,6 @@ scan_prog_file (prog_name, which_pass) end++) continue; -#ifdef COLLECT_QUALIFY_MATCH - COLLECT_QUALIFY_MATCH; -#endif *end = '\0'; switch (is_ctor_dtor (name)) |