+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>
* gdb.base/watchpoint.c (buf): Make it 31 bytes.
char ebcdic_us_string[NUM_CHARS];
char ibm1047_string[NUM_CHARS];
+#ifndef __cplusplus
+
/* 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
purposes of this test). */
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''
support. It is ok if these have the wrong size on some platforms
typedef unsigned short char16_t;
typedef unsigned int char32_t;
+#endif
+
+wchar_t utf_32_string[NUM_CHARS];
+
/* Make sure to use the typedefs. */
char16_t uvar;
char32_t Uvar;
"parse character literal in ${target_charset}"
# 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" \
"check value of parsed character literal in ${target_charset}"
"parse string literal in ${target_charset}"
# 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" \
"check value of parsed string literal in ${target_charset}"
if {$have_escape} {
# 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" \
"check value of '\\${escape}' in ${target_charset}"
# 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" \
"check value of \"\\${escape}\" in ${target_charset}"
}
# get the unescaped character, in the target character set.
gdb_test "print $L'\\q'" " = \[0-9-\]+ $L'q'" \
"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"
}
}
# 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" \
"EVAL_SKIP cleanup handling regression test"