* ch-exp.y (expression_conversion): Recognize 'ARRAY () TYPE (EXPR)'
authorPer Bothner <per@bothner.com>
Wed, 22 Feb 1995 07:43:01 +0000 (07:43 +0000)
committerPer Bothner <per@bothner.com>
Wed, 22 Feb 1995 07:43:01 +0000 (07:43 +0000)
        (same as C's '(TYPE[])EXPR')

gdb/ChangeLog
gdb/ch-exp.y

index 86b5499fbd32feb5af3d5f5e0e66258f6d0863bb..9cdbb9e799323f996c9e8e32d50c770ed929fb0b 100644 (file)
@@ -1,3 +1,12 @@
+Tue Feb 21 20:48:42 1995  Per Bothner  <bothner@kalessin.cygnus.com>
+
+       * valops.c (call_function_by_hand):  Set using_gcc to 2 if gcc-2.
+       Call error if too few arguments.
+       If REG_STRUCT_HAS_ADDR (structs passed by invisible reference),
+       copy and convert to reference *before* we calculate alignment.
+       Also, make sure structs allocated for return values and invisible
+       reference don't violate STACK_ALIGN.
+
 Tue Feb 21 11:47:26 1995  Stan Shebs  <shebs@andros.cygnus.com>
 
        * top.c (print_gdb_version): Update the year.
index c87157c4654897ea75e30367a0a20bf6f2e8eeda..98e890d9d3a082e2aaa57d28a51032034e018d17 100644 (file)
@@ -237,6 +237,7 @@ yyerror PARAMS ((char *));
 %token <voidval>       UPPER
 %token <voidval>       LOWER
 %token <voidval>       LENGTH
+%token <voidval>       ARRAY
 
 /* Tokens which are not Chill tokens used in expressions, but rather GDB
    specific things that we recognize in the same context as Chill tokens
@@ -608,6 +609,22 @@ expression_conversion:     mode_name parenthesised_expression
                          write_exp_elt_type ($1.type);
                          write_exp_elt_opcode (UNOP_CAST);
                        }
+               |       ARRAY '(' ')' mode_name parenthesised_expression
+                       /* This is pseudo-Chill, similar to C's '(TYPE[])EXPR'
+                          which casts to an artificial array. */
+                       {
+                         struct type *range_type
+                           = create_range_type ((struct type *) NULL,
+                                                builtin_type_int, 0, 0);
+                         struct type *array_type
+                           = create_array_type ((struct type *) NULL,
+                                                $4.type, range_type);
+                         TYPE_ARRAY_UPPER_BOUND_TYPE(array_type)
+                           = BOUND_CANNOT_BE_DETERMINED;
+                         write_exp_elt_opcode (UNOP_CAST);
+                         write_exp_elt_type (array_type);
+                         write_exp_elt_opcode (UNOP_CAST);
+                       }
                ;
 
 /* Z.200, 5.2.12 */
@@ -1717,6 +1734,7 @@ struct token
 
 static const struct token idtokentab[] =
 {
+    { "array", ARRAY },
     { "length", LENGTH },
     { "lower", LOWER },
     { "upper", UPPER },