+2019-12-04 Andrew Burgess <andrew.burgess@embecosm.com>
+ Chris January <chris.january@arm.com>
+
+ * f-exp.y (COMPLEX_KEYWORD, SINGLE, DOUBLE, PRECISION): New
+ tokens.
+ (typebase): New patterns for complex, single/double precision, and
+ single/double complex.
+ (f77_keywords): Change token for complex keyword, and add single,
+ double, and precision keywords.
+
2019-12-04 Simon Marchi <simon.marchi@polymtl.ca>
* avr-tdep.c (_initialize_avr_tdep): Improve help of command
%token INT_KEYWORD INT_S2_KEYWORD LOGICAL_S1_KEYWORD LOGICAL_S2_KEYWORD
%token LOGICAL_S8_KEYWORD
%token LOGICAL_KEYWORD REAL_KEYWORD REAL_S8_KEYWORD REAL_S16_KEYWORD
+%token COMPLEX_KEYWORD
%token COMPLEX_S8_KEYWORD COMPLEX_S16_KEYWORD COMPLEX_S32_KEYWORD
%token BOOL_AND BOOL_OR BOOL_NOT
+%token SINGLE DOUBLE PRECISION
%token <lval> CHARACTER
%token <voidval> DOLLAR_VARIABLE
{ $$ = parse_f_type (pstate)->builtin_real_s8; }
| REAL_S16_KEYWORD
{ $$ = parse_f_type (pstate)->builtin_real_s16; }
+ | COMPLEX_KEYWORD
+ { $$ = parse_f_type (pstate)->builtin_complex_s8; }
| COMPLEX_S8_KEYWORD
{ $$ = parse_f_type (pstate)->builtin_complex_s8; }
| COMPLEX_S16_KEYWORD
{ $$ = parse_f_type (pstate)->builtin_complex_s16; }
| COMPLEX_S32_KEYWORD
{ $$ = parse_f_type (pstate)->builtin_complex_s32; }
+ | SINGLE PRECISION
+ { $$ = parse_f_type (pstate)->builtin_real;}
+ | DOUBLE PRECISION
+ { $$ = parse_f_type (pstate)->builtin_real_s8;}
+ | SINGLE COMPLEX_KEYWORD
+ { $$ = parse_f_type (pstate)->builtin_complex_s8;}
+ | DOUBLE COMPLEX_KEYWORD
+ { $$ = parse_f_type (pstate)->builtin_complex_s16;}
;
nonempty_typelist
{ "integer", INT_KEYWORD, BINOP_END, true },
{ "logical", LOGICAL_KEYWORD, BINOP_END, true },
{ "real_16", REAL_S16_KEYWORD, BINOP_END, true },
- { "complex", COMPLEX_S8_KEYWORD, BINOP_END, true },
+ { "complex", COMPLEX_KEYWORD, BINOP_END, true },
{ "sizeof", SIZEOF, BINOP_END, true },
{ "real_8", REAL_S8_KEYWORD, BINOP_END, true },
{ "real", REAL_KEYWORD, BINOP_END, true },
+ { "single", SINGLE, BINOP_END, true },
+ { "double", DOUBLE, BINOP_END, true },
+ { "precision", PRECISION, BINOP_END, true },
/* The following correspond to actual functions in Fortran and are case
insensitive. */
{ "kind", KIND, BINOP_END, false },
+2019-12-04 Andrew Burgess <andrew.burgess@embecosm.com>
+
+ * gdb.fortran/type-kinds.exp (test_cast_1_to_type_kind): Handle
+ casting to type with no kind specified.
+ (test_basic_parsing_of_type_kinds): Additional tests for types
+ with no kind specified, and add tests for single/double
+ precision/complex types.
+
2019-12-04 Tom Tromey <tromey@adacore.com>
* gdb.base/endianity.c (struct other) <x>: New field.
# Cast the value 1 to the type 'BASE_TYPE (kind=TYPE_KIND)'. The
# expected result of the cast is CAST_RESULT, and the size of the
-# value returned by the cast should be SIZE_RESULT.
+# value returned by the cast should be SIZE_RESULT. If TYPE_KIND is
+# the empty string then the cast is done to just 'BASE_TYPE'.
proc test_cast_1_to_type_kind {base_type type_kind cast_result size_result} {
- set type_string "$base_type (kind=$type_kind)"
+ if { $type_kind != "" } {
+ set kind_string " (kind=$type_kind)"
+ } else {
+ set kind_string ""
+ }
+ set type_string "${base_type}${kind_string}"
gdb_test "p (($type_string) 1)" " = $cast_result"
gdb_test "p sizeof (($type_string) 1)" " = $size_result"
}
proc test_basic_parsing_of_type_kinds {} {
test_cast_1_to_type_kind "character" "1" "1 '\\\\001'" "1"
+ test_cast_1_to_type_kind "complex" "" "\\(1,0\\)" "8"
test_cast_1_to_type_kind "complex" "4" "\\(1,0\\)" "8"
test_cast_1_to_type_kind "complex" "8" "\\(1,0\\)" "16"
test_cast_1_to_type_kind "complex" "16" "\\(1,0\\)" "32"
+ test_cast_1_to_type_kind "real" "" "1" "4"
test_cast_1_to_type_kind "real" "4" "1" "4"
test_cast_1_to_type_kind "real" "8" "1" "8"
test_cast_1_to_type_kind "real" "16" "1" "16"
+ test_cast_1_to_type_kind "logical" "" "\\.TRUE\\." "4"
test_cast_1_to_type_kind "logical" "1" "\\.TRUE\\." "1"
test_cast_1_to_type_kind "logical" "4" "\\.TRUE\\." "4"
test_cast_1_to_type_kind "logical" "8" "\\.TRUE\\." "8"
+ test_cast_1_to_type_kind "integer" "" "1" "4"
test_cast_1_to_type_kind "integer" "2" "1" "2"
test_cast_1_to_type_kind "integer" "4" "1" "4"
test_cast_1_to_type_kind "integer" "8" "1" "8"
+
+ test_cast_1_to_type_kind "double precision" "" "1" "8"
+ test_cast_1_to_type_kind "single precision" "" "1" "4"
+
+ test_cast_1_to_type_kind "double complex" "" "\\(1,0\\)" "16"
+ test_cast_1_to_type_kind "single complex" "" "\\(1,0\\)" "8"
}
proc test_parsing_invalid_type_kinds {} {