[PATCH] Remove CHECK_TYPEDEF, use check_typedef instead

Joel Brobecker brobecker@adacore.com
Tue Jul 7 13:20:00 GMT 2015


> I think that the CHECK_TYPEDEF macro is not necessary, and even a bit
> annoying.  It makes unclear the fact that the "type" variables gets
> overwritten.  It has actually bitten me a few times.  I think the
> following, explicit form, is better.
> 
>   type = check_typedef (type);

I don't have a strong opinion, but I would tend to agree...

If this patch goes in, I'd suggest pushing it to the 7.10 branch
as well. It might simplify backporting in the future.

What do others think?

> 
> This patches changes all instances of CHECK_TYPEDEF for an equivalent
> call to check_typedef.  The bulk of the change was done with this sed:
> 
>   sed -i 's/CHECK_TYPEDEF (\([^)]*\));/\1 = check_typedef (\1);/' <file>.c
> 
> The ChangeLog was generated using David Malcom's generate_changelog.py.
> I manually fixed those places where it gets the wrong function name,
> hopefully all of them.
> 
> The patch was built-tested, and I ran a few smoke tests.
> 
> gdb/ChangeLog:
> 	* gdbtypes.h (CHECK_TYPEDEF): Remove.
> 	* aarch64-tdep.c (aarch64_return_in_memory): Replace CHECK_TYPEDEF
>         with check_typedef.
> 	* ada-lang.c (decode_constrained_packed_array_type): Likewise.
> 	(ada_array_length): Likewise.
> 	(find_parallel_type_by_descriptive_type): Likewise.
> 	(ada_check_typedef): Likewise.
> 	* arm-tdep.c (arm_return_in_memory): Likewise.
> 	* ax-gdb.c (gen_trace_static_fields): Likewise.
> 	(gen_struct_ref_recursive): Likewise.
> 	* c-exp.y (exp : SIZEOF '(' type ')' %prec UNARY): Likewise.
> 	(variable: block COLONCOLON name): Likewise.
> 	(qualified_name: TYPENAME COLONCOLON name): Likewise.
> 	* c-lang.c (classify_type): Likewise.
> 	* c-typeprint.c (c_print_type): Likewise.
> 	(c_print_typedef): Likewise.
> 	(c_type_print_base): Likewise.
> 	* c-valprint.c (c_val_print): Likewise.
> 	* compile/compile-c-types.c (convert_type): Likewise.
> 	* compile/compile-object-load.c (get_out_value_type): Likewise.
> 	* completer.c (add_struct_fields): Likewise.
> 	(expression_completer): Likewise.
> 	* cp-namespace.c (cp_find_type_baseclass_by_name): Likewise.
> 	(cp_lookup_nested_symbol_1): Likewise.
> 	(cp_lookup_nested_symbol): Likewise.
> 	* cp-valprint.c (cp_print_value_fields): Likewise.
> 	(cp_print_static_field): Likewise.
> 	* d-valprint.c (d_val_print): Likewise.
> 	* eval.c (evaluate_subexp_standard): Likewise.
> 	(evaluate_subexp_for_sizeof): Likewise.
> 	* f-exp.y (exp : SIZEOF '(' type ')' %prec UNARY): Likewise.
> 	* f-typeprint.c (f_type_print_base): Likewise.
> 	* f-valprint.c (f_val_print): Likewise.
> 	* gdbtypes.c (get_discrete_bounds): Likewise.
> 	(create_array_type_with_stride): Likewise.
> 	(type_name_no_tag_or_error): Likewise.
> 	(lookup_struct_elt_type): Likewise.
> 	(get_unsigned_type_max): Likewise.
> 	(internal_type_vptr_fieldno): Likewise.
> 	(set_type_vptr_fieldno): Likewise.
> 	(internal_type_vptr_basetype): Likewise.
> 	(set_type_vptr_basetype): Likewise.
>         (get_vptr_fieldno): Likewise.
> 	(is_integral_type): Likewise.
> 	(is_scalar_type): Likewise.
>         (is_scalar_type_recursive): Likewise.
> 	(distance_to_ancestor): Likewise.
> 	(is_unique_ancestor_worker): Likewise.
> 	(check_types_equal): Likewise.
> 	* gnu-v2-abi.c (gnuv2_value_rtti_type): Likewise.
> 	* gnu-v3-abi.c (gnuv3_dynamic_class): Likewise.
> 	(gnuv3_get_vtable): Likewise.
> 	(gnuv3_pass_by_reference): Likewise.
> 	* go-exp.y (exp : SIZEOF_KEYWORD '(' type ')' %prec UNARY): Likewise.
> 	* go-lang.c (gccgo_string_p): Likewise.
> 	(go_classify_struct_type): Likewise.
> 	* go-typeprint.c (go_print_type): Likewise.
> 	* go-valprint.c (go_val_print): Likewise.
> 	* guile/scm-math.c (vlscm_binop): Likewise.
> 	* guile/scm-value.c (gdbscm_value_dynamic_type): Likewise.
> 	(gdbscm_value_to_bytevector): Likewise.
> 	(gdbscm_value_to_bool): Likewise.
> 	(gdbscm_value_to_integer): Likewise.
> 	(gdbscm_value_to_real): Likewise.
> 	* infcall.c (call_function_by_hand_dummy): Likewise.
> 	* infcmd.c (get_return_value): Likewise.
> 	* jv-lang.c (is_object_type): Likewise.
> 	* jv-typeprint.c (java_type_print_base): Likewise.
> 	* jv-valprint.c (java_print_value_fields): Likewise.
> 	(java_val_print): Likewise.
> 	* linespec.c (find_methods): Likewise.
> 	(collect_one_symbol): Likewise.
> 	* m2-typeprint.c (m2_print_type): Likewise.
> 	(m2_print_typedef): Likewise.
> 	(m2_get_discrete_bounds): Likewise.
> 	* m2-valprint.c (m2_print_long_set): Likewise.
> 	(m2_print_unbounded_array): Likewise.
> 	(m2_print_array_contents): Likewise.
> 	(m2_val_print): Likewise.
> 	* opencl-lang.c (opencl_print_type): Likewise.
> 	* p-exp.y (exp : SIZEOF '(' type ')' %prec UNARY): Likewise.
> 	* p-typeprint.c (pascal_print_type): Likewise.
> 	(pascal_print_typedef): Likewise.
> 	(pascal_type_print_base): Likewise.
> 	* p-valprint.c (pascal_val_print): Likewise.
> 	(pascal_object_print_value_fields): Likewise.
> 	(pascal_object_print_static_field): Likewise.
> 	* python/py-type.c (typy_fields_items): Likewise.
> 	(typy_get_composite): Likewise.
> 	* python/py-value.c (valpy_get_dynamic_type): Likewise.
> 	(valpy_binop): Likewise.
> 	(valpy_long): Likewise.
> 	(valpy_float): Likewise.
> 	* stack.c (return_command): Likewise.
> 	* symtab.c (check_field): Likewise.
> 	(lookup_symbol_aux): Likewise.
> 	* tic6x-tdep.c (tic6x_return_value): Likewise.
> 	* typeprint.c (print_type_scalar): Likewise.
> 	* valarith.c (value_vector_widen): Likewise.
> 	* valops.c (value_cast): Likewise.
> 	(value_assign): Likewise.
> 	(do_search_struct_field): Likewise.
> 	(search_struct_method): Likewise.
> 	(find_method_list): Likewise.
> 	* valprint.c (val_print_scalar_type_p): Likewise.
> 	(valprint_check_validity): Likewise.
> 	(generic_val_print): Likewise.
> 	* value.c (unpack_double): Likewise.
> 	(value_primitive_field): Likewise.
> 	(unpack_bits_as_long): Likewise.
> ---
>  gdb/aarch64-tdep.c                |  2 +-
>  gdb/ada-lang.c                    |  8 ++++----
>  gdb/arm-tdep.c                    |  2 +-
>  gdb/ax-gdb.c                      |  4 ++--
>  gdb/c-exp.y                       |  6 +++---
>  gdb/c-lang.c                      |  2 +-
>  gdb/c-typeprint.c                 |  6 +++---
>  gdb/c-valprint.c                  |  2 +-
>  gdb/compile/compile-c-types.c     |  2 +-
>  gdb/compile/compile-object-load.c |  4 ++--
>  gdb/completer.c                   |  4 ++--
>  gdb/cp-namespace.c                |  6 +++---
>  gdb/cp-valprint.c                 |  4 ++--
>  gdb/d-valprint.c                  |  2 +-
>  gdb/eval.c                        |  4 ++--
>  gdb/f-exp.y                       |  2 +-
>  gdb/f-typeprint.c                 |  2 +-
>  gdb/f-valprint.c                  |  2 +-
>  gdb/gdbtypes.c                    | 42 +++++++++++++++++++--------------------
>  gdb/gdbtypes.h                    |  5 -----
>  gdb/gnu-v2-abi.c                  |  4 ++--
>  gdb/gnu-v3-abi.c                  |  6 +++---
>  gdb/go-exp.y                      |  2 +-
>  gdb/go-lang.c                     |  8 ++++----
>  gdb/go-typeprint.c                |  2 +-
>  gdb/go-valprint.c                 |  2 +-
>  gdb/guile/scm-math.c              |  8 ++++----
>  gdb/guile/scm-value.c             | 10 +++++-----
>  gdb/infcall.c                     |  2 +-
>  gdb/infcmd.c                      |  2 +-
>  gdb/jv-lang.c                     |  2 +-
>  gdb/jv-typeprint.c                |  2 +-
>  gdb/jv-valprint.c                 |  4 ++--
>  gdb/linespec.c                    |  4 ++--
>  gdb/m2-typeprint.c                |  6 +++---
>  gdb/m2-valprint.c                 | 10 +++++-----
>  gdb/opencl-lang.c                 |  2 +-
>  gdb/p-exp.y                       |  2 +-
>  gdb/p-typeprint.c                 |  6 +++---
>  gdb/p-valprint.c                  |  8 ++++----
>  gdb/python/py-type.c              |  4 ++--
>  gdb/python/py-value.c             | 14 ++++++-------
>  gdb/stack.c                       |  2 +-
>  gdb/symtab.c                      |  4 ++--
>  gdb/tic6x-tdep.c                  |  2 +-
>  gdb/typeprint.c                   |  2 +-
>  gdb/valarith.c                    |  2 +-
>  gdb/valops.c                      | 10 +++++-----
>  gdb/valprint.c                    |  8 ++++----
>  gdb/value.c                       |  6 +++---
>  50 files changed, 126 insertions(+), 131 deletions(-)
> 
> diff --git a/gdb/aarch64-tdep.c b/gdb/aarch64-tdep.c
> index 9650a7a..f703874 100644
> --- a/gdb/aarch64-tdep.c
> +++ b/gdb/aarch64-tdep.c
> @@ -2023,7 +2023,7 @@ aarch64_return_in_memory (struct gdbarch *gdbarch, struct type *type)
>    int nRc;
>    enum type_code code;
>  
> -  CHECK_TYPEDEF (type);
> +  type = check_typedef (type);
>  
>    /* In the AArch64 ABI, "integer" like aggregate types are returned
>       in registers.  For an aggregate type to be integer like, its size
> diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
> index 782447a..06c72ee 100644
> --- a/gdb/ada-lang.c
> +++ b/gdb/ada-lang.c
> @@ -2238,7 +2238,7 @@ decode_constrained_packed_array_type (struct type *type)
>        lim_warning (_("could not find bounds information on packed array"));
>        return NULL;
>      }
> -  CHECK_TYPEDEF (shadow_type);
> +  shadow_type = check_typedef (shadow_type);
>  
>    if (TYPE_CODE (shadow_type) != TYPE_CODE_ARRAY)
>      {
> @@ -3056,7 +3056,7 @@ ada_array_length (struct value *arr, int n)
>        high = value_as_long (desc_one_bound (desc_bounds (arr), n, 1));
>      }
>  
> -  CHECK_TYPEDEF (arr_type);
> +  arr_type = check_typedef (arr_type);
>    index_type = TYPE_INDEX_TYPE (arr_type);
>    if (index_type != NULL)
>      {
> @@ -7841,7 +7841,7 @@ find_parallel_type_by_descriptive_type (struct type *type, const char *name)
>  	result = tmp;
>        else
>  	{
> -	  CHECK_TYPEDEF (result);
> +	  result = check_typedef (result);
>  	  if (HAVE_GNAT_AUX_INFO (result))
>  	    result = TYPE_DESCRIPTIVE_TYPE (result);
>  	  else
> @@ -8943,7 +8943,7 @@ ada_check_typedef (struct type *type)
>        && is_thick_pntr (ada_typedef_target_type (type)))
>      return type;
>  
> -  CHECK_TYPEDEF (type);
> +  type = check_typedef (type);
>    if (type == NULL || TYPE_CODE (type) != TYPE_CODE_ENUM
>        || !TYPE_STUB (type)
>        || TYPE_TAG_NAME (type) == NULL)
> diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c
> index 527bd01..a458c9a 100644
> --- a/gdb/arm-tdep.c
> +++ b/gdb/arm-tdep.c
> @@ -9008,7 +9008,7 @@ arm_return_in_memory (struct gdbarch *gdbarch, struct type *type)
>    int nRc;
>    enum type_code code;
>  
> -  CHECK_TYPEDEF (type);
> +  type = check_typedef (type);
>  
>    /* In the ARM ABI, "integer" like aggregate types are returned in
>       registers.  For an aggregate type to be integer like, its size
> diff --git a/gdb/ax-gdb.c b/gdb/ax-gdb.c
> index 7a9d1e7..ef4d154 100644
> --- a/gdb/ax-gdb.c
> +++ b/gdb/ax-gdb.c
> @@ -322,7 +322,7 @@ gen_trace_static_fields (struct gdbarch *gdbarch,
>    int i, nbases = TYPE_N_BASECLASSES (type);
>    struct axs_value value;
>  
> -  CHECK_TYPEDEF (type);
> +  type = check_typedef (type);
>  
>    for (i = TYPE_NFIELDS (type) - 1; i >= nbases; i--)
>      {
> @@ -1438,7 +1438,7 @@ gen_struct_ref_recursive (struct expression *exp, struct agent_expr *ax,
>    int i, rslt;
>    int nbases = TYPE_N_BASECLASSES (type);
>  
> -  CHECK_TYPEDEF (type);
> +  type = check_typedef (type);
>  
>    for (i = TYPE_NFIELDS (type) - 1; i >= nbases; i--)
>      {
> diff --git a/gdb/c-exp.y b/gdb/c-exp.y
> index f458545..3ea544d 100644
> --- a/gdb/c-exp.y
> +++ b/gdb/c-exp.y
> @@ -793,7 +793,7 @@ exp	:	SIZEOF '(' type ')'	%prec UNARY
>  					      (parse_language (pstate),
>  					       parse_gdbarch (pstate),
>  					       "int"));
> -			  CHECK_TYPEDEF (type);
> +			  type = check_typedef (type);
>  
>  			    /* $5.3.3/2 of the C++ Standard (n3290 draft)
>  			       says of sizeof:  "When applied to a reference
> @@ -985,7 +985,7 @@ variable:	block COLONCOLON name
>  qualified_name:	TYPENAME COLONCOLON name
>  			{
>  			  struct type *type = $1.type;
> -			  CHECK_TYPEDEF (type);
> +			  type = check_typedef (type);
>  			  if (!type_aggregate_p (type))
>  			    error (_("`%s' is not defined as an aggregate type."),
>  				   TYPE_SAFE_NAME (type));
> @@ -1001,7 +1001,7 @@ qualified_name:	TYPENAME COLONCOLON name
>  			  struct stoken tmp_token;
>  			  char *buf;
>  
> -			  CHECK_TYPEDEF (type);
> +			  type = check_typedef (type);
>  			  if (!type_aggregate_p (type))
>  			    error (_("`%s' is not defined as an aggregate type."),
>  				   TYPE_SAFE_NAME (type));
> diff --git a/gdb/c-lang.c b/gdb/c-lang.c
> index 4b44b95..cbc7a9e 100644
> --- a/gdb/c-lang.c
> +++ b/gdb/c-lang.c
> @@ -124,7 +124,7 @@ classify_type (struct type *elttype, struct gdbarch *gdbarch,
>  	  /* Perhaps check_typedef did not update the target type.  In
>  	     this case, force the lookup again and hope it works out.
>  	     It never will for C, but it might for C++.  */
> -	  CHECK_TYPEDEF (elttype);
> +	  elttype = check_typedef (elttype);
>  	}
>      }
>  
> diff --git a/gdb/c-typeprint.c b/gdb/c-typeprint.c
> index 421b720..708ace0 100644
> --- a/gdb/c-typeprint.c
> +++ b/gdb/c-typeprint.c
> @@ -89,7 +89,7 @@ c_print_type (struct type *type,
>    const char *local_name;
>  
>    if (show > 0)
> -    CHECK_TYPEDEF (type);
> +    type = check_typedef (type);
>  
>    local_name = find_typedef_in_hash (flags, type);
>    if (local_name != NULL)
> @@ -144,7 +144,7 @@ c_print_typedef (struct type *type,
>  		 struct symbol *new_symbol,
>  		 struct ui_file *stream)
>  {
> -  CHECK_TYPEDEF (type);
> +  type = check_typedef (type);
>    fprintf_filtered (stream, "typedef ");
>    type_print (type, "", stream, 0);
>    if (TYPE_NAME ((SYMBOL_TYPE (new_symbol))) == 0
> @@ -876,7 +876,7 @@ c_type_print_base (struct type *type, struct ui_file *stream,
>        return;
>      }
>  
> -  CHECK_TYPEDEF (type);
> +  type = check_typedef (type);
>  
>    switch (TYPE_CODE (type))
>      {
> diff --git a/gdb/c-valprint.c b/gdb/c-valprint.c
> index 8d8b744..c0e661b 100644
> --- a/gdb/c-valprint.c
> +++ b/gdb/c-valprint.c
> @@ -146,7 +146,7 @@ c_val_print (struct type *type, const gdb_byte *valaddr,
>    unsigned eltlen;
>    CORE_ADDR addr;
>  
> -  CHECK_TYPEDEF (type);
> +  type = check_typedef (type);
>    switch (TYPE_CODE (type))
>      {
>      case TYPE_CODE_ARRAY:
> diff --git a/gdb/compile/compile-c-types.c b/gdb/compile/compile-c-types.c
> index 22f5a9d..db6eb9c 100644
> --- a/gdb/compile/compile-c-types.c
> +++ b/gdb/compile/compile-c-types.c
> @@ -382,7 +382,7 @@ convert_type (struct compile_c_instance *context, struct type *type)
>  
>    /* We don't ever have to deal with typedefs in this code, because
>       those are only needed as symbols by the C compiler.  */
> -  CHECK_TYPEDEF (type);
> +  type = check_typedef (type);
>  
>    inst.type = type;
>    found = htab_find (context->type_map, &inst);
> diff --git a/gdb/compile/compile-object-load.c b/gdb/compile/compile-object-load.c
> index 8298748..162227a 100644
> --- a/gdb/compile/compile-object-load.c
> +++ b/gdb/compile/compile-object-load.c
> @@ -474,14 +474,14 @@ get_out_value_type (struct symbol *func_sym, struct objfile *objfile,
>      error (_("No \"%s\" symbol found"), COMPILE_I_EXPR_PTR_TYPE);
>  
>    gdb_type = SYMBOL_TYPE (gdb_val_sym);
> -  CHECK_TYPEDEF (gdb_type);
> +  gdb_type = check_typedef (gdb_type);
>  
>    gdb_ptr_type_sym = block_lookup_symbol (block, COMPILE_I_EXPR_PTR_TYPE,
>  					  VAR_DOMAIN);
>    if (gdb_ptr_type_sym == NULL)
>      error (_("No \"%s\" symbol found"), COMPILE_I_EXPR_PTR_TYPE);
>    gdb_ptr_type = SYMBOL_TYPE (gdb_ptr_type_sym);
> -  CHECK_TYPEDEF (gdb_ptr_type);
> +  gdb_ptr_type = check_typedef (gdb_ptr_type);
>    if (TYPE_CODE (gdb_ptr_type) != TYPE_CODE_PTR)
>      error (_("Type of \"%s\" is not a pointer"), COMPILE_I_EXPR_PTR_TYPE);
>    gdb_type_from_ptr = TYPE_TARGET_TYPE (gdb_ptr_type);
> diff --git a/gdb/completer.c b/gdb/completer.c
> index fd52a04..d1ebf67 100644
> --- a/gdb/completer.c
> +++ b/gdb/completer.c
> @@ -344,7 +344,7 @@ add_struct_fields (struct type *type, VEC (char_ptr) **output,
>    int computed_type_name = 0;
>    const char *type_name = NULL;
>  
> -  CHECK_TYPEDEF (type);
> +  type = check_typedef (type);
>    for (i = 0; i < TYPE_NFIELDS (type); ++i)
>      {
>        if (i < TYPE_N_BASECLASSES (type))
> @@ -415,7 +415,7 @@ expression_completer (struct cmd_list_element *ignore,
>      {
>        for (;;)
>  	{
> -	  CHECK_TYPEDEF (type);
> +	  type = check_typedef (type);
>  	  if (TYPE_CODE (type) != TYPE_CODE_PTR
>  	      && TYPE_CODE (type) != TYPE_CODE_REF)
>  	    break;
> diff --git a/gdb/cp-namespace.c b/gdb/cp-namespace.c
> index ab7d0cb..41f8d35 100644
> --- a/gdb/cp-namespace.c
> +++ b/gdb/cp-namespace.c
> @@ -882,7 +882,7 @@ cp_find_type_baseclass_by_name (struct type *parent_type, const char *name)
>  {
>    int i;
>  
> -  CHECK_TYPEDEF (parent_type);
> +  parent_type = check_typedef (parent_type);
>    for (i = 0; i < TYPE_N_BASECLASSES (parent_type); ++i)
>      {
>        struct type *type = check_typedef (TYPE_BASECLASS (parent_type, i));
> @@ -1002,7 +1002,7 @@ cp_lookup_nested_symbol_1 (struct type *container_type,
>      }
>  
>    /* If this is a class with baseclasses, search them next.  */
> -  CHECK_TYPEDEF (container_type);
> +  container_type = check_typedef (container_type);
>    if (TYPE_N_BASECLASSES (container_type) > 0)
>      {
>        sym = find_symbol_in_baseclass (container_type, nested_name, block,
> @@ -1029,7 +1029,7 @@ cp_lookup_nested_symbol (struct type *parent_type,
>       original type.  */
>    struct type *saved_parent_type = parent_type;
>  
> -  CHECK_TYPEDEF (parent_type);
> +  parent_type = check_typedef (parent_type);
>  
>    if (symbol_lookup_debug)
>      {
> diff --git a/gdb/cp-valprint.c b/gdb/cp-valprint.c
> index feb3a66..0c32f04 100644
> --- a/gdb/cp-valprint.c
> +++ b/gdb/cp-valprint.c
> @@ -165,7 +165,7 @@ cp_print_value_fields (struct type *type, struct type *real_type,
>    int fields_seen = 0;
>    static int last_set_recurse = -1;
>  
> -  CHECK_TYPEDEF (type);
> +  type = check_typedef (type);
>    
>    if (recurse == 0)
>      {
> @@ -669,7 +669,7 @@ cp_print_static_field (struct type *type,
>        addr = value_address (val);
>        obstack_grow (&dont_print_statmem_obstack, (char *) &addr,
>  		    sizeof (CORE_ADDR));
> -      CHECK_TYPEDEF (type);
> +      type = check_typedef (type);
>        cp_print_value_fields (type, value_enclosing_type (val),
>  			     value_contents_for_printing (val),
>  			     value_embedded_offset (val), addr,
> diff --git a/gdb/d-valprint.c b/gdb/d-valprint.c
> index 89efb05..5f4df32 100644
> --- a/gdb/d-valprint.c
> +++ b/gdb/d-valprint.c
> @@ -80,7 +80,7 @@ d_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
>  {
>    int ret;
>  
> -  CHECK_TYPEDEF (type);
> +  type = check_typedef (type);
>    switch (TYPE_CODE (type))
>      {
>        case TYPE_CODE_STRUCT:
> diff --git a/gdb/eval.c b/gdb/eval.c
> index 6bbd495..5699aea 100644
> --- a/gdb/eval.c
> +++ b/gdb/eval.c
> @@ -1226,7 +1226,7 @@ evaluate_subexp_standard (struct type *expect_type,
>  
>  	    block_for_pc (funaddr);
>  
> -	    CHECK_TYPEDEF (val_type);
> +	    val_type = check_typedef (val_type);
>  	  
>  	    if ((val_type == NULL) 
>  		|| (TYPE_CODE(val_type) == TYPE_CODE_ERROR))
> @@ -3089,7 +3089,7 @@ evaluate_subexp_for_sizeof (struct expression *exp, int *pos,
>    /* $5.3.3/2 of the C++ Standard (n3290 draft) says of sizeof:
>       "When applied to a reference or a reference type, the result is
>       the size of the referenced type."  */
> -  CHECK_TYPEDEF (type);
> +  type = check_typedef (type);
>    if (exp->language_defn->la_language == language_cplus
>        && TYPE_CODE (type) == TYPE_CODE_REF)
>      type = check_typedef (TYPE_TARGET_TYPE (type));
> diff --git a/gdb/f-exp.y b/gdb/f-exp.y
> index 144e17f..94494f0 100644
> --- a/gdb/f-exp.y
> +++ b/gdb/f-exp.y
> @@ -487,7 +487,7 @@ exp	:	SIZEOF '(' type ')'	%prec UNARY
>  			  write_exp_elt_type (pstate,
>  					      parse_f_type (pstate)
>  					      ->builtin_integer);
> -			  CHECK_TYPEDEF ($3);
> +			  $3 = check_typedef ($3);
>  			  write_exp_elt_longcst (pstate,
>  						 (LONGEST) TYPE_LENGTH ($3));
>  			  write_exp_elt_opcode (pstate, OP_LONG); }
> diff --git a/gdb/f-typeprint.c b/gdb/f-typeprint.c
> index 4957e1f..590ed73 100644
> --- a/gdb/f-typeprint.c
> +++ b/gdb/f-typeprint.c
> @@ -273,7 +273,7 @@ f_type_print_base (struct type *type, struct ui_file *stream, int show,
>      }
>  
>    if (TYPE_CODE (type) != TYPE_CODE_TYPEDEF)
> -    CHECK_TYPEDEF (type);
> +    type = check_typedef (type);
>  
>    switch (TYPE_CODE (type))
>      {
> diff --git a/gdb/f-valprint.c b/gdb/f-valprint.c
> index 8d74f03..2e5519b 100644
> --- a/gdb/f-valprint.c
> +++ b/gdb/f-valprint.c
> @@ -264,7 +264,7 @@ f_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
>    CORE_ADDR addr;
>    int index;
>  
> -  CHECK_TYPEDEF (type);
> +  type = check_typedef (type);
>    switch (TYPE_CODE (type))
>      {
>      case TYPE_CODE_STRING:
> diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
> index ca86fbd..e44fd4f 100644
> --- a/gdb/gdbtypes.c
> +++ b/gdb/gdbtypes.c
> @@ -898,7 +898,7 @@ has_static_range (const struct range_bounds *bounds)
>  int
>  get_discrete_bounds (struct type *type, LONGEST *lowp, LONGEST *highp)
>  {
> -  CHECK_TYPEDEF (type);
> +  type = check_typedef (type);
>    switch (TYPE_CODE (type))
>      {
>      case TYPE_CODE_RANGE:
> @@ -1074,7 +1074,7 @@ create_array_type_with_stride (struct type *result_type,
>  
>        if (get_discrete_bounds (range_type, &low_bound, &high_bound) < 0)
>  	low_bound = high_bound = 0;
> -      CHECK_TYPEDEF (element_type);
> +      element_type = check_typedef (element_type);
>        /* Be careful when setting the array length.  Ada arrays can be
>  	 empty arrays with the high_bound being smaller than the low_bound.
>  	 In such cases, the array length should be zero.  */
> @@ -1383,7 +1383,7 @@ type_name_no_tag_or_error (struct type *type)
>    const char *name;
>    struct objfile *objfile;
>  
> -  CHECK_TYPEDEF (type);
> +  type = check_typedef (type);
>  
>    name = type_name_no_tag (type);
>    if (name != NULL)
> @@ -1562,7 +1562,7 @@ lookup_struct_elt_type (struct type *type, const char *name, int noerr)
>  
>    for (;;)
>      {
> -      CHECK_TYPEDEF (type);
> +      type = check_typedef (type);
>        if (TYPE_CODE (type) != TYPE_CODE_PTR
>  	  && TYPE_CODE (type) != TYPE_CODE_REF)
>  	break;
> @@ -1639,7 +1639,7 @@ get_unsigned_type_max (struct type *type, ULONGEST *max)
>  {
>    unsigned int n;
>  
> -  CHECK_TYPEDEF (type);
> +  type = check_typedef (type);
>    gdb_assert (TYPE_CODE (type) == TYPE_CODE_INT && TYPE_UNSIGNED (type));
>    gdb_assert (TYPE_LENGTH (type) <= sizeof (ULONGEST));
>  
> @@ -1656,7 +1656,7 @@ get_signed_type_minmax (struct type *type, LONGEST *min, LONGEST *max)
>  {
>    unsigned int n;
>  
> -  CHECK_TYPEDEF (type);
> +  type = check_typedef (type);
>    gdb_assert (TYPE_CODE (type) == TYPE_CODE_INT && !TYPE_UNSIGNED (type));
>    gdb_assert (TYPE_LENGTH (type) <= sizeof (LONGEST));
>  
> @@ -1675,7 +1675,7 @@ get_signed_type_minmax (struct type *type, LONGEST *min, LONGEST *max)
>  int
>  internal_type_vptr_fieldno (struct type *type)
>  {
> -  CHECK_TYPEDEF (type);
> +  type = check_typedef (type);
>    gdb_assert (TYPE_CODE (type) == TYPE_CODE_STRUCT
>  	      || TYPE_CODE (type) == TYPE_CODE_UNION);
>    if (!HAVE_CPLUS_STRUCT (type))
> @@ -1688,7 +1688,7 @@ internal_type_vptr_fieldno (struct type *type)
>  void
>  set_type_vptr_fieldno (struct type *type, int fieldno)
>  {
> -  CHECK_TYPEDEF (type);
> +  type = check_typedef (type);
>    gdb_assert (TYPE_CODE (type) == TYPE_CODE_STRUCT
>  	      || TYPE_CODE (type) == TYPE_CODE_UNION);
>    if (!HAVE_CPLUS_STRUCT (type))
> @@ -1702,7 +1702,7 @@ set_type_vptr_fieldno (struct type *type, int fieldno)
>  struct type *
>  internal_type_vptr_basetype (struct type *type)
>  {
> -  CHECK_TYPEDEF (type);
> +  type = check_typedef (type);
>    gdb_assert (TYPE_CODE (type) == TYPE_CODE_STRUCT
>  	      || TYPE_CODE (type) == TYPE_CODE_UNION);
>    gdb_assert (TYPE_SPECIFIC_FIELD (type) == TYPE_SPECIFIC_CPLUS_STUFF);
> @@ -1714,7 +1714,7 @@ internal_type_vptr_basetype (struct type *type)
>  void
>  set_type_vptr_basetype (struct type *type, struct type *basetype)
>  {
> -  CHECK_TYPEDEF (type);
> +  type = check_typedef (type);
>    gdb_assert (TYPE_CODE (type) == TYPE_CODE_STRUCT
>  	      || TYPE_CODE (type) == TYPE_CODE_UNION);
>    if (!HAVE_CPLUS_STRUCT (type))
> @@ -1737,7 +1737,7 @@ set_type_vptr_basetype (struct type *type, struct type *basetype)
>  int
>  get_vptr_fieldno (struct type *type, struct type **basetypep)
>  {
> -  CHECK_TYPEDEF (type);
> +  type = check_typedef (type);
>  
>    if (TYPE_VPTR_FIELDNO (type) < 0)
>      {
> @@ -2679,7 +2679,7 @@ can_dereference (struct type *t)
>  {
>    /* FIXME: Should we return true for references as well as
>       pointers?  */
> -  CHECK_TYPEDEF (t);
> +  t = check_typedef (t);
>    return
>      (t != NULL
>       && TYPE_CODE (t) == TYPE_CODE_PTR
> @@ -2689,7 +2689,7 @@ can_dereference (struct type *t)
>  int
>  is_integral_type (struct type *t)
>  {
> -  CHECK_TYPEDEF (t);
> +  t = check_typedef (t);
>    return
>      ((t != NULL)
>       && ((TYPE_CODE (t) == TYPE_CODE_INT)
> @@ -2705,7 +2705,7 @@ is_integral_type (struct type *t)
>  static int
>  is_scalar_type (struct type *type)
>  {
> -  CHECK_TYPEDEF (type);
> +  type = check_typedef (type);
>  
>    switch (TYPE_CODE (type))
>      {
> @@ -2727,7 +2727,7 @@ is_scalar_type (struct type *type)
>  int
>  is_scalar_type_recursive (struct type *t)
>  {
> -  CHECK_TYPEDEF (t);
> +  t = check_typedef (t);
>  
>    if (is_scalar_type (t))
>      return 1;
> @@ -2809,8 +2809,8 @@ distance_to_ancestor (struct type *base, struct type *dclass, int is_public)
>    int i;
>    int d;
>  
> -  CHECK_TYPEDEF (base);
> -  CHECK_TYPEDEF (dclass);
> +  base = check_typedef (base);
> +  dclass = check_typedef (dclass);
>  
>    if (class_types_same_p (base, dclass))
>      return 0;
> @@ -2859,8 +2859,8 @@ is_unique_ancestor_worker (struct type *base, struct type *dclass,
>  {
>    int i, count = 0;
>  
> -  CHECK_TYPEDEF (base);
> -  CHECK_TYPEDEF (dclass);
> +  base = check_typedef (base);
> +  dclass = check_typedef (dclass);
>  
>    for (i = 0; i < TYPE_N_BASECLASSES (dclass) && count < 2; ++i)
>      {
> @@ -3179,8 +3179,8 @@ static int
>  check_types_equal (struct type *type1, struct type *type2,
>  		   VEC (type_equality_entry_d) **worklist)
>  {
> -  CHECK_TYPEDEF (type1);
> -  CHECK_TYPEDEF (type2);
> +  type1 = check_typedef (type1);
> +  type2 = check_typedef (type2);
>  
>    if (type1 == type2)
>      return 1;
> diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h
> index fd3bc0e..c166e48 100644
> --- a/gdb/gdbtypes.h
> +++ b/gdb/gdbtypes.h
> @@ -1814,11 +1814,6 @@ extern void add_dyn_prop
>  
>  extern struct type *check_typedef (struct type *);
>  
> -#define CHECK_TYPEDEF(TYPE)			\
> -  do {						\
> -    (TYPE) = check_typedef (TYPE);		\
> -  } while (0)
> -
>  extern void check_stub_method_group (struct type *, int);
>  
>  extern char *gdb_mangle_name (struct type *, int, int);
> diff --git a/gdb/gnu-v2-abi.c b/gdb/gnu-v2-abi.c
> index 68b734c..c508b55 100644
> --- a/gdb/gnu-v2-abi.c
> +++ b/gdb/gnu-v2-abi.c
> @@ -204,7 +204,7 @@ gnuv2_value_rtti_type (struct value *v, int *full, int *top, int *using_enc)
>  
>    /* Get declared type.  */
>    known_type = value_type (v);
> -  CHECK_TYPEDEF (known_type);
> +  known_type = check_typedef (known_type);
>    /* RTTI works only or class objects.  */
>    if (TYPE_CODE (known_type) != TYPE_CODE_STRUCT)
>      return NULL;
> @@ -225,7 +225,7 @@ gnuv2_value_rtti_type (struct value *v, int *full, int *top, int *using_enc)
>    /* Make sure our basetype and known type match, otherwise, cast
>       so we can get at the vtable properly.  */
>    btype = known_type_vptr_basetype;
> -  CHECK_TYPEDEF (btype);
> +  btype = check_typedef (btype);
>    if (btype != known_type )
>      {
>        v = value_cast (btype, v);
> diff --git a/gdb/gnu-v3-abi.c b/gdb/gnu-v3-abi.c
> index 5c04011..e233fe6 100644
> --- a/gdb/gnu-v3-abi.c
> +++ b/gdb/gnu-v3-abi.c
> @@ -202,7 +202,7 @@ gnuv3_dynamic_class (struct type *type)
>  {
>    int fieldnum, fieldelem;
>  
> -  CHECK_TYPEDEF (type);
> +  type = check_typedef (type);
>    gdb_assert (TYPE_CODE (type) == TYPE_CODE_STRUCT
>  	      || TYPE_CODE (type) == TYPE_CODE_UNION);
>  
> @@ -253,7 +253,7 @@ gnuv3_get_vtable (struct gdbarch *gdbarch,
>    struct value *vtable_pointer;
>    CORE_ADDR vtable_address;
>  
> -  CHECK_TYPEDEF (container_type);
> +  container_type = check_typedef (container_type);
>    gdb_assert (TYPE_CODE (container_type) == TYPE_CODE_STRUCT);
>  
>    /* If this type does not have a virtual table, don't read the first
> @@ -1293,7 +1293,7 @@ gnuv3_pass_by_reference (struct type *type)
>  {
>    int fieldnum, fieldelem;
>  
> -  CHECK_TYPEDEF (type);
> +  type = check_typedef (type);
>  
>    /* We're only interested in things that can have methods.  */
>    if (TYPE_CODE (type) != TYPE_CODE_STRUCT
> diff --git a/gdb/go-exp.y b/gdb/go-exp.y
> index bada4cf..a719d2f 100644
> --- a/gdb/go-exp.y
> +++ b/gdb/go-exp.y
> @@ -508,7 +508,7 @@ exp	:	SIZEOF_KEYWORD '(' type ')'  %prec UNARY
>  			  write_exp_elt_type
>  			    (pstate,
>  			     parse_type (pstate)->builtin_unsigned_int);
> -			  CHECK_TYPEDEF ($3);
> +			  $3 = check_typedef ($3);
>  			  write_exp_elt_longcst (pstate,
>  						 (LONGEST) TYPE_LENGTH ($3));
>  			  write_exp_elt_opcode (pstate, OP_LONG);
> diff --git a/gdb/go-lang.c b/gdb/go-lang.c
> index b48467d..2835dd9 100644
> --- a/gdb/go-lang.c
> +++ b/gdb/go-lang.c
> @@ -77,8 +77,8 @@ gccgo_string_p (struct type *type)
>        struct type *type0 = TYPE_FIELD_TYPE (type, 0);
>        struct type *type1 = TYPE_FIELD_TYPE (type, 1);
>  
> -      CHECK_TYPEDEF (type0);
> -      CHECK_TYPEDEF (type1);
> +      type0 = check_typedef (type0);
> +      type1 = check_typedef (type1);
>  
>        if (TYPE_CODE (type0) == TYPE_CODE_PTR
>  	  && strcmp (TYPE_FIELD_NAME (type, 0), "__data") == 0
> @@ -87,7 +87,7 @@ gccgo_string_p (struct type *type)
>  	{
>  	  struct type *target_type = TYPE_TARGET_TYPE (type0);
>  
> -	  CHECK_TYPEDEF (target_type);
> +	  target_type = check_typedef (target_type);
>  
>  	  if (TYPE_CODE (target_type) == TYPE_CODE_INT
>  	      && TYPE_LENGTH (target_type) == 1
> @@ -119,7 +119,7 @@ sixg_string_p (struct type *type)
>  enum go_type
>  go_classify_struct_type (struct type *type)
>  {
> -  CHECK_TYPEDEF (type);
> +  type = check_typedef (type);
>  
>    /* Recognize strings as they're useful to be able to print without
>       pretty-printers.  */
> diff --git a/gdb/go-typeprint.c b/gdb/go-typeprint.c
> index c35a552..6e7625e 100644
> --- a/gdb/go-typeprint.c
> +++ b/gdb/go-typeprint.c
> @@ -48,7 +48,7 @@ go_print_type (struct type *type, const char *varstring,
>  {
>    /* Borrowed from c-typeprint.c.  */
>    if (show > 0)
> -    CHECK_TYPEDEF (type);
> +    type = check_typedef (type);
>  
>    /* Print the type of "abc" as "string", not char[4].  */
>    if (TYPE_CODE (type) == TYPE_CODE_ARRAY
> diff --git a/gdb/go-valprint.c b/gdb/go-valprint.c
> index 5779a1c..a40d6f2 100644
> --- a/gdb/go-valprint.c
> +++ b/gdb/go-valprint.c
> @@ -91,7 +91,7 @@ go_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
>  	      const struct value *val,
>  	      const struct value_print_options *options)
>  {
> -  CHECK_TYPEDEF (type);
> +  type = check_typedef (type);
>  
>    switch (TYPE_CODE (type))
>      {
> diff --git a/gdb/guile/scm-math.c b/gdb/guile/scm-math.c
> index 4b6bb5d..5fbe0eb 100644
> --- a/gdb/guile/scm-math.c
> +++ b/gdb/guile/scm-math.c
> @@ -186,9 +186,9 @@ vlscm_binop (enum valscm_binary_opcode opcode, SCM x, SCM y,
>  	    struct type *ltype = value_type (arg1);
>  	    struct type *rtype = value_type (arg2);
>  
> -	    CHECK_TYPEDEF (ltype);
> +	    ltype = check_typedef (ltype);
>  	    ltype = STRIP_REFERENCE (ltype);
> -	    CHECK_TYPEDEF (rtype);
> +	    rtype = check_typedef (rtype);
>  	    rtype = STRIP_REFERENCE (rtype);
>  
>  	    if (TYPE_CODE (ltype) == TYPE_CODE_PTR
> @@ -206,9 +206,9 @@ vlscm_binop (enum valscm_binary_opcode opcode, SCM x, SCM y,
>  	    struct type *ltype = value_type (arg1);
>  	    struct type *rtype = value_type (arg2);
>  
> -	    CHECK_TYPEDEF (ltype);
> +	    ltype = check_typedef (ltype);
>  	    ltype = STRIP_REFERENCE (ltype);
> -	    CHECK_TYPEDEF (rtype);
> +	    rtype = check_typedef (rtype);
>  	    rtype = STRIP_REFERENCE (rtype);
>  
>  	    if (TYPE_CODE (ltype) == TYPE_CODE_PTR
> diff --git a/gdb/guile/scm-value.c b/gdb/guile/scm-value.c
> index 3789c38..d26ab0d 100644
> --- a/gdb/guile/scm-value.c
> +++ b/gdb/guile/scm-value.c
> @@ -581,7 +581,7 @@ gdbscm_value_dynamic_type (SCM self)
>  	= make_cleanup_value_free_to_mark (value_mark ());
>  
>        type = value_type (value);
> -      CHECK_TYPEDEF (type);
> +      type = check_typedef (type);
>  
>        if (((TYPE_CODE (type) == TYPE_CODE_PTR)
>  	   || (TYPE_CODE (type) == TYPE_CODE_REF))
> @@ -906,7 +906,7 @@ gdbscm_value_to_bytevector (SCM self)
>  
>    TRY
>      {
> -      CHECK_TYPEDEF (type);
> +      type = check_typedef (type);
>        length = TYPE_LENGTH (type);
>        contents = value_contents (value);
>      }
> @@ -950,7 +950,7 @@ gdbscm_value_to_bool (SCM self)
>  
>    TRY
>      {
> -      CHECK_TYPEDEF (type);
> +      type = check_typedef (type);
>      }
>    CATCH (except, RETURN_MASK_ALL)
>      {
> @@ -993,7 +993,7 @@ gdbscm_value_to_integer (SCM self)
>  
>    TRY
>      {
> -      CHECK_TYPEDEF (type);
> +      type = check_typedef (type);
>      }
>    CATCH (except, RETURN_MASK_ALL)
>      {
> @@ -1039,7 +1039,7 @@ gdbscm_value_to_real (SCM self)
>  
>    TRY
>      {
> -      CHECK_TYPEDEF (type);
> +      type = check_typedef (type);
>      }
>    CATCH (except, RETURN_MASK_ALL)
>      {
> diff --git a/gdb/infcall.c b/gdb/infcall.c
> index e3bd72a..139c361 100644
> --- a/gdb/infcall.c
> +++ b/gdb/infcall.c
> @@ -757,7 +757,7 @@ call_function_by_hand_dummy (struct value *function,
>    if (!values_type)
>      values_type = builtin_type (gdbarch)->builtin_int;
>  
> -  CHECK_TYPEDEF (values_type);
> +  values_type = check_typedef (values_type);
>  
>    /* Are we returning a value using a structure return (passing a
>       hidden argument pointing to storage) or a normal value return?
> diff --git a/gdb/infcmd.c b/gdb/infcmd.c
> index 03282a7..4948d27 100644
> --- a/gdb/infcmd.c
> +++ b/gdb/infcmd.c
> @@ -1530,7 +1530,7 @@ get_return_value (struct value *function, struct type *value_type,
>  
>    gdbarch = get_regcache_arch (stop_regs);
>  
> -  CHECK_TYPEDEF (value_type);
> +  value_type = check_typedef (value_type);
>    gdb_assert (TYPE_CODE (value_type) != TYPE_CODE_VOID);
>  
>    /* FIXME: 2003-09-27: When returning from a nested inferior function
> diff --git a/gdb/jv-lang.c b/gdb/jv-lang.c
> index 0d635c7..fee816c 100644
> --- a/gdb/jv-lang.c
> +++ b/gdb/jv-lang.c
> @@ -610,7 +610,7 @@ get_java_object_header_size (struct gdbarch *gdbarch)
>  int
>  is_object_type (struct type *type)
>  {
> -  CHECK_TYPEDEF (type);
> +  type = check_typedef (type);
>    if (TYPE_CODE (type) == TYPE_CODE_PTR)
>      {
>        struct type *ttype = check_typedef (TYPE_TARGET_TYPE (type));
> diff --git a/gdb/jv-typeprint.c b/gdb/jv-typeprint.c
> index 0bf6d10..3ea81c3 100644
> --- a/gdb/jv-typeprint.c
> +++ b/gdb/jv-typeprint.c
> @@ -110,7 +110,7 @@ java_type_print_base (struct type *type, struct ui_file *stream, int show,
>        return;
>      }
>  
> -  CHECK_TYPEDEF (type);
> +  type = check_typedef (type);
>  
>    switch (TYPE_CODE (type))
>      {
> diff --git a/gdb/jv-valprint.c b/gdb/jv-valprint.c
> index 1ad599b..9fc8f50 100644
> --- a/gdb/jv-valprint.c
> +++ b/gdb/jv-valprint.c
> @@ -273,7 +273,7 @@ java_print_value_fields (struct type *type, const gdb_byte *valaddr,
>  {
>    int i, len, n_baseclasses;
>  
> -  CHECK_TYPEDEF (type);
> +  type = check_typedef (type);
>  
>    fprintf_filtered (stream, "{");
>    len = TYPE_NFIELDS (type);
> @@ -462,7 +462,7 @@ java_val_print (struct type *type, const gdb_byte *valaddr,
>    struct type *target_type;
>    CORE_ADDR addr;
>  
> -  CHECK_TYPEDEF (type);
> +  type = check_typedef (type);
>    switch (TYPE_CODE (type))
>      {
>      case TYPE_CODE_PTR:
> diff --git a/gdb/linespec.c b/gdb/linespec.c
> index 65155d9..81f526d 100644
> --- a/gdb/linespec.c
> +++ b/gdb/linespec.c
> @@ -1129,7 +1129,7 @@ find_methods (struct type *t, const char *name,
>      {
>        int method_counter;
>  
> -      CHECK_TYPEDEF (t);
> +      t = check_typedef (t);
>  
>        /* Loop over each method name.  At this level, all overloads of a name
>           are counted as a single name.  There is an inner loop which loops over
> @@ -2717,7 +2717,7 @@ collect_one_symbol (struct symbol *sym, void *d)
>      return 1; /* Continue iterating.  */
>  
>    t = SYMBOL_TYPE (sym);
> -  CHECK_TYPEDEF (t);
> +  t = check_typedef (t);
>    if (TYPE_CODE (t) != TYPE_CODE_STRUCT
>        && TYPE_CODE (t) != TYPE_CODE_UNION
>        && TYPE_CODE (t) != TYPE_CODE_NAMESPACE)
> diff --git a/gdb/m2-typeprint.c b/gdb/m2-typeprint.c
> index be19872..a1a33e5 100644
> --- a/gdb/m2-typeprint.c
> +++ b/gdb/m2-typeprint.c
> @@ -74,7 +74,7 @@ m2_print_type (struct type *type, const char *varstring,
>  	       int show, int level,
>  	       const struct type_print_options *flags)
>  {
> -  CHECK_TYPEDEF (type);
> +  type = check_typedef (type);
>  
>    QUIT;
>  
> @@ -160,7 +160,7 @@ void
>  m2_print_typedef (struct type *type, struct symbol *new_symbol,
>  		  struct ui_file *stream)
>  {
> -  CHECK_TYPEDEF (type);
> +  type = check_typedef (type);
>    fprintf_filtered (stream, "TYPE ");
>    if (!TYPE_NAME (SYMBOL_TYPE (new_symbol))
>        || strcmp (TYPE_NAME ((SYMBOL_TYPE (new_symbol))),
> @@ -373,7 +373,7 @@ m2_is_long_set (struct type *type)
>  static int
>  m2_get_discrete_bounds (struct type *type, LONGEST *lowp, LONGEST *highp)
>  {
> -  CHECK_TYPEDEF (type);
> +  type = check_typedef (type);
>    switch (TYPE_CODE (type))
>      {
>      case TYPE_CODE_CHAR:
> diff --git a/gdb/m2-valprint.c b/gdb/m2-valprint.c
> index 7afcce3..f592933 100644
> --- a/gdb/m2-valprint.c
> +++ b/gdb/m2-valprint.c
> @@ -81,7 +81,7 @@ m2_print_long_set (struct type *type, const gdb_byte *valaddr,
>    struct type *target;
>    int bitval;
>  
> -  CHECK_TYPEDEF (type);
> +  type = check_typedef (type);
>  
>    fprintf_filtered (stream, "{");
>    len = TYPE_NFIELDS (type);
> @@ -167,7 +167,7 @@ m2_print_unbounded_array (struct type *type, const gdb_byte *valaddr,
>    LONGEST len;
>    struct value *val;
>  
> -  CHECK_TYPEDEF (type);
> +  type = check_typedef (type);
>    content_type = TYPE_TARGET_TYPE (TYPE_FIELD_TYPE (type, 0));
>  
>    addr = unpack_pointer (TYPE_FIELD_TYPE (type, 0),
> @@ -268,7 +268,7 @@ m2_print_array_contents (struct type *type, const gdb_byte *valaddr,
>  			 const struct value_print_options *options,
>  			 int len)
>  {
> -  CHECK_TYPEDEF (type);
> +  type = check_typedef (type);
>  
>    if (TYPE_LENGTH (type) > 0)
>      {
> @@ -319,7 +319,7 @@ m2_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
>    struct type *elttype;
>    CORE_ADDR addr;
>  
> -  CHECK_TYPEDEF (type);
> +  type = check_typedef (type);
>    switch (TYPE_CODE (type))
>      {
>      case TYPE_CODE_ARRAY:
> @@ -406,7 +406,7 @@ m2_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
>  
>      case TYPE_CODE_SET:
>        elttype = TYPE_INDEX_TYPE (type);
> -      CHECK_TYPEDEF (elttype);
> +      elttype = check_typedef (elttype);
>        if (TYPE_STUB (elttype))
>  	{
>  	  fprintf_filtered (stream, _("<incomplete type>"));
> diff --git a/gdb/opencl-lang.c b/gdb/opencl-lang.c
> index dd1e944..6583d15 100644
> --- a/gdb/opencl-lang.c
> +++ b/gdb/opencl-lang.c
> @@ -1007,7 +1007,7 @@ opencl_print_type (struct type *type, const char *varstring,
>       be printed using their TYPE_NAME.  */
>    if (show > 0)
>      {
> -      CHECK_TYPEDEF (type);
> +      type = check_typedef (type);
>        if (TYPE_CODE (type) == TYPE_CODE_ARRAY && TYPE_VECTOR (type)
>  	  && TYPE_NAME (type) != NULL)
>  	show = 0;
> diff --git a/gdb/p-exp.y b/gdb/p-exp.y
> index 9e2dc82..5d5c22b 100644
> --- a/gdb/p-exp.y
> +++ b/gdb/p-exp.y
> @@ -596,7 +596,7 @@ exp	:	SIZEOF '(' type ')'	%prec UNARY
>  			  write_exp_elt_type (pstate,
>  					    parse_type (pstate)->builtin_int);
>  			  current_type = parse_type (pstate)->builtin_int;
> -			  CHECK_TYPEDEF ($3);
> +			  $3 = check_typedef ($3);
>  			  write_exp_elt_longcst (pstate,
>  						 (LONGEST) TYPE_LENGTH ($3));
>  			  write_exp_elt_opcode (pstate, OP_LONG); }
> diff --git a/gdb/p-typeprint.c b/gdb/p-typeprint.c
> index b5bf4d4..40ece58 100644
> --- a/gdb/p-typeprint.c
> +++ b/gdb/p-typeprint.c
> @@ -55,7 +55,7 @@ pascal_print_type (struct type *type, const char *varstring,
>    code = TYPE_CODE (type);
>  
>    if (show > 0)
> -    CHECK_TYPEDEF (type);
> +    type = check_typedef (type);
>  
>    if ((code == TYPE_CODE_FUNC
>         || code == TYPE_CODE_METHOD))
> @@ -96,7 +96,7 @@ void
>  pascal_print_typedef (struct type *type, struct symbol *new_symbol,
>  		      struct ui_file *stream)
>  {
> -  CHECK_TYPEDEF (type);
> +  type = check_typedef (type);
>    fprintf_filtered (stream, "type ");
>    fprintf_filtered (stream, "%s = ", SYMBOL_PRINT_NAME (new_symbol));
>    type_print (type, "", stream, 0);
> @@ -479,7 +479,7 @@ pascal_type_print_base (struct type *type, struct ui_file *stream, int show,
>        return;
>      }
>  
> -  CHECK_TYPEDEF (type);
> +  type = check_typedef (type);
>  
>    switch (TYPE_CODE (type))
>      {
> diff --git a/gdb/p-valprint.c b/gdb/p-valprint.c
> index a66ff44..f736a79 100644
> --- a/gdb/p-valprint.c
> +++ b/gdb/p-valprint.c
> @@ -74,7 +74,7 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr,
>    CORE_ADDR addr;
>    int want_space = 0;
>  
> -  CHECK_TYPEDEF (type);
> +  type = check_typedef (type);
>    switch (TYPE_CODE (type))
>      {
>      case TYPE_CODE_ARRAY:
> @@ -336,7 +336,7 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr,
>  
>      case TYPE_CODE_SET:
>        elttype = TYPE_INDEX_TYPE (type);
> -      CHECK_TYPEDEF (elttype);
> +      elttype = check_typedef (elttype);
>        if (TYPE_STUB (elttype))
>  	{
>  	  fprintf_filtered (stream, "<incomplete type>");
> @@ -537,7 +537,7 @@ pascal_object_print_value_fields (struct type *type, const gdb_byte *valaddr,
>    int i, len, n_baseclasses;
>    char *last_dont_print = obstack_next_free (&dont_print_statmem_obstack);
>  
> -  CHECK_TYPEDEF (type);
> +  type = check_typedef (type);
>  
>    fprintf_filtered (stream, "{");
>    len = TYPE_NFIELDS (type);
> @@ -872,7 +872,7 @@ pascal_object_print_static_field (struct value *val,
>        obstack_grow (&dont_print_statmem_obstack, (char *) &addr,
>  		    sizeof (CORE_ADDR));
>  
> -      CHECK_TYPEDEF (type);
> +      type = check_typedef (type);
>        pascal_object_print_value_fields (type,
>  					value_contents_for_printing (val),
>  					value_embedded_offset (val),
> diff --git a/gdb/python/py-type.c b/gdb/python/py-type.c
> index 648d8c8..e202c83 100644
> --- a/gdb/python/py-type.c
> +++ b/gdb/python/py-type.c
> @@ -346,7 +346,7 @@ typy_fields_items (PyObject *self, enum gdbpy_iter_kind kind)
>  
>    TRY
>      {
> -      CHECK_TYPEDEF (checked_type);
> +      checked_type = check_typedef (checked_type);
>      }
>    CATCH (except, RETURN_MASK_ALL)
>      {
> @@ -477,7 +477,7 @@ typy_get_composite (struct type *type)
>      {
>        TRY
>  	{
> -	  CHECK_TYPEDEF (type);
> +	  type = check_typedef (type);
>  	}
>        CATCH (except, RETURN_MASK_ALL)
>  	{
> diff --git a/gdb/python/py-value.c b/gdb/python/py-value.c
> index 97eb66a..ec26bc8 100644
> --- a/gdb/python/py-value.c
> +++ b/gdb/python/py-value.c
> @@ -356,7 +356,7 @@ valpy_get_dynamic_type (PyObject *self, void *closure)
>        struct cleanup *cleanup = make_cleanup_value_free_to_mark (value_mark ());
>  
>        type = value_type (val);
> -      CHECK_TYPEDEF (type);
> +      type = check_typedef (type);
>  
>        if (((TYPE_CODE (type) == TYPE_CODE_PTR)
>  	   || (TYPE_CODE (type) == TYPE_CODE_REF))
> @@ -1059,9 +1059,9 @@ valpy_binop (enum valpy_opcode opcode, PyObject *self, PyObject *other)
>  	    struct type *ltype = value_type (arg1);
>  	    struct type *rtype = value_type (arg2);
>  
> -	    CHECK_TYPEDEF (ltype);
> +	    ltype = check_typedef (ltype);
>  	    ltype = STRIP_REFERENCE (ltype);
> -	    CHECK_TYPEDEF (rtype);
> +	    rtype = check_typedef (rtype);
>  	    rtype = STRIP_REFERENCE (rtype);
>  
>  	    handled = 1;
> @@ -1083,9 +1083,9 @@ valpy_binop (enum valpy_opcode opcode, PyObject *self, PyObject *other)
>  	    struct type *ltype = value_type (arg1);
>  	    struct type *rtype = value_type (arg2);
>  
> -	    CHECK_TYPEDEF (ltype);
> +	    ltype = check_typedef (ltype);
>  	    ltype = STRIP_REFERENCE (ltype);
> -	    CHECK_TYPEDEF (rtype);
> +	    rtype = check_typedef (rtype);
>  	    rtype = STRIP_REFERENCE (rtype);
>  
>  	    handled = 1;
> @@ -1474,7 +1474,7 @@ valpy_long (PyObject *self)
>  
>    TRY
>      {
> -      CHECK_TYPEDEF (type);
> +      type = check_typedef (type);
>  
>        if (!is_integral_type (type)
>  	  && TYPE_CODE (type) != TYPE_CODE_PTR)
> @@ -1501,7 +1501,7 @@ valpy_float (PyObject *self)
>  
>    TRY
>      {
> -      CHECK_TYPEDEF (type);
> +      type = check_typedef (type);
>  
>        if (TYPE_CODE (type) != TYPE_CODE_FLT)
>  	error (_("Cannot convert value to float."));
> diff --git a/gdb/stack.c b/gdb/stack.c
> index 39803d9..4878825 100644
> --- a/gdb/stack.c
> +++ b/gdb/stack.c
> @@ -2415,7 +2415,7 @@ return_command (char *retval_exp, int from_tty)
>  	  return_type = value_type (return_value);
>  	}
>        do_cleanups (old_chain);
> -      CHECK_TYPEDEF (return_type);
> +      return_type = check_typedef (return_type);
>        return_value = value_cast (return_type, return_value);
>  
>        /* Make sure the value is fully evaluated.  It may live in the
> diff --git a/gdb/symtab.c b/gdb/symtab.c
> index 2b6af6c..decc5a9 100644
> --- a/gdb/symtab.c
> +++ b/gdb/symtab.c
> @@ -2030,7 +2030,7 @@ check_field (struct type *type, const char *name,
>    int i;
>  
>    /* The type may be a stub.  */
> -  CHECK_TYPEDEF (type);
> +  type = check_typedef (type);
>  
>    for (i = TYPE_NFIELDS (type) - 1; i >= TYPE_N_BASECLASSES (type); i--)
>      {
> @@ -2133,7 +2133,7 @@ lookup_symbol_aux (const char *name, const struct block *block,
>  
>  	  /* I'm not really sure that type of this can ever
>  	     be typedefed; just be safe.  */
> -	  CHECK_TYPEDEF (t);
> +	  t = check_typedef (t);
>  	  if (TYPE_CODE (t) == TYPE_CODE_PTR
>  	      || TYPE_CODE (t) == TYPE_CODE_REF)
>  	    t = TYPE_TARGET_TYPE (t);
> diff --git a/gdb/tic6x-tdep.c b/gdb/tic6x-tdep.c
> index 2603f91..3fc5642 100644
> --- a/gdb/tic6x-tdep.c
> +++ b/gdb/tic6x-tdep.c
> @@ -807,7 +807,7 @@ tic6x_return_value (struct gdbarch *gdbarch, struct value *function,
>      {
>        if (type != NULL)
>  	{
> -	  CHECK_TYPEDEF (type);
> +	  type = check_typedef (type);
>  	  if (language_pass_by_reference (type))
>  	    return RETURN_VALUE_STRUCT_CONVENTION;
>  	}
> diff --git a/gdb/typeprint.c b/gdb/typeprint.c
> index 5a97ace..9e44225 100644
> --- a/gdb/typeprint.c
> +++ b/gdb/typeprint.c
> @@ -524,7 +524,7 @@ print_type_scalar (struct type *type, LONGEST val, struct ui_file *stream)
>    unsigned int i;
>    unsigned len;
>  
> -  CHECK_TYPEDEF (type);
> +  type = check_typedef (type);
>  
>    switch (TYPE_CODE (type))
>      {
> diff --git a/gdb/valarith.c b/gdb/valarith.c
> index df1e8c3..0162c10 100644
> --- a/gdb/valarith.c
> +++ b/gdb/valarith.c
> @@ -1391,7 +1391,7 @@ value_vector_widen (struct value *scalar_value, struct type *vector_type)
>    LONGEST low_bound, high_bound;
>    int i;
>  
> -  CHECK_TYPEDEF (vector_type);
> +  vector_type = check_typedef (vector_type);
>  
>    gdb_assert (TYPE_CODE (vector_type) == TYPE_CODE_ARRAY
>  	      && TYPE_VECTOR (vector_type));
> diff --git a/gdb/valops.c b/gdb/valops.c
> index 50082c9..6d10eca 100644
> --- a/gdb/valops.c
> +++ b/gdb/valops.c
> @@ -381,7 +381,7 @@ value_cast (struct type *type, struct value *arg2)
>      /* We deref the value and then do the cast.  */
>      return value_cast (type, coerce_ref (arg2)); 
>  
> -  CHECK_TYPEDEF (type);
> +  type = check_typedef (type);
>    code1 = TYPE_CODE (type);
>    arg2 = coerce_ref (arg2);
>    type2 = check_typedef (value_type (arg2));
> @@ -1012,7 +1012,7 @@ value_assign (struct value *toval, struct value *fromval)
>  	fromval = coerce_array (fromval);
>      }
>  
> -  CHECK_TYPEDEF (type);
> +  type = check_typedef (type);
>  
>    /* Since modifying a register can trash the frame chain, and
>       modifying memory can trash the frame cache, we save the old frame
> @@ -1804,7 +1804,7 @@ do_search_struct_field (const char *name, struct value *arg1, int offset,
>    int i;
>    int nbases;
>  
> -  CHECK_TYPEDEF (type);
> +  type = check_typedef (type);
>    nbases = TYPE_N_BASECLASSES (type);
>  
>    if (!looking_for_baseclass)
> @@ -1985,7 +1985,7 @@ search_struct_method (const char *name, struct value **arg1p,
>    int name_matched = 0;
>    char dem_opname[64];
>  
> -  CHECK_TYPEDEF (type);
> +  type = check_typedef (type);
>    for (i = TYPE_NFN_FIELDS (type) - 1; i >= 0; i--)
>      {
>        const char *t_field_name = TYPE_FN_FIELDLIST_NAME (type, i);
> @@ -2287,7 +2287,7 @@ find_method_list (struct value **argp, const char *method,
>    VEC (xmethod_worker_ptr) *worker_vec = NULL, *new_vec = NULL;
>  
>    gdb_assert (fn_list != NULL && xm_worker_vec != NULL);
> -  CHECK_TYPEDEF (type);
> +  type = check_typedef (type);
>  
>    /* First check in object itself.
>       This function is called recursively to search through base classes.
> diff --git a/gdb/valprint.c b/gdb/valprint.c
> index 294c6a8..52a386a 100644
> --- a/gdb/valprint.c
> +++ b/gdb/valprint.c
> @@ -274,11 +274,11 @@ show_symbol_print (struct ui_file *file, int from_tty,
>  int
>  val_print_scalar_type_p (struct type *type)
>  {
> -  CHECK_TYPEDEF (type);
> +  type = check_typedef (type);
>    while (TYPE_CODE (type) == TYPE_CODE_REF)
>      {
>        type = TYPE_TARGET_TYPE (type);
> -      CHECK_TYPEDEF (type);
> +      type = check_typedef (type);
>      }
>    switch (TYPE_CODE (type))
>      {
> @@ -301,7 +301,7 @@ valprint_check_validity (struct ui_file *stream,
>  			 int embedded_offset,
>  			 const struct value *val)
>  {
> -  CHECK_TYPEDEF (type);
> +  type = check_typedef (type);
>  
>    if (TYPE_CODE (type) != TYPE_CODE_UNION
>        && TYPE_CODE (type) != TYPE_CODE_STRUCT
> @@ -386,7 +386,7 @@ generic_val_print (struct type *type, const gdb_byte *valaddr,
>    LONGEST val;
>    CORE_ADDR addr;
>  
> -  CHECK_TYPEDEF (type);
> +  type = check_typedef (type);
>    switch (TYPE_CODE (type))
>      {
>      case TYPE_CODE_ARRAY:
> diff --git a/gdb/value.c b/gdb/value.c
> index a01f390..4399493 100644
> --- a/gdb/value.c
> +++ b/gdb/value.c
> @@ -2852,7 +2852,7 @@ unpack_double (struct type *type, const gdb_byte *valaddr, int *invp)
>    int nosign;
>  
>    *invp = 0;			/* Assume valid.  */
> -  CHECK_TYPEDEF (type);
> +  type = check_typedef (type);
>    code = TYPE_CODE (type);
>    len = TYPE_LENGTH (type);
>    nosign = TYPE_UNSIGNED (type);
> @@ -2993,7 +2993,7 @@ value_primitive_field (struct value *arg1, int offset,
>    struct value *v;
>    struct type *type;
>  
> -  CHECK_TYPEDEF (arg_type);
> +  arg_type = check_typedef (arg_type);
>    type = TYPE_FIELD_TYPE (arg_type, fieldno);
>  
>    /* Call check_typedef on our type to make sure that, if TYPE
> @@ -3195,7 +3195,7 @@ unpack_bits_as_long (struct type *field_type, const gdb_byte *valaddr,
>  
>    /* Read the minimum number of bytes required; there may not be
>       enough bytes to read an entire ULONGEST.  */
> -  CHECK_TYPEDEF (field_type);
> +  field_type = check_typedef (field_type);
>    if (bitsize)
>      bytes_read = ((bitpos % 8) + bitsize + 7) / 8;
>    else
> -- 
> 2.1.4

-- 
Joel



More information about the Gdb-patches mailing list