• R/O
  • HTTP
  • SSH
  • HTTPS

提交

标签
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Commit MetaInfo

修订版e6a959d68b8181c816851dcfc91ae0b2b9296df3 (tree)
时间2015-10-14 03:40:50
作者Pedro Alves <palves@redh...>
CommiterPedro Alves

Log Message

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.

更改概述

差异

--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,22 @@
11 2015-10-13 Pedro Alves <palves@redhat.com>
22
3+ * ada-lang.c (ada_enum_name): Constify local.
4+ * ada-typeprint.c (print_range_bound): Constify locals.
5+ * c-varobj.c (c_describe_child): Likewise.
6+ * cli/cli-setshow.c (do_set_command): Likewise.
7+ * gdb_vecs.c (delim_string_to_char_ptr_vec_append): Likewise.
8+ * dwarf2read.c (find_file_and_directory): Likewise.
9+ (anonymous_struct_prefix, dwarf2_name): Likewise.
10+ * gnu-v3-abi.c (gnuv3_rtti_type): Likewise.
11+ * go-lang.c (unpack_mangled_go_symbol): Likewise.
12+ * jv-typeprint.c (java_type_print_base): Likewise.
13+ * ser-tcp.c (net_open): Likewise.
14+ * symfile.c (deduce_language_from_filename): Likewise.
15+ * symtab.c (gdb_mangle_name): Likewise.
16+ * tui/tui-io.c (tui_redisplay_readline): Likewise.
17+
18+2015-10-13 Pedro Alves <palves@redhat.com>
19+
320 * infrun.c (restore_execution_direction): New function.
421 (fetch_inferior_event): Use it instead of
522 make_cleanup_restore_integer.
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -9430,7 +9430,7 @@ ada_enum_name (const char *name)
94309430 {
94319431 static char *result;
94329432 static size_t result_len = 0;
9433- char *tmp;
9433+ const char *tmp;
94349434
94359435 /* First, unqualify the enumeration name:
94369436 1. Search for the last '.' character. If we find one, then skip
--- a/gdb/ada-typeprint.c
+++ b/gdb/ada-typeprint.c
@@ -203,7 +203,7 @@ print_range (struct type *type, struct ui_file *stream,
203203 set *N past the bound and its delimiter, if any. */
204204
205205 static void
206-print_range_bound (struct type *type, char *bounds, int *n,
206+print_range_bound (struct type *type, const char *bounds, int *n,
207207 struct ui_file *stream)
208208 {
209209 LONGEST B;
@@ -230,8 +230,8 @@ print_range_bound (struct type *type, char *bounds, int *n,
230230 else
231231 {
232232 int bound_len;
233- char *bound = bounds + *n;
234- char *pend;
233+ const char *bound = bounds + *n;
234+ const char *pend;
235235
236236 pend = strstr (bound, "__");
237237 if (pend == NULL)
@@ -300,7 +300,7 @@ print_range_type (struct type *raw_type, struct ui_file *stream,
300300 else
301301 {
302302 int prefix_len = subtype_info - name;
303- char *bounds_str;
303+ const char *bounds_str;
304304 int n;
305305
306306 subtype_info += 5;
--- a/gdb/c-varobj.c
+++ b/gdb/c-varobj.c
@@ -370,7 +370,7 @@ c_describe_child (const struct varobj *parent, int index,
370370
371371 if (cfull_expression)
372372 {
373- char *join = was_ptr ? "->" : ".";
373+ const char *join = was_ptr ? "->" : ".";
374374
375375 *cfull_expression = xstrprintf ("(%s)%s%s", parent_expression,
376376 join, field_name);
@@ -741,7 +741,7 @@ cplus_describe_child (const struct varobj *parent, int index,
741741 if (TYPE_CODE (type) == TYPE_CODE_STRUCT
742742 || TYPE_CODE (type) == TYPE_CODE_UNION)
743743 {
744- char *join = was_ptr ? "->" : ".";
744+ const char *join = was_ptr ? "->" : ".";
745745
746746 if (CPLUS_FAKE_CHILD (parent))
747747 {
@@ -825,7 +825,7 @@ cplus_describe_child (const struct varobj *parent, int index,
825825
826826 if (cfull_expression)
827827 {
828- char *ptr = was_ptr ? "*" : "";
828+ const char *ptr = was_ptr ? "*" : "";
829829
830830 /* Cast the parent to the base' type. Note that in gdb,
831831 expression like
--- a/gdb/cli/cli-setshow.c
+++ b/gdb/cli/cli-setshow.c
@@ -523,7 +523,7 @@ do_set_command (const char *arg, int from_tty, struct cmd_list_element *c)
523523 break;
524524 case var_boolean:
525525 {
526- char *opt = *(int *) c->var ? "on" : "off";
526+ const char *opt = *(int *) c->var ? "on" : "off";
527527
528528 observer_notify_command_param_changed (name, opt);
529529 }
--- a/gdb/common/gdb_vecs.c
+++ b/gdb/common/gdb_vecs.c
@@ -49,7 +49,8 @@ delim_string_to_char_ptr_vec_append (VEC (char_ptr) **vecp,
4949 do
5050 {
5151 size_t this_len;
52- char *next_field, *this_field;
52+ const char *next_field;
53+ char *this_field;
5354
5455 next_field = strchr (str, delimiter);
5556 if (next_field == NULL)
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -9074,7 +9074,7 @@ find_file_and_directory (struct die_info *die, struct dwarf2_cu *cu,
90749074 {
90759075 /* Irix 6.2 native cc prepends <machine>.: to the compilation
90769076 directory, get rid of it. */
9077- char *cp = strchr (*comp_dir, ':');
9077+ const char *cp = strchr (*comp_dir, ':');
90789078
90799079 if (cp && cp != *comp_dir && cp[-1] == '.' && cp[1] == '/')
90809080 *comp_dir = cp + 1;
@@ -19239,7 +19239,7 @@ static char *
1923919239 anonymous_struct_prefix (struct die_info *die, struct dwarf2_cu *cu)
1924019240 {
1924119241 struct attribute *attr;
19242- char *base;
19242+ const char *base;
1924319243
1924419244 if (die->tag != DW_TAG_class_type && die->tag != DW_TAG_interface_type
1924519245 && 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)
1962119621
1962219622 if (demangled)
1962319623 {
19624- char *base;
19624+ const char *base;
1962519625
1962619626 /* FIXME: we already did this for the partial symbol... */
1962719627 DW_STRING (attr)
--- a/gdb/gnu-v3-abi.c
+++ b/gdb/gnu-v3-abi.c
@@ -296,7 +296,7 @@ gnuv3_rtti_type (struct value *value,
296296 const char *class_name;
297297 struct type *run_time_type;
298298 LONGEST offset_to_top;
299- char *atsign;
299+ const char *atsign;
300300
301301 /* We only have RTTI for class objects. */
302302 if (TYPE_CODE (values_type) != TYPE_CODE_STRUCT)
--- a/gdb/go-lang.c
+++ b/gdb/go-lang.c
@@ -195,9 +195,9 @@ unpack_mangled_go_symbol (const char *mangled_name,
195195 /* Pointer to "N" if valid "N<digit(s)>_" found. */
196196 char *method_type;
197197 /* Pointer to the first '.'. */
198- char *first_dot;
198+ const char *first_dot;
199199 /* Pointer to the last '.'. */
200- char *last_dot;
200+ const char *last_dot;
201201 /* Non-zero if we saw a pointer indicator. */
202202 int saw_pointer;
203203
--- a/gdb/jv-typeprint.c
+++ b/gdb/jv-typeprint.c
@@ -223,7 +223,8 @@ java_type_print_base (struct type *type, struct ui_file *stream, int show,
223223 for (j = 0; j < n_overloads; j++)
224224 {
225225 const char *real_physname;
226- char *physname, *p;
226+ const char *p;
227+ char *physname;
227228 int is_full_physname_constructor;
228229
229230 real_physname = TYPE_FN_FIELD_PHYSNAME (f, j);
--- a/gdb/ser-tcp.c
+++ b/gdb/ser-tcp.c
@@ -155,7 +155,8 @@ wait_for_connect (struct serial *scb, unsigned int *polls)
155155 int
156156 net_open (struct serial *scb, const char *name)
157157 {
158- char *port_str, hostname[100];
158+ char hostname[100];
159+ const char *port_str;
159160 int n, port, tmp;
160161 int use_udp;
161162 struct hostent *hostent;
--- a/gdb/symfile.c
+++ b/gdb/symfile.c
@@ -2881,7 +2881,7 @@ enum language
28812881 deduce_language_from_filename (const char *filename)
28822882 {
28832883 int i;
2884- char *cp;
2884+ const char *cp;
28852885
28862886 if (filename != NULL)
28872887 if ((cp = strrchr (filename, '.')) != NULL)
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -515,8 +515,8 @@ gdb_mangle_name (struct type *type, int method_id, int signature_id)
515515 int is_constructor;
516516 int is_destructor = is_destructor_name (physname);
517517 /* Need a new type prefix. */
518- char *const_prefix = method->is_const ? "C" : "";
519- char *volatile_prefix = method->is_volatile ? "V" : "";
518+ const char *const_prefix = method->is_const ? "C" : "";
519+ const char *volatile_prefix = method->is_volatile ? "V" : "";
520520 char buf[20];
521521 int len = (newname == NULL ? 0 : strlen (newname));
522522
--- a/gdb/tui/tui-io.c
+++ b/gdb/tui/tui-io.c
@@ -203,7 +203,7 @@ tui_redisplay_readline (void)
203203 int c_line;
204204 int in;
205205 WINDOW *w;
206- char *prompt;
206+ const char *prompt;
207207 int start_line;
208208
209209 /* Detect when we temporarily left SingleKey and now the readline