From bf90c83acca6736f451807d3e231b53dc02bc57b Mon Sep 17 00:00:00 2001 From: Pedro Alves Date: Thu, 2 Jul 2020 15:54:36 +0100 Subject: 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. --- gdb/testsuite/ChangeLog | 5 +++++ gdb/testsuite/gdb.base/charset.c | 17 +++++++++++++---- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 47e4d7c..79c1208 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,5 +1,10 @@ 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 prepare_for_testing and don't try compiling with -DNO_PROTOTYPES. * gdb.base/overlays.c: Remove references to PARAMS. diff --git a/gdb/testsuite/gdb.base/charset.c b/gdb/testsuite/gdb.base/charset.c index ec4927d..20d548b 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; -- cgit v1.1