+
+# Test "whatis"/"ptype" of expressions involving casts to/from dfp
+# typedefs.
+
+# This list is composed by sub-lists, and their elements are (in
+# order):
+#
+# - Type to cast to. This is also what "whatis" should print.
+# - What "ptype" should print.
+
+# Columns in the sublists represent:
+ # to/whatis # ptype
+foreach elem {
+ {"_Decimal32" "_Decimal32"}
+ {"_Decimal64" "_Decimal64"}
+ {"_Decimal128" "_Decimal128"}
+ {"d32_t" "_Decimal32"}
+ {"d64_t" "_Decimal64"}
+ {"d128_t" "_Decimal128"}
+ {"d32_t2" "_Decimal32"}
+ {"d64_t2" "_Decimal64"}
+ {"d128_t2" "_Decimal128"}
+} {
+ set type [lindex $elem 0]
+ set ptype [lindex $elem 1]
+ gdb_test "whatis ($type) 0" " = $type"
+ gdb_test "ptype ($type) 0" " = $ptype"
+}
+
+# Test:
+# - whatis/ptype of variables of typedef type.
+# - whatis/ptype of typedef type names.
+# - whatis/ptype of typedef-of-typedef type names.
+
+# Columns in the sublists represent:
+ # Type name # whatis # ptype
+foreach elem {
+ {"v_d32_t" "d32_t" "_Decimal32"}
+ {"v_d64_t" "d64_t" "_Decimal64"}
+ {"v_d128_t" "d128_t" "_Decimal128"}
+
+ {"d32_t" "_Decimal32" "_Decimal32"}
+ {"d64_t" "_Decimal64" "_Decimal64"}
+ {"d128_t" "_Decimal128" "_Decimal128"}
+
+ {"d32_t2" "d32_t" "_Decimal32"}
+ {"d64_t2" "d64_t" "_Decimal64"}
+ {"d128_t2" "d128_t" "_Decimal128"}
+} {
+ set type [lindex $elem 0]
+ set whatis [lindex $elem 1]
+ set ptype [lindex $elem 2]
+ gdb_test "whatis $type" " = $whatis"
+ gdb_test "ptype $type" " = $ptype"
+}