From: Jason Merrill Date: Thu, 20 Oct 1994 22:06:20 +0000 (+0000) Subject: (add_to_list): Check for duplicates. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=0393b857b1c992c941ebb1219d2ed567212587d2;p=gcc.git (add_to_list): Check for duplicates. From-SVN: r8328 --- 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))