[binutils-gdb] gdb: use type instance macros to query const, volatile, restrict
Tankut Baris Aktemur via Gdb-cvs <[email protected]> Thu, 23 Jul 2026 10:12:29 +0000 (GMT)
| Newsgroups | gmane.comp.gdb.cvs |
|---|---|
| Message-ID | <[email protected]> |
https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D288048cf1548= 7db49390c88d96f2913736300b8f commit 288048cf15487db49390c88d96f2913736300b8f Author: Tankut Baris Aktemur <[email protected]> Date: Thu Jul 23 05:04:42 2026 -0500 gdb: use type instance macros to query const, volatile, restrict =20 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. =20 Approved-By: Tom Tromey <[email protected]> Diff: --- 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)) !=3D 0) + if (TYPE_CONST (type) || TYPE_VOLATILE (type) || TYPE_RESTRICT (type)) return convert_qualified (context, type); =20 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 *ins= tance, { /* 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)) !=3D 0) + if (TYPE_CONST (type) || TYPE_VOLATILE (type) || TYPE_RESTRICT (type)) return compile_cplus_convert_qualified (instance, type); =20 switch (type->code ())