aboutsummaryrefslogtreecommitdiff
path: root/gdb/guile
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@efficios.com>2020-05-14 13:46:38 -0400
committerSimon Marchi <simon.marchi@efficios.com>2020-05-14 13:46:38 -0400
commit7813437494ac39f3aef392d06ed5416e84fe386b (patch)
tree15290bf5b2bd9d23c59103a6a42b99adc0111d6d /gdb/guile
parent67607e24d0413828acdfa9bc38f6fbac40b860b9 (diff)
downloadgdb-7813437494ac39f3aef392d06ed5416e84fe386b.zip
gdb-7813437494ac39f3aef392d06ed5416e84fe386b.tar.gz
gdb-7813437494ac39f3aef392d06ed5416e84fe386b.tar.bz2
gdb: remove TYPE_CODE macro
Remove TYPE_CODE, changing all the call sites to use type::code directly. This is quite a big diff, but this was mostly done using sed and coccinelle. A few call sites were done by hand. gdb/ChangeLog: * gdbtypes.h (TYPE_CODE): Remove. Change all call sites to use type::code instead.
Diffstat (limited to 'gdb/guile')
-rw-r--r--gdb/guile/scm-lazy-string.c4
-rw-r--r--gdb/guile/scm-math.c16
-rw-r--r--gdb/guile/scm-type.c32
-rw-r--r--gdb/guile/scm-value.c36
4 files changed, 44 insertions, 44 deletions
diff --git a/gdb/guile/scm-lazy-string.c b/gdb/guile/scm-lazy-string.c
index 6e5ee6c..0df1b3a 100644
--- a/gdb/guile/scm-lazy-string.c
+++ b/gdb/guile/scm-lazy-string.c
@@ -201,7 +201,7 @@ lsscm_elt_type (lazy_string_smob *ls_smob)
realtype = check_typedef (type);
- switch (TYPE_CODE (realtype))
+ switch (realtype->code ())
{
case TYPE_CODE_PTR:
case TYPE_CODE_ARRAY:
@@ -314,7 +314,7 @@ lsscm_safe_lazy_string_to_value (SCM string, int arg_pos,
struct type *type = tyscm_scm_to_type (ls_smob->type);
struct type *realtype = check_typedef (type);
- switch (TYPE_CODE (realtype))
+ switch (realtype->code ())
{
case TYPE_CODE_PTR:
/* If a length is specified we need to convert this to an array
diff --git a/gdb/guile/scm-math.c b/gdb/guile/scm-math.c
index 12784d6..7c63fa2 100644
--- a/gdb/guile/scm-math.c
+++ b/gdb/guile/scm-math.c
@@ -65,7 +65,7 @@ enum valscm_binary_opcode
/* If TYPE is a reference, return the target; otherwise return TYPE. */
#define STRIP_REFERENCE(TYPE) \
- ((TYPE_CODE (TYPE) == TYPE_CODE_REF) ? (TYPE_TARGET_TYPE (TYPE)) : (TYPE))
+ ((TYPE->code () == TYPE_CODE_REF) ? (TYPE_TARGET_TYPE (TYPE)) : (TYPE))
/* Helper for vlscm_unop. Contains all the code that may throw a GDB
exception. */
@@ -168,10 +168,10 @@ vlscm_binop_gdbthrow (enum valscm_binary_opcode opcode, SCM x, SCM y,
rtype = check_typedef (rtype);
rtype = STRIP_REFERENCE (rtype);
- if (TYPE_CODE (ltype) == TYPE_CODE_PTR
+ if (ltype->code () == TYPE_CODE_PTR
&& is_integral_type (rtype))
res_val = value_ptradd (arg1, value_as_long (arg2));
- else if (TYPE_CODE (rtype) == TYPE_CODE_PTR
+ else if (rtype->code () == TYPE_CODE_PTR
&& is_integral_type (ltype))
res_val = value_ptradd (arg2, value_as_long (arg1));
else
@@ -188,15 +188,15 @@ vlscm_binop_gdbthrow (enum valscm_binary_opcode opcode, SCM x, SCM y,
rtype = check_typedef (rtype);
rtype = STRIP_REFERENCE (rtype);
- if (TYPE_CODE (ltype) == TYPE_CODE_PTR
- && TYPE_CODE (rtype) == TYPE_CODE_PTR)
+ if (ltype->code () == TYPE_CODE_PTR
+ && rtype->code () == TYPE_CODE_PTR)
{
/* A ptrdiff_t for the target would be preferable here. */
res_val
= value_from_longest (builtin_type (gdbarch)->builtin_long,
value_ptrdiff (arg1, arg2));
}
- else if (TYPE_CODE (ltype) == TYPE_CODE_PTR
+ else if (ltype->code () == TYPE_CODE_PTR
&& is_integral_type (rtype))
res_val = value_ptradd (arg1, - value_as_long (arg2));
else
@@ -525,7 +525,7 @@ vlscm_convert_typed_number (const char *func_name, int obj_arg_pos, SCM obj,
struct gdbarch *gdbarch, SCM *except_scmp)
{
if (is_integral_type (type)
- || TYPE_CODE (type) == TYPE_CODE_PTR)
+ || type->code () == TYPE_CODE_PTR)
{
if (TYPE_UNSIGNED (type))
{
@@ -558,7 +558,7 @@ vlscm_convert_typed_number (const char *func_name, int obj_arg_pos, SCM obj,
return value_from_longest (type, gdbscm_scm_to_longest (obj));
}
}
- else if (TYPE_CODE (type) == TYPE_CODE_FLT)
+ else if (type->code () == TYPE_CODE_FLT)
return value_from_host_double (type, scm_to_double (obj));
else
{
diff --git a/gdb/guile/scm-type.c b/gdb/guile/scm-type.c
index bf2f751..521f484 100644
--- a/gdb/guile/scm-type.c
+++ b/gdb/guile/scm-type.c
@@ -529,7 +529,7 @@ gdbscm_type_code (SCM self)
= tyscm_get_type_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
struct type *type = t_smob->type;
- return scm_from_int (TYPE_CODE (type));
+ return scm_from_int (type->code ());
}
/* (type-fields <gdb:type>) -> list
@@ -577,9 +577,9 @@ gdbscm_type_tag (SCM self)
struct type *type = t_smob->type;
const char *tagname = nullptr;
- if (TYPE_CODE (type) == TYPE_CODE_STRUCT
- || TYPE_CODE (type) == TYPE_CODE_UNION
- || TYPE_CODE (type) == TYPE_CODE_ENUM)
+ if (type->code () == TYPE_CODE_STRUCT
+ || type->code () == TYPE_CODE_UNION
+ || type->code () == TYPE_CODE_ENUM)
tagname = TYPE_NAME (type);
if (tagname == nullptr)
@@ -685,17 +685,17 @@ tyscm_get_composite (struct type *type)
}
GDBSCM_HANDLE_GDB_EXCEPTION (exc);
- if (TYPE_CODE (type) != TYPE_CODE_PTR
- && TYPE_CODE (type) != TYPE_CODE_REF)
+ if (type->code () != TYPE_CODE_PTR
+ && type->code () != TYPE_CODE_REF)
break;
type = TYPE_TARGET_TYPE (type);
}
/* If this is not a struct, union, or enum type, raise TypeError
exception. */
- if (TYPE_CODE (type) != TYPE_CODE_STRUCT
- && TYPE_CODE (type) != TYPE_CODE_UNION
- && TYPE_CODE (type) != TYPE_CODE_ENUM)
+ if (type->code () != TYPE_CODE_STRUCT
+ && type->code () != TYPE_CODE_UNION
+ && type->code () != TYPE_CODE_ENUM)
return NULL;
return type;
@@ -817,12 +817,12 @@ gdbscm_type_range (SCM self)
/* Initialize these to appease GCC warnings. */
LONGEST low = 0, high = 0;
- SCM_ASSERT_TYPE (TYPE_CODE (type) == TYPE_CODE_ARRAY
- || TYPE_CODE (type) == TYPE_CODE_STRING
- || TYPE_CODE (type) == TYPE_CODE_RANGE,
+ SCM_ASSERT_TYPE (type->code () == TYPE_CODE_ARRAY
+ || type->code () == TYPE_CODE_STRING
+ || type->code () == TYPE_CODE_RANGE,
self, SCM_ARG1, FUNC_NAME, _("ranged type"));
- switch (TYPE_CODE (type))
+ switch (type->code ())
{
case TYPE_CODE_ARRAY:
case TYPE_CODE_STRING:
@@ -1163,7 +1163,7 @@ gdbscm_field_enumval (SCM self)
struct field *field = tyscm_field_smob_to_field (f_smob);
struct type *type = tyscm_field_smob_containing_type (f_smob);
- SCM_ASSERT_TYPE (TYPE_CODE (type) == TYPE_CODE_ENUM,
+ SCM_ASSERT_TYPE (type->code () == TYPE_CODE_ENUM,
self, SCM_ARG1, FUNC_NAME, _("enum type"));
return scm_from_long (FIELD_ENUMVAL (*field));
@@ -1180,7 +1180,7 @@ gdbscm_field_bitpos (SCM self)
struct field *field = tyscm_field_smob_to_field (f_smob);
struct type *type = tyscm_field_smob_containing_type (f_smob);
- SCM_ASSERT_TYPE (TYPE_CODE (type) != TYPE_CODE_ENUM,
+ SCM_ASSERT_TYPE (type->code () != TYPE_CODE_ENUM,
self, SCM_ARG1, FUNC_NAME, _("non-enum type"));
return scm_from_long (FIELD_BITPOS (*field));
@@ -1222,7 +1222,7 @@ gdbscm_field_baseclass_p (SCM self)
= tyscm_get_field_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
struct type *type = tyscm_field_smob_containing_type (f_smob);
- if (TYPE_CODE (type) == TYPE_CODE_STRUCT)
+ if (type->code () == TYPE_CODE_STRUCT)
return scm_from_bool (f_smob->field_num < TYPE_N_BASECLASSES (type));
return SCM_BOOL_F;
}
diff --git a/gdb/guile/scm-value.c b/gdb/guile/scm-value.c
index 53b373e..c4d4045 100644
--- a/gdb/guile/scm-value.c
+++ b/gdb/guile/scm-value.c
@@ -470,7 +470,7 @@ gdbscm_value_referenced_value (SCM self)
struct value *res_val;
- switch (TYPE_CODE (check_typedef (value_type (value))))
+ switch (check_typedef (value_type (value))->code ())
{
case TYPE_CODE_PTR:
res_val = value_ind (value);
@@ -523,12 +523,12 @@ gdbscm_value_dynamic_type (SCM self)
type = value_type (value);
type = check_typedef (type);
- if (((TYPE_CODE (type) == TYPE_CODE_PTR)
- || (TYPE_CODE (type) == TYPE_CODE_REF))
- && (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_STRUCT))
+ if (((type->code () == TYPE_CODE_PTR)
+ || (type->code () == TYPE_CODE_REF))
+ && (TYPE_TARGET_TYPE (type)->code () == TYPE_CODE_STRUCT))
{
struct value *target;
- int was_pointer = TYPE_CODE (type) == TYPE_CODE_PTR;
+ int was_pointer = type->code () == TYPE_CODE_PTR;
if (was_pointer)
target = value_ind (value);
@@ -544,7 +544,7 @@ gdbscm_value_dynamic_type (SCM self)
type = lookup_lvalue_reference_type (type);
}
}
- else if (TYPE_CODE (type) == TYPE_CODE_STRUCT)
+ else if (type->code () == TYPE_CODE_STRUCT)
type = value_rtti_type (value, NULL, NULL, NULL);
else
{
@@ -682,8 +682,8 @@ gdbscm_value_subscript (SCM self, SCM index_scm)
a subscript. */
struct value *tmp = coerce_ref (value);
struct type *tmp_type = check_typedef (value_type (tmp));
- if (TYPE_CODE (tmp_type) != TYPE_CODE_ARRAY
- && TYPE_CODE (tmp_type) != TYPE_CODE_PTR)
+ if (tmp_type->code () != TYPE_CODE_ARRAY
+ && tmp_type->code () != TYPE_CODE_PTR)
error (_("Cannot subscript requested type"));
struct value *res_val = value_subscript (tmp, value_as_long (index));
@@ -715,7 +715,7 @@ gdbscm_value_call (SCM self, SCM args)
}
GDBSCM_HANDLE_GDB_EXCEPTION (exc);
- SCM_ASSERT_TYPE (TYPE_CODE (ftype) == TYPE_CODE_FUNC, self,
+ SCM_ASSERT_TYPE (ftype->code () == TYPE_CODE_FUNC, self,
SCM_ARG1, FUNC_NAME,
_("function (value of TYPE_CODE_FUNC)"));
@@ -796,11 +796,11 @@ gdbscm_value_to_bytevector (SCM self)
static int
is_intlike (struct type *type, int ptr_ok)
{
- return (TYPE_CODE (type) == TYPE_CODE_INT
- || TYPE_CODE (type) == TYPE_CODE_ENUM
- || TYPE_CODE (type) == TYPE_CODE_BOOL
- || TYPE_CODE (type) == TYPE_CODE_CHAR
- || (ptr_ok && TYPE_CODE (type) == TYPE_CODE_PTR));
+ return (type->code () == TYPE_CODE_INT
+ || type->code () == TYPE_CODE_ENUM
+ || type->code () == TYPE_CODE_BOOL
+ || type->code () == TYPE_CODE_CHAR
+ || (ptr_ok && type->code () == TYPE_CODE_PTR));
}
/* (value->bool <gdb:value>) -> boolean
@@ -833,7 +833,7 @@ gdbscm_value_to_bool (SCM self)
try
{
- if (TYPE_CODE (type) == TYPE_CODE_PTR)
+ if (type->code () == TYPE_CODE_PTR)
l = value_as_address (value);
else
l = value_as_long (value);
@@ -877,7 +877,7 @@ gdbscm_value_to_integer (SCM self)
try
{
- if (TYPE_CODE (type) == TYPE_CODE_PTR)
+ if (type->code () == TYPE_CODE_PTR)
l = value_as_address (value);
else
l = value_as_long (value);
@@ -920,7 +920,7 @@ gdbscm_value_to_real (SCM self)
}
GDBSCM_HANDLE_GDB_EXCEPTION (exc);
- SCM_ASSERT_TYPE (is_intlike (type, 0) || TYPE_CODE (type) == TYPE_CODE_FLT,
+ SCM_ASSERT_TYPE (is_intlike (type, 0) || type->code () == TYPE_CODE_FLT,
self, SCM_ARG1, FUNC_NAME, _("number"));
try
@@ -1113,7 +1113,7 @@ gdbscm_value_to_lazy_string (SCM self, SCM rest)
type = value_type (value);
realtype = check_typedef (type);
- switch (TYPE_CODE (realtype))
+ switch (realtype->code ())
{
case TYPE_CODE_ARRAY:
{