gdb: Convert language_data::c_style_arrays to a method

Convert language_data::c_style_arrays member variable to a virtual
method language_defn::c_style_arrays_p.

There should be no user visible changes after this commit.

gdb/ChangeLog:

	* ada-lang.c (ada_language_data): Remove c_style_arrays
	initializer.
	(ada_language::c_style_arrays_p): New member fuction.
	* c-lang.c (c_language_data): Remove c_style_arrays
	initializer.
	(cplus_language_data): Likewise.
	(asm_language_data): Likewise.
	(minimal_language_data): Likewise.
	* d-lang.c (d_language_data): Likewise.
	* eval.c (ptrmath_type_p): Update call to c_style_arrays_p.
	* f-lang.c (f_language_data): Remove c_style_arrays initializer.
	(f_language::c_style_arrays_p): New member function.
	* go-lang.c (go_language_data): Remove c_style_arrays initializer.
	* infcall.c (value_arg_coerce): Update call to c_style_arrays_p.
	* language.c (unknown_language_data): Remove c_style_arrays
	initializer.
	(auto_language_data): Likewise.
	* language.h (language_data): Remove c_style_arrays field.
	(language_defn::c_style_arrays_p): New member function.
	* m2-lang.c (m2_language_data): Remove c_style_arrays initializer.
	(m2_language::c_style_arrays_p): New member function.
	* objc-lang.c (objc_language_data): Remove c_style_arrays
	initializer.
	* opencl-lang.c (opencl_language_data): Likewise.
	* p-lang.c (pascal_language_data): Likewise.
	* rust-lang.c (rust_language_data): Likewise.
	* valarith.c (value_subscript): Update call to c_style_arrays_p,
	and update local variable to a bool.
	* valops.c (value_cast): Update call to c_style_arrays_p.
	(value_array): Likewise.
	* value.c (coerce_array): Likewise.
This commit is contained in:
Andrew Burgess 2020-07-04 09:06:08 +01:00
parent 85967615df
commit 67bd3fd5e4
18 changed files with 65 additions and 28 deletions

View file

@ -140,7 +140,7 @@ value_ptrdiff (struct value *arg1, struct value *arg2)
struct value *
value_subscript (struct value *array, LONGEST index)
{
int c_style = current_language->c_style_arrays;
bool c_style = current_language->c_style_arrays_p ();
struct type *tarray;
array = coerce_ref (array);
@ -156,7 +156,7 @@ value_subscript (struct value *array, LONGEST index)
if (VALUE_LVAL (array) != lval_memory)
return value_subscripted_rvalue (array, index, lowerbound);
if (c_style == 0)
if (!c_style)
{
if (index >= lowerbound && index <= upperbound)
return value_subscripted_rvalue (array, index, lowerbound);
@ -165,7 +165,7 @@ value_subscript (struct value *array, LONGEST index)
if (upperbound > -1)
warning (_("array or string index out of range"));
/* fall doing C stuff */
c_style = 1;
c_style = true;
}
index -= lowerbound;