* gdbtypes.h (builtin_type_void): Remove macro, add declaration.

(builtin_type_f_void): Remove macro.
	* gdbtypes.c (builtin_type_void): New global variable.
	(_initialize_gdbtypes): Initialize it.

	* gnu-v3-abi.c (build_gdb_vtable_type): Do not call
	lookup_pointer_type or lookup_function_type on builtin_type_void.
	* printcmd.c (set_next_address): Likewise.
	* objc-lang.c (value_nsstring): Likewise.
	* mt-tdep.c (mt_copro_register_type): Likewise.
	* xtensa-tdep.c (xtensa_register_type): Likewise.

	* symfile.c (syms_from_objfile): Remove special handling
	of builtin_type_void and builtin_type_char.
This commit is contained in:
Ulrich Weigand 2008-09-11 14:20:50 +00:00
parent d4dbb9c7d4
commit fde6c81990
9 changed files with 39 additions and 29 deletions

View File

@ -1,3 +1,20 @@
2008-09-11 Ulrich Weigand <uweigand@de.ibm.com>
* gdbtypes.h (builtin_type_void): Remove macro, add declaration.
(builtin_type_f_void): Remove macro.
* gdbtypes.c (builtin_type_void): New global variable.
(_initialize_gdbtypes): Initialize it.
* gnu-v3-abi.c (build_gdb_vtable_type): Do not call
lookup_pointer_type or lookup_function_type on builtin_type_void.
* printcmd.c (set_next_address): Likewise.
* objc-lang.c (value_nsstring): Likewise.
* mt-tdep.c (mt_copro_register_type): Likewise.
* xtensa-tdep.c (xtensa_register_type): Likewise.
* symfile.c (syms_from_objfile): Remove special handling
of builtin_type_void and builtin_type_char.
2008-09-11 Ulrich Weigand <uweigand@de.ibm.com>
* eval.c (evaluate_subexp_standard): Use exp->gdbarch types instead

View File

@ -108,6 +108,9 @@ struct type *builtin_type_arm_ext;
struct type *builtin_type_ia64_spill;
struct type *builtin_type_ia64_quad;
/* Platform-neutral void type. */
struct type *builtin_type_void;
int opaque_type_resolution = 1;
static void
@ -3330,6 +3333,11 @@ _initialize_gdbtypes (void)
builtin_type_ia64_quad =
build_flt (-1, "builtin_type_ia64_quad", floatformats_ia64_quad);
builtin_type_void =
init_type (TYPE_CODE_VOID, 1,
0,
"void", (struct objfile *) NULL);
add_setshow_zinteger_cmd ("overload", no_class, &overload_debug, _("\
Set debugging of C++ overloading."), _("\
Show debugging of C++ overloading."), _("\

View File

@ -1020,8 +1020,6 @@ extern const struct builtin_type *builtin_type (struct gdbarch *gdbarch);
(builtin_type (current_gdbarch)->builtin_core_addr)
#define builtin_type_true_char \
(builtin_type (current_gdbarch)->builtin_true_char)
#define builtin_type_void \
(builtin_type (current_gdbarch)->builtin_void)
#define builtin_type_char \
(builtin_type (current_gdbarch)->builtin_char)
#define builtin_type_short \
@ -1096,9 +1094,13 @@ extern struct type *builtin_type_arm_ext;
extern struct type *builtin_type_ia64_spill;
extern struct type *builtin_type_ia64_quad;
/* Platform-neutral void type. Never attempt to construct a pointer
or reference type to this, because those cannot be platform-neutral.
You must use builtin_type (...)->builtin_void in those cases. */
extern struct type *builtin_type_void;
/* This type represents a type that was unrecognized in symbol
read-in. */
extern struct type *builtin_type_error;
@ -1176,8 +1178,6 @@ extern const struct builtin_f_type *builtin_f_type (struct gdbarch *gdbarch);
(builtin_f_type (current_gdbarch)->builtin_complex_s16)
#define builtin_type_f_complex_s32 \
(builtin_f_type (current_gdbarch)->builtin_complex_s32)
#define builtin_type_f_void \
(builtin_f_type (current_gdbarch)->builtin_void)
/* RTTI for C++ */

View File

@ -107,9 +107,9 @@ build_gdb_vtable_type (struct gdbarch *arch)
int offset;
struct type *void_ptr_type
= lookup_pointer_type (builtin_type_void);
= builtin_type (arch)->builtin_data_ptr;
struct type *ptr_to_void_fn_type
= lookup_pointer_type (lookup_function_type (builtin_type_void));
= builtin_type (arch)->builtin_func_ptr;
/* ARCH can't give us the true ptrdiff_t type, so we guess. */
struct type *ptrdiff_type

View File

@ -251,19 +251,13 @@ mt_copro_register_type (struct gdbarch *arch, int regnum)
static struct type *
mt_register_type (struct gdbarch *arch, int regnum)
{
static struct type *void_func_ptr = NULL;
static struct type *void_ptr = NULL;
static struct type *copro_type;
static struct type *copro_type = NULL;
if (regnum >= 0 && regnum < MT_NUM_REGS + MT_NUM_PSEUDO_REGS)
{
if (void_func_ptr == NULL)
if (copro_type == NULL)
{
struct type *temp;
void_ptr = lookup_pointer_type (builtin_type_void);
void_func_ptr =
lookup_pointer_type (lookup_function_type (builtin_type_void));
temp = create_range_type (NULL, builtin_type_unsigned_int, 0, 1);
copro_type = create_array_type (NULL, builtin_type_int16, temp);
}
@ -272,10 +266,10 @@ mt_register_type (struct gdbarch *arch, int regnum)
case MT_PC_REGNUM:
case MT_RA_REGNUM:
case MT_IRA_REGNUM:
return void_func_ptr;
return builtin_type (arch)->builtin_func_ptr;
case MT_SP_REGNUM:
case MT_FP_REGNUM:
return void_ptr;
return builtin_type (arch)->builtin_data_ptr;
case MT_COPRO_REGNUM:
case MT_COPRO_PSEUDOREG_REGNUM:
return copro_type;

View File

@ -173,7 +173,7 @@ value_nsstring (char *ptr, int len)
if (sym == NULL)
sym = lookup_struct_typedef("NXString", 0, 1);
if (sym == NULL)
type = lookup_pointer_type(builtin_type_void);
type = builtin_type_void_data_ptr;
else
type = lookup_pointer_type(SYMBOL_TYPE (sym));

View File

@ -513,8 +513,7 @@ set_next_address (CORE_ADDR addr)
/* Make address available to the user as $_. */
set_internalvar (lookup_internalvar ("_"),
value_from_pointer (lookup_pointer_type (builtin_type_void),
addr));
value_from_pointer (builtin_type_void_data_ptr, addr));
}
/* Optionally print address ADDR symbolically as <SYMBOL+OFFSET> on STREAM,

View File

@ -896,14 +896,6 @@ syms_from_objfile (struct objfile *objfile,
(*objfile->sf->sym_read) (objfile, mainline);
/* Don't allow char * to have a typename (else would get caddr_t).
Ditto void *. FIXME: Check whether this is now done by all the
symbol readers themselves (many of them now do), and if so remove
it from here. */
TYPE_NAME (lookup_pointer_type (builtin_type_char)) = 0;
TYPE_NAME (lookup_pointer_type (builtin_type_void)) = 0;
/* Mark the objfile has having had initial symbol read attempted. Note
that this does not mean we found any symbols... */

View File

@ -233,7 +233,7 @@ xtensa_register_type (struct gdbarch *gdbarch, int regnum)
if (regnum == gdbarch_pc_regnum (gdbarch)
|| regnum == gdbarch_tdep (gdbarch)->a0_base + 1)
return lookup_pointer_type (builtin_type_void);
return builtin_type (gdbarch)->builtin_data_ptr;
/* Return the stored type for all other registers. */
else if (regnum >= 0 && regnum < gdbarch_num_regs (gdbarch)