X-Git-Url: http://git.ipfire.org/?a=blobdiff_plain;f=gdb%2Fgdbtypes.c;h=c736dff2ca82f9dd588ef1e30227308798bf6b07;hb=ae7104966177c7bcb7bef9e1445489d9d2f97f06;hp=4dd1a6a64ec27590fefd49bd0f1a80fd2b9548d3;hpb=d3b54e63f4866551953a03f512049741b0e776c4;p=thirdparty%2Fbinutils-gdb.git diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c index 4dd1a6a64ec..c736dff2ca8 100644 --- a/gdb/gdbtypes.c +++ b/gdb/gdbtypes.c @@ -3413,6 +3413,15 @@ init_decfloat_type (struct objfile *objfile, int bit, const char *name) return t; } +/* Return true if init_complex_type can be called with TARGET_TYPE. */ + +bool +can_create_complex_type (struct type *target_type) +{ + return (target_type->code () == TYPE_CODE_INT + || target_type->code () == TYPE_CODE_FLT); +} + /* Allocate a TYPE_CODE_COMPLEX type structure. NAME is the type name. TARGET_TYPE is the component type. */ @@ -3421,8 +3430,7 @@ init_complex_type (const char *name, struct type *target_type) { struct type *t; - gdb_assert (target_type->code () == TYPE_CODE_INT - || target_type->code () == TYPE_CODE_FLT); + gdb_assert (can_create_complex_type (target_type)); if (TYPE_MAIN_TYPE (target_type)->flds_bnds.complex_type == nullptr) {