diff options
author | Per Bothner <per@bothner.com> | 1995-12-01 08:08:41 +0000 |
---|---|---|
committer | Per Bothner <per@bothner.com> | 1995-12-01 08:08:41 +0000 |
commit | a366d882c09d3fb36aafca0d3f9cc7aa1aa46dfe (patch) | |
tree | 2802fc355e6f4068462d07cb309bb152fd5ea2f9 /gdb | |
parent | 5f3e7bfcbfcd9a744d69e5ed2a2a56af38bf2e35 (diff) | |
download | gdb-a366d882c09d3fb36aafca0d3f9cc7aa1aa46dfe.zip gdb-a366d882c09d3fb36aafca0d3f9cc7aa1aa46dfe.tar.gz gdb-a366d882c09d3fb36aafca0d3f9cc7aa1aa46dfe.tar.bz2 |
* language.c (lang_bool_type), language.h: New function.
* language.h (LA_BOOL_TYPE): New macro.
* eval.c (evaluate_subexp_standard) Use LA_BOOL_TYPE instead
of builtin_type_int where appropriate,
* valarith.c (value_subscript): Likewise.
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/ChangeLog | 6 | ||||
-rw-r--r-- | gdb/eval.c | 16 | ||||
-rw-r--r-- | gdb/language.c | 23 | ||||
-rw-r--r-- | gdb/language.h | 5 |
4 files changed, 42 insertions, 8 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index ebbcc68..247d8bb 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,11 @@ Thu Nov 30 23:54:17 1995 Per Bothner <bothner@kalessin.cygnus.com> + * language.c (lang_bool_type), language.h: New function. + * language.h (LA_BOOL_TYPE): New macro. + * eval.c (evaluate_subexp_standard) Use LA_BOOL_TYPE instead + of builtin_type_int where appropriate, + * valarith.c (value_subscript): Likewise. + * valops.c (value_slice): Implement (value) bitstring slices. * valprint.c (val_print): If TYPE_LENGTH is zero, don't automatically print "<incomplete type>" - Chill has zero-length (string) types. @@ -1258,7 +1258,7 @@ evaluate_subexp_standard (expect_type, exp, pos, noside) tem = value_logical_not (arg1); arg2 = evaluate_subexp (NULL_TYPE, exp, pos, (tem ? EVAL_SKIP : noside)); - return value_from_longest (builtin_type_int, + return value_from_longest (LA_BOOL_TYPE, (LONGEST) (!tem && !value_logical_not (arg2))); } @@ -1284,7 +1284,7 @@ evaluate_subexp_standard (expect_type, exp, pos, noside) tem = value_logical_not (arg1); arg2 = evaluate_subexp (NULL_TYPE, exp, pos, (!tem ? EVAL_SKIP : noside)); - return value_from_longest (builtin_type_int, + return value_from_longest (LA_BOOL_TYPE, (LONGEST) (!tem || !value_logical_not (arg2))); } @@ -1300,7 +1300,7 @@ evaluate_subexp_standard (expect_type, exp, pos, noside) else { tem = value_equal (arg1, arg2); - return value_from_longest (builtin_type_int, (LONGEST) tem); + return value_from_longest (LA_BOOL_TYPE, (LONGEST) tem); } case BINOP_NOTEQUAL: @@ -1315,7 +1315,7 @@ evaluate_subexp_standard (expect_type, exp, pos, noside) else { tem = value_equal (arg1, arg2); - return value_from_longest (builtin_type_int, (LONGEST) ! tem); + return value_from_longest (LA_BOOL_TYPE, (LONGEST) ! tem); } case BINOP_LESS: @@ -1330,7 +1330,7 @@ evaluate_subexp_standard (expect_type, exp, pos, noside) else { tem = value_less (arg1, arg2); - return value_from_longest (builtin_type_int, (LONGEST) tem); + return value_from_longest (LA_BOOL_TYPE, (LONGEST) tem); } case BINOP_GTR: @@ -1345,7 +1345,7 @@ evaluate_subexp_standard (expect_type, exp, pos, noside) else { tem = value_less (arg2, arg1); - return value_from_longest (builtin_type_int, (LONGEST) tem); + return value_from_longest (LA_BOOL_TYPE, (LONGEST) tem); } case BINOP_GEQ: @@ -1360,7 +1360,7 @@ evaluate_subexp_standard (expect_type, exp, pos, noside) else { tem = value_less (arg2, arg1) || value_equal (arg1, arg2); - return value_from_longest (builtin_type_int, (LONGEST) tem); + return value_from_longest (LA_BOOL_TYPE, (LONGEST) tem); } case BINOP_LEQ: @@ -1375,7 +1375,7 @@ evaluate_subexp_standard (expect_type, exp, pos, noside) else { tem = value_less (arg1, arg2) || value_equal (arg1, arg2); - return value_from_longest (builtin_type_int, (LONGEST) tem); + return value_from_longest (LA_BOOL_TYPE, (LONGEST) tem); } case BINOP_REPEAT: diff --git a/gdb/language.c b/gdb/language.c index 2504f86..0ce74fe 100644 --- a/gdb/language.c +++ b/gdb/language.c @@ -773,6 +773,29 @@ structured_type(type) } #endif +struct type * +lang_bool_type () +{ + struct symbol *sym; + struct type *type; + switch(current_language->la_language) + { + case language_chill: + return builtin_type_chill_bool; + case language_cplus: + sym = lookup_symbol ("bool", NULL, VAR_NAMESPACE, NULL, NULL); + if (sym) + { + struct type *type = SYMBOL_TYPE (sym); + if (type && TYPE_CODE (type) == TYPE_CODE_BOOL) + return type; + } + /* ... else fall through ... */ + default: + return builtin_type_int; + } +} + /* This page contains functions that return info about (struct value) values used in GDB. */ diff --git a/gdb/language.h b/gdb/language.h index 9542d72..cb9d709 100644 --- a/gdb/language.h +++ b/gdb/language.h @@ -407,6 +407,11 @@ range_error PARAMS ((char *, ...)) extern int value_true PARAMS ((struct value *)); +extern struct type * lang_bool_type PARAMS ((void)); + +/* The type used for Boolean values in teh current language. */ +#define LA_BOOL_TYPE lang_bool_type () + /* Misc: The string representing a particular enum language. */ extern const struct language_defn * |