Blame SOURCES/gdb-rhbz1560010-fix-assertion-symbol-language-dict-language-3of5.patch

4c2ad1
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
4c2ad1
From: Sergio Durigan Junior <sergiodj@redhat.com>
4c2ad1
Date: Fri, 11 Jan 2019 11:26:59 -0500
4c2ad1
Subject: 
4c2ad1
 gdb-rhbz1560010-fix-assertion-symbol-language-dict-language-3of5.patch
4c2ad1
4c2ad1
;; Fix 'Assertion `SYMBOL_LANGUAGE (sym) == DICT_LANGUAGE (dict)->la_language' failed.'
4c2ad1
;; Keith Seitz, RHBZ#1560010.
4c2ad1
4c2ad1
gdb/23712: Cleanup/Remove temporary dictionary functions
4c2ad1
4c2ad1
Now that multidictionary's are being used, there is no longer any need
4c2ad1
to retain the four temporary functions introduced in the beginning of
4c2ad1
this series.
4c2ad1
4c2ad1
This patch removes them.
4c2ad1
4c2ad1
As an additional cleanup, since the single-language dictionaries are
4c2ad1
no longer used outside dictionary.c, make all of those functions
4c2ad1
static.
4c2ad1
4c2ad1
gdb/ChangeLog:
4c2ad1
4c2ad1
	PR gdb/23712
4c2ad1
	PR symtab/23010
4c2ad1
	* dictionary.c (pending_to_vector): Remove.
4c2ad1
	(dict_create_hashed_1, dict_create_linear_1, dict_add_pending_1):
4c2ad1
	Remove _1 suffix, replacing functions of the same name.  Update
4c2ad1
	all callers.
4c2ad1
	(dict_create_hashed, dict_create_hashed_expandable)
4c2ad1
	(dict_create_linear, dict_create_linear_expandable, dict_free)
4c2ad1
	(dict_add_symbol, dict_add_pending, dict_size, dict_empty):
4c2ad1
	Make functions static.
4c2ad1
4c2ad1
diff --git a/gdb/dictionary.c b/gdb/dictionary.c
4c2ad1
--- a/gdb/dictionary.c
4c2ad1
+++ b/gdb/dictionary.c
4c2ad1
@@ -342,31 +342,14 @@ static void insert_symbol_hashed (struct dictionary *dict,
4c2ad1
 
4c2ad1
 static void expand_hashtable (struct dictionary *dict);
4c2ad1
 
4c2ad1
-/* A function to convert a linked list into a vector.  */
4c2ad1
-
4c2ad1
-static std::vector<symbol *>
4c2ad1
-pending_to_vector (const struct pending *symbol_list)
4c2ad1
-{
4c2ad1
-  std::vector<symbol *> symlist;
4c2ad1
-
4c2ad1
-  for (const struct pending *list_counter = symbol_list;
4c2ad1
-       list_counter != nullptr; list_counter = list_counter->next)
4c2ad1
-    {
4c2ad1
-      for (int i = list_counter->nsyms - 1; i >= 0; --i)
4c2ad1
-	symlist.push_back (list_counter->symbol[i]);
4c2ad1
-    }
4c2ad1
-
4c2ad1
-  return symlist;
4c2ad1
-}
4c2ad1
-
4c2ad1
 /* The creation functions.  */
4c2ad1
 
4c2ad1
-/* A function to transition dict_create_hashed to new API.  */
4c2ad1
+/* Create a hashed dictionary of a given language.  */
4c2ad1
 
4c2ad1
 static struct dictionary *
4c2ad1
-dict_create_hashed_1 (struct obstack *obstack,
4c2ad1
-		      enum language language,
4c2ad1
-		      const std::vector<symbol *> &symbol_list)
4c2ad1
+dict_create_hashed (struct obstack *obstack,
4c2ad1
+		    enum language language,
4c2ad1
+		    const std::vector<symbol *> &symbol_list)
4c2ad1
 {
4c2ad1
   /* Allocate the dictionary.  */
4c2ad1
   struct dictionary *retval = XOBNEW (obstack, struct dictionary);
4c2ad1
@@ -388,21 +371,9 @@ dict_create_hashed_1 (struct obstack *obstack,
4c2ad1
   return retval;
4c2ad1
 }
4c2ad1
 
4c2ad1
-/* See dictionary.h.  */
4c2ad1
-
4c2ad1
-struct dictionary *
4c2ad1
-dict_create_hashed (struct obstack *obstack,
4c2ad1
-		    enum language language,
4c2ad1
-		    const struct pending *symbol_list)
4c2ad1
-{
4c2ad1
-  std::vector<symbol *> symlist = pending_to_vector (symbol_list);
4c2ad1
-
4c2ad1
-  return dict_create_hashed_1 (obstack, language, symlist);
4c2ad1
-}
4c2ad1
+/* Create an expandable hashed dictionary of a given language.  */
4c2ad1
 
4c2ad1
-/* See dictionary.h.  */
4c2ad1
-
4c2ad1
-extern struct dictionary *
4c2ad1
+static struct dictionary *
4c2ad1
 dict_create_hashed_expandable (enum language language)
4c2ad1
 {
4c2ad1
   struct dictionary *retval = XNEW (struct dictionary);
4c2ad1
@@ -417,12 +388,12 @@ dict_create_hashed_expandable (enum language language)
4c2ad1
   return retval;
4c2ad1
 }
4c2ad1
 
4c2ad1
-/* A function to transition dict_create_linear to new API.  */
4c2ad1
+/* Create a linear dictionary of a given language.  */
4c2ad1
 
4c2ad1
 static struct dictionary *
4c2ad1
-dict_create_linear_1 (struct obstack *obstack,
4c2ad1
-		      enum language language,
4c2ad1
-		      const std::vector<symbol *> &symbol_list)
4c2ad1
+dict_create_linear (struct obstack *obstack,
4c2ad1
+		    enum language language,
4c2ad1
+		    const std::vector<symbol *> &symbol_list)
4c2ad1
 {
4c2ad1
   struct dictionary *retval = XOBNEW (obstack, struct dictionary);
4c2ad1
   DICT_VECTOR (retval) = &dict_linear_vector;
4c2ad1
@@ -442,21 +413,9 @@ dict_create_linear_1 (struct obstack *obstack,
4c2ad1
   return retval;
4c2ad1
 }
4c2ad1
 
4c2ad1
-/* See dictionary.h.  */
4c2ad1
-
4c2ad1
-struct dictionary *
4c2ad1
-dict_create_linear (struct obstack *obstack,
4c2ad1
-		    enum language language,
4c2ad1
-		    const struct pending *symbol_list)
4c2ad1
-{
4c2ad1
-  std::vector<symbol *> symlist = pending_to_vector (symbol_list);
4c2ad1
-
4c2ad1
-  return dict_create_linear_1 (obstack, language, symlist);
4c2ad1
-}
4c2ad1
-
4c2ad1
-/* See dictionary.h.  */
4c2ad1
+/* Create an expandable linear dictionary of a given language.  */
4c2ad1
 
4c2ad1
-struct dictionary *
4c2ad1
+static struct dictionary *
4c2ad1
 dict_create_linear_expandable (enum language language)
4c2ad1
 {
4c2ad1
   struct dictionary *retval = XNEW (struct dictionary);
4c2ad1
@@ -476,7 +435,7 @@ dict_create_linear_expandable (enum language language)
4c2ad1
 /* Free the memory used by a dictionary that's not on an obstack.  (If
4c2ad1
    any.)  */
4c2ad1
 
4c2ad1
-void
4c2ad1
+static void
4c2ad1
 dict_free (struct dictionary *dict)
4c2ad1
 {
4c2ad1
   (DICT_VECTOR (dict))->free (dict);
4c2ad1
@@ -484,34 +443,24 @@ dict_free (struct dictionary *dict)
4c2ad1
 
4c2ad1
 /* Add SYM to DICT.  DICT had better be expandable.  */
4c2ad1
 
4c2ad1
-void
4c2ad1
+static void
4c2ad1
 dict_add_symbol (struct dictionary *dict, struct symbol *sym)
4c2ad1
 {
4c2ad1
   (DICT_VECTOR (dict))->add_symbol (dict, sym);
4c2ad1
 }
4c2ad1
 
4c2ad1
-/* A function to transition dict_add_pending to new API.  */
4c2ad1
+/* Utility to add a list of symbols to a dictionary.
4c2ad1
+   DICT must be an expandable dictionary.  */
4c2ad1
 
4c2ad1
 static void
4c2ad1
-dict_add_pending_1 (struct dictionary *dict,
4c2ad1
-		    const std::vector<symbol *> &symbol_list)
4c2ad1
+dict_add_pending (struct dictionary *dict,
4c2ad1
+		  const std::vector<symbol *> &symbol_list)
4c2ad1
 {
4c2ad1
   /* Preserve ordering by reversing the list.  */
4c2ad1
   for (auto sym = symbol_list.rbegin (); sym != symbol_list.rend (); ++sym)
4c2ad1
     dict_add_symbol (dict, *sym);
4c2ad1
 }
4c2ad1
 
4c2ad1
-/* Utility to add a list of symbols to a dictionary.
4c2ad1
-   DICT must be an expandable dictionary.  */
4c2ad1
-
4c2ad1
-void
4c2ad1
-dict_add_pending (struct dictionary *dict, const struct pending *symbol_list)
4c2ad1
-{
4c2ad1
-  std::vector<symbol *> symlist = pending_to_vector (symbol_list);
4c2ad1
-
4c2ad1
-  dict_add_pending_1 (dict, symlist);
4c2ad1
-}
4c2ad1
-
4c2ad1
 /* Initialize ITERATOR to point at the first symbol in DICT, and
4c2ad1
    return that first symbol, or NULL if DICT is empty.  */
4c2ad1
 
4c2ad1
@@ -548,7 +497,7 @@ dict_iter_match_next (const lookup_name_info &name,
4c2ad1
     ->iter_match_next (name, iterator);
4c2ad1
 }
4c2ad1
 
4c2ad1
-int
4c2ad1
+static int
4c2ad1
 dict_size (const struct dictionary *dict)
4c2ad1
 {
4c2ad1
   return (DICT_VECTOR (dict))->size (dict);
4c2ad1
@@ -560,7 +509,7 @@ dict_size (const struct dictionary *dict)
4c2ad1
 
4c2ad1
 /* Test to see if DICT is empty.  */
4c2ad1
 
4c2ad1
-int
4c2ad1
+static int
4c2ad1
 dict_empty (struct dictionary *dict)
4c2ad1
 {
4c2ad1
   struct dict_iterator iter;
4c2ad1
@@ -1019,7 +968,7 @@ mdict_create_hashed (struct obstack *obstack,
4c2ad1
       std::vector<symbol *> symlist = pair.second;
4c2ad1
 
4c2ad1
       retval->dictionaries[idx++]
4c2ad1
-	= dict_create_hashed_1 (obstack, language, symlist);
4c2ad1
+	= dict_create_hashed (obstack, language, symlist);
4c2ad1
     }
4c2ad1
 
4c2ad1
   return retval;
4c2ad1
@@ -1064,7 +1013,7 @@ mdict_create_linear (struct obstack *obstack,
4c2ad1
       std::vector<symbol *> symlist = pair.second;
4c2ad1
 
4c2ad1
       retval->dictionaries[idx++]
4c2ad1
-	= dict_create_linear_1 (obstack, language, symlist);
4c2ad1
+	= dict_create_linear (obstack, language, symlist);
4c2ad1
     }
4c2ad1
 
4c2ad1
   return retval;
4c2ad1
@@ -1210,7 +1159,7 @@ mdict_add_pending (struct multidictionary *mdict,
4c2ad1
 	  dict = create_new_language_dictionary (mdict, language);
4c2ad1
 	}
4c2ad1
 
4c2ad1
-      dict_add_pending_1 (dict, symlist);
4c2ad1
+      dict_add_pending (dict, symlist);
4c2ad1
     }
4c2ad1
 }
4c2ad1