mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-25 21:41:47 +08:00
gdb.base/charset.{c,exp} C++ify
Adjust gdb.base/charset.{c,exp} so that the testcase works when compiled as a C++ program. wchar_t is built-in in C++, so don't make a phony typedef. The "print /d" is so that we also get "1" instead of "true" in C++ mode. gdb/testsuite/ChangeLog: * gdb.base/charset.c [__cplusplus] (wchar_t, char16_t, char32_t): Don't define. (utf_32_string): Compile for both C and C++. * gdb.base/charset.exp: Use "print /d".
This commit is contained in:
@ -1,3 +1,10 @@
|
|||||||
|
2020-09-17 Pedro Alves <pedro@palves.net>
|
||||||
|
|
||||||
|
* gdb.base/charset.c [__cplusplus] (wchar_t, char16_t, char32_t):
|
||||||
|
Don't define.
|
||||||
|
(utf_32_string): Compile for both C and C++.
|
||||||
|
* gdb.base/charset.exp: Use "print /d".
|
||||||
|
|
||||||
2020-09-17 Pedro Alves <pedro@palves.net>
|
2020-09-17 Pedro Alves <pedro@palves.net>
|
||||||
|
|
||||||
* gdb.base/watchpoint.c (buf): Make it 31 bytes.
|
* gdb.base/watchpoint.c (buf): Make it 31 bytes.
|
||||||
|
@ -49,11 +49,12 @@ char iso_8859_1_string[NUM_CHARS];
|
|||||||
char ebcdic_us_string[NUM_CHARS];
|
char ebcdic_us_string[NUM_CHARS];
|
||||||
char ibm1047_string[NUM_CHARS];
|
char ibm1047_string[NUM_CHARS];
|
||||||
|
|
||||||
|
#ifndef __cplusplus
|
||||||
|
|
||||||
/* We make a phony wchar_t and then pretend that this platform uses
|
/* We make a phony wchar_t and then pretend that this platform uses
|
||||||
UTF-32 (or UTF-16, depending on the size -- same difference for the
|
UTF-32 (or UTF-16, depending on the size -- same difference for the
|
||||||
purposes of this test). */
|
purposes of this test). */
|
||||||
typedef unsigned int wchar_t;
|
typedef unsigned int wchar_t;
|
||||||
wchar_t utf_32_string[NUM_CHARS];
|
|
||||||
|
|
||||||
/* We also define a couple phony types for testing the u'' and U''
|
/* We also define a couple phony types for testing the u'' and U''
|
||||||
support. It is ok if these have the wrong size on some platforms
|
support. It is ok if these have the wrong size on some platforms
|
||||||
@ -61,6 +62,10 @@ wchar_t utf_32_string[NUM_CHARS];
|
|||||||
typedef unsigned short char16_t;
|
typedef unsigned short char16_t;
|
||||||
typedef unsigned int char32_t;
|
typedef unsigned int char32_t;
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
wchar_t utf_32_string[NUM_CHARS];
|
||||||
|
|
||||||
/* Make sure to use the typedefs. */
|
/* Make sure to use the typedefs. */
|
||||||
char16_t uvar;
|
char16_t uvar;
|
||||||
char32_t Uvar;
|
char32_t Uvar;
|
||||||
|
@ -409,7 +409,7 @@ foreach target_charset $charset_subset {
|
|||||||
"parse character literal in ${target_charset}"
|
"parse character literal in ${target_charset}"
|
||||||
|
|
||||||
# Check that the character literal was encoded correctly.
|
# Check that the character literal was encoded correctly.
|
||||||
gdb_test "print $L'A' == $var_name\[7\]" \
|
gdb_test "print /d $L'A' == $var_name\[7\]" \
|
||||||
" = 1" \
|
" = 1" \
|
||||||
"check value of parsed character literal in ${target_charset}"
|
"check value of parsed character literal in ${target_charset}"
|
||||||
|
|
||||||
@ -419,7 +419,7 @@ foreach target_charset $charset_subset {
|
|||||||
"parse string literal in ${target_charset}"
|
"parse string literal in ${target_charset}"
|
||||||
|
|
||||||
# Check that the string literal was encoded correctly.
|
# Check that the string literal was encoded correctly.
|
||||||
gdb_test "print $L\"q\"\[0\] == $var_name\[49\]" \
|
gdb_test "print /d $L\"q\"\[0\] == $var_name\[49\]" \
|
||||||
" = 1" \
|
" = 1" \
|
||||||
"check value of parsed string literal in ${target_charset}"
|
"check value of parsed string literal in ${target_charset}"
|
||||||
|
|
||||||
@ -470,12 +470,12 @@ foreach target_charset $charset_subset {
|
|||||||
if {$have_escape} {
|
if {$have_escape} {
|
||||||
|
|
||||||
# Try parsing a backslash escape in a character literal.
|
# Try parsing a backslash escape in a character literal.
|
||||||
gdb_test "print $L'\\${escape}' == $var_name\[$i\]" \
|
gdb_test "print /d $L'\\${escape}' == $var_name\[$i\]" \
|
||||||
" = 1" \
|
" = 1" \
|
||||||
"check value of '\\${escape}' in ${target_charset}"
|
"check value of '\\${escape}' in ${target_charset}"
|
||||||
|
|
||||||
# Try parsing a backslash escape in a string literal.
|
# Try parsing a backslash escape in a string literal.
|
||||||
gdb_test "print $L\"\\${escape}\"\[0\] == $var_name\[$i\]" \
|
gdb_test "print /d $L\"\\${escape}\"\[0\] == $var_name\[$i\]" \
|
||||||
" = 1" \
|
" = 1" \
|
||||||
"check value of \"\\${escape}\" in ${target_charset}"
|
"check value of \"\\${escape}\" in ${target_charset}"
|
||||||
}
|
}
|
||||||
@ -485,7 +485,7 @@ foreach target_charset $charset_subset {
|
|||||||
# get the unescaped character, in the target character set.
|
# get the unescaped character, in the target character set.
|
||||||
gdb_test "print $L'\\q'" " = \[0-9-\]+ $L'q'" \
|
gdb_test "print $L'\\q'" " = \[0-9-\]+ $L'q'" \
|
||||||
"print escape that doesn't exist in $target_charset"
|
"print escape that doesn't exist in $target_charset"
|
||||||
gdb_test "print $L'\\q' == $var_name\[49\]" " = 1" \
|
gdb_test "print /d $L'\\q' == $var_name\[49\]" " = 1" \
|
||||||
"check value of escape that doesn't exist in $target_charset"
|
"check value of escape that doesn't exist in $target_charset"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -585,7 +585,7 @@ if {$ucs2_ok} {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Regression test for a cleanup bug in the charset code.
|
# Regression test for a cleanup bug in the charset code.
|
||||||
gdb_test "print 'a' == 'a' || 'b' == 'b'" \
|
gdb_test "print /d 'a' == 'a' || 'b' == 'b'" \
|
||||||
".* = 1" \
|
".* = 1" \
|
||||||
"EVAL_SKIP cleanup handling regression test"
|
"EVAL_SKIP cleanup handling regression test"
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user