gdb: ensure the cast in gdbarch_tdep is valid
[binutils-gdb.git] / gprof / sym_ids.c
index 657957e8c8a34df0a04897b76a41885450112bec..12c200cd47a877691145f64fca8e9f0fb8309575 100644 (file)
@@ -1,6 +1,6 @@
 /* sym_ids.c
 
-   Copyright 1999, 2000, 2001, 2002, 2004, 2007 Free Software Foundation, Inc.
+   Copyright (C) 1999-2022 Free Software Foundation, Inc.
 
    This file is part of GNU Binutils.
 
 #include "sym_ids.h"
 #include "corefile.h"
 
-static struct sym_id
+struct match
+  {
+    int prev_index;    /* Index of prev match.  */
+    Sym *prev_match;   /* Previous match.  */
+    Sym *first_match;  /* Chain of all matches.  */
+    Sym sym;
+  };
+
+struct sym_id
   {
     struct sym_id *next;
     char *spec;                        /* Parsing modifies this.  */
     Table_Id which_table;
-    bfd_boolean has_right;
-
-    struct match
-      {
-       int prev_index;         /* Index of prev match.  */
-       Sym *prev_match;        /* Previous match.  */
-       Sym *first_match;       /* Chain of all matches.  */
-       Sym sym;
-      }
-    left, right;
-  }
- *id_list;
+    bool has_right;
+
+    struct match left, right;
+  };
+
+static struct sym_id  *id_list;
 
 static void parse_spec
   (char *, Sym *);
 static void parse_id
   (struct sym_id *);
-static bfd_boolean match
+static bool match
   (Sym *, Sym *);
 static void extend_match
-  (struct match *, Sym *, Sym_Table *, bfd_boolean);
+  (struct match *, Sym *, Sym_Table *, bool);
 
 
 Sym_Table syms[NUM_TABLES];
@@ -179,7 +181,7 @@ parse_id (struct sym_id *id)
     {
       parse_spec (slash + 1, &id->right.sym);
       *slash = '\0';
-      id->has_right = TRUE;
+      id->has_right = true;
     }
   parse_spec (id->spec, &id->left.sym);
 
@@ -216,27 +218,27 @@ parse_id (struct sym_id *id)
 
 /* Return TRUE iff PATTERN matches SYM.  */
 
-static bfd_boolean
+static bool
 match (Sym *pattern, Sym *sym)
 {
   if (pattern->file && pattern->file != sym->file)
-    return FALSE;
+    return false;
   if (pattern->line_num && pattern->line_num != sym->line_num)
-    return FALSE;
+    return false;
   if (pattern->name)
     {
       const char *sym_name = sym->name;
       if (*sym_name && bfd_get_symbol_leading_char (core_bfd) == *sym_name)
        sym_name++;
       if (strcmp (pattern->name, sym_name) != 0)
-       return FALSE;
+       return false;
     }
-  return TRUE;
+  return true;
 }
 
 
 static void
-extend_match (struct match *m, Sym *sym, Sym_Table *tab, bfd_boolean second_pass)
+extend_match (struct match *m, Sym *sym, Sym_Table *tab, bool second_pass)
 {
   if (m->prev_match != sym - 1)
     {
@@ -271,7 +273,7 @@ extend_match (struct match *m, Sym *sym, Sym_Table *tab, bfd_boolean second_pass
    requests---you get what you ask for!  */
 
 void
-sym_id_parse ()
+sym_id_parse (void)
 {
   Sym *sym, *left, *right;
   struct sym_id *id;
@@ -287,10 +289,10 @@ sym_id_parse ()
       for (id = id_list; id; id = id->next)
        {
          if (match (&id->left.sym, sym))
-           extend_match (&id->left, sym, &syms[id->which_table], FALSE);
+           extend_match (&id->left, sym, &syms[id->which_table], false);
 
          if (id->has_right && match (&id->right.sym, sym))
-           extend_match (&id->right, sym, &right_ids, FALSE);
+           extend_match (&id->right, sym, &right_ids, false);
        }
     }
 
@@ -318,10 +320,10 @@ sym_id_parse ()
       for (id = id_list; id; id = id->next)
        {
          if (match (&id->left.sym, sym))
-           extend_match (&id->left, sym, &syms[id->which_table], TRUE);
+           extend_match (&id->left, sym, &syms[id->which_table], true);
 
          if (id->has_right && match (&id->right.sym, sym))
-           extend_match (&id->right, sym, &right_ids, TRUE);
+           extend_match (&id->right, sym, &right_ids, true);
        }
     }
 
@@ -369,7 +371,7 @@ sym_id_parse ()
    time requesting -k a/b.  Fortunately, those symbol tables don't get
    very big (the user has to type them!), so a linear search is probably
    tolerable.  */
-bfd_boolean
+bool
 sym_id_arc_is_present (Sym_Table *sym_tab, Sym *from, Sym *to)
 {
   Sym *sym;
@@ -378,8 +380,8 @@ sym_id_arc_is_present (Sym_Table *sym_tab, Sym *from, Sym *to)
     {
       if (from->addr >= sym->addr && from->addr <= sym->end_addr
          && arc_lookup (sym, to))
-       return TRUE;
+       return true;
     }
 
-  return FALSE;
+  return false;
 }