[PATCH v2 01/17] gdb: use type instance macros to query const, volatile, restrict
Tankut Baris Aktemur <[email protected]> Wed, 22 Jul 2026 05:41:50 -0500
| Newsgroups | gmane.comp.gdb.patches |
|---|---|
| Message-ID | <20260722-users-aktemur-type-instance-flags-v2-1-d60dcbc2a76f@amd.com> |
In two cases in compile/compile-c-types.c and compile/compile-cplus-types.c, we query if a type is const, volatile, or restrict using bitmasks. For such read-only queries, there are macros. Use them for code uniformity. The new code may be slightly less optimal, but I don't think this would matter in practice. This is a code cleanup step in a series. Approved-By: Tom Tromey <[email protected]> --- gdb/compile/compile-c-types.c | 4 +--- gdb/compile/compile-cplus-types.c | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/gdb/compile/compile-c-types.c b/gdb/compile/compile-c-types.c index be79b582081..af9dea730eb 100644 --- a/gdb/compile/compile-c-types.c +++ b/gdb/compile/compile-c-types.c @@ -278,9 +278,7 @@ convert_type_basic (compile_c_instance *context, struct type *type) { /* If we are converting a qualified type, first convert the unqualified type and then apply the qualifiers. */ - if ((type->instance_flags () & (TYPE_INSTANCE_FLAG_CONST - | TYPE_INSTANCE_FLAG_VOLATILE - | TYPE_INSTANCE_FLAG_RESTRICT)) != 0) + if (TYPE_CONST (type) || TYPE_VOLATILE (type) || TYPE_RESTRICT (type)) return convert_qualified (context, type); switch (type->code ()) diff --git a/gdb/compile/compile-cplus-types.c b/gdb/compile/compile-cplus-types.c index 031775c3679..ff25fc62c8b 100644 --- a/gdb/compile/compile-cplus-types.c +++ b/gdb/compile/compile-cplus-types.c @@ -1126,9 +1126,7 @@ convert_type_cplus_basic (compile_cplus_instance *instance, { /* If we are converting a qualified type, first convert the unqualified type and then apply the qualifiers. */ - if ((type->instance_flags () & (TYPE_INSTANCE_FLAG_CONST - | TYPE_INSTANCE_FLAG_VOLATILE - | TYPE_INSTANCE_FLAG_RESTRICT)) != 0) + if (TYPE_CONST (type) || TYPE_VOLATILE (type) || TYPE_RESTRICT (type)) return compile_cplus_convert_qualified (instance, type); switch (type->code ()) -- 2.34.1