expression evaluation. */
static int warnings_issued = 0;
-static const char *known_runtime_file_name_patterns[] = {
+static const char * const known_runtime_file_name_patterns[] = {
ADA_KNOWN_RUNTIME_FILE_NAME_PATTERNS NULL
};
-static const char *known_auxiliary_function_name_patterns[] = {
+static const char * const known_auxiliary_function_name_patterns[] = {
ADA_KNOWN_AUXILIARY_FUNCTION_NAME_PATTERNS NULL
};
static LONGEST
max_of_type (struct type *t)
{
- if (TYPE_UNSIGNED (t))
+ if (t->is_unsigned ())
return (LONGEST) umax_of_size (TYPE_LENGTH (t));
else
return max_of_size (TYPE_LENGTH (t));
static LONGEST
min_of_type (struct type *t)
{
- if (TYPE_UNSIGNED (t))
+ if (t->is_unsigned ())
return 0;
else
return min_of_size (TYPE_LENGTH (t));
{
struct type *target_type = TYPE_TARGET_TYPE (p_bounds_type);
- if (TYPE_STUB (target_type))
+ if (target_type->is_stub ())
p_bounds = value_cast (lookup_pointer_type
(ada_check_typedef (target_type)),
p_bounds);
(*elt_bits + HOST_CHAR_BIT - 1) / HOST_CHAR_BIT;
}
- TYPE_FIXED_INSTANCE (new_type) = 1;
+ new_type->set_is_fixed_instance (true);
return new_type;
}
default:
return 0;
case TYPE_CODE_INT:
- return !TYPE_UNSIGNED (type);
+ return !type->is_unsigned ();
case TYPE_CODE_RANGE:
return type->bounds ()->low.const_val () - type->bounds ()->bias < 0;
}
else
type = arr_type;
- if (TYPE_FIXED_INSTANCE (type))
+ if (type->is_fixed_instance ())
{
/* The array has already been fixed, so we do not need to
check the parallel ___XA type again. That encoding has
/* If two symbols have the same name and one of them is a stub type,
the get rid of the stub. */
- if (TYPE_STUB (SYMBOL_TYPE ((*syms)[i].symbol))
+ if (SYMBOL_TYPE ((*syms)[i].symbol)->is_stub ()
&& (*syms)[i].symbol->linkage_name () != NULL)
{
for (j = 0; j < syms->size (); j++)
{
if (j != i
- && !TYPE_STUB (SYMBOL_TYPE ((*syms)[j].symbol))
+ && !SYMBOL_TYPE ((*syms)[j].symbol)->is_stub ()
&& (*syms)[j].symbol->linkage_name () != NULL
&& strcmp ((*syms)[i].symbol->linkage_name (),
(*syms)[j].symbol->linkage_name ()) == 0)
if (remove_p)
syms->erase (syms->begin () + i);
-
- i += 1;
+ else
+ i += 1;
}
/* If all the remaining symbols are identical enumerals, then
rtype->set_fields
((struct field *) TYPE_ZALLOC (rtype, nfields * sizeof (struct field)));
rtype->set_name (ada_type_name (type));
- TYPE_FIXED_INSTANCE (rtype) = 1;
+ rtype->set_is_fixed_instance (true);
off = 0;
bit_len = 0;
int f;
/* No need no do anything if the input type is already fixed. */
- if (TYPE_FIXED_INSTANCE (type0))
+ if (type0->is_fixed_instance ())
return type0;
/* Likewise if we already have computed the static approximation. */
type->set_fields (fields);
type->set_name (ada_type_name (type0));
- TYPE_FIXED_INSTANCE (type) = 1;
+ type->set_is_fixed_instance (true);
TYPE_LENGTH (type) = 0;
}
type->field (f).set_type (new_type);
rtype->set_fields (fields);
rtype->set_name (ada_type_name (type));
- TYPE_FIXED_INSTANCE (rtype) = 1;
+ rtype->set_is_fixed_instance (true);
TYPE_LENGTH (rtype) = TYPE_LENGTH (type);
branch_type = to_fixed_variant_branch_type
{
struct type *templ_type;
- if (TYPE_FIXED_INSTANCE (type0))
+ if (type0->is_fixed_instance ())
return type0;
templ_type = dynamic_template_type (type0);
}
else
{
- TYPE_FIXED_INSTANCE (type0) = 1;
+ type0->set_is_fixed_instance (true);
return type0;
}
static const char *xa_suffix = "___XA";
type0 = ada_check_typedef (type0);
- if (TYPE_FIXED_INSTANCE (type0))
+ if (type0->is_fixed_instance ())
return type0;
constrained_packed_array_p = ada_is_constrained_packed_array_type (type0);
TYPE_LENGTH (result)++;
}
- TYPE_FIXED_INSTANCE (result) = 1;
+ result->set_is_fixed_instance (true);
return result;
}
Consider the case of an array, for instance, where the size
of the array is computed from the number of elements in
our array multiplied by the size of its element. */
- TYPE_STUB (fixed_record_type) = 0;
+ fixed_record_type->set_is_stub (false);
}
}
return fixed_record_type;
if (type0 == NULL)
return NULL;
- if (TYPE_FIXED_INSTANCE (type0))
+ if (type0->is_fixed_instance ())
return type0;
type0 = ada_check_typedef (type0);
type = check_typedef (type);
if (type == NULL || type->code () != TYPE_CODE_ENUM
- || !TYPE_STUB (type)
+ || !type->is_stub ()
|| type->name () == NULL)
return type;
else
/* Table mapping attribute numbers to names.
NOTE: Keep up to date with enum ada_attribute definition in ada-lang.h. */
-static const char *attribute_names[] = {
+static const char * const attribute_names[] = {
"<?>",
"first",
static struct value *
evaluate_subexp_type (struct expression *exp, int *pos)
{
- return evaluate_subexp (NULL_TYPE, exp, pos, EVAL_AVOID_SIDE_EFFECTS);
+ return evaluate_subexp (nullptr, exp, pos, EVAL_AVOID_SIDE_EFFECTS);
}
/* If VAL is wrapped in an aligner or subtype wrapper, return the
if (v2 == 0)
error (_("second operand of %s must not be zero."), op_string (op));
- if (TYPE_UNSIGNED (type1) || op == BINOP_MOD)
+ if (type1->is_unsigned () || op == BINOP_MOD)
return value_binop (arg1, arg2, op);
v1 = value_as_long (arg1);
return ada_evaluate_subexp (type, exp, pos, noside);
case BINOP_ASSIGN:
- arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
+ arg1 = evaluate_subexp (nullptr, exp, pos, noside);
if (exp->elts[*pos].opcode == OP_AGGREGATE)
{
arg1 = assign_aggregate (arg1, arg1, exp, pos, noside);
case BINOP_DIV:
case BINOP_REM:
case BINOP_MOD:
- arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
- arg2 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
+ arg1 = evaluate_subexp (nullptr, exp, pos, noside);
+ arg2 = evaluate_subexp (nullptr, exp, pos, noside);
if (noside == EVAL_SKIP)
goto nosideret;
else if (noside == EVAL_AVOID_SIDE_EFFECTS)
case BINOP_EQUAL:
case BINOP_NOTEQUAL:
- arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
+ arg1 = evaluate_subexp (nullptr, exp, pos, noside);
arg2 = evaluate_subexp (value_type (arg1), exp, pos, noside);
if (noside == EVAL_SKIP)
goto nosideret;
return value_from_longest (type, (LONGEST) tem);
case UNOP_NEG:
- arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
+ arg1 = evaluate_subexp (nullptr, exp, pos, noside);
if (noside == EVAL_SKIP)
goto nosideret;
else if (ada_is_gnat_encoded_fixed_point_type (value_type (arg1)))
{
struct value *val;
- arg1 = evaluate_subexp (NULL_TYPE, exp, pos, EVAL_AVOID_SIDE_EFFECTS);
- *pos = pc;
+ arg1 = evaluate_subexp (nullptr, exp, pos, EVAL_AVOID_SIDE_EFFECTS);
+ *pos = pc;
val = evaluate_subexp_standard (expect_type, exp, pos, noside);
return value_cast (value_type (arg1), val);
a fixed type would result in the loss of that type name,
thus preventing us from printing the name of the ancestor
type in the type description. */
- arg1 = evaluate_subexp (NULL_TYPE, exp, pos, EVAL_NORMAL);
+ arg1 = evaluate_subexp (nullptr, exp, pos, EVAL_NORMAL);
if (type->code () != TYPE_CODE_REF)
{
else
{
for (tem = 0; tem <= nargs; tem += 1)
- argvec[tem] = evaluate_subexp (NULL_TYPE, exp, pos, noside);
- argvec[tem] = 0;
+ argvec[tem] = evaluate_subexp (nullptr, exp, pos, noside);
+ argvec[tem] = 0;
if (noside == EVAL_SKIP)
goto nosideret;
case TERNOP_SLICE:
{
- struct value *array = evaluate_subexp (NULL_TYPE, exp, pos, noside);
- struct value *low_bound_val =
- evaluate_subexp (NULL_TYPE, exp, pos, noside);
- struct value *high_bound_val =
- evaluate_subexp (NULL_TYPE, exp, pos, noside);
- LONGEST low_bound;
+ struct value *array = evaluate_subexp (nullptr, exp, pos, noside);
+ struct value *low_bound_val
+ = evaluate_subexp (nullptr, exp, pos, noside);
+ struct value *high_bound_val
+ = evaluate_subexp (nullptr, exp, pos, noside);
+ LONGEST low_bound;
LONGEST high_bound;
low_bound_val = coerce_ref (low_bound_val);
case UNOP_IN_RANGE:
(*pos) += 2;
- arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
+ arg1 = evaluate_subexp (nullptr, exp, pos, noside);
type = check_typedef (exp->elts[pc + 1].type);
if (noside == EVAL_SKIP)
case BINOP_IN_BOUNDS:
(*pos) += 2;
- arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
- arg2 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
+ arg1 = evaluate_subexp (nullptr, exp, pos, noside);
+ arg2 = evaluate_subexp (nullptr, exp, pos, noside);
if (noside == EVAL_SKIP)
goto nosideret;
|| value_equal (arg2, arg1)));
case TERNOP_IN_RANGE:
- arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
- arg2 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
- arg3 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
+ arg1 = evaluate_subexp (nullptr, exp, pos, noside);
+ arg2 = evaluate_subexp (nullptr, exp, pos, noside);
+ arg3 = evaluate_subexp (nullptr, exp, pos, noside);
if (noside == EVAL_SKIP)
goto nosideret;
if (exp->elts[*pos].opcode == OP_TYPE)
{
- evaluate_subexp (NULL_TYPE, exp, pos, EVAL_SKIP);
- arg1 = NULL;
+ evaluate_subexp (nullptr, exp, pos, EVAL_SKIP);
+ arg1 = NULL;
type_arg = check_typedef (exp->elts[pc + 2].type);
}
else
{
- arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
- type_arg = NULL;
+ arg1 = evaluate_subexp (nullptr, exp, pos, noside);
+ type_arg = NULL;
}
if (exp->elts[*pos].opcode != OP_LONG)
}
case OP_ATR_TAG:
- arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
+ arg1 = evaluate_subexp (nullptr, exp, pos, noside);
if (noside == EVAL_SKIP)
goto nosideret;
case OP_ATR_MIN:
case OP_ATR_MAX:
- evaluate_subexp (NULL_TYPE, exp, pos, EVAL_SKIP);
- arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
- arg2 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
+ evaluate_subexp (nullptr, exp, pos, EVAL_SKIP);
+ arg1 = evaluate_subexp (nullptr, exp, pos, noside);
+ arg2 = evaluate_subexp (nullptr, exp, pos, noside);
if (noside == EVAL_SKIP)
goto nosideret;
else if (noside == EVAL_AVOID_SIDE_EFFECTS)
{
struct type *type_arg = check_typedef (exp->elts[pc + 2].type);
- evaluate_subexp (NULL_TYPE, exp, pos, EVAL_SKIP);
- if (noside == EVAL_SKIP)
+ evaluate_subexp (nullptr, exp, pos, EVAL_SKIP);
+ if (noside == EVAL_SKIP)
goto nosideret;
if (!ada_is_modular_type (type_arg))
case OP_ATR_POS:
- evaluate_subexp (NULL_TYPE, exp, pos, EVAL_SKIP);
- arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
+ evaluate_subexp (nullptr, exp, pos, EVAL_SKIP);
+ arg1 = evaluate_subexp (nullptr, exp, pos, noside);
if (noside == EVAL_SKIP)
goto nosideret;
type = builtin_type (exp->gdbarch)->builtin_int;
return value_pos_atr (type, arg1);
case OP_ATR_SIZE:
- arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
+ arg1 = evaluate_subexp (nullptr, exp, pos, noside);
type = value_type (arg1);
/* If the argument is a reference, then dereference its type, since
TARGET_CHAR_BIT * TYPE_LENGTH (type));
case OP_ATR_VAL:
- evaluate_subexp (NULL_TYPE, exp, pos, EVAL_SKIP);
- arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
+ evaluate_subexp (nullptr, exp, pos, EVAL_SKIP);
+ arg1 = evaluate_subexp (nullptr, exp, pos, noside);
type = exp->elts[pc + 2].type;
if (noside == EVAL_SKIP)
goto nosideret;
return value_val_atr (type, arg1);
case BINOP_EXP:
- arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
- arg2 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
+ arg1 = evaluate_subexp (nullptr, exp, pos, noside);
+ arg2 = evaluate_subexp (nullptr, exp, pos, noside);
if (noside == EVAL_SKIP)
goto nosideret;
else if (noside == EVAL_AVOID_SIDE_EFFECTS)
}
case UNOP_PLUS:
- arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
+ arg1 = evaluate_subexp (nullptr, exp, pos, noside);
if (noside == EVAL_SKIP)
goto nosideret;
else
return arg1;
case UNOP_ABS:
- arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
+ arg1 = evaluate_subexp (nullptr, exp, pos, noside);
if (noside == EVAL_SKIP)
goto nosideret;
unop_promote (exp->language_defn, exp->gdbarch, &arg1);
case UNOP_IND:
preeval_pos = *pos;
- arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
+ arg1 = evaluate_subexp (nullptr, exp, pos, noside);
if (noside == EVAL_SKIP)
goto nosideret;
type = ada_check_typedef (value_type (arg1));
|| type->code () == TYPE_CODE_PTR)
&& ada_is_tagged_type (TYPE_TARGET_TYPE (type), 0))
{
- arg1 = evaluate_subexp (NULL_TYPE, exp, &preeval_pos,
- EVAL_NORMAL);
+ arg1
+ = evaluate_subexp (nullptr, exp, &preeval_pos, EVAL_NORMAL);
type = value_type (ada_value_ind (arg1));
}
else
tem = longest_to_int (exp->elts[pc + 1].longconst);
(*pos) += 3 + BYTES_TO_EXP_ELEM (tem + 1);
preeval_pos = *pos;
- arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
+ arg1 = evaluate_subexp (nullptr, exp, pos, noside);
if (noside == EVAL_SKIP)
goto nosideret;
if (noside == EVAL_AVOID_SIDE_EFFECTS)
if (type == NULL)
{
- arg1 = evaluate_subexp (NULL_TYPE, exp, &preeval_pos,
- EVAL_NORMAL);
+ arg1
+ = evaluate_subexp (nullptr, exp, &preeval_pos, EVAL_NORMAL);
arg1 = ada_value_struct_elt (arg1,
&exp->elts[pc + 2].string,
0);
return (subranged_type != NULL && type->code () == TYPE_CODE_RANGE
&& subranged_type->code () == TYPE_CODE_INT
- && TYPE_UNSIGNED (subranged_type));
+ && subranged_type->is_unsigned ());
}
/* Assuming ada_is_modular_type (TYPE), the modulus of TYPE. */
an Ada83 compiler). As such, we do not include Numeric_Error from
this list of standard exceptions. */
-static const char *standard_exc[] = {
+static const char * const standard_exc[] = {
"constraint_error",
"program_error",
"storage_error",
}
}
-static const char *ada_extensions[] =
-{
- ".adb", ".ads", ".a", ".ada", ".dg", NULL
-};
-
/* Constant data that describes the Ada language. */
extern const struct language_data ada_language_data =
{
- "ada", /* Language name */
- "Ada",
- language_ada,
- range_check_off,
- case_sensitive_on, /* Yes, Ada is case-insensitive, but
- that's not quite what this means. */
- array_row_major,
- macro_expansion_no,
- ada_extensions,
- &ada_exp_descriptor,
- NULL, /* name_of_this */
- true, /* la_store_sym_names_in_linkage_form_p */
ada_op_print_tab, /* expression operators for printing */
- 0, /* c-style arrays */
- 1, /* String lower bound */
- &ada_varobj_ops,
- "(...)" /* la_struct_too_deep_ellipsis */
};
/* Class representing the Ada language. */
: language_defn (language_ada, ada_language_data)
{ /* Nothing. */ }
+ /* See language.h. */
+
+ const char *name () const override
+ { return "ada"; }
+
+ /* See language.h. */
+
+ const char *natural_name () const override
+ { return "Ada"; }
+
+ /* See language.h. */
+
+ const std::vector<const char *> &filename_extensions () const override
+ {
+ static const std::vector<const char *> extensions
+ = { ".adb", ".ads", ".a", ".ada", ".dg" };
+ return extensions;
+ }
+
/* Print an array element index using the Ada syntax. */
void print_array_index (struct type *index_type,
return ada_is_string_type (type);
}
+ /* See language.h. */
+
+ const char *struct_too_deep_ellipsis () const override
+ { return "(...)"; }
+
+ /* See language.h. */
+
+ bool c_style_arrays_p () const override
+ { return false; }
+
+ /* See language.h. */
+
+ bool store_sym_names_in_linkage_form_p () const override
+ { return true; }
+
+ /* See language.h. */
+
+ const struct lang_varobj_ops *varobj_ops () const override
+ { return &ada_varobj_ops; }
+
+ /* See language.h. */
+
+ const struct exp_descriptor *expression_ops () const override
+ { return &ada_exp_descriptor; }
protected:
/* See language.h. */