AArch64: Add MOVPRFX tests and update testsuite
[deliverable/binutils-gdb.git] / gdb / macrotab.c
index 30c020b511d1fd708df411682a8afc3e42324d52..2171580637ee176d896b6228a18846bd82139924 100644 (file)
@@ -1,5 +1,5 @@
 /* C preprocessor macro tables for GDB.
-   Copyright (C) 2002-2015 Free Software Foundation, Inc.
+   Copyright (C) 2002-2018 Free Software Foundation, Inc.
    Contributed by Red Hat, Inc.
 
    This file is part of GDB.
@@ -130,7 +130,7 @@ macro_bcache (struct macro_table *t, const void *addr, int len)
 static const char *
 macro_bcache_str (struct macro_table *t, const char *s)
 {
-  return macro_bcache (t, s, strlen (s) + 1);
+  return (const char *) macro_bcache (t, s, strlen (s) + 1);
 }
 
 
@@ -352,7 +352,7 @@ new_macro_key (struct macro_table *t,
                struct macro_source_file *file,
                int line)
 {
-  struct macro_key *k = macro_alloc (sizeof (*k), t);
+  struct macro_key *k = (struct macro_key *) macro_alloc (sizeof (*k), t);
 
   memset (k, 0, sizeof (*k));
   k->table = t;
@@ -385,7 +385,8 @@ new_source_file (struct macro_table *t,
                  const char *filename)
 {
   /* Get space for the source file structure itself.  */
-  struct macro_source_file *f = macro_alloc (sizeof (*f), t);
+  struct macro_source_file *f
+    = (struct macro_source_file *) macro_alloc (sizeof (*f), t);
 
   memset (f, 0, sizeof (*f));
   f->table = t;
@@ -477,8 +478,7 @@ macro_include (struct macro_source_file *source,
 
       link_fullname = macro_source_fullname (*link);
       source_fullname = macro_source_fullname (source);
-      complaint (&symfile_complaints,
-                _("both `%s' and `%s' allegedly #included at %s:%d"),
+      complaint (_("both `%s' and `%s' allegedly #included at %s:%d"),
                 included, link_fullname, source_fullname, line);
       xfree (source_fullname);
       xfree (link_fullname);
@@ -553,7 +553,8 @@ new_macro_definition (struct macro_table *t,
                       int argc, const char **argv,
                       const char *replacement)
 {
-  struct macro_definition *d = macro_alloc (sizeof (*d), t);
+  struct macro_definition *d
+    = (struct macro_definition *) macro_alloc (sizeof (*d), t);
 
   memset (d, 0, sizeof (*d));
   d->table = t;
@@ -568,12 +569,13 @@ new_macro_definition (struct macro_table *t,
       int cached_argv_size = argc * sizeof (*cached_argv);
 
       /* Bcache all the arguments.  */
-      cached_argv = alloca (cached_argv_size);
+      cached_argv = (const char **) alloca (cached_argv_size);
       for (i = 0; i < argc; i++)
         cached_argv[i] = macro_bcache_str (t, argv[i]);
 
       /* Now bcache the array of argument pointers itself.  */
-      d->argv = macro_bcache (t, cached_argv, cached_argv_size);
+      d->argv = ((const char * const *)
+                macro_bcache (t, cached_argv, cached_argv_size));
     }
 
   /* We don't bcache the entire definition structure because it's got
@@ -727,8 +729,7 @@ check_for_redefinition (struct macro_source_file *source, int line,
          
          source_fullname = macro_source_fullname (source);
          found_key_fullname = macro_source_fullname (found_key->start_file);
-         complaint (&symfile_complaints,
-                    _("macro `%s' redefined at %s:%d; "
+         complaint (_("macro `%s' redefined at %s:%d; "
                       "original definition at %s:%d"),
                     name, source_fullname, line, found_key_fullname,
                     found_key->start_line);
@@ -856,8 +857,7 @@ macro_undef (struct macro_source_file *source, int line,
 
              source_fullname = macro_source_fullname (source);
              key_fullname = macro_source_fullname (key->end_file);
-              complaint (&symfile_complaints,
-                         _("macro '%s' is #undefined twice,"
+              complaint (_("macro '%s' is #undefined twice,"
                            " at %s:%d and %s:%d"),
                         name, source_fullname, line, key_fullname,
                         key->end_line);
@@ -877,8 +877,7 @@ macro_undef (struct macro_source_file *source, int line,
          has no macro definition in scope is ignored.  So we should
          ignore it too.  */
 #if 0
-      complaint (&symfile_complaints,
-                _("no definition for macro `%s' in scope to #undef at %s:%d"),
+      complaint (_("no definition for macro `%s' in scope to #undef at %s:%d"),
                 name, source->filename, line);
 #endif
     }
@@ -962,8 +961,7 @@ macro_definition_location (struct macro_source_file *source,
    the FILE and LINE fields.  */
 struct macro_for_each_data
 {
-  macro_callback_fn fn;
-  void *user_data;
+  gdb::function_view<macro_callback_fn> fn;
   struct macro_source_file *file;
   int line;
 };
@@ -982,20 +980,18 @@ foreach_macro (splay_tree_node node, void *arg)
                          (struct macro_definition *) node->value);
   xfree (key_fullname);
 
-  (*datum->fn) (key->name, def, key->start_file, key->start_line,
-               datum->user_data);
+  datum->fn (key->name, def, key->start_file, key->start_line);
   return 0;
 }
 
 /* Call FN for every macro in TABLE.  */
 void
-macro_for_each (struct macro_table *table, macro_callback_fn fn,
-               void *user_data)
+macro_for_each (struct macro_table *table,
+               gdb::function_view<macro_callback_fn> fn)
 {
   struct macro_for_each_data datum;
 
   datum.fn = fn;
-  datum.user_data = user_data;
   datum.file = NULL;
   datum.line = 0;
   splay_tree_foreach (table->definitions, foreach_macro, &datum);
@@ -1021,20 +1017,18 @@ foreach_macro_in_scope (splay_tree_node node, void *info)
       && (!key->end_file
          || compare_locations (key->end_file, key->end_line,
                                datum->file, datum->line) >= 0))
-    (*datum->fn) (key->name, def, key->start_file, key->start_line,
-                 datum->user_data);
+    datum->fn (key->name, def, key->start_file, key->start_line);
   return 0;
 }
 
 /* Call FN for every macro is visible in SCOPE.  */
 void
 macro_for_each_in_scope (struct macro_source_file *file, int line,
-                        macro_callback_fn fn, void *user_data)
+                        gdb::function_view<macro_callback_fn> fn)
 {
   struct macro_for_each_data datum;
 
   datum.fn = fn;
-  datum.user_data = user_data;
   datum.file = file;
   datum.line = line;
   splay_tree_foreach (file->table->definitions,
@@ -1099,5 +1093,5 @@ macro_source_fullname (struct macro_source_file *file)
   if (comp_dir == NULL || IS_ABSOLUTE_PATH (file->filename))
     return xstrdup (file->filename);
 
-  return concat (comp_dir, SLASH_STRING, file->filename, NULL);
+  return concat (comp_dir, SLASH_STRING, file->filename, (char *) NULL);
 }
This page took 0.027487 seconds and 4 git commands to generate.