summaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorUlrich Weigand <uweigand@de.ibm.com>2008-09-11 14:20:50 +0000
committerUlrich Weigand <uweigand@de.ibm.com>2008-09-11 14:20:50 +0000
commit17cc51d1b6cf33c1481cc7a559f6617d8ad4262b (patch)
tree0d4587e2e2e9b013cce509520023a14cd649cb88 /gdb
parent440292c1219d5263849c02af3b9aac57e7c829dc (diff)
downloadgdb-17cc51d1b6cf33c1481cc7a559f6617d8ad4262b.tar.gz
* 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.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog17
-rw-r--r--gdb/gdbtypes.c8
-rw-r--r--gdb/gdbtypes.h10
-rw-r--r--gdb/gnu-v3-abi.c4
-rw-r--r--gdb/mt-tdep.c14
-rw-r--r--gdb/objc-lang.c2
-rw-r--r--gdb/printcmd.c3
-rw-r--r--gdb/symfile.c8
-rw-r--r--gdb/xtensa-tdep.c2
9 files changed, 39 insertions, 29 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 988a45a739f..5a486af2478 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,22 @@
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
of builtin_type_ macros when handling OP_OBJC_ operations.
* objc-lang.c (print_object_command): Likewise.
diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
index 12397230a87..955848b098c 100644
--- a/gdb/gdbtypes.c
+++ b/gdb/gdbtypes.c
@@ -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."), _("\
diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h
index 25b8c432f59..4ee48dd3923 100644
--- a/gdb/gdbtypes.h
+++ b/gdb/gdbtypes.h
@@ -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++ */
diff --git a/gdb/gnu-v3-abi.c b/gdb/gnu-v3-abi.c
index c28a7862609..90497ca0b0b 100644
--- a/gdb/gnu-v3-abi.c
+++ b/gdb/gnu-v3-abi.c
@@ -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
diff --git a/gdb/mt-tdep.c b/gdb/mt-tdep.c
index da6e99cf77a..0a78f0fe160 100644
--- a/gdb/mt-tdep.c
+++ b/gdb/mt-tdep.c
@@ -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;
diff --git a/gdb/objc-lang.c b/gdb/objc-lang.c
index 4dadd4c9539..7dea97ef96e 100644
--- a/gdb/objc-lang.c
+++ b/gdb/objc-lang.c
@@ -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));
diff --git a/gdb/printcmd.c b/gdb/printcmd.c
index e87d2a7c06a..f09dc91609c 100644
--- a/gdb/printcmd.c
+++ b/gdb/printcmd.c
@@ -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,
diff --git a/gdb/symfile.c b/gdb/symfile.c
index d067d2be536..5827a53eb76 100644
--- a/gdb/symfile.c
+++ b/gdb/symfile.c
@@ -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... */
diff --git a/gdb/xtensa-tdep.c b/gdb/xtensa-tdep.c
index 1355d96bc65..7f8ecc2cef2 100644
--- a/gdb/xtensa-tdep.c
+++ b/gdb/xtensa-tdep.c
@@ -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)