diff options
author | Pedro Alves <palves@redhat.com> | 2020-07-02 15:54:36 +0100 |
---|---|---|
committer | Pedro Alves <palves@redhat.com> | 2020-07-03 15:00:08 +0100 |
commit | bf90c83acca6736f451807d3e231b53dc02bc57b (patch) | |
tree | 49fe9406174dec5f9561eb6064ec411d540c30f1 /gdb | |
parent | 2eb821570037e8836d61ab3dcb9331c21f8a64d9 (diff) | |
download | gdb-bf90c83acca6736f451807d3e231b53dc02bc57b.zip gdb-bf90c83acca6736f451807d3e231b53dc02bc57b.tar.gz gdb-bf90c83acca6736f451807d3e231b53dc02bc57b.tar.bz2 |
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.
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | 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 <palves@redhat.com> + * gdb.base/charset.c (init_string): Change all char parameters to + unsigned char parameters. + +2020-07-03 Pedro Alves <palves@redhat.com> + * 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; |