From: Pedro Alves Date: Thu, 2 Jul 2020 14:54:36 +0000 (+0100) Subject: Fix gdb.base/charset.exp with Clang X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=bf90c83acca6736f451807d3e231b53dc02bc57b;p=binutils-gdb.git Fix gdb.base/charset.exp with Clang gdb.base/charset.exp fails to run with Clang, because of: gdb compile failed, /home/pedro/gdb/mygit/src/gdb/testsuite/gdb.base/charset.c:144:20: warning: implicit conversion from 'int' to 'char' changes value from 162 to -94 [-Wconstant-conversion] 11, 162, 17); ^~~ /home/pedro/gdb/mygit/src/gdb/testsuite/gdb.base/charset.c:151:16: warning: implicit conversion from 'int' to 'char' changes value from 167 to -89 [-Wconstant-conversion] 167, ^~~ /home/pedro/gdb/mygit/src/gdb/testsuite/gdb.base/charset.c:168:16: warning: implicit conversion from 'int' to 'char' changes value from 167 to -89 [-Wconstant-conversion] 167, ^~~ 3 warnings generated. === gdb Summary === # of untested testcases 1 Fix it by changing init_string to take unsigned char parameters. gdb/testsuite/ChangeLog: * gdb.base/charset.c (init_string): Change all char parameters to unsigned char parameters. --- diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 47e4d7c509a..79c1208bd50 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2020-07-03 Pedro Alves + + * gdb.base/charset.c (init_string): Change all char parameters to + unsigned char parameters. + 2020-07-03 Pedro Alves * gdb.base/call-sc.exp (start_scalars_test): Use diff --git a/gdb/testsuite/gdb.base/charset.c b/gdb/testsuite/gdb.base/charset.c index ec4927da515..20d548b1928 100644 --- a/gdb/testsuite/gdb.base/charset.c +++ b/gdb/testsuite/gdb.base/charset.c @@ -77,12 +77,21 @@ short short_array[3]; int int_array[3]; long long_array[3]; +/* These are unsigned char so we can pass down characters >127 without + explicit casts or warnings. */ + void init_string (char string[], - char x, - char alert, char backspace, char form_feed, - char line_feed, char carriage_return, char horizontal_tab, - char vertical_tab, char cent, char misc_ctrl) + unsigned char x, + unsigned char alert, + unsigned char backspace, + unsigned char form_feed, + unsigned char line_feed, + unsigned char carriage_return, + unsigned char horizontal_tab, + unsigned char vertical_tab, + unsigned char cent, + unsigned char misc_ctrl) { int i;