aboutsummaryrefslogtreecommitdiff
path: root/gdb/expprint.c
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2013-03-07 19:24:32 +0000
committerPedro Alves <palves@redhat.com>2013-03-07 19:24:32 +0000
commitac91cd701edad8df82aa7f12c9c51c1a3e7ba09e (patch)
tree4901d24600112d529c6af07d603b93ce84378092 /gdb/expprint.c
parent2898e56054c7a35f85908729b01c6eb763317269 (diff)
downloadgdb-ac91cd701edad8df82aa7f12c9c51c1a3e7ba09e.zip
gdb-ac91cd701edad8df82aa7f12c9c51c1a3e7ba09e.tar.gz
gdb-ac91cd701edad8df82aa7f12c9c51c1a3e7ba09e.tar.bz2
Fix -Wpointer-sign around strings/encoding conversions.
Trimmed for brevity: $ make WERROR_CFLAGS="-Wpointer-sign -Werror" c-lang.o expprint.o utils.o valprint.o varobj.o -k 2>&1 1>/dev/null ../../src/gdb/c-lang.c: In function ‘parse_one_string’: ../../src/gdb/c-lang.c:540:8: error: pointer targets in passing argument 3 of ‘convert_between_encodings’ differ in signedness [-Werror=pointer-sign] In file included from ../../src/gdb/c-lang.c:30:0: ../../src/gdb/charset.h:64:6: note: expected ‘const gdb_byte *’ but argument is of type ‘char *’ ../../src/gdb/expprint.c: In function ‘print_subexp_standard’: ../../src/gdb/expprint.c:205:2: error: pointer targets in passing argument 3 of ‘current_language->la_printstr’ differ in signedness [-Werror=pointer-sign] ../../src/gdb/expprint.c:205:2: note: expected ‘const gdb_byte *’ but argument is of type ‘char *’ cc1: all warnings being treated as errors make: *** [expprint.o] Error 1 ../../src/gdb/utils.c: In function ‘host_char_to_target’: ../../src/gdb/utils.c:1474:9: error: pointer targets in passing argument 3 of ‘convert_between_encodings’ differ in signedness [-Werror=pointer-sign] ../../src/gdb/varobj.c: In function ‘value_get_print_value’: ../../src/gdb/varobj.c:2934:8: error: pointer targets in return differ in signedness [-Werror=pointer-sign] ../../src/gdb/varobj.c:2968:12: error: pointer targets in assignment differ in signedness [-Werror=pointer-sign] ../../src/gdb/varobj.c:2971:3: error: pointer targets in return differ in signedness [-Werror=pointer-sign] cc1: all warnings being treated as errors make: *** [varobj.o] Error 1 As with the previous patch, the encoding conversion code works with gdb_byte arrays as the generic buffers that hold strings of any encoding/width. This patch adds casts where appropriate. gdb/ 2013-03-07 Pedro Alves <palves@redhat.com> * c-lang.c (parse_one_string): Cast argument to gdb_byte *. * expprint.c (print_subexp_standard): Likewise. * utils.c (host_char_to_target): Likewise. * valprint.c (generic_emit_char, generic_printstr): Likewise. * varobj.c (value_get_print_value): Change type of local to char*. Cast it gdb_byte * in call to language printer.
Diffstat (limited to 'gdb/expprint.c')
-rw-r--r--gdb/expprint.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/gdb/expprint.c b/gdb/expprint.c
index 4dd2d7c..6905534 100644
--- a/gdb/expprint.c
+++ b/gdb/expprint.c
@@ -203,7 +203,8 @@ print_subexp_standard (struct expression *exp, int *pos,
additional parameter to LA_PRINT_STRING. -fnf */
get_user_print_options (&opts);
LA_PRINT_STRING (stream, builtin_type (exp->gdbarch)->builtin_char,
- &exp->elts[pc + 2].string, nargs, NULL, 0, &opts);
+ (gdb_byte *) &exp->elts[pc + 2].string, nargs,
+ NULL, 0, &opts);
}
return;
@@ -217,7 +218,8 @@ print_subexp_standard (struct expression *exp, int *pos,
fputs_filtered ("@\"", stream);
get_user_print_options (&opts);
LA_PRINT_STRING (stream, builtin_type (exp->gdbarch)->builtin_char,
- &exp->elts[pc + 2].string, nargs, NULL, 0, &opts);
+ (gdb_byte *) &exp->elts[pc + 2].string, nargs,
+ NULL, 0, &opts);
fputs_filtered ("\"", stream);
}
return;
@@ -307,7 +309,7 @@ print_subexp_standard (struct expression *exp, int *pos,
get_user_print_options (&opts);
LA_PRINT_STRING (stream, builtin_type (exp->gdbarch)->builtin_char,
- tempstr, nargs - 1, NULL, 0, &opts);
+ (gdb_byte *) tempstr, nargs - 1, NULL, 0, &opts);
(*pos) = pc;
}
else