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

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