This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
FYI: some const-correctness in dbxread.c
- From: Tom Tromey <tromey at redhat dot com>
- To: gdb-patches at sourceware dot org
- Date: Tue, 20 Aug 2013 12:21:34 -0600
- Subject: FYI: some const-correctness in dbxread.c
I'm checking this in.
I noticed a couple of spots in dbxread.c that needlessly cast away
const. This patch removes the casts and fixes up the fallout.
Tested by rebuilding.
Tom
2013-08-20 Tom Tromey <tromey@redhat.com>
* dbxread.c (record_minimal_symbol): Make 'name' argument const.
Update.
(read_dbx_dynamic_symtab): Make 'name' const. Remove casts.
Index: dbxread.c
===================================================================
RCS file: /cvs/src/src/gdb/dbxread.c,v
retrieving revision 1.147
diff -u -r1.147 dbxread.c
--- dbxread.c 30 May 2013 17:34:18 -0000 1.147
+++ dbxread.c 20 Aug 2013 18:20:14 -0000
@@ -291,7 +291,8 @@
static void dbx_symfile_finish (struct objfile *);
-static void record_minimal_symbol (char *, CORE_ADDR, int, struct objfile *);
+static void record_minimal_symbol (const char *, CORE_ADDR, int,
+ struct objfile *);
static void add_new_header_file (char *, int);
@@ -435,7 +436,7 @@
#endif
static void
-record_minimal_symbol (char *name, CORE_ADDR address, int type,
+record_minimal_symbol (const char *name, CORE_ADDR address, int type,
struct objfile *objfile)
{
enum minimal_symbol_type ms_type;
@@ -491,7 +492,7 @@
/* Same with virtual function tables, both global and static. */
{
- char *tempstring = name;
+ const char *tempstring = name;
if (tempstring[0] == bfd_get_symbol_leading_char (objfile->obfd))
++tempstring;
@@ -1001,7 +1002,7 @@
long dynrel_count;
arelent **dynrels;
CORE_ADDR sym_value;
- char *name;
+ const char *name;
/* Check that the symbol file has dynamic symbols that we know about.
bfd_arch_unknown can happen if we are reading a sun3 symbol file
@@ -1067,7 +1068,7 @@
if (sym->flags & BSF_GLOBAL)
type |= N_EXT;
- record_minimal_symbol ((char *) bfd_asymbol_name (sym), sym_value,
+ record_minimal_symbol (bfd_asymbol_name (sym), sym_value,
type, objfile);
}
}
@@ -1121,7 +1122,7 @@
continue;
}
- name = (char *) bfd_asymbol_name (*rel->sym_ptr_ptr);
+ name = bfd_asymbol_name (*rel->sym_ptr_ptr);
prim_record_minimal_symbol (name, address, mst_solib_trampoline,
objfile);
}