forked from Imagelibrary/binutils-gdb
* language.h (struct language_arch_info): New members
bool_type_default and bool_type_symbol. (lang_bool_type): Remove prototype. (LA_BOOL_TYPE): Remove macro. (language_bool_type): Add prototype. * language.c (lang_bool_type): Remove. (language_bool_type): New function. * value.h (value_in): Change return value to int. * value.c (value_in): Return int instead of struct value *. * eval.c (evaluate_subexp_standard): Call language_bool_type instead of using LA_BOOL_TYPE. Update call to value_in. * ada-lang.c (ada_evaluate_subexp): Call language_bool_type instead of using LA_BOOL_TYPE or builtin_type_int for boolean values. * language.c (unknown_language_arch_info): Set bool_type_default member of struct language_arch_info. * ada-lang.c (ada_language_arch_info): Set bool_type_symbol and bool_type_default members of struct language_arch_info. * c-lang.c (c_language_arch_info): Set bool_type_default member of struct language_arch_info. (cplus_language_arch_info): Set bool_type_symbol and bool_type_default members of struct language_arch_info. * f-lang.c (f_language_arch_info): Set bool_type_symbol and bool_type_default members of struct language_arch_info. * jv-lang.c (java_language_arch_info): Set bool_type_symbol and bool_type_default members of struct language_arch_info. * m2-lang.c (m2_language_arch_info): Set bool_type_symbol and bool_type_default members of struct language_arch_info. * p-lang.c (p_language_arch_info): Set bool_type_symbol and bool_type_default members of struct language_arch_info.
This commit is contained in:
@@ -787,51 +787,6 @@ structured_type (struct type *type)
|
||||
}
|
||||
#endif
|
||||
|
||||
struct type *
|
||||
lang_bool_type (void)
|
||||
{
|
||||
struct symbol *sym;
|
||||
struct type *type;
|
||||
switch (current_language->la_language)
|
||||
{
|
||||
case language_fortran:
|
||||
sym = lookup_symbol ("logical", NULL, VAR_DOMAIN, NULL);
|
||||
if (sym)
|
||||
{
|
||||
type = SYMBOL_TYPE (sym);
|
||||
if (type && TYPE_CODE (type) == TYPE_CODE_BOOL)
|
||||
return type;
|
||||
}
|
||||
return builtin_type_f_logical_s2;
|
||||
case language_cplus:
|
||||
case language_pascal:
|
||||
case language_ada:
|
||||
if (current_language->la_language==language_cplus)
|
||||
{sym = lookup_symbol ("bool", NULL, VAR_DOMAIN, NULL);}
|
||||
else
|
||||
{sym = lookup_symbol ("boolean", NULL, VAR_DOMAIN, NULL);}
|
||||
if (sym)
|
||||
{
|
||||
type = SYMBOL_TYPE (sym);
|
||||
if (type && TYPE_CODE (type) == TYPE_CODE_BOOL)
|
||||
return type;
|
||||
}
|
||||
return builtin_type_bool;
|
||||
case language_java:
|
||||
sym = lookup_symbol ("boolean", NULL, VAR_DOMAIN, NULL);
|
||||
if (sym)
|
||||
{
|
||||
type = SYMBOL_TYPE (sym);
|
||||
if (type && TYPE_CODE (type) == TYPE_CODE_BOOL)
|
||||
return type;
|
||||
}
|
||||
return java_boolean_type;
|
||||
|
||||
default:
|
||||
return builtin_type_int;
|
||||
}
|
||||
}
|
||||
|
||||
/* This page contains functions that return info about
|
||||
(struct value) values used in GDB. */
|
||||
|
||||
@@ -1169,6 +1124,7 @@ unknown_language_arch_info (struct gdbarch *gdbarch,
|
||||
struct language_arch_info *lai)
|
||||
{
|
||||
lai->string_char_type = builtin_type (gdbarch)->builtin_char;
|
||||
lai->bool_type_default = builtin_type (gdbarch)->builtin_int;
|
||||
lai->primitive_type_vector = GDBARCH_OBSTACK_CALLOC (gdbarch, 1,
|
||||
struct type *);
|
||||
}
|
||||
@@ -1316,6 +1272,29 @@ language_string_char_type (const struct language_defn *la,
|
||||
return ld->arch_info[la->la_language].string_char_type;
|
||||
}
|
||||
|
||||
struct type *
|
||||
language_bool_type (const struct language_defn *la,
|
||||
struct gdbarch *gdbarch)
|
||||
{
|
||||
struct language_gdbarch *ld = gdbarch_data (gdbarch,
|
||||
language_gdbarch_data);
|
||||
|
||||
if (ld->arch_info[la->la_language].bool_type_symbol)
|
||||
{
|
||||
struct symbol *sym;
|
||||
sym = lookup_symbol (ld->arch_info[la->la_language].bool_type_symbol,
|
||||
NULL, VAR_DOMAIN, NULL);
|
||||
if (sym)
|
||||
{
|
||||
struct type *type = SYMBOL_TYPE (sym);
|
||||
if (type && TYPE_CODE (type) == TYPE_CODE_BOOL)
|
||||
return type;
|
||||
}
|
||||
}
|
||||
|
||||
return ld->arch_info[la->la_language].bool_type_default;
|
||||
}
|
||||
|
||||
struct type *
|
||||
language_lookup_primitive_type_by_name (const struct language_defn *la,
|
||||
struct gdbarch *gdbarch,
|
||||
|
||||
Reference in New Issue
Block a user