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

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