More char constification
Trivial constifications flagged by G++. E.g.: src/gdb/c-varobj.c: In function ‘void c_describe_child(const varobj*, int, char**, value**, type**, char**)’: src/gdb/c-varobj.c:373:33: error: invalid conversion from ‘const char*’ to ‘char*’ [-fpermissive] char *join = was_ptr ? "->" : "."; ^ gdb/ChangeLog: 2015-10-13 Pedro Alves <palves@redhat.com> * ada-lang.c (ada_enum_name): Constify local. * ada-typeprint.c (print_range_bound): Constify locals. * c-varobj.c (c_describe_child): Likewise. * cli/cli-setshow.c (do_set_command): Likewise. * gdb_vecs.c (delim_string_to_char_ptr_vec_append): Likewise. * dwarf2read.c (find_file_and_directory): Likewise. (anonymous_struct_prefix, dwarf2_name): Likewise. * gnu-v3-abi.c (gnuv3_rtti_type): Likewise. * go-lang.c (unpack_mangled_go_symbol): Likewise. * jv-typeprint.c (java_type_print_base): Likewise. * ser-tcp.c (net_open): Likewise. * symfile.c (deduce_language_from_filename): Likewise. * symtab.c (gdb_mangle_name): Likewise. * tui/tui-io.c (tui_redisplay_readline): Likewise.
This commit is contained in:
parent
170742de5d
commit
e6a959d68b
@ -1,3 +1,20 @@
|
||||
2015-10-13 Pedro Alves <palves@redhat.com>
|
||||
|
||||
* ada-lang.c (ada_enum_name): Constify local.
|
||||
* ada-typeprint.c (print_range_bound): Constify locals.
|
||||
* c-varobj.c (c_describe_child): Likewise.
|
||||
* cli/cli-setshow.c (do_set_command): Likewise.
|
||||
* gdb_vecs.c (delim_string_to_char_ptr_vec_append): Likewise.
|
||||
* dwarf2read.c (find_file_and_directory): Likewise.
|
||||
(anonymous_struct_prefix, dwarf2_name): Likewise.
|
||||
* gnu-v3-abi.c (gnuv3_rtti_type): Likewise.
|
||||
* go-lang.c (unpack_mangled_go_symbol): Likewise.
|
||||
* jv-typeprint.c (java_type_print_base): Likewise.
|
||||
* ser-tcp.c (net_open): Likewise.
|
||||
* symfile.c (deduce_language_from_filename): Likewise.
|
||||
* symtab.c (gdb_mangle_name): Likewise.
|
||||
* tui/tui-io.c (tui_redisplay_readline): Likewise.
|
||||
|
||||
2015-10-13 Pedro Alves <palves@redhat.com>
|
||||
|
||||
* infrun.c (restore_execution_direction): New function.
|
||||
|
@ -9430,7 +9430,7 @@ ada_enum_name (const char *name)
|
||||
{
|
||||
static char *result;
|
||||
static size_t result_len = 0;
|
||||
char *tmp;
|
||||
const char *tmp;
|
||||
|
||||
/* First, unqualify the enumeration name:
|
||||
1. Search for the last '.' character. If we find one, then skip
|
||||
|
@ -203,7 +203,7 @@ print_range (struct type *type, struct ui_file *stream,
|
||||
set *N past the bound and its delimiter, if any. */
|
||||
|
||||
static void
|
||||
print_range_bound (struct type *type, char *bounds, int *n,
|
||||
print_range_bound (struct type *type, const char *bounds, int *n,
|
||||
struct ui_file *stream)
|
||||
{
|
||||
LONGEST B;
|
||||
@ -230,8 +230,8 @@ print_range_bound (struct type *type, char *bounds, int *n,
|
||||
else
|
||||
{
|
||||
int bound_len;
|
||||
char *bound = bounds + *n;
|
||||
char *pend;
|
||||
const char *bound = bounds + *n;
|
||||
const char *pend;
|
||||
|
||||
pend = strstr (bound, "__");
|
||||
if (pend == NULL)
|
||||
@ -300,7 +300,7 @@ print_range_type (struct type *raw_type, struct ui_file *stream,
|
||||
else
|
||||
{
|
||||
int prefix_len = subtype_info - name;
|
||||
char *bounds_str;
|
||||
const char *bounds_str;
|
||||
int n;
|
||||
|
||||
subtype_info += 5;
|
||||
|
@ -370,7 +370,7 @@ c_describe_child (const struct varobj *parent, int index,
|
||||
|
||||
if (cfull_expression)
|
||||
{
|
||||
char *join = was_ptr ? "->" : ".";
|
||||
const char *join = was_ptr ? "->" : ".";
|
||||
|
||||
*cfull_expression = xstrprintf ("(%s)%s%s", parent_expression,
|
||||
join, field_name);
|
||||
@ -741,7 +741,7 @@ cplus_describe_child (const struct varobj *parent, int index,
|
||||
if (TYPE_CODE (type) == TYPE_CODE_STRUCT
|
||||
|| TYPE_CODE (type) == TYPE_CODE_UNION)
|
||||
{
|
||||
char *join = was_ptr ? "->" : ".";
|
||||
const char *join = was_ptr ? "->" : ".";
|
||||
|
||||
if (CPLUS_FAKE_CHILD (parent))
|
||||
{
|
||||
@ -825,7 +825,7 @@ cplus_describe_child (const struct varobj *parent, int index,
|
||||
|
||||
if (cfull_expression)
|
||||
{
|
||||
char *ptr = was_ptr ? "*" : "";
|
||||
const char *ptr = was_ptr ? "*" : "";
|
||||
|
||||
/* Cast the parent to the base' type. Note that in gdb,
|
||||
expression like
|
||||
|
@ -523,7 +523,7 @@ do_set_command (const char *arg, int from_tty, struct cmd_list_element *c)
|
||||
break;
|
||||
case var_boolean:
|
||||
{
|
||||
char *opt = *(int *) c->var ? "on" : "off";
|
||||
const char *opt = *(int *) c->var ? "on" : "off";
|
||||
|
||||
observer_notify_command_param_changed (name, opt);
|
||||
}
|
||||
|
@ -49,7 +49,8 @@ delim_string_to_char_ptr_vec_append (VEC (char_ptr) **vecp,
|
||||
do
|
||||
{
|
||||
size_t this_len;
|
||||
char *next_field, *this_field;
|
||||
const char *next_field;
|
||||
char *this_field;
|
||||
|
||||
next_field = strchr (str, delimiter);
|
||||
if (next_field == NULL)
|
||||
|
@ -9074,7 +9074,7 @@ find_file_and_directory (struct die_info *die, struct dwarf2_cu *cu,
|
||||
{
|
||||
/* Irix 6.2 native cc prepends <machine>.: to the compilation
|
||||
directory, get rid of it. */
|
||||
char *cp = strchr (*comp_dir, ':');
|
||||
const char *cp = strchr (*comp_dir, ':');
|
||||
|
||||
if (cp && cp != *comp_dir && cp[-1] == '.' && cp[1] == '/')
|
||||
*comp_dir = cp + 1;
|
||||
@ -19239,7 +19239,7 @@ static char *
|
||||
anonymous_struct_prefix (struct die_info *die, struct dwarf2_cu *cu)
|
||||
{
|
||||
struct attribute *attr;
|
||||
char *base;
|
||||
const char *base;
|
||||
|
||||
if (die->tag != DW_TAG_class_type && die->tag != DW_TAG_interface_type
|
||||
&& die->tag != DW_TAG_structure_type && die->tag != DW_TAG_union_type)
|
||||
@ -19621,7 +19621,7 @@ dwarf2_name (struct die_info *die, struct dwarf2_cu *cu)
|
||||
|
||||
if (demangled)
|
||||
{
|
||||
char *base;
|
||||
const char *base;
|
||||
|
||||
/* FIXME: we already did this for the partial symbol... */
|
||||
DW_STRING (attr)
|
||||
|
@ -296,7 +296,7 @@ gnuv3_rtti_type (struct value *value,
|
||||
const char *class_name;
|
||||
struct type *run_time_type;
|
||||
LONGEST offset_to_top;
|
||||
char *atsign;
|
||||
const char *atsign;
|
||||
|
||||
/* We only have RTTI for class objects. */
|
||||
if (TYPE_CODE (values_type) != TYPE_CODE_STRUCT)
|
||||
|
@ -195,9 +195,9 @@ unpack_mangled_go_symbol (const char *mangled_name,
|
||||
/* Pointer to "N" if valid "N<digit(s)>_" found. */
|
||||
char *method_type;
|
||||
/* Pointer to the first '.'. */
|
||||
char *first_dot;
|
||||
const char *first_dot;
|
||||
/* Pointer to the last '.'. */
|
||||
char *last_dot;
|
||||
const char *last_dot;
|
||||
/* Non-zero if we saw a pointer indicator. */
|
||||
int saw_pointer;
|
||||
|
||||
|
@ -223,7 +223,8 @@ java_type_print_base (struct type *type, struct ui_file *stream, int show,
|
||||
for (j = 0; j < n_overloads; j++)
|
||||
{
|
||||
const char *real_physname;
|
||||
char *physname, *p;
|
||||
const char *p;
|
||||
char *physname;
|
||||
int is_full_physname_constructor;
|
||||
|
||||
real_physname = TYPE_FN_FIELD_PHYSNAME (f, j);
|
||||
|
@ -155,7 +155,8 @@ wait_for_connect (struct serial *scb, unsigned int *polls)
|
||||
int
|
||||
net_open (struct serial *scb, const char *name)
|
||||
{
|
||||
char *port_str, hostname[100];
|
||||
char hostname[100];
|
||||
const char *port_str;
|
||||
int n, port, tmp;
|
||||
int use_udp;
|
||||
struct hostent *hostent;
|
||||
|
@ -2881,7 +2881,7 @@ enum language
|
||||
deduce_language_from_filename (const char *filename)
|
||||
{
|
||||
int i;
|
||||
char *cp;
|
||||
const char *cp;
|
||||
|
||||
if (filename != NULL)
|
||||
if ((cp = strrchr (filename, '.')) != NULL)
|
||||
|
@ -515,8 +515,8 @@ gdb_mangle_name (struct type *type, int method_id, int signature_id)
|
||||
int is_constructor;
|
||||
int is_destructor = is_destructor_name (physname);
|
||||
/* Need a new type prefix. */
|
||||
char *const_prefix = method->is_const ? "C" : "";
|
||||
char *volatile_prefix = method->is_volatile ? "V" : "";
|
||||
const char *const_prefix = method->is_const ? "C" : "";
|
||||
const char *volatile_prefix = method->is_volatile ? "V" : "";
|
||||
char buf[20];
|
||||
int len = (newname == NULL ? 0 : strlen (newname));
|
||||
|
||||
|
@ -203,7 +203,7 @@ tui_redisplay_readline (void)
|
||||
int c_line;
|
||||
int in;
|
||||
WINDOW *w;
|
||||
char *prompt;
|
||||
const char *prompt;
|
||||
int start_line;
|
||||
|
||||
/* Detect when we temporarily left SingleKey and now the readline
|
||||
|
Loading…
x
Reference in New Issue
Block a user