summaryrefslogtreecommitdiff
path: root/gdb/ada-exp.y
diff options
context:
space:
mode:
authorPaul N. Hilfinger <hilfinger@adacore.com>2008-08-19 10:10:38 +0000
committerPaul N. Hilfinger <hilfinger@adacore.com>2008-08-19 10:10:38 +0000
commit3d77cf61170a238859d26cafefaf9215e5a4e8d5 (patch)
treeb6fb605992eb39cf74077e5ce62b559aa5ec1e3e /gdb/ada-exp.y
parent7247861f2263948f1c8d6ee5d5288445f00029af (diff)
downloadgdb-3d77cf61170a238859d26cafefaf9215e5a4e8d5.tar.gz
* ada-lang.c (discrete_type_high_bound,discrete_type_low_bound): Change
API to return LONGEST values rather than struct values. (ada_evaluate_subexp): Change to use new API of discrete_type_low_bound and discrete_type_high_bound. (to_fixed_range_type): Create a range type in cases where argument is base type and its limits are representable as ints. (ada_is_modular_type): Correct so that base type must be integral. * ada-lex.l (TRUEKEYWORD,FALSEKEYWORD): Make 'true' and 'false' keywords when they appear alone, since we are phasing out direct representation of these identifiers in ebugging data. * ada-exp.y: Define 'true' and 'false' as primaries. (type_boolean): New function. (type_int,type_long,type_long_long,type_floattype_double) (type_long_double): Remove uses of current_gdbarch for consistency with type_boolean. (write_int): Change comment to indicate that it might write boolean constant as well. * ada-typeprint.c (ada_print_type): Print '(false, true)' for boolean type, since will no longer be represented as enumerated type in debugging data. * ada-valprint.c (print_optional_low_bound): Handle boolean case as well.
Diffstat (limited to 'gdb/ada-exp.y')
-rw-r--r--gdb/ada-exp.y29
1 files changed, 22 insertions, 7 deletions
diff --git a/gdb/ada-exp.y b/gdb/ada-exp.y
index 53107a855c3..c146baf1e2b 100644
--- a/gdb/ada-exp.y
+++ b/gdb/ada-exp.y
@@ -153,6 +153,8 @@ static struct type *type_long_double (void);
static struct type *type_char (void);
+static struct type *type_boolean (void);
+
static struct type *type_system_address (void);
%}
@@ -180,6 +182,7 @@ static struct type *type_system_address (void);
%token <typed_val> INT NULL_PTR CHARLIT
%token <typed_val_float> FLOAT
+%token TRUEKEYWORD FALSEKEYWORD
%token COLONCOLON
%token <sval> STRING NAME DOT_ID
%type <bval> block
@@ -602,6 +605,12 @@ primary : STRING
}
;
+primary : TRUEKEYWORD
+ { write_int (1, type_boolean ()); }
+ | FALSEKEYWORD
+ { write_int (0, type_boolean ()); }
+ ;
+
primary : NEW NAME
{ error (_("NEW not implemented.")); }
;
@@ -820,7 +829,7 @@ write_var_from_sym (struct block *orig_left_context,
write_exp_elt_opcode (OP_VAR_VALUE);
}
-/* Write integer constant ARG of type TYPE. */
+/* Write integer or boolean constant ARG of type TYPE. */
static void
write_int (LONGEST arg, struct type *type)
@@ -1455,37 +1464,37 @@ convert_char_literal (struct type *type, LONGEST val)
static struct type *
type_int (void)
{
- return builtin_type (current_gdbarch)->builtin_int;
+ return builtin_type_int;
}
static struct type *
type_long (void)
{
- return builtin_type (current_gdbarch)->builtin_long;
+ return builtin_type_long;
}
static struct type *
type_long_long (void)
{
- return builtin_type (current_gdbarch)->builtin_long_long;
+ return builtin_type_long_long;
}
static struct type *
type_float (void)
{
- return builtin_type (current_gdbarch)->builtin_float;
+ return builtin_type_float;
}
static struct type *
type_double (void)
{
- return builtin_type (current_gdbarch)->builtin_double;
+ return builtin_type_double;
}
static struct type *
type_long_double (void)
{
- return builtin_type (current_gdbarch)->builtin_long_double;
+ return builtin_type_long_double;
}
static struct type *
@@ -1495,6 +1504,12 @@ type_char (void)
}
static struct type *
+type_boolean (void)
+{
+ return builtin_type_bool;
+}
+
+static struct type *
type_system_address (void)
{
struct type *type