This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: RFA: Use type flag bit testing macros
- From: Jim Blandy <jimb at zwingli dot cygnus dot com>
- To: fnf at redhat dot com
- Cc: gdb-patches at sources dot redhat dot com
- Date: 11 Dec 2001 16:23:36 -0500
- Subject: Re: RFA: Use type flag bit testing macros
- References: <200112102016.fBAKGhh02336@fishpond.ninemoons.com>
Approved.
Fred Fish <fnf@ns1.ninemoons.com> writes:
>
> This patch fixes up the remaining places where we can use the type
> flag bit testing macros from gdbtypes.h instead of peeking directly at
> the desired bit(s).
>
> -Fred
>
> 2001-12-10 Fred Fish <fnf@redhat.com>
>
> * c-typeprint.c (c_type_print_base): Use type flags access macros
> to test bits.
> * ch-typeprint.c (chill_type_print_base): Ditto.
> * ch-valprint.c (chill_val_print): Ditto.
> * d10v-tdep.c (d10v_pointer_to_address): Ditto.
> * dwarf2read.c (dwarf2_add_member_fn): Ditto.
> * dwarfread.c (read_structure_scope): Ditto.
> * gdbtypes.c (create_range_type): Dittol
> (create_set_type): Ditto.
> (check_typedef): Ditto.
> * jv-typeprint.c (java_type_print_base): Ditto.
> * p-typeprint.c (pascal_type_print_base): Ditto
> * p-valprint.c (pascal_val_print): Ditto.
> * stabsread.c (read_cfront_member_functions): Ditto.
> (read_member_functions): Ditto.
> (cleanup_undefined_types): Ditto.
> * valprint.c (val_print): Ditto.
>
> * valops.c (hand_function_call): Remove is_prototyped
> variable and just use type flag test macro directly.
>
> Index: c-typeprint.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/c-typeprint.c,v
> retrieving revision 1.12
> diff -u -p -r1.12 c-typeprint.c
> --- c-typeprint.c 2001/11/15 01:55:59 1.12
> +++ c-typeprint.c 2001/12/10 20:00:05
> @@ -751,7 +751,7 @@ c_type_print_base (struct type *type, st
> fprintf_filtered (stream, "{\n");
> if ((TYPE_NFIELDS (type) == 0) && (TYPE_NFN_FIELDS (type) == 0))
> {
> - if (TYPE_FLAGS (type) & TYPE_FLAG_STUB)
> + if (TYPE_STUB (type))
> fprintfi_filtered (level + 4, stream, "<incomplete type>\n");
> else
> fprintfi_filtered (level + 4, stream, "<no data fields>\n");
> Index: ch-typeprint.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/ch-typeprint.c,v
> retrieving revision 1.5
> diff -u -p -r1.5 ch-typeprint.c
> --- ch-typeprint.c 2001/03/27 20:36:23 1.5
> +++ ch-typeprint.c 2001/12/10 20:00:06
> @@ -207,7 +207,7 @@ chill_type_print_base (struct type *type
> fprintf_filtered (stream, "(\n");
> if ((TYPE_NFIELDS (type) == 0) && (TYPE_NFN_FIELDS (type) == 0))
> {
> - if (TYPE_FLAGS (type) & TYPE_FLAG_STUB)
> + if (TYPE_STUB (type))
> {
> fprintfi_filtered (level + 4, stream, "<incomplete type>\n");
> }
> Index: ch-valprint.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/ch-valprint.c,v
> retrieving revision 1.4
> diff -u -p -r1.4 ch-valprint.c
> --- ch-valprint.c 2001/11/10 20:44:37 1.4
> +++ ch-valprint.c 2001/12/10 20:00:08
> @@ -335,7 +335,7 @@ chill_val_print (struct type *type, char
> case TYPE_CODE_SET:
> elttype = TYPE_INDEX_TYPE (type);
> CHECK_TYPEDEF (elttype);
> - if (TYPE_FLAGS (elttype) & TYPE_FLAG_STUB)
> + if (TYPE_STUB (elttype))
> {
> fprintf_filtered (stream, "<incomplete type>");
> gdb_flush (stream);
> Index: d10v-tdep.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/d10v-tdep.c,v
> retrieving revision 1.27
> diff -u -p -r1.27 d10v-tdep.c
> --- d10v-tdep.c 2001/12/05 02:05:04 1.27
> +++ d10v-tdep.c 2001/12/10 20:00:12
> @@ -439,8 +439,8 @@ d10v_pointer_to_address (struct type *ty
>
> /* Is it a code address? */
> if (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_FUNC
> - || TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_METHOD ||
> - (TYPE_FLAGS (TYPE_TARGET_TYPE (type)) & TYPE_FLAG_CODE_SPACE) != 0)
> + || TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_METHOD
> + || TYPE_CODE_SPACE (TYPE_TARGET_TYPE (type)))
> return d10v_make_iaddr (addr);
> else
> return d10v_make_daddr (addr);
> Index: dwarf2read.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/dwarf2read.c,v
> retrieving revision 1.41
> diff -u -p -r1.41 dwarf2read.c
> --- dwarf2read.c 2001/12/09 23:17:07 1.41
> +++ dwarf2read.c 2001/12/10 20:00:33
> @@ -2134,7 +2134,7 @@ dwarf2_add_member_fn (struct field_info
> arg_types[iparams] = TYPE_FIELD_TYPE (die->type, iparams);
>
> /* Set last entry in argument type vector. */
> - if (TYPE_FLAGS (die->type) & TYPE_FLAG_VARARGS)
> + if (TYPE_VARARGS (die->type))
> arg_types[nparams] = NULL;
> else
> arg_types[nparams] = dwarf2_fundamental_type (objfile, FT_VOID);
> Index: dwarfread.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/dwarfread.c,v
> retrieving revision 1.10
> diff -u -p -r1.10 dwarfread.c
> --- dwarfread.c 2001/11/06 23:38:14 1.10
> +++ dwarfread.c 2001/12/10 20:00:42
> @@ -1147,7 +1147,7 @@ read_structure_scope (struct dieinfo *di
> struct symbol *sym;
>
> type = struct_type (dip, thisdie, enddie, objfile);
> - if (!(TYPE_FLAGS (type) & TYPE_FLAG_STUB))
> + if (!TYPE_STUB (type))
> {
> sym = new_symbol (dip, objfile);
> if (sym != NULL)
> Index: gdbtypes.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/gdbtypes.c,v
> retrieving revision 1.32
> diff -u -p -r1.32 gdbtypes.c
> --- gdbtypes.c 2001/12/10 06:23:21 1.32
> +++ gdbtypes.c 2001/12/10 20:00:51
> @@ -569,7 +569,7 @@ create_range_type (struct type *result_t
> }
> TYPE_CODE (result_type) = TYPE_CODE_RANGE;
> TYPE_TARGET_TYPE (result_type) = index_type;
> - if (TYPE_FLAGS (index_type) & TYPE_FLAG_STUB)
> + if (TYPE_STUB (index_type))
> TYPE_FLAGS (result_type) |= TYPE_FLAG_TARGET_STUB;
> else
> TYPE_LENGTH (result_type) = TYPE_LENGTH (check_typedef (index_type));
> @@ -732,7 +732,7 @@ create_set_type (struct type *result_typ
> TYPE_ALLOC (result_type, 1 * sizeof (struct field));
> memset (TYPE_FIELDS (result_type), 0, sizeof (struct field));
>
> - if (!(TYPE_FLAGS (domain_type) & TYPE_FLAG_STUB))
> + if (!TYPE_STUB (domain_type))
> {
> if (get_discrete_bounds (domain_type, &low_bound, &high_bound) < 0)
> low_bound = high_bound = 0;
> @@ -1245,7 +1245,7 @@ check_typedef (struct type *type)
> make_cv_type (is_const, is_volatile, newtype, &type);
> }
> /* Otherwise, rely on the stub flag being set for opaque/stubbed types */
> - else if ((TYPE_FLAGS (type) & TYPE_FLAG_STUB) && !currently_reading_symtab)
> + else if (TYPE_STUB (type) && !currently_reading_symtab)
> {
> char *name = type_name_no_tag (type);
> /* FIXME: shouldn't we separately check the TYPE_NAME and the
> @@ -1263,12 +1263,12 @@ check_typedef (struct type *type)
> make_cv_type (is_const, is_volatile, SYMBOL_TYPE (sym), &type);
> }
>
> - if (TYPE_FLAGS (type) & TYPE_FLAG_TARGET_STUB)
> + if (TYPE_TARGET_STUB (type))
> {
> struct type *range_type;
> struct type *target_type = check_typedef (TYPE_TARGET_TYPE (type));
>
> - if (TYPE_FLAGS (target_type) & (TYPE_FLAG_STUB | TYPE_FLAG_TARGET_STUB))
> + if (TYPE_STUB (target_type) || TYPE_TARGET_STUB (target_type))
> {
> }
> else if (TYPE_CODE (type) == TYPE_CODE_ARRAY
> Index: jv-typeprint.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/jv-typeprint.c,v
> retrieving revision 1.5
> diff -u -p -r1.5 jv-typeprint.c
> --- jv-typeprint.c 2001/04/27 00:19:09 1.5
> +++ jv-typeprint.c 2001/12/10 20:00:51
> @@ -152,7 +152,7 @@ java_type_print_base (struct type *type,
> fprintf_filtered (stream, "{\n");
> if ((TYPE_NFIELDS (type) == 0) && (TYPE_NFN_FIELDS (type) == 0))
> {
> - if (TYPE_FLAGS (type) & TYPE_FLAG_STUB)
> + if (TYPE_STUB (type))
> fprintfi_filtered (level + 4, stream, "<incomplete type>\n");
> else
> fprintfi_filtered (level + 4, stream, "<no data fields>\n");
> Index: p-typeprint.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/p-typeprint.c,v
> retrieving revision 1.5
> diff -u -p -r1.5 p-typeprint.c
> --- p-typeprint.c 2001/03/27 20:36:24 1.5
> +++ p-typeprint.c 2001/12/10 20:00:53
> @@ -588,7 +588,7 @@ pascal_type_print_base (struct type *typ
> fprintf_filtered (stream, "\n");
> if ((TYPE_NFIELDS (type) == 0) && (TYPE_NFN_FIELDS (type) == 0))
> {
> - if (TYPE_FLAGS (type) & TYPE_FLAG_STUB)
> + if (TYPE_STUB (type))
> fprintfi_filtered (level + 4, stream, "<incomplete type>\n");
> else
> fprintfi_filtered (level + 4, stream, "<no data fields>\n");
> Index: p-valprint.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/p-valprint.c,v
> retrieving revision 1.6
> diff -u -p -r1.6 p-valprint.c
> --- p-valprint.c 2001/11/10 20:44:38 1.6
> +++ p-valprint.c 2001/12/10 20:00:57
> @@ -445,7 +445,7 @@ pascal_val_print (struct type *type, cha
> case TYPE_CODE_SET:
> elttype = TYPE_INDEX_TYPE (type);
> CHECK_TYPEDEF (elttype);
> - if (TYPE_FLAGS (elttype) & TYPE_FLAG_STUB)
> + if (TYPE_STUB (elttype))
> {
> fprintf_filtered (stream, "<incomplete type>");
> gdb_flush (stream);
> Index: stabsread.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/stabsread.c,v
> retrieving revision 1.18
> diff -u -p -r1.18 stabsread.c
> --- stabsread.c 2001/12/07 23:30:13 1.18
> +++ stabsread.c 2001/12/10 20:01:14
> @@ -869,7 +869,7 @@ read_cfront_member_functions (struct fie
> TYPE_CODE (new_sublist->fn_field.type) = TYPE_CODE_METHOD;
>
> /* If this is just a stub, then we don't have the real name here. */
> - if (TYPE_FLAGS (new_sublist->fn_field.type) & TYPE_FLAG_STUB)
> + if (TYPE_STUB (new_sublist->fn_field.type))
> {
> if (!TYPE_DOMAIN_TYPE (new_sublist->fn_field.type))
> TYPE_DOMAIN_TYPE (new_sublist->fn_field.type) = type;
> @@ -3100,7 +3100,7 @@ read_member_functions (struct field_info
>
> /* If this is just a stub, then we don't have the real name here. */
>
> - if (TYPE_FLAGS (new_sublist->fn_field.type) & TYPE_FLAG_STUB)
> + if (TYPE_STUB (new_sublist->fn_field.type))
> {
> if (!TYPE_DOMAIN_TYPE (new_sublist->fn_field.type))
> TYPE_DOMAIN_TYPE (new_sublist->fn_field.type) = type;
> @@ -4941,7 +4941,7 @@ cleanup_undefined_types (void)
> as well as in check_typedef to deal with the (legitimate in
> C though not C++) case of several types with the same name
> in different source files. */
> - if (TYPE_FLAGS (*type) & TYPE_FLAG_STUB)
> + if (TYPE_STUB (*type))
> {
> struct pending *ppt;
> int i;
> Index: valops.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/valops.c,v
> retrieving revision 1.43
> diff -u -p -r1.43 valops.c
> --- valops.c 2001/12/07 22:16:43 1.43
> +++ valops.c 2001/12/10 20:01:24
> @@ -1458,10 +1458,8 @@ hand_function_call (value_ptr function,
>
> else
> {
> - int is_prototyped = TYPE_FLAGS (ftype) & TYPE_FLAG_PROTOTYPED;
> param_type = TYPE_FIELD_TYPE (ftype, i);
> -
> - args[i] = value_arg_coerce (args[i], param_type, is_prototyped);
> + args[i] = value_arg_coerce (args[i], param_type, TYPE_PROTOTYPED (ftype));
> }
>
> /*elz: this code is to handle the case in which the function to be called
> Index: valprint.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/valprint.c,v
> retrieving revision 1.18
> diff -u -p -r1.18 valprint.c
> --- valprint.c 2001/11/10 21:34:56 1.18
> +++ valprint.c 2001/12/10 20:01:33
> @@ -142,7 +142,7 @@ val_print (struct type *type, char *vala
> only a stub and we can't find and substitute its complete type, then
> print appropriate string and return. */
>
> - if (TYPE_FLAGS (real_type) & TYPE_FLAG_STUB)
> + if (TYPE_STUB (real_type))
> {
> fprintf_filtered (stream, "<incomplete type>");
> gdb_flush (stream);
>
>