* C++-compat clean build
@ 2013-10-01 11:25 Ondrej Oprala
2013-10-01 11:52 ` Ondrej Oprala
` (2 more replies)
0 siblings, 3 replies; 11+ messages in thread
From: Ondrej Oprala @ 2013-10-01 11:25 UTC (permalink / raw)
To: 'gdb-patches@sourceware.org'
[-- Attachment #1: Type: text/plain, Size: 264 bytes --]
Hi,
this is the first of a few patches I intend to write to make gdb code
compile cleanly with -Wc++-compat.
The idea is to make separate patches for respective subdirs under gdb/,
unless someone objects ofc.
Thanks in advance for any advice/criticism.
Ondrej
[-- Attachment #2: cxx-compat-rootsrcdir.patch --]
[-- Type: text/x-patch, Size: 88069 bytes --]
From e9e5dfa288defe38c3e0325c608e5dca7fb6a7bc Mon Sep 17 00:00:00 2001
From: Ondrej Oprala <ooprala@redhat.com>
Date: Sun, 29 Sep 2013 22:28:39 +0200
Subject: [PATCH] Make code compile cleanly with -Wc++-compat
---
gdb/amd64-linux-nat.c | 18 ++++-----
gdb/amd64-linux-tdep.c | 12 +++---
gdb/amd64-nat.c | 4 +-
gdb/amd64-tdep.c | 22 +++++------
gdb/ax-gdb.c | 2 +-
gdb/ax-general.c | 14 +++----
gdb/ctf.c | 4 +-
gdb/dcache.c | 4 +-
gdb/i386-linux-tdep.c | 6 +--
gdb/i386-nat.c | 14 +++----
gdb/i386-tdep.c | 28 +++++++-------
gdb/i387-tdep.c | 12 +++---
gdb/inf-ptrace.c | 6 +--
gdb/linux-fork.c | 4 +-
gdb/linux-nat.c | 47 ++++++++++++-----------
gdb/linux-record.c | 26 ++++++-------
gdb/linux-tdep.c | 16 ++++----
gdb/linux-thread-db.c | 59 +++++++++++++++++------------
gdb/proc-service.c | 2 +-
gdb/remote-fileio.c | 14 +++----
gdb/remote-notif.c | 2 +-
gdb/remote.c | 100 +++++++++++++++++++++++++------------------------
gdb/ser-base.c | 6 +--
gdb/ser-pipe.c | 2 +-
gdb/ser-tcp.c | 4 +-
gdb/solib-svr4.c | 61 ++++++++++++++++--------------
gdb/symfile-mem.c | 3 +-
gdb/tracepoint.c | 67 +++++++++++++++++----------------
28 files changed, 290 insertions(+), 269 deletions(-)
diff --git a/gdb/amd64-linux-nat.c b/gdb/amd64-linux-nat.c
index 8dfe7c5..958eec8 100644
--- a/gdb/amd64-linux-nat.c
+++ b/gdb/amd64-linux-nat.c
@@ -172,7 +172,7 @@ amd64_linux_fetch_inferior_registers (struct target_ops *ops,
{
elf_gregset_t regs;
- if (ptrace (PTRACE_GETREGS, tid, 0, (long) ®s) < 0)
+ if (ptrace ((enum __ptrace_request) PTRACE_GETREGS, tid, 0, (long) ®s) < 0)
perror_with_name (_("Couldn't get registers"));
amd64_supply_native_gregset (regcache, ®s, -1);
@@ -199,7 +199,7 @@ amd64_linux_fetch_inferior_registers (struct target_ops *ops,
}
else
{
- if (ptrace (PTRACE_GETFPREGS, tid, 0, (long) &fpregs) < 0)
+ if (ptrace ((enum __ptrace_request) PTRACE_GETFPREGS, tid, 0, (long) &fpregs) < 0)
perror_with_name (_("Couldn't get floating point status"));
amd64_supply_fxsave (regcache, -1, &fpregs);
@@ -227,12 +227,12 @@ amd64_linux_store_inferior_registers (struct target_ops *ops,
{
elf_gregset_t regs;
- if (ptrace (PTRACE_GETREGS, tid, 0, (long) ®s) < 0)
+ if (ptrace ((enum __ptrace_request) PTRACE_GETREGS, tid, 0, (long) ®s) < 0)
perror_with_name (_("Couldn't get registers"));
amd64_collect_native_gregset (regcache, ®s, regnum);
- if (ptrace (PTRACE_SETREGS, tid, 0, (long) ®s) < 0)
+ if (ptrace ((enum __ptrace_request) PTRACE_SETREGS, tid, 0, (long) ®s) < 0)
perror_with_name (_("Couldn't write registers"));
if (regnum != -1)
@@ -262,12 +262,12 @@ amd64_linux_store_inferior_registers (struct target_ops *ops,
}
else
{
- if (ptrace (PTRACE_GETFPREGS, tid, 0, (long) &fpregs) < 0)
+ if (ptrace ((enum __ptrace_request) PTRACE_GETFPREGS, tid, 0, (long) &fpregs) < 0)
perror_with_name (_("Couldn't get floating point status"));
amd64_collect_fxsave (regcache, regnum, &fpregs);
- if (ptrace (PTRACE_SETFPREGS, tid, 0, (long) &fpregs) < 0)
+ if (ptrace ((enum __ptrace_request) PTRACE_SETFPREGS, tid, 0, (long) &fpregs) < 0)
perror_with_name (_("Couldn't write floating point status"));
}
}
@@ -499,7 +499,7 @@ ps_get_thread_area (const struct ps_prochandle *ph,
#ifndef PTRACE_GET_THREAD_AREA
#define PTRACE_GET_THREAD_AREA 25
#endif
- if (ptrace (PTRACE_GET_THREAD_AREA,
+ if (ptrace ((enum __ptrace_request) PTRACE_GET_THREAD_AREA,
lwpid, (void *) (long) idx, (unsigned long) &desc) < 0)
return PS_ERR;
@@ -538,7 +538,7 @@ ps_get_thread_area (const struct ps_prochandle *ph,
}
}
#endif
- if (ptrace (PTRACE_ARCH_PRCTL, lwpid, base, ARCH_GET_FS) == 0)
+ if (ptrace ((enum __ptrace_request) PTRACE_ARCH_PRCTL, lwpid, base, ARCH_GET_FS) == 0)
return PS_OK;
break;
case GS:
@@ -555,7 +555,7 @@ ps_get_thread_area (const struct ps_prochandle *ph,
}
}
#endif
- if (ptrace (PTRACE_ARCH_PRCTL, lwpid, base, ARCH_GET_GS) == 0)
+ if (ptrace ((enum __ptrace_request) PTRACE_ARCH_PRCTL, lwpid, base, ARCH_GET_GS) == 0)
return PS_OK;
break;
default: /* Should not happen. */
diff --git a/gdb/amd64-linux-tdep.c b/gdb/amd64-linux-tdep.c
index 4f67762..bf4af3c 100644
--- a/gdb/amd64-linux-tdep.c
+++ b/gdb/amd64-linux-tdep.c
@@ -831,7 +831,7 @@ amd64_canonicalize_syscall (enum amd64_syscall syscall_number)
return gdb_sys_prctl;
case amd64_sys_arch_prctl:
- return -1; /* Note */
+ return (enum gdb_syscall) -1; /* Note */
case amd64_sys_adjtimex:
return gdb_sys_adjtimex;
@@ -1158,7 +1158,7 @@ amd64_canonicalize_syscall (enum amd64_syscall syscall_number)
return gdb_sys_move_pages;
default:
- return -1;
+ return (enum gdb_syscall) -1;
}
}
@@ -1178,7 +1178,7 @@ amd64_linux_syscall_record (struct regcache *regcache)
{
int ret;
ULONGEST syscall_native;
- enum gdb_syscall syscall_gdb = -1;
+ enum gdb_syscall syscall_gdb = (enum gdb_syscall) -1;
regcache_raw_read_unsigned (regcache, AMD64_RAX_REGNUM, &syscall_native);
@@ -1212,7 +1212,7 @@ amd64_linux_syscall_record (struct regcache *regcache)
break;
}
- syscall_gdb = amd64_canonicalize_syscall (syscall_native);
+ syscall_gdb = amd64_canonicalize_syscall ((enum amd64_syscall) syscall_native);
if (syscall_gdb < 0)
{
@@ -1531,7 +1531,7 @@ amd64_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
const struct target_desc *tdesc = info.target_desc;
- struct tdesc_arch_data *tdesc_data = (void *) info.tdep_info;
+ struct tdesc_arch_data *tdesc_data = (struct tdesc_arch_data *) info.tdep_info;
const struct tdesc_feature *feature;
int valid_p;
@@ -1572,7 +1572,7 @@ amd64_x32_linux_init_abi(struct gdbarch_info info, struct gdbarch *gdbarch)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
const struct target_desc *tdesc = info.target_desc;
- struct tdesc_arch_data *tdesc_data = (void *) info.tdep_info;
+ struct tdesc_arch_data *tdesc_data = (struct tdesc_arch_data *) info.tdep_info;
const struct tdesc_feature *feature;
int valid_p;
diff --git a/gdb/amd64-nat.c b/gdb/amd64-nat.c
index 2a9239a..b608637 100644
--- a/gdb/amd64-nat.c
+++ b/gdb/amd64-nat.c
@@ -91,7 +91,7 @@ void
amd64_supply_native_gregset (struct regcache *regcache,
const void *gregs, int regnum)
{
- const char *regs = gregs;
+ const char *regs = (const char *) gregs;
struct gdbarch *gdbarch = get_regcache_arch (regcache);
int num_regs = amd64_native_gregset64_num_regs;
int i;
@@ -122,7 +122,7 @@ void
amd64_collect_native_gregset (const struct regcache *regcache,
void *gregs, int regnum)
{
- char *regs = gregs;
+ char *regs = (char *) gregs;
struct gdbarch *gdbarch = get_regcache_arch (regcache);
int num_regs = amd64_native_gregset64_num_regs;
int i;
diff --git a/gdb/amd64-tdep.c b/gdb/amd64-tdep.c
index 91f60a1..dc68ded 100644
--- a/gdb/amd64-tdep.c
+++ b/gdb/amd64-tdep.c
@@ -762,12 +762,12 @@ amd64_push_arguments (struct regcache *regcache, int nargs,
AMD64_XMM0_REGNUM + 4, AMD64_XMM0_REGNUM + 5,
AMD64_XMM0_REGNUM + 6, AMD64_XMM0_REGNUM + 7,
};
- struct value **stack_args = alloca (nargs * sizeof (struct value *));
+ struct value **stack_args = (struct value **) alloca (nargs * sizeof (struct value *));
/* An array that mirrors the stack_args array. For all arguments
that are passed by MEMORY, if that argument's address also needs
to be stored in a register, the ARG_ADDR_REGNO array will contain
that register number (or a negative value otherwise). */
- int *arg_addr_regno = alloca (nargs * sizeof (int));
+ int *arg_addr_regno = (int *) alloca (nargs * sizeof (int));
int num_stack_args = 0;
int num_elements = 0;
int element = 0;
@@ -1302,7 +1302,7 @@ amd64_displaced_step_copy_insn (struct gdbarch *gdbarch,
/* Extra space for sentinels so fixup_{riprel,displaced_copy} don't have to
continually watch for running off the end of the buffer. */
int fixup_sentinel_space = len;
- struct displaced_step_closure *dsc =
+ struct displaced_step_closure *dsc = (struct displaced_step_closure *)
xmalloc (sizeof (*dsc) + len + fixup_sentinel_space);
gdb_byte *buf = &dsc->insn_buf[0];
struct amd64_insn *details = &dsc->insn_details;
@@ -1598,7 +1598,7 @@ amd64_relocate_instruction (struct gdbarch *gdbarch,
int len = gdbarch_max_insn_length (gdbarch);
/* Extra space for sentinels. */
int fixup_sentinel_space = len;
- gdb_byte *buf = xmalloc (len + fixup_sentinel_space);
+ gdb_byte *buf = (gdb_byte *) xmalloc (len + fixup_sentinel_space);
struct amd64_insn insn_details;
int offset = 0;
LONGEST rel32, newrel;
@@ -2357,7 +2357,7 @@ amd64_frame_cache (struct frame_info *this_frame, void **this_cache)
struct amd64_frame_cache *cache;
if (*this_cache)
- return *this_cache;
+ return (struct amd64_frame_cache *) *this_cache;
cache = amd64_alloc_frame_cache ();
*this_cache = cache;
@@ -2472,7 +2472,7 @@ amd64_sigtramp_frame_cache (struct frame_info *this_frame, void **this_cache)
int i;
if (*this_cache)
- return *this_cache;
+ return (struct amd64_frame_cache *) *this_cache;
cache = amd64_alloc_frame_cache ();
@@ -2638,7 +2638,7 @@ amd64_epilogue_frame_cache (struct frame_info *this_frame, void **this_cache)
gdb_byte buf[8];
if (*this_cache)
- return *this_cache;
+ return (struct amd64_frame_cache *) *this_cache;
cache = amd64_alloc_frame_cache ();
*this_cache = cache;
@@ -3044,7 +3044,7 @@ amd64_supply_fxsave (struct regcache *regcache, int regnum,
if (fxsave
&& gdbarch_bfd_arch_info (gdbarch)->bits_per_word == 64)
{
- const gdb_byte *regs = fxsave;
+ const gdb_byte *regs = (const gdb_byte *) fxsave;
if (regnum == -1 || regnum == I387_FISEG_REGNUM (tdep))
regcache_raw_supply (regcache, I387_FISEG_REGNUM (tdep), regs + 12);
@@ -3067,7 +3067,7 @@ amd64_supply_xsave (struct regcache *regcache, int regnum,
if (xsave
&& gdbarch_bfd_arch_info (gdbarch)->bits_per_word == 64)
{
- const gdb_byte *regs = xsave;
+ const gdb_byte *regs = (const gdb_byte *) xsave;
if (regnum == -1 || regnum == I387_FISEG_REGNUM (tdep))
regcache_raw_supply (regcache, I387_FISEG_REGNUM (tdep),
@@ -3089,7 +3089,7 @@ amd64_collect_fxsave (const struct regcache *regcache, int regnum,
{
struct gdbarch *gdbarch = get_regcache_arch (regcache);
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
- gdb_byte *regs = fxsave;
+ gdb_byte *regs = (gdb_byte *) fxsave;
i387_collect_fxsave (regcache, regnum, fxsave);
@@ -3110,7 +3110,7 @@ amd64_collect_xsave (const struct regcache *regcache, int regnum,
{
struct gdbarch *gdbarch = get_regcache_arch (regcache);
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
- gdb_byte *regs = xsave;
+ gdb_byte *regs = (gdb_byte *) xsave;
i387_collect_xsave (regcache, regnum, xsave, gcore);
diff --git a/gdb/ax-gdb.c b/gdb/ax-gdb.c
index 4196655..6ccf482 100644
--- a/gdb/ax-gdb.c
+++ b/gdb/ax-gdb.c
@@ -2564,7 +2564,7 @@ gen_printf (CORE_ADDR scope, struct gdbarch *gdbarch,
/* Issue the printf bytecode proper. */
ax_simple (ax, aop_printf);
- ax_simple (ax, nargs);
+ ax_simple (ax, (enum agent_op) nargs);
ax_string (ax, format, fmtlen);
/* And terminate. */
diff --git a/gdb/ax-general.c b/gdb/ax-general.c
index 78d7f7e..5bb3e0d 100644
--- a/gdb/ax-general.c
+++ b/gdb/ax-general.c
@@ -43,19 +43,19 @@ static void generic_ext (struct agent_expr *x, enum agent_op op, int n);
struct agent_expr *
new_agent_expr (struct gdbarch *gdbarch, CORE_ADDR scope)
{
- struct agent_expr *x = xmalloc (sizeof (*x));
+ struct agent_expr *x = (struct agent_expr *) xmalloc (sizeof (*x));
x->len = 0;
x->size = 1; /* Change this to a larger value once
reallocation code is tested. */
- x->buf = xmalloc (x->size);
+ x->buf = (unsigned char *) xmalloc (x->size);
x->gdbarch = gdbarch;
x->scope = scope;
/* Bit vector for registers used. */
x->reg_mask_len = 1;
- x->reg_mask = xmalloc (x->reg_mask_len * sizeof (x->reg_mask[0]));
+ x->reg_mask = (unsigned char *) xmalloc (x->reg_mask_len * sizeof (x->reg_mask[0]));
memset (x->reg_mask, 0, x->reg_mask_len * sizeof (x->reg_mask[0]));
x->tracing = 0;
@@ -76,7 +76,7 @@ free_agent_expr (struct agent_expr *x)
static void
do_free_agent_expr_cleanup (void *x)
{
- free_agent_expr (x);
+ free_agent_expr ((struct agent_expr *) x);
}
struct cleanup *
@@ -96,7 +96,7 @@ grow_expr (struct agent_expr *x, int n)
x->size *= 2;
if (x->size < x->len + n)
x->size = x->len + n + 10;
- x->buf = xrealloc (x->buf, x->size);
+ x->buf = (unsigned char *) xrealloc (x->buf, x->size);
}
}
@@ -393,7 +393,7 @@ ax_print (struct ui_file *f, struct agent_expr *x)
for (i = 0; i < x->len;)
{
- enum agent_op op = x->buf[i];
+ enum agent_op op = (enum agent_op) x->buf[i];
if (op >= (sizeof (aop_map) / sizeof (aop_map[0]))
|| !aop_map[op].name)
@@ -460,7 +460,7 @@ ax_reg_mask (struct agent_expr *ax, int reg)
/* It's not appropriate to double here. This isn't a
string buffer. */
int new_len = byte + 1;
- unsigned char *new_reg_mask = xrealloc (ax->reg_mask,
+ unsigned char *new_reg_mask = (unsigned char *) xrealloc (ax->reg_mask,
new_len
* sizeof (ax->reg_mask[0]));
memset (new_reg_mask + ax->reg_mask_len, 0,
diff --git a/gdb/ctf.c b/gdb/ctf.c
index 23ee36d..e213e88 100644
--- a/gdb/ctf.c
+++ b/gdb/ctf.c
@@ -860,8 +860,8 @@ static const struct trace_file_write_ops ctf_write_ops =
struct trace_file_writer *
ctf_trace_file_writer_new (void)
{
- struct ctf_trace_file_writer *writer
- = xmalloc (sizeof (struct ctf_trace_file_writer));
+ struct ctf_trace_file_writer *writer = (typeof (writer))
+ xmalloc (sizeof (struct ctf_trace_file_writer));
writer->base.ops = &ctf_write_ops;
diff --git a/gdb/dcache.c b/gdb/dcache.c
index acb9de4..d65fd90 100644
--- a/gdb/dcache.c
+++ b/gdb/dcache.c
@@ -377,7 +377,7 @@ dcache_alloc (DCACHE *dcache, CORE_ADDR addr)
if (db)
remove_block (&dcache->freelist, db);
else
- db = xmalloc (offsetof (struct dcache_block, data) +
+ db = (struct dcache_block *) xmalloc (offsetof (struct dcache_block, data) +
dcache->line_size);
dcache->size++;
@@ -689,7 +689,7 @@ set_dcache_command (char *arg, int from_tty)
{
printf_unfiltered (
"\"set dcache\" must be followed by the name of a subcommand.\n");
- help_list (dcache_set_list, "set dcache ", -1, gdb_stdout);
+ help_list (dcache_set_list, "set dcache ", (enum command_class) -1, gdb_stdout);
}
static void
diff --git a/gdb/i386-linux-tdep.c b/gdb/i386-linux-tdep.c
index 7b69aab..b2c0023 100644
--- a/gdb/i386-linux-tdep.c
+++ b/gdb/i386-linux-tdep.c
@@ -403,9 +403,9 @@ i386_canonicalize_syscall (int syscall)
enum { i386_syscall_max = 499 };
if (syscall <= i386_syscall_max)
- return syscall;
+ return (enum gdb_syscall) syscall;
else
- return -1;
+ return (enum gdb_syscall) -1;
}
/* Parse the arguments of current system call instruction and record
@@ -708,7 +708,7 @@ i386_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
const struct target_desc *tdesc = info.target_desc;
- struct tdesc_arch_data *tdesc_data = (void *) info.tdep_info;
+ struct tdesc_arch_data *tdesc_data = (struct tdesc_arch_data *) info.tdep_info;
const struct tdesc_feature *feature;
int valid_p;
diff --git a/gdb/i386-nat.c b/gdb/i386-nat.c
index 6069350..a5bd25d 100644
--- a/gdb/i386-nat.c
+++ b/gdb/i386-nat.c
@@ -194,7 +194,7 @@ i386_add_process (pid_t pid)
{
struct i386_process_info *proc;
- proc = xcalloc (1, sizeof (*proc));
+ proc = (struct i386_process_info *) xcalloc (1, sizeof (*proc));
proc->pid = pid;
proc->next = i386_process_list;
@@ -605,10 +605,10 @@ i386_insert_watchpoint (CORE_ADDR addr, int len, int type,
if (((len != 1 && len !=2 && len !=4) && !(TARGET_HAS_DR_LEN_8 && len == 8))
|| addr % len != 0)
retval = i386_handle_nonaligned_watchpoint (&local_state,
- WP_INSERT, addr, len, type);
+ WP_INSERT, addr, len, (enum target_hw_bp_type) type);
else
{
- unsigned len_rw = i386_length_and_rw_bits (len, type);
+ unsigned len_rw = i386_length_and_rw_bits (len, (enum target_hw_bp_type) type);
retval = i386_insert_aligned_watchpoint (&local_state,
addr, len_rw);
@@ -618,7 +618,7 @@ i386_insert_watchpoint (CORE_ADDR addr, int len, int type,
i386_update_inferior_debug_regs (&local_state);
if (maint_show_dr)
- i386_show_dr (state, "insert_watchpoint", addr, len, type);
+ i386_show_dr (state, "insert_watchpoint", addr, len, (enum target_hw_bp_type) type);
return retval;
}
@@ -640,10 +640,10 @@ i386_remove_watchpoint (CORE_ADDR addr, int len, int type,
if (((len != 1 && len !=2 && len !=4) && !(TARGET_HAS_DR_LEN_8 && len == 8))
|| addr % len != 0)
retval = i386_handle_nonaligned_watchpoint (&local_state,
- WP_REMOVE, addr, len, type);
+ WP_REMOVE, addr, len, (enum target_hw_bp_type) type);
else
{
- unsigned len_rw = i386_length_and_rw_bits (len, type);
+ unsigned len_rw = i386_length_and_rw_bits (len, (enum target_hw_bp_type) type);
retval = i386_remove_aligned_watchpoint (&local_state,
addr, len_rw);
@@ -653,7 +653,7 @@ i386_remove_watchpoint (CORE_ADDR addr, int len, int type,
i386_update_inferior_debug_regs (&local_state);
if (maint_show_dr)
- i386_show_dr (state, "remove_watchpoint", addr, len, type);
+ i386_show_dr (state, "remove_watchpoint", addr, len, (enum target_hw_bp_type) type);
return retval;
}
diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c
index b159b49..ce087b9 100644
--- a/gdb/i386-tdep.c
+++ b/gdb/i386-tdep.c
@@ -552,7 +552,7 @@ i386_displaced_step_copy_insn (struct gdbarch *gdbarch,
struct regcache *regs)
{
size_t len = gdbarch_max_insn_length (gdbarch);
- gdb_byte *buf = xmalloc (len);
+ gdb_byte *buf = (gdb_byte *) xmalloc (len);
read_memory (from, buf, len);
@@ -1825,7 +1825,7 @@ i386_frame_cache (struct frame_info *this_frame, void **this_cache)
struct i386_frame_cache *cache;
if (*this_cache)
- return *this_cache;
+ return (struct i386_frame_cache *) *this_cache;
cache = i386_alloc_frame_cache ();
*this_cache = cache;
@@ -1985,7 +1985,7 @@ i386_epilogue_frame_cache (struct frame_info *this_frame, void **this_cache)
CORE_ADDR sp;
if (*this_cache)
- return *this_cache;
+ return (struct i386_frame_cache *) *this_cache;
cache = i386_alloc_frame_cache ();
*this_cache = cache;
@@ -2169,7 +2169,7 @@ i386_sigtramp_frame_cache (struct frame_info *this_frame, void **this_cache)
gdb_byte buf[4];
if (*this_cache)
- return *this_cache;
+ return (struct i386_frame_cache *) *this_cache;
cache = i386_alloc_frame_cache ();
@@ -3196,7 +3196,7 @@ i386_supply_gregset (const struct regset *regset, struct regcache *regcache,
int regnum, const void *gregs, size_t len)
{
const struct gdbarch_tdep *tdep = gdbarch_tdep (regset->arch);
- const gdb_byte *regs = gregs;
+ const gdb_byte *regs = (const gdb_byte *) gregs;
int i;
gdb_assert (len == tdep->sizeof_gregset);
@@ -3220,7 +3220,7 @@ i386_collect_gregset (const struct regset *regset,
int regnum, void *gregs, size_t len)
{
const struct gdbarch_tdep *tdep = gdbarch_tdep (regset->arch);
- gdb_byte *regs = gregs;
+ gdb_byte *regs = (gdb_byte *) gregs;
int i;
gdb_assert (len == tdep->sizeof_gregset);
@@ -3459,7 +3459,7 @@ i386_stap_parse_special_token (struct gdbarch *gdbarch,
{
/* In order to parse special tokens, we use a state-machine that go
through every known token and try to get a match. */
- enum
+ enum cur_state
{
TRIPLET,
THREE_ARG_DISPLACEMENT,
@@ -3556,7 +3556,7 @@ i386_stap_parse_special_token (struct gdbarch *gdbarch,
break;
len = s - start;
- regname = alloca (len + 1);
+ regname = (char *) alloca (len + 1);
strncpy (regname, start, len);
regname[len] = '\0';
@@ -3651,7 +3651,7 @@ i386_stap_parse_special_token (struct gdbarch *gdbarch,
break;
len_base = s - start;
- base = alloca (len_base + 1);
+ base = (char *) alloca (len_base + 1);
strncpy (base, start, len_base);
base[len_base] = '\0';
@@ -3668,7 +3668,7 @@ i386_stap_parse_special_token (struct gdbarch *gdbarch,
++s;
len_index = s - start;
- index = alloca (len_index + 1);
+ index = (char *) alloca (len_index + 1);
strncpy (index, start, len_index);
index[len_index] = '\0';
@@ -3758,7 +3758,7 @@ i386_stap_parse_special_token (struct gdbarch *gdbarch,
}
/* Advancing to the next state. */
- ++current_state;
+ current_state = (enum cur_state) (current_state + 1);
}
return 0;
@@ -7774,7 +7774,7 @@ i386_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_gen_return_address (gdbarch, i386_gen_return_address);
/* Hook in ABI-specific overrides, if they have been registered. */
- info.tdep_info = (void *) tdesc_data;
+ info.tdep_info = (struct gdbarch_tdep_info *) tdesc_data;
gdbarch_init_osabi (info, gdbarch);
if (!i386_validate_tdesc_p (tdep, tdesc_data))
@@ -7799,7 +7799,9 @@ i386_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
tdesc_use_registers (gdbarch, tdesc, tdesc_data);
/* Override gdbarch_register_reggroup_p set in tdesc_use_registers. */
- set_gdbarch_register_reggroup_p (gdbarch, tdep->register_reggroup_p);
+ set_gdbarch_register_reggroup_p (gdbarch,
+ (gdbarch_register_reggroup_p_ftype *)
+ tdep->register_reggroup_p);
/* Make %al the first pseudo-register. */
tdep->al_regnum = gdbarch_num_regs (gdbarch);
diff --git a/gdb/i387-tdep.c b/gdb/i387-tdep.c
index 48a00c3..bfa06a8 100644
--- a/gdb/i387-tdep.c
+++ b/gdb/i387-tdep.c
@@ -452,7 +452,7 @@ i387_supply_fsave (struct regcache *regcache, int regnum, const void *fsave)
struct gdbarch *gdbarch = get_regcache_arch (regcache);
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
- const gdb_byte *regs = fsave;
+ const gdb_byte *regs = (const gdb_byte *) fsave;
int i;
gdb_assert (tdep->st0_regnum >= I386_ST0_REGNUM);
@@ -505,7 +505,7 @@ void
i387_collect_fsave (const struct regcache *regcache, int regnum, void *fsave)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (get_regcache_arch (regcache));
- gdb_byte *regs = fsave;
+ gdb_byte *regs = (gdb_byte *) fsave;
int i;
gdb_assert (tdep->st0_regnum >= I386_ST0_REGNUM);
@@ -598,7 +598,7 @@ void
i387_supply_fxsave (struct regcache *regcache, int regnum, const void *fxsave)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (get_regcache_arch (regcache));
- const gdb_byte *regs = fxsave;
+ const gdb_byte *regs = (gdb_byte *) fxsave;
int i;
gdb_assert (tdep->st0_regnum >= I386_ST0_REGNUM);
@@ -681,7 +681,7 @@ void
i387_collect_fxsave (const struct regcache *regcache, int regnum, void *fxsave)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (get_regcache_arch (regcache));
- gdb_byte *regs = fxsave;
+ gdb_byte *regs = (gdb_byte *) fxsave;
int i;
gdb_assert (tdep->st0_regnum >= I386_ST0_REGNUM);
@@ -773,7 +773,7 @@ i387_supply_xsave (struct regcache *regcache, int regnum,
const void *xsave)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (get_regcache_arch (regcache));
- const gdb_byte *regs = xsave;
+ const gdb_byte *regs = (const gdb_byte *) xsave;
int i;
unsigned int clear_bv;
static const gdb_byte zero[MAX_REGISTER_SIZE] = { 0 };
@@ -980,7 +980,7 @@ i387_collect_xsave (const struct regcache *regcache, int regnum,
void *xsave, int gcore)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (get_regcache_arch (regcache));
- gdb_byte *regs = xsave;
+ gdb_byte *regs = (gdb_byte *) xsave;
int i;
enum
{
diff --git a/gdb/inf-ptrace.c b/gdb/inf-ptrace.c
index 046e0ce..de9f34e 100644
--- a/gdb/inf-ptrace.c
+++ b/gdb/inf-ptrace.c
@@ -368,7 +368,7 @@ inf_ptrace_resume (struct target_ops *ops,
where it was. If GDB wanted it to start some other way, we have
already written a new program counter value to the child. */
errno = 0;
- ptrace (request, pid, (PTRACE_TYPE_ARG3)1, gdb_signal_to_host (signal));
+ ptrace ((enum __ptrace_request)request, pid, (PTRACE_TYPE_ARG3)1, gdb_signal_to_host (signal));
if (errno != 0)
perror_with_name (("ptrace"));
}
@@ -735,7 +735,7 @@ inf_ptrace_fetch_register (struct regcache *regcache, int regnum)
size = register_size (gdbarch, regnum);
gdb_assert ((size % sizeof (PTRACE_TYPE_RET)) == 0);
- buf = alloca (size);
+ buf = (long int *) alloca (size);
/* Read the register contents from the inferior a chunk at a time. */
for (i = 0; i < size / sizeof (PTRACE_TYPE_RET); i++)
@@ -793,7 +793,7 @@ inf_ptrace_store_register (const struct regcache *regcache, int regnum)
size = register_size (gdbarch, regnum);
gdb_assert ((size % sizeof (PTRACE_TYPE_RET)) == 0);
- buf = alloca (size);
+ buf = (PTRACE_TYPE_RET *)alloca (size);
/* Write the register contents into the inferior a chunk at a time. */
regcache_raw_collect (regcache, regnum, buf);
diff --git a/gdb/linux-fork.c b/gdb/linux-fork.c
index 4100cb1..e56488a 100644
--- a/gdb/linux-fork.c
+++ b/gdb/linux-fork.c
@@ -297,7 +297,7 @@ fork_save_infrun_state (struct fork_info *fp, int clobber_regs)
fp->maxfd = tmp;
}
/* Allocate array of file positions. */
- fp->filepos = xrealloc (fp->filepos,
+ fp->filepos = (off_t *) xrealloc (fp->filepos,
(fp->maxfd + 1) * sizeof (*fp->filepos));
/* Initialize to -1 (invalid). */
@@ -416,7 +416,7 @@ linux_fork_detach (char *args, int from_tty)
static void
inferior_call_waitpid_cleanup (void *fp)
{
- struct fork_info *oldfp = fp;
+ struct fork_info *oldfp = (struct fork_info *) fp;
if (oldfp)
{
diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c
index 45a6e5f..3d03cf9 100644
--- a/gdb/linux-nat.c
+++ b/gdb/linux-nat.c
@@ -312,7 +312,7 @@ static struct lwp_info *find_lwp_pid (ptid_t ptid);
static void
add_to_pid_list (struct simple_pid_list **listp, int pid, int status)
{
- struct simple_pid_list *new_pid = xmalloc (sizeof (struct simple_pid_list));
+ struct simple_pid_list *new_pid = (struct simple_pid_list *) xmalloc (sizeof (struct simple_pid_list));
new_pid->pid = pid;
new_pid->status = status;
@@ -403,7 +403,7 @@ linux_test_for_tracefork (int original_pid)
linux_supports_tracefork_flag = 0;
linux_supports_tracevforkdone_flag = 0;
- ret = ptrace (PTRACE_SETOPTIONS, original_pid, 0, PTRACE_O_TRACEFORK);
+ ret = ptrace ((enum __ptrace_request) PTRACE_SETOPTIONS, original_pid, 0, PTRACE_O_TRACEFORK);
if (ret != 0)
{
restore_child_signals_mask (&prev_mask);
@@ -426,7 +426,7 @@ linux_test_for_tracefork (int original_pid)
error (_("linux_test_for_tracefork: waitpid: unexpected status %d."),
status);
- ret = ptrace (PTRACE_SETOPTIONS, child_pid, 0, PTRACE_O_TRACEFORK);
+ ret = ptrace ((enum __ptrace_request) PTRACE_SETOPTIONS, child_pid, 0, PTRACE_O_TRACEFORK);
if (ret != 0)
{
ret = ptrace (PTRACE_KILL, child_pid, 0, 0);
@@ -450,7 +450,7 @@ linux_test_for_tracefork (int original_pid)
}
/* Check whether PTRACE_O_TRACEVFORKDONE is available. */
- ret = ptrace (PTRACE_SETOPTIONS, child_pid, 0,
+ ret = ptrace ((enum __ptrace_request) PTRACE_SETOPTIONS, child_pid, 0,
PTRACE_O_TRACEFORK | PTRACE_O_TRACEVFORKDONE);
linux_supports_tracevforkdone_flag = (ret == 0);
@@ -464,7 +464,7 @@ linux_test_for_tracefork (int original_pid)
&& status >> 16 == PTRACE_EVENT_FORK)
{
second_pid = 0;
- ret = ptrace (PTRACE_GETEVENTMSG, child_pid, 0, &second_pid);
+ ret = ptrace ((enum __ptrace_request) PTRACE_GETEVENTMSG, child_pid, 0, &second_pid);
if (ret == 0 && second_pid != 0)
{
int second_status;
@@ -507,7 +507,7 @@ linux_test_for_tracesysgood (int original_pid)
linux_supports_tracesysgood_flag = 0;
- ret = ptrace (PTRACE_SETOPTIONS, original_pid, 0, PTRACE_O_TRACESYSGOOD);
+ ret = ptrace ((enum __ptrace_request) PTRACE_SETOPTIONS, original_pid, 0, PTRACE_O_TRACESYSGOOD);
if (ret != 0)
goto out;
@@ -559,10 +559,9 @@ linux_enable_tracesysgood (ptid_t ptid)
current_ptrace_options |= PTRACE_O_TRACESYSGOOD;
- ptrace (PTRACE_SETOPTIONS, pid, 0, current_ptrace_options);
+ ptrace ((enum __ptrace_request) PTRACE_SETOPTIONS, pid, 0, current_ptrace_options);
}
-\f
void
linux_enable_event_reporting (ptid_t ptid)
{
@@ -583,7 +582,7 @@ linux_enable_event_reporting (ptid_t ptid)
/* Do not enable PTRACE_O_TRACEEXIT until GDB is more prepared to support
read-only process state. */
- ptrace (PTRACE_SETOPTIONS, pid, 0, current_ptrace_options);
+ ptrace ((enum __ptrace_request) PTRACE_SETOPTIONS, pid, 0, current_ptrace_options);
}
static void
@@ -622,7 +621,7 @@ num_lwps (int pid)
static void
delete_lwp_cleanup (void *lp_voidp)
{
- struct lwp_info *lp = lp_voidp;
+ struct lwp_info *lp = (struct lwp_info *) lp_voidp;
delete_lwp (lp->ptid);
}
@@ -1852,7 +1851,7 @@ linux_nat_detach (struct target_ops *ops, char *args, int from_tty)
{
/* Put the signal number in ARGS so that inf_ptrace_detach will
pass it along with PTRACE_DETACH. */
- args = alloca (8);
+ args = (char *)alloca (8);
sprintf (args, "%d", (int) WSTOPSIG (status));
if (debug_linux_nat)
fprintf_unfiltered (gdb_stdlog,
@@ -2175,8 +2174,8 @@ linux_handle_syscall_trap (struct lwp_info *lp, int stopping)
if (catching_syscall_number (syscall_number))
{
/* Alright, an event to report. */
- ourstatus->kind = lp->syscall_state;
- ourstatus->value.syscall_number = syscall_number;
+ ourstatus->kind = (enum target_waitkind) lp->syscall_state;
+ ourstatus->value.syscall_number = (int) syscall_number;
if (debug_linux_nat)
fprintf_unfiltered (gdb_stdlog,
@@ -2264,7 +2263,7 @@ linux_handle_extended_wait (struct lwp_info *lp, int status,
unsigned long new_pid;
int ret;
- ptrace (PTRACE_GETEVENTMSG, pid, 0, &new_pid);
+ ptrace ((enum __ptrace_request) PTRACE_GETEVENTMSG, pid, 0, &new_pid);
/* If we haven't already seen the new PID stop, wait for it now. */
if (! pull_pid_from_list (&stopped_pids, new_pid, &status))
@@ -2950,7 +2949,7 @@ running_callback (struct lwp_info *lp, void *data)
static int
count_events_callback (struct lwp_info *lp, void *data)
{
- int *count = data;
+ int *count = (int *) data;
gdb_assert (count != NULL);
@@ -2978,7 +2977,7 @@ select_singlestep_lwp_callback (struct lwp_info *lp, void *data)
static int
select_event_lwp_callback (struct lwp_info *lp, void *data)
{
- int *selector = data;
+ int *selector = (int *) data;
gdb_assert (selector != NULL);
@@ -3026,7 +3025,7 @@ cancel_breakpoint (struct lwp_info *lp)
static int
cancel_breakpoints_callback (struct lwp_info *lp, void *data)
{
- struct lwp_info *event_lp = data;
+ struct lwp_info *event_lp = (struct lwp_info *) data;
/* Leave the LWP that has been elected to receive a SIGTRAP alone. */
if (lp == event_lp)
@@ -3121,7 +3120,7 @@ resumed_callback (struct lwp_info *lp, void *data)
static int
stop_and_resume_callback (struct lwp_info *lp, void *data)
{
- int *new_pending_p = data;
+ int *new_pending_p = (int *) data;
if (!lp->stopped)
{
@@ -3869,7 +3868,7 @@ retry:
static int
resume_stopped_resumed_lwps (struct lwp_info *lp, void *data)
{
- ptid_t *wait_ptid_p = data;
+ ptid_t *wait_ptid_p = (ptid_t *) data;
if (lp->stopped
&& lp->resumed
@@ -4150,7 +4149,7 @@ linux_xfer_siginfo (struct target_ops *ops, enum target_object object,
return -1;
errno = 0;
- ptrace (PTRACE_GETSIGINFO, pid, (PTRACE_TYPE_ARG3) 0, &siginfo);
+ ptrace ((enum __ptrace_request) PTRACE_GETSIGINFO, pid, (PTRACE_TYPE_ARG3) 0, &siginfo);
if (errno != 0)
return -1;
@@ -4175,7 +4174,7 @@ linux_xfer_siginfo (struct target_ops *ops, enum target_object object,
siginfo_fixup (&siginfo, inf_siginfo, 1);
errno = 0;
- ptrace (PTRACE_SETSIGINFO, pid, (PTRACE_TYPE_ARG3) 0, &siginfo);
+ ptrace ((enum __ptrace_request) PTRACE_SETSIGINFO, pid, (PTRACE_TYPE_ARG3) 0, &siginfo);
if (errno != 0)
return -1;
}
@@ -4305,8 +4304,8 @@ linux_child_pid_to_exec_file (int pid)
{
char *name1, *name2;
- name1 = xmalloc (PATH_MAX);
- name2 = xmalloc (PATH_MAX);
+ name1 = (char *) xmalloc (PATH_MAX);
+ name2 = (char *) xmalloc (PATH_MAX);
make_cleanup (xfree, name1);
make_cleanup (xfree, name2);
memset (name2, 0, PATH_MAX);
@@ -5203,7 +5202,7 @@ linux_nat_get_siginfo (ptid_t ptid, siginfo_t *siginfo)
pid = GET_PID (ptid);
errno = 0;
- ptrace (PTRACE_GETSIGINFO, pid, (PTRACE_TYPE_ARG3) 0, siginfo);
+ ptrace ((enum __ptrace_request) PTRACE_GETSIGINFO, pid, (PTRACE_TYPE_ARG3) 0, siginfo);
if (errno != 0)
{
memset (siginfo, 0, sizeof (*siginfo));
diff --git a/gdb/linux-record.c b/gdb/linux-record.c
index 616f08f..2ca2944 100644
--- a/gdb/linux-record.c
+++ b/gdb/linux-record.c
@@ -98,7 +98,7 @@ record_linux_sockaddr (struct regcache *regcache,
if (!addr)
return 0;
- a = alloca (tdep->size_int);
+ a = (gdb_byte *) alloca (tdep->size_int);
if (record_full_arch_list_add_mem ((CORE_ADDR) len, tdep->size_int))
return -1;
@@ -140,7 +140,7 @@ record_linux_msghdr (struct regcache *regcache,
if (record_full_arch_list_add_mem ((CORE_ADDR) addr, tdep->size_msghdr))
return -1;
- a = alloca (tdep->size_msghdr);
+ a = (gdb_byte *) alloca (tdep->size_msghdr);
if (target_read_memory ((CORE_ADDR) addr, a, tdep->size_msghdr))
{
if (record_debug)
@@ -172,7 +172,7 @@ record_linux_msghdr (struct regcache *regcache,
ULONGEST i;
ULONGEST len = extract_unsigned_integer (a, tdep->size_size_t,
byte_order);
- gdb_byte *iov = alloca (tdep->size_iovec);
+ gdb_byte *iov = (gdb_byte *) alloca (tdep->size_iovec);
for (i = 0; i < len; i++)
{
@@ -805,7 +805,7 @@ Do you want to stop the program?"),
if (tmpulongest)
{
ULONGEST optvalp;
- gdb_byte *optlenp = alloca (tdep->size_int);
+ gdb_byte *optlenp = (gdb_byte *) alloca (tdep->size_int);
if (target_read_memory ((CORE_ADDR) tmpulongest, optlenp,
tdep->size_int))
@@ -847,7 +847,7 @@ Do you want to stop the program?"),
&tmpulongest);
if (tmpulongest)
{
- gdb_byte *a = alloca (tdep->size_ulong * 2);
+ gdb_byte *a = (gdb_byte *) alloca (tdep->size_ulong * 2);
ULONGEST len;
tmpulongest += tdep->size_ulong;
@@ -875,7 +875,7 @@ Do you want to stop the program?"),
case RECORD_SYS_SOCKETPAIR:
{
- gdb_byte *a = alloca (tdep->size_ulong);
+ gdb_byte *a = (gdb_byte *) alloca (tdep->size_ulong);
regcache_raw_read_unsigned (regcache, tdep->arg2,
&tmpulongest);
@@ -909,7 +909,7 @@ Do you want to stop the program?"),
&tmpulongest);
if (tmpulongest)
{
- gdb_byte *a = alloca (tdep->size_ulong * 2);
+ gdb_byte *a = (gdb_byte *) alloca (tdep->size_ulong * 2);
ULONGEST len;
tmpulongest += tdep->size_ulong * 4;
@@ -936,7 +936,7 @@ Do you want to stop the program?"),
&tmpulongest);
if (tmpulongest)
{
- gdb_byte *a = alloca (tdep->size_ulong * 2);
+ gdb_byte *a = (gdb_byte *) alloca (tdep->size_ulong * 2);
tmpulongest += tdep->size_ulong;
if (target_read_memory ((CORE_ADDR) tmpulongest, a,
@@ -968,8 +968,8 @@ Do you want to stop the program?"),
break;
case RECORD_SYS_GETSOCKOPT:
{
- gdb_byte *a = alloca (tdep->size_ulong * 2);
- gdb_byte *av = alloca (tdep->size_int);
+ gdb_byte *a = (gdb_byte *) alloca (tdep->size_ulong * 2);
+ gdb_byte *av = (gdb_byte *) alloca (tdep->size_int);
regcache_raw_read_unsigned (regcache, tdep->arg2,
&tmpulongest);
@@ -1030,7 +1030,7 @@ Do you want to stop the program?"),
break;
case RECORD_SYS_RECVMSG:
{
- gdb_byte *a = alloca (tdep->size_ulong);
+ gdb_byte *a = (gdb_byte *) alloca (tdep->size_ulong);
regcache_raw_read_unsigned (regcache, tdep->arg2,
&tmpulongest);
@@ -1386,7 +1386,7 @@ Do you want to stop the program?"),
regcache_raw_read_unsigned (regcache, tdep->arg2, &vec);
if (vec)
{
- gdb_byte *iov = alloca (tdep->size_iovec);
+ gdb_byte *iov = (gdb_byte *) alloca (tdep->size_iovec);
regcache_raw_read_unsigned (regcache, tdep->arg3, &vlen);
for (tmpulongest = 0; tmpulongest < vlen; tmpulongest++)
@@ -1889,7 +1889,7 @@ Do you want to stop the program?"),
gdb_byte *iocbp;
regcache_raw_read_unsigned (regcache, tdep->arg2, &nr);
- iocbp = alloca (nr * tdep->size_pointer);
+ iocbp = (gdb_byte *) alloca (nr * tdep->size_pointer);
if (target_read_memory ((CORE_ADDR) tmpulongest, iocbp,
nr * tdep->size_pointer))
{
diff --git a/gdb/linux-tdep.c b/gdb/linux-tdep.c
index bfb6404..bfc5aff 100644
--- a/gdb/linux-tdep.c
+++ b/gdb/linux-tdep.c
@@ -52,7 +52,7 @@ init_linux_gdbarch_data (struct gdbarch *gdbarch)
static struct linux_gdbarch_data *
get_linux_gdbarch_data (struct gdbarch *gdbarch)
{
- return gdbarch_data (gdbarch, linux_gdbarch_data_handle);
+ return (struct linux_gdbarch_data *) gdbarch_data (gdbarch, linux_gdbarch_data_handle);
}
/* This function is suitable for architectures that don't
@@ -560,7 +560,7 @@ linux_core_info_proc_mappings (struct gdbarch *gdbarch, char *args)
if (note_size < 2 * addr_size)
error (_("malformed core note - too short for header"));
- contents = xmalloc (note_size);
+ contents = (unsigned char *) xmalloc (note_size);
cleanup = make_cleanup (xfree, contents);
if (!bfd_get_section_contents (core_bfd, section, contents, 0, note_size))
error (_("could not get core note contents"));
@@ -786,7 +786,8 @@ linux_find_memory_regions_thunk (ULONGEST vaddr, ULONGEST size,
int read, int write, int exec, int modified,
const char *filename, void *arg)
{
- struct linux_find_memory_regions_data *data = arg;
+ struct linux_find_memory_regions_data *data =
+ (struct linux_find_memory_regions_data *) arg;
return data->func (vaddr, size, read, write, exec, modified, data->obfd);
}
@@ -934,7 +935,7 @@ linux_make_mappings_callback (ULONGEST vaddr, ULONGEST size,
int read, int write, int exec, int modified,
const char *filename, void *data)
{
- struct linux_make_mappings_data *map_data = data;
+ struct linux_make_mappings_data *map_data = (struct linux_make_mappings_data *) data;
gdb_byte buf[sizeof (ULONGEST)];
if (*filename == '\0' || inode == 0)
@@ -1041,7 +1042,7 @@ linux_collect_thread_registers (const struct regcache *regcache,
sect_list->size);
gdb_assert (regset && regset->collect_regset);
- buf = xmalloc (sect_list->size);
+ buf = (char *) xmalloc (sect_list->size);
regset->collect_regset (regset, regcache, -1, buf, sect_list->size);
/* PRSTATUS still needs to be treated specially. */
@@ -1082,7 +1083,7 @@ linux_get_siginfo_data (struct gdbarch *gdbarch, LONGEST *size)
siginfo_type = gdbarch_get_siginfo_type (gdbarch);
- buf = xmalloc (TYPE_LENGTH (siginfo_type));
+ buf = (gdb_byte *) xmalloc (TYPE_LENGTH (siginfo_type));
cleanups = make_cleanup (xfree, buf);
bytes_read = target_read (¤t_target, TARGET_OBJECT_SIGNAL_INFO, NULL,
@@ -1119,7 +1120,8 @@ struct linux_corefile_thread_data
static int
linux_corefile_thread_callback (struct thread_info *info, void *data)
{
- struct linux_corefile_thread_data *args = data;
+ struct linux_corefile_thread_data *args =
+ (struct linux_corefile_thread_data *) data;
if (ptid_get_pid (info->ptid) == args->pid)
{
diff --git a/gdb/linux-thread-db.c b/gdb/linux-thread-db.c
index d64e81c..3c1bd48 100644
--- a/gdb/linux-thread-db.c
+++ b/gdb/linux-thread-db.c
@@ -215,7 +215,7 @@ add_thread_db_info (void *handle)
{
struct thread_db_info *info;
- info = xcalloc (1, sizeof (*info));
+ info = (struct thread_db_info *) xcalloc (1, sizeof (*info));
info->pid = ptid_get_pid (inferior_ptid);
info->handle = handle;
@@ -411,7 +411,7 @@ thread_get_info_callback (const td_thrhandle_t *thp, void *argp)
struct thread_get_info_inout *inout;
struct thread_db_info *info;
- inout = argp;
+ inout = (struct thread_get_info_inout *) argp;
info = inout->thread_db_info;
err = info->td_thr_get_info_p (thp, &ti);
@@ -538,7 +538,7 @@ enable_thread_event (int event, CORE_ADDR *bp)
info->proc_handle.ptid = inferior_ptid;
/* Get the breakpoint address for thread EVENT. */
- err = info->td_ta_event_addr_p (info->thread_agent, event, ¬ify);
+ err = info->td_ta_event_addr_p (info->thread_agent, (td_event_e) event, ¬ify);
if (err != TD_OK)
return err;
@@ -726,7 +726,7 @@ try_thread_db_load_1 (struct thread_db_info *info)
/* Initialize pointers to the dynamic library functions we will use.
Essential functions first. */
- info->td_init_p = verbose_dlsym (info->handle, "td_init");
+ info->td_init_p = (td_err_e (*)(void)) verbose_dlsym (info->handle, "td_init");
if (info->td_init_p == NULL)
return 0;
@@ -738,7 +738,7 @@ try_thread_db_load_1 (struct thread_db_info *info)
return 0;
}
- info->td_ta_new_p = verbose_dlsym (info->handle, "td_ta_new");
+ info->td_ta_new_p = (td_err_e (*)(struct ps_prochandle *, td_thragent_t **)) verbose_dlsym (info->handle, "td_ta_new");
if (info->td_ta_new_p == NULL)
return 0;
@@ -769,34 +769,45 @@ try_thread_db_load_1 (struct thread_db_info *info)
return 0;
}
- info->td_ta_map_id2thr_p = verbose_dlsym (info->handle, "td_ta_map_id2thr");
+ info->td_ta_map_id2thr_p = (td_ta_map_id2thr_ftype *)
+ verbose_dlsym (info->handle, "td_ta_map_id2thr");
if (info->td_ta_map_id2thr_p == NULL)
return 0;
- info->td_ta_map_lwp2thr_p = verbose_dlsym (info->handle,
- "td_ta_map_lwp2thr");
+ info->td_ta_map_lwp2thr_p = (td_ta_map_lwp2thr_ftype *)
+ verbose_dlsym (info->handle, "td_ta_map_lwp2thr");
+
if (info->td_ta_map_lwp2thr_p == NULL)
return 0;
- info->td_ta_thr_iter_p = verbose_dlsym (info->handle, "td_ta_thr_iter");
+ info->td_ta_thr_iter_p = (td_ta_thr_iter_ftype *)
+ verbose_dlsym (info->handle, "td_ta_thr_iter");
if (info->td_ta_thr_iter_p == NULL)
return 0;
- info->td_thr_validate_p = verbose_dlsym (info->handle, "td_thr_validate");
+ info->td_thr_validate_p = (td_thr_validate_ftype *)
+ verbose_dlsym (info->handle, "td_thr_validate");
if (info->td_thr_validate_p == NULL)
return 0;
- info->td_thr_get_info_p = verbose_dlsym (info->handle, "td_thr_get_info");
+ info->td_thr_get_info_p = (td_thr_get_info_ftype *)
+ verbose_dlsym (info->handle, "td_thr_get_info");
if (info->td_thr_get_info_p == NULL)
return 0;
/* These are not essential. */
- info->td_ta_event_addr_p = dlsym (info->handle, "td_ta_event_addr");
- info->td_ta_set_event_p = dlsym (info->handle, "td_ta_set_event");
- info->td_ta_clear_event_p = dlsym (info->handle, "td_ta_clear_event");
- info->td_ta_event_getmsg_p = dlsym (info->handle, "td_ta_event_getmsg");
- info->td_thr_event_enable_p = dlsym (info->handle, "td_thr_event_enable");
- info->td_thr_tls_get_addr_p = dlsym (info->handle, "td_thr_tls_get_addr");
+ info->td_ta_event_addr_p = (td_ta_event_addr_ftype *)
+ dlsym (info->handle, "td_ta_event_addr");
+ info->td_ta_set_event_p = (td_ta_set_event_ftype *)
+ dlsym (info->handle, "td_ta_set_event");
+ info->td_ta_clear_event_p = (td_ta_clear_event_ftype *)
+ dlsym (info->handle, "td_ta_clear_event");
+ info->td_ta_event_getmsg_p = (td_ta_event_getmsg_ftype *)
+ dlsym (info->handle, "td_ta_event_getmsg");
+ info->td_thr_event_enable_p = (td_thr_event_enable_ftype *)
+ dlsym (info->handle, "td_thr_event_enable");
+ info->td_thr_tls_get_addr_p = (td_thr_tls_get_addr_ftype *)
+ dlsym (info->handle, "td_thr_tls_get_addr");
if (thread_db_find_new_threads_silently (inferior_ptid) != 0)
{
@@ -900,7 +911,7 @@ try_thread_db_load_from_pdir_1 (struct objfile *obj, const char *subdir)
return 0;
}
- path = xmalloc (strlen (obj->name) + (subdir ? strlen (subdir) + 1 : 0)
+ path = (char *) xmalloc (strlen (obj->name) + (subdir ? strlen (subdir) + 1 : 0)
+ 1 + strlen (LIBTHREAD_DB_SO) + 1);
cleanup = make_cleanup (xfree, path);
@@ -983,7 +994,7 @@ try_thread_db_load_from_dir (const char *dir, size_t dir_len)
if (!auto_load_thread_db)
return 0;
- path = xmalloc (dir_len + 1 + strlen (LIBTHREAD_DB_SO) + 1);
+ path = (char *) xmalloc (dir_len + 1 + strlen (LIBTHREAD_DB_SO) + 1);
cleanup = make_cleanup (xfree, path);
memcpy (path, dir, dir_len);
@@ -1034,7 +1045,7 @@ thread_db_load_search (void)
if (this_dir[pdir_len] == '/')
{
- subdir = xmalloc (strlen (this_dir));
+ subdir = (char *) xmalloc (strlen (this_dir));
make_cleanup (xfree, subdir);
strcpy (subdir, this_dir + pdir_len + 1);
}
@@ -1282,7 +1293,7 @@ attach_thread (ptid_t ptid, const td_thrhandle_t *th_p,
}
/* Construct the thread's private data. */
- private_thr = xmalloc (sizeof (struct private_thread_info));
+ private_thr = (struct private_thread_info *) xmalloc (sizeof (struct private_thread_info));
memset (private_thr, 0, sizeof (struct private_thread_info));
/* A thread ID of zero may mean the thread library has not initialized
@@ -1550,7 +1561,7 @@ find_new_threads_callback (const td_thrhandle_t *th_p, void *data)
td_err_e err;
ptid_t ptid;
struct thread_info *tp;
- struct callback_data *cb_data = data;
+ struct callback_data *cb_data = (struct callback_data *) data;
struct thread_db_info *info = cb_data->info;
err = info->td_thr_get_info_p (th_p, &ti);
@@ -1936,7 +1947,7 @@ info_auto_load_libthread_db (char *args, int from_tty)
if (info->filename != NULL)
info_count++;
- array = xmalloc (sizeof (*array) * info_count);
+ array = (struct thread_db_info **) xmalloc (sizeof (*array) * info_count);
back_to = make_cleanup (xfree, array);
info_count = 0;
@@ -1998,7 +2009,7 @@ info_auto_load_libthread_db (char *args, int from_tty)
ui_out_table_header (uiout, pids_len, ui_left, "PIDs", "Pids");
ui_out_table_body (uiout);
- pids = xmalloc (max_pids_len + 1);
+ pids = (char *) xmalloc (max_pids_len + 1);
make_cleanup (xfree, pids);
/* Note I is incremented inside the cycle, not at its end. */
diff --git a/gdb/proc-service.c b/gdb/proc-service.c
index 83e1d67..2902265 100644
--- a/gdb/proc-service.c
+++ b/gdb/proc-service.c
@@ -227,7 +227,7 @@ ps_err_e
ps_pdread (gdb_ps_prochandle_t ph, psaddr_t addr,
gdb_ps_read_buf_t buf, gdb_ps_size_t size)
{
- return ps_xfer_memory (ph, addr, buf, size, 0);
+ return ps_xfer_memory (ph, addr, (gdb_byte *)buf, size, 0);
}
/* Write SIZE bytes from BUF into the target process PH at address ADDR. */
diff --git a/gdb/remote-fileio.c b/gdb/remote-fileio.c
index 5b7ef1d..5ed5bd6 100644
--- a/gdb/remote-fileio.c
+++ b/gdb/remote-fileio.c
@@ -614,7 +614,7 @@ remote_fileio_func_open (char *buf)
mode = remote_fileio_mode_to_host (num, 1);
/* Request pathname. */
- pathname = alloca (length);
+ pathname = (char *) alloca (length);
if (target_read_memory (ptrval, (gdb_byte *) pathname, length) != 0)
{
remote_fileio_ioerror ();
@@ -958,7 +958,7 @@ remote_fileio_func_rename (char *buf)
}
/* Request oldpath using 'm' packet */
- oldpath = alloca (old_len);
+ oldpath = (char *) alloca (old_len);
if (target_read_memory (old_ptr, (gdb_byte *) oldpath, old_len) != 0)
{
remote_fileio_ioerror ();
@@ -966,7 +966,7 @@ remote_fileio_func_rename (char *buf)
}
/* Request newpath using 'm' packet */
- newpath = alloca (new_len);
+ newpath = (char *) alloca (new_len);
if (target_read_memory (new_ptr, (gdb_byte *) newpath, new_len) != 0)
{
remote_fileio_ioerror ();
@@ -1044,7 +1044,7 @@ remote_fileio_func_unlink (char *buf)
return;
}
/* Request pathname using 'm' packet */
- pathname = alloca (length);
+ pathname = (char *) alloca (length);
if (target_read_memory (ptrval, (gdb_byte *) pathname, length) != 0)
{
remote_fileio_ioerror ();
@@ -1094,7 +1094,7 @@ remote_fileio_func_stat (char *buf)
statptr = (CORE_ADDR) lnum;
/* Request pathname using 'm' packet */
- pathname = alloca (namelength);
+ pathname = (char *) alloca (namelength);
if (target_read_memory (nameptr, (gdb_byte *) pathname, namelength) != 0)
{
remote_fileio_ioerror ();
@@ -1295,7 +1295,7 @@ remote_fileio_func_system (char *buf)
if (length)
{
/* Request commandline using 'm' packet */
- cmdline = alloca (length);
+ cmdline = (char *) alloca (length);
if (target_read_memory (ptrval, (gdb_byte *) cmdline, length) != 0)
{
remote_fileio_ioerror ();
@@ -1349,7 +1349,7 @@ static struct {
static int
do_remote_fileio_request (struct ui_out *uiout, void *buf_arg)
{
- char *buf = buf_arg;
+ char *buf = (char *) buf_arg;
char *c;
int idx;
diff --git a/gdb/remote-notif.c b/gdb/remote-notif.c
index 0f73a52..696394a 100644
--- a/gdb/remote-notif.c
+++ b/gdb/remote-notif.c
@@ -242,7 +242,7 @@ handle_notification (char *buf)
static void
do_notif_event_xfree (void *arg)
{
- struct notif_event *event = arg;
+ struct notif_event *event = (struct notif_event *) arg;
if (event && event->dtr)
event->dtr (event);
diff --git a/gdb/remote.c b/gdb/remote.c
index a1ff465..4c56e47 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -532,7 +532,8 @@ static struct gdbarch_data *remote_gdbarch_data_handle;
static struct remote_arch_state *
get_remote_arch_state (void)
{
- return gdbarch_data (target_gdbarch (), remote_gdbarch_data_handle);
+ return (struct remote_arch_state *)
+ gdbarch_data (target_gdbarch (), remote_gdbarch_data_handle);
}
/* Fetch the global remote target state. */
@@ -553,8 +554,8 @@ get_remote_state (void)
static int
compare_pnums (const void *lhs_, const void *rhs_)
{
- const struct packet_reg * const *lhs = lhs_;
- const struct packet_reg * const *rhs = rhs_;
+ const struct packet_reg * const *lhs = (const struct packet_reg * const*) lhs_;
+ const struct packet_reg * const *rhs = (const struct packet_reg * const*) rhs_;
if ((*lhs)->pnum < (*rhs)->pnum)
return -1;
@@ -587,7 +588,7 @@ map_regcache_remote_table (struct gdbarch *gdbarch, struct packet_reg *regs)
with a remote protocol number, in order of ascending protocol
number. */
- remote_regs = alloca (gdbarch_num_regs (gdbarch)
+ remote_regs = (struct packet_reg **) alloca (gdbarch_num_regs (gdbarch)
* sizeof (struct packet_reg *));
for (num_remote_regs = 0, regnum = 0;
regnum < gdbarch_num_regs (gdbarch);
@@ -624,7 +625,7 @@ remote_register_number_and_offset (struct gdbarch *gdbarch, int regnum,
gdb_assert (regnum < gdbarch_num_regs (gdbarch));
- regs = xcalloc (gdbarch_num_regs (gdbarch), sizeof (struct packet_reg));
+ regs = (struct packet_reg *) xcalloc (gdbarch_num_regs (gdbarch), sizeof (struct packet_reg));
old_chain = make_cleanup (xfree, regs);
sizeof_g_packet = map_regcache_remote_table (gdbarch, regs);
@@ -681,7 +682,7 @@ init_remote_state (struct gdbarch *gdbarch)
if (rs->buf_size < rsa->remote_packet_size)
{
rs->buf_size = 2 * rsa->remote_packet_size;
- rs->buf = xrealloc (rs->buf, rs->buf_size);
+ rs->buf = (char *) xrealloc (rs->buf, rs->buf_size);
}
return rsa;
@@ -922,7 +923,7 @@ get_memory_packet_size (struct memory_packet_config *config)
if (rs->buf_size < what_they_get + 1)
{
rs->buf_size = 2 * what_they_get;
- rs->buf = xrealloc (rs->buf, 2 * what_they_get);
+ rs->buf = (char *) xrealloc (rs->buf, 2 * what_they_get);
}
return what_they_get;
@@ -1615,7 +1616,8 @@ demand_private_info (ptid_t ptid)
if (!info->private_data)
{
- info->private_data = xmalloc (sizeof (*(info->private_data)));
+ info->private_data = (typeof (info->private_data))
+ xmalloc (sizeof (*(info->private_data)));
info->private_dtor = free_private_thread_info;
info->private_data->core = -1;
info->private_data->extra = 0;
@@ -1654,7 +1656,7 @@ remote_pass_signals (int numsigs, unsigned char *pass_signals)
if (pass_signals[i])
count++;
}
- pass_packet = xmalloc (count * 3 + strlen ("QPassSignals:") + 1);
+ pass_packet = (char *) xmalloc (count * 3 + strlen ("QPassSignals:") + 1);
strcpy (pass_packet, "QPassSignals:");
p = pass_packet + strlen (pass_packet);
for (i = 0; i < numsigs; i++)
@@ -1713,7 +1715,7 @@ remote_program_signals (int numsigs, unsigned char *signals)
if (signals[i])
count++;
}
- packet = xmalloc (count * 3 + strlen ("QProgramSignals:") + 1);
+ packet = (char *) xmalloc (count * 3 + strlen ("QProgramSignals:") + 1);
strcpy (packet, "QProgramSignals:");
p = packet + strlen (packet);
for (i = 0; i < numsigs; i++)
@@ -2634,13 +2636,13 @@ start_thread (struct gdb_xml_parser *parser,
const struct gdb_xml_element *element,
void *user_data, VEC(gdb_xml_value_s) *attributes)
{
- struct threads_parsing_context *data = user_data;
+ struct threads_parsing_context *data = (struct threads_parsing_context *) user_data;
struct thread_item item;
char *id;
struct gdb_xml_value *attr;
- id = xml_find_attribute (attributes, "id")->value;
+ id = (char *) xml_find_attribute (attributes, "id")->value;
item.ptid = read_ptid (id, NULL);
attr = xml_find_attribute (attributes, "core");
@@ -2659,7 +2661,7 @@ end_thread (struct gdb_xml_parser *parser,
const struct gdb_xml_element *element,
void *user_data, const char *body_text)
{
- struct threads_parsing_context *data = user_data;
+ struct threads_parsing_context *data = (struct threads_parsing_context *) user_data;
if (body_text && *body_text)
VEC_last (thread_item_t, data->items)->extra = xstrdup (body_text);
@@ -2693,7 +2695,7 @@ const struct gdb_xml_element threads_elements[] = {
static void
clear_threads_parsing_context (void *p)
{
- struct threads_parsing_context *context = p;
+ struct threads_parsing_context *context = (struct threads_parsing_context *) p;
int i;
struct thread_item *item;
@@ -3281,7 +3283,7 @@ stop_reply_extract_thread (char *stop_reply)
}
}
- return null_ptid;
+ return (ptid_t) null_ptid;
}
/* Query the remote target for which is the current thread/process,
@@ -3481,7 +3483,7 @@ remote_start_remote (int from_tty, struct target_ops *target, int extended_p)
else
{
/* Save the reply for later. */
- wait_status = alloca (strlen (rs->buf) + 1);
+ wait_status = (char *) alloca (strlen (rs->buf) + 1);
strcpy (wait_status, rs->buf);
}
@@ -3674,7 +3676,7 @@ remote_check_symbols (void)
/* Allocate a message buffer. We can't reuse the input buffer in RS,
because we need both at the same time. */
- msg = alloca (get_remote_packet_size ());
+ msg = (char *) alloca (get_remote_packet_size ());
/* Invite target to request symbol lookups. */
@@ -4210,7 +4212,7 @@ remote_query_supported (void)
if (rs->buf_size < rs->explicit_packet_size)
{
rs->buf_size = rs->explicit_packet_size;
- rs->buf = xrealloc (rs->buf, rs->buf_size);
+ rs->buf = (char *) xrealloc (rs->buf, rs->buf_size);
}
/* Handle the defaults for unmentioned features. */
@@ -4230,7 +4232,7 @@ remote_query_supported (void)
static void
remote_unpush_target (void)
{
- pop_all_targets_above (process_stratum - 1);
+ pop_all_targets_above ((enum strata) (process_stratum - 1));
}
static void
@@ -4511,7 +4513,7 @@ extended_remote_attach_1 (struct target_ops *target, char *args, int from_tty)
if (!non_stop)
{
/* Save the reply for later. */
- wait_status = alloca (strlen (rs->buf) + 1);
+ wait_status = (char *) alloca (strlen (rs->buf) + 1);
strcpy (wait_status, rs->buf);
}
else if (strcmp (rs->buf, "OK") != 0)
@@ -5371,8 +5373,8 @@ remote_notif_remove_all (QUEUE (stop_reply_p) *q,
stop_reply_p event,
void *data)
{
- struct queue_iter_param *param = data;
- struct inferior *inf = param->input;
+ struct queue_iter_param *param = (struct queue_iter_param *) data;
+ struct inferior *inf = (struct inferior *) param->input;
if (inf == NULL || ptid_get_pid (event->ptid) == inf->pid)
{
@@ -5419,8 +5421,8 @@ remote_notif_remove_once_on_match (QUEUE (stop_reply_p) *q,
stop_reply_p event,
void *data)
{
- struct queue_iter_param *param = data;
- ptid_t *ptid = param->input;
+ struct queue_iter_param *param = (struct queue_iter_param *) data;
+ ptid_t *ptid = (ptid_t *) param->input;
if (ptid_match (event->ptid, *ptid))
{
@@ -5495,7 +5497,7 @@ stop_reply_match_ptid_and_ws (QUEUE (stop_reply_p) *q,
struct stop_reply *event,
void *data)
{
- ptid_t *ptid = data;
+ ptid_t *ptid = (ptid_t *) data;
return !(ptid_equal (*ptid, event->ptid)
&& event->ws.kind == TARGET_WAITKIND_STOPPED);
@@ -6214,7 +6216,7 @@ process_g_packet (struct regcache *regcache)
}
}
- regs = alloca (rsa->sizeof_g_packet);
+ regs = (char *) alloca (rsa->sizeof_g_packet);
/* Unimplemented registers read as all bits zero. */
memset (regs, 0, rsa->sizeof_g_packet);
@@ -6421,7 +6423,7 @@ store_registers_using_G (const struct regcache *regcache)
{
int i;
- regs = alloca (rsa->sizeof_g_packet);
+ regs = (gdb_byte *) alloca (rsa->sizeof_g_packet);
memset (regs, 0, rsa->sizeof_g_packet);
for (i = 0; i < gdbarch_num_regs (get_regcache_arch (regcache)); i++)
{
@@ -7230,7 +7232,7 @@ putpkt_binary (char *buf, int cnt)
struct remote_state *rs = get_remote_state ();
int i;
unsigned char csum = 0;
- char *buf2 = alloca (cnt + 6);
+ char *buf2 = (char *) alloca (cnt + 6);
int ch;
int tcount = 0;
@@ -7560,7 +7562,7 @@ read_frame (char **buf_p,
{
/* Make some more room in the buffer. */
*sizeof_buf += repeat;
- *buf_p = xrealloc (*buf_p, *sizeof_buf);
+ *buf_p = (char *) xrealloc (*buf_p, *sizeof_buf);
buf = *buf_p;
}
@@ -7578,7 +7580,7 @@ read_frame (char **buf_p,
{
/* Make some more room in the buffer. */
*sizeof_buf *= 2;
- *buf_p = xrealloc (*buf_p, *sizeof_buf);
+ *buf_p = (char *) xrealloc (*buf_p, *sizeof_buf);
buf = *buf_p;
}
@@ -7782,7 +7784,7 @@ getpkt_or_notif_sane (char **buf, long *sizeof_buf, int forever,
static int
putpkt_for_catch_errors (void *arg)
{
- return putpkt (arg);
+ return putpkt ((char *) arg);
}
static void
@@ -8273,7 +8275,7 @@ remote_insert_watchpoint (CORE_ADDR addr, int len, int type,
struct remote_state *rs = get_remote_state ();
char *endbuf = rs->buf + get_remote_packet_size ();
char *p;
- enum Z_packet_type packet = watchpoint_to_Z_packet (type);
+ enum Z_packet_type packet = (enum Z_packet_type) watchpoint_to_Z_packet (type);
if (remote_protocol_packets[PACKET_Z0 + packet].support == PACKET_DISABLE)
return 1;
@@ -8322,7 +8324,7 @@ remote_remove_watchpoint (CORE_ADDR addr, int len, int type,
struct remote_state *rs = get_remote_state ();
char *endbuf = rs->buf + get_remote_packet_size ();
char *p;
- enum Z_packet_type packet = watchpoint_to_Z_packet (type);
+ enum Z_packet_type packet = (enum Z_packet_type) watchpoint_to_Z_packet (type);
if (remote_protocol_packets[PACKET_Z0 + packet].support == PACKET_DISABLE)
return -1;
@@ -8627,7 +8629,7 @@ compare_sections_command (char *args, int from_tty)
matched = 1; /* Do this section. */
lma = s->lma;
- sectdata = xmalloc (size);
+ sectdata = (gdb_byte *) xmalloc (size);
old_chain = make_cleanup (xfree, sectdata);
bfd_get_section_contents (exec_bfd, s, sectdata, 0, size);
@@ -9512,7 +9514,7 @@ register_remote_g_packet_guess (struct gdbarch *gdbarch, int bytes,
const struct target_desc *tdesc)
{
struct remote_g_packet_data *data
- = gdbarch_data (gdbarch, remote_g_packet_data_handle);
+ = (struct remote_g_packet_data *) gdbarch_data (gdbarch, remote_g_packet_data_handle);
struct remote_g_packet_guess new_guess, *guess;
int ix;
@@ -9537,8 +9539,8 @@ register_remote_g_packet_guess (struct gdbarch *gdbarch, int bytes,
static int
remote_read_description_p (struct target_ops *target)
{
- struct remote_g_packet_data *data
- = gdbarch_data (target_gdbarch (), remote_g_packet_data_handle);
+ struct remote_g_packet_data *data = (typeof (data))
+ gdbarch_data (target_gdbarch (), remote_g_packet_data_handle);
if (!VEC_empty (remote_g_packet_guess_s, data->guesses))
return 1;
@@ -9549,8 +9551,8 @@ remote_read_description_p (struct target_ops *target)
static const struct target_desc *
remote_read_description (struct target_ops *target)
{
- struct remote_g_packet_data *data
- = gdbarch_data (target_gdbarch (), remote_g_packet_data_handle);
+ struct remote_g_packet_data *data = (typeof (data))
+ gdbarch_data (target_gdbarch (), remote_g_packet_data_handle);
/* Do not try this during initial connection, when we do not know
whether there is a running but stopped thread. */
@@ -9934,7 +9936,7 @@ remote_hostio_readlink (const char *filename, int *remote_errno)
if (len < 0)
return NULL;
- ret = xmalloc (len + 1);
+ ret = (char *) xmalloc (len + 1);
read_len = remote_unescape_input ((gdb_byte *) attachment, attachment_len,
(gdb_byte *) ret, len);
@@ -10034,7 +10036,7 @@ remote_bfd_iovec_open (struct bfd *abfd, void *open_closure)
return NULL;
}
- stream = xmalloc (sizeof (int));
+ stream = (int *) xmalloc (sizeof (int));
*stream = fd;
return stream;
}
@@ -10138,7 +10140,7 @@ remote_file_put (const char *local_file, const char *remote_file, int from_tty)
/* Send up to this many bytes at once. They won't all fit in the
remote packet limit, so we'll transfer slightly fewer. */
io_size = get_remote_packet_size ();
- buffer = xmalloc (io_size);
+ buffer = (gdb_byte *) xmalloc (io_size);
make_cleanup (xfree, buffer);
close_cleanup = make_cleanup (remote_hostio_close_cleanup, &fd);
@@ -10224,7 +10226,7 @@ remote_file_get (const char *remote_file, const char *local_file, int from_tty)
/* Send up to this many bytes at once. They won't all fit in the
remote packet limit, so we'll transfer slightly fewer. */
io_size = get_remote_packet_size ();
- buffer = xmalloc (io_size);
+ buffer = (gdb_byte *) xmalloc (io_size);
make_cleanup (xfree, buffer);
close_cleanup = make_cleanup (remote_hostio_close_cleanup, &fd);
@@ -10331,7 +10333,7 @@ remote_delete_command (char *args, int from_tty)
static void
remote_command (char *args, int from_tty)
{
- help_list (remote_cmdlist, "remote ", -1, gdb_stdout);
+ help_list (remote_cmdlist, "remote ", (enum command_class) -1, gdb_stdout);
}
static int
@@ -10447,7 +10449,7 @@ static void free_actions_list_cleanup_wrapper (void *);
static void
free_actions_list_cleanup_wrapper (void *al)
{
- free_actions_list (al);
+ free_actions_list ((char **) al);
}
static void
@@ -11362,7 +11364,7 @@ remote_enable_btrace (ptid_t ptid)
target_pid_to_str (ptid));
}
- tinfo = xzalloc (sizeof (*tinfo));
+ tinfo = (struct btrace_target_info *) xzalloc (sizeof (*tinfo));
tinfo->ptid = ptid;
return tinfo;
@@ -11675,7 +11677,7 @@ remote_async (void (*callback) (enum inferior_event_type event_type,
static void
set_remote_cmd (char *args, int from_tty)
{
- help_list (remote_set_cmdlist, "set remote ", -1, gdb_stdout);
+ help_list (remote_set_cmdlist, "set remote ", (enum command_class) -1, gdb_stdout);
}
static void
@@ -11827,7 +11829,7 @@ _initialize_remote (void)
whenever a larger buffer is needed. */
rs = get_remote_state_raw ();
rs->buf_size = 400;
- rs->buf = xmalloc (rs->buf_size);
+ rs->buf = (char *) xmalloc (rs->buf_size);
init_remote_ops ();
add_target (&remote_ops);
@@ -12229,6 +12231,6 @@ stepping is supported by the target. The default is on."),
any_thread_ptid = ptid_build (42000, 1, 0);
target_buf_size = 2048;
- target_buf = xmalloc (target_buf_size);
+ target_buf = (char *) xmalloc (target_buf_size);
}
diff --git a/gdb/ser-base.c b/gdb/ser-base.c
index 52c5726..10fb0a7 100644
--- a/gdb/ser-base.c
+++ b/gdb/ser-base.c
@@ -155,7 +155,7 @@ run_async_handler_and_reschedule (struct serial *scb)
static void
fd_event (int error, void *context)
{
- struct serial *scb = context;
+ struct serial *scb = (struct serial *) context;
if (error != 0)
{
scb->bufcnt = SERIAL_ERROR;
@@ -192,7 +192,7 @@ fd_event (int error, void *context)
static void
push_event (void *context)
{
- struct serial *scb = context;
+ struct serial *scb = (struct serial *) context;
scb->async_state = NOTHING_SCHEDULED; /* Timers are one-off */
run_async_handler_and_reschedule (scb);
@@ -442,7 +442,7 @@ ser_base_readchar (struct serial *scb, int timeout)
int
ser_base_write (struct serial *scb, const void *buf, size_t count)
{
- const char *str = buf;
+ const char *str = (const char *) buf;
int cc;
while (count > 0)
diff --git a/gdb/ser-pipe.c b/gdb/ser-pipe.c
index 1b30f78..aa9c7aa 100644
--- a/gdb/ser-pipe.c
+++ b/gdb/ser-pipe.c
@@ -149,7 +149,7 @@ pipe_open (struct serial *scb, const char *name)
static void
pipe_close (struct serial *scb)
{
- struct pipe_state *state = scb->state;
+ struct pipe_state *state = (struct pipe_state *) scb->state;
close (scb->fd);
scb->fd = -1;
diff --git a/gdb/ser-tcp.c b/gdb/ser-tcp.c
index f40bfce..58bb303 100644
--- a/gdb/ser-tcp.c
+++ b/gdb/ser-tcp.c
@@ -363,13 +363,13 @@ ser_tcp_send_break (struct serial *scb)
static void
set_tcp_cmd (char *args, int from_tty)
{
- help_list (tcp_set_cmdlist, "set tcp ", -1, gdb_stdout);
+ help_list (tcp_set_cmdlist, "set tcp ", (enum command_class) -1, gdb_stdout);
}
static void
show_tcp_cmd (char *args, int from_tty)
{
- help_list (tcp_show_cmdlist, "show tcp ", -1, gdb_stdout);
+ help_list (tcp_show_cmdlist, "show tcp ", (enum command_class) -1, gdb_stdout);
}
diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c
index afe6ac9..e8db3df 100644
--- a/gdb/solib-svr4.c
+++ b/gdb/solib-svr4.c
@@ -199,7 +199,7 @@ lm_info_read (CORE_ADDR lm_addr)
struct lm_info *lm_info;
struct cleanup *back_to;
- lm = xmalloc (lmo->link_map_size);
+ lm = (gdb_byte *) xmalloc (lmo->link_map_size);
back_to = make_cleanup (xfree, lm);
if (target_read_memory (lm_addr, lm, lmo->link_map_size) != 0)
@@ -212,7 +212,7 @@ lm_info_read (CORE_ADDR lm_addr)
{
struct type *ptr_type = builtin_type (target_gdbarch ())->builtin_data_ptr;
- lm_info = xzalloc (sizeof (*lm_info));
+ lm_info = (struct lm_info *) xzalloc (sizeof (*lm_info));
lm_info->lm_addr = lm_addr;
lm_info->l_addr_inferior = extract_typed_address (&lm[lmo->l_addr_offset],
@@ -409,7 +409,7 @@ svr4_pspace_data_cleanup (struct program_space *pspace, void *arg)
{
struct svr4_info *info;
- info = program_space_data (pspace, solib_svr4_pspace_data);
+ info = (struct svr4_info *) program_space_data (pspace, solib_svr4_pspace_data);
if (info == NULL)
return;
@@ -427,7 +427,7 @@ get_svr4_info (void)
{
struct svr4_info *info;
- info = program_space_data (current_program_space, solib_svr4_pspace_data);
+ info = (struct svr4_info *) program_space_data (current_program_space, solib_svr4_pspace_data);
if (info != NULL)
return info;
@@ -571,7 +571,7 @@ read_program_header (int type, int *p_sect_size, int *p_arch_size)
}
/* Read in requested program header. */
- buf = xmalloc (sect_size);
+ buf = (gdb_byte *) xmalloc (sect_size);
if (target_read_memory (sect_addr, buf, sect_size))
{
xfree (buf);
@@ -604,7 +604,7 @@ find_program_interpreter (void)
{
int sect_size = bfd_section_size (exec_bfd, interp_sect);
- buf = xmalloc (sect_size);
+ buf = (gdb_byte *) xmalloc (sect_size);
bfd_get_section_contents (exec_bfd, interp_sect, buf, 0, sect_size);
}
}
@@ -667,7 +667,7 @@ scan_dyntag (int dyntag, bfd *abfd, CORE_ADDR *ptr)
/* Read in .dynamic from the BFD. We will get the actual value
from memory later. */
sect_size = bfd_section_size (abfd, sect);
- buf = bufstart = alloca (sect_size);
+ buf = bufstart = (gdb_byte *) alloca (sect_size);
if (!bfd_get_section_contents (abfd, sect,
buf, 0, sect_size))
return 0;
@@ -804,7 +804,7 @@ elf_locate_base (void)
gdb_byte *pbuf;
int pbuf_size = TYPE_LENGTH (ptr_type);
- pbuf = alloca (pbuf_size);
+ pbuf = (gdb_byte *) alloca (pbuf_size);
/* DT_MIPS_RLD_MAP contains a pointer to the address
of the dynamic link structure. */
if (target_read_memory (dyn_ptr, pbuf, pbuf_size))
@@ -980,7 +980,7 @@ open_symbol_file_object (void *from_ttyp)
struct link_map_offsets *lmo = svr4_fetch_link_map_offsets ();
struct type *ptr_type = builtin_type (target_gdbarch ())->builtin_data_ptr;
int l_name_size = TYPE_LENGTH (ptr_type);
- gdb_byte *l_name_buf = xmalloc (l_name_size);
+ gdb_byte *l_name_buf = (gdb_byte *) xmalloc (l_name_size);
struct cleanup *cleanups = make_cleanup (xfree, l_name_buf);
struct svr4_info *info = get_svr4_info ();
@@ -1095,10 +1095,10 @@ svr4_copy_library_list (struct so_list *src)
{
struct so_list *new_so;
- new_so = xmalloc (sizeof (struct so_list));
+ new_so = (struct so_list *) xmalloc (sizeof (struct so_list));
memcpy (new_so, src, sizeof (struct so_list));
- new_so->lm_info = xmalloc (sizeof (struct lm_info));
+ new_so->lm_info = (struct lm_info *) xmalloc (sizeof (struct lm_info));
memcpy (new_so->lm_info, src->lm_info, sizeof (struct lm_info));
new_so->next = NULL;
@@ -1123,11 +1123,11 @@ library_list_start_library (struct gdb_xml_parser *parser,
const struct gdb_xml_element *element,
void *user_data, VEC(gdb_xml_value_s) *attributes)
{
- struct svr4_library_list *list = user_data;
- const char *name = xml_find_attribute (attributes, "name")->value;
- ULONGEST *lmp = xml_find_attribute (attributes, "lm")->value;
- ULONGEST *l_addrp = xml_find_attribute (attributes, "l_addr")->value;
- ULONGEST *l_ldp = xml_find_attribute (attributes, "l_ld")->value;
+ struct svr4_library_list *list = (struct svr4_library_list *) user_data;
+ const char *name = (const char *) xml_find_attribute (attributes, "name")->value;
+ ULONGEST *lmp = (ULONGEST *) xml_find_attribute (attributes, "lm")->value;
+ ULONGEST *l_addrp = (ULONGEST *) xml_find_attribute (attributes, "l_addr")->value;
+ ULONGEST *l_ldp = (ULONGEST *) xml_find_attribute (attributes, "l_ld")->value;
struct so_list *new_elem;
new_elem = XZALLOC (struct so_list);
@@ -1151,8 +1151,8 @@ svr4_library_list_start_list (struct gdb_xml_parser *parser,
const struct gdb_xml_element *element,
void *user_data, VEC(gdb_xml_value_s) *attributes)
{
- struct svr4_library_list *list = user_data;
- const char *version = xml_find_attribute (attributes, "version")->value;
+ struct svr4_library_list *list = (struct svr4_library_list *) user_data;
+ const char *version = (const char *) xml_find_attribute (attributes, "version")->value;
struct gdb_xml_value *main_lm = xml_find_attribute (attributes, "main-lm");
if (strcmp (version, "1.0") != 0)
@@ -1285,7 +1285,7 @@ svr4_default_sos (void)
new_so = XZALLOC (struct so_list);
- new_so->lm_info = xzalloc (sizeof (struct lm_info));
+ new_so->lm_info = (struct lm_info *) xzalloc (sizeof (struct lm_info));
/* Nothing will ever check the other fields if we set l_addr_p. */
new_so->lm_info->l_addr = info->debug_loader_offset;
@@ -1574,7 +1574,7 @@ struct probe_and_action
static hashval_t
hash_probe_and_action (const void *p)
{
- const struct probe_and_action *pa = p;
+ const struct probe_and_action *pa = (const struct probe_and_action *) p;
return (hashval_t) pa->probe->address;
}
@@ -1585,8 +1585,8 @@ hash_probe_and_action (const void *p)
static int
equal_probe_and_action (const void *p1, const void *p2)
{
- const struct probe_and_action *pa1 = p1;
- const struct probe_and_action *pa2 = p2;
+ const struct probe_and_action *pa1 = (const struct probe_and_action *) p1;
+ const struct probe_and_action *pa2 = (const struct probe_and_action *) p2;
return pa1->probe->address == pa2->probe->address;
}
@@ -1890,7 +1890,7 @@ svr4_update_solib_event_breakpoint (struct breakpoint *b, void *arg)
struct svr4_info *info;
struct probe_and_action *pa;
- info = program_space_data (loc->pspace, solib_svr4_pspace_data);
+ info = (struct svr4_info *) program_space_data (loc->pspace, solib_svr4_pspace_data);
if (info == NULL || info->probes_table == NULL)
continue;
@@ -2395,7 +2395,7 @@ read_program_headers_from_bfd (bfd *abfd, int *phdrs_size)
if (*phdrs_size == 0)
return NULL;
- buf = xmalloc (*phdrs_size);
+ buf = (gdb_byte *) xmalloc (*phdrs_size);
if (bfd_seek (abfd, ehdr->e_phoff, SEEK_SET) != 0
|| bfd_bread (buf, *phdrs_size, abfd) != *phdrs_size)
{
@@ -2815,7 +2815,7 @@ svr4_relocate_main_executable (void)
struct section_offsets *new_offsets;
int i;
- new_offsets = alloca (symfile_objfile->num_sections
+ new_offsets = (struct section_offsets *) alloca (symfile_objfile->num_sections
* sizeof (*new_offsets));
for (i = 0; i < symfile_objfile->num_sections; i++)
@@ -2946,7 +2946,7 @@ solib_svr4_init (struct obstack *obstack)
{
struct solib_svr4_ops *ops;
- ops = OBSTACK_ZALLOC (obstack, struct solib_svr4_ops);
+ ops = (struct solib_svr4_ops *) OBSTACK_ZALLOC (obstack, struct solib_svr4_ops);
ops->fetch_link_map_offsets = NULL;
return ops;
}
@@ -2958,7 +2958,8 @@ void
set_solib_svr4_fetch_link_map_offsets (struct gdbarch *gdbarch,
struct link_map_offsets *(*flmo) (void))
{
- struct solib_svr4_ops *ops = gdbarch_data (gdbarch, solib_svr4_data);
+ struct solib_svr4_ops *ops = (struct solib_svr4_ops *) gdbarch_data (gdbarch,
+ solib_svr4_data);
ops->fetch_link_map_offsets = flmo;
@@ -2971,7 +2972,8 @@ set_solib_svr4_fetch_link_map_offsets (struct gdbarch *gdbarch,
static struct link_map_offsets *
svr4_fetch_link_map_offsets (void)
{
- struct solib_svr4_ops *ops = gdbarch_data (target_gdbarch (), solib_svr4_data);
+ struct solib_svr4_ops *ops = (struct solib_svr4_ops *) gdbarch_data (target_gdbarch (),
+ solib_svr4_data);
gdb_assert (ops->fetch_link_map_offsets);
return ops->fetch_link_map_offsets ();
@@ -2982,7 +2984,8 @@ svr4_fetch_link_map_offsets (void)
static int
svr4_have_link_map_offsets (void)
{
- struct solib_svr4_ops *ops = gdbarch_data (target_gdbarch (), solib_svr4_data);
+ struct solib_svr4_ops *ops = (struct solib_svr4_ops *) gdbarch_data (target_gdbarch (),
+ solib_svr4_data);
return (ops->fetch_link_map_offsets != NULL);
}
diff --git a/gdb/symfile-mem.c b/gdb/symfile-mem.c
index e148d09..fb60e1a 100644
--- a/gdb/symfile-mem.c
+++ b/gdb/symfile-mem.c
@@ -179,7 +179,8 @@ struct symbol_file_add_from_memory_args
static int
symbol_file_add_from_memory_wrapper (struct ui_out *uiout, void *data)
{
- struct symbol_file_add_from_memory_args *args = data;
+ struct symbol_file_add_from_memory_args *args =
+ (struct symbol_file_add_from_memory_args *) data;
symbol_file_add_from_memory (args->bfd, args->sysinfo_ehdr, args->name,
args->from_tty);
diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c
index ce61fb7..ccfac3e 100644
--- a/gdb/tracepoint.c
+++ b/gdb/tracepoint.c
@@ -871,7 +871,7 @@ static int memrange_cmp (const void *, const void *);
static int
memrange_cmp (const void *va, const void *vb)
{
- const struct memrange *a = va, *b = vb;
+ const struct memrange *a = (const struct memrange *) va, *b = (const struct memrange *) vb;
if (a->type < b->type)
return -1;
@@ -959,7 +959,7 @@ add_memrange (struct collection_list *memranges,
if (memranges->next_memrange >= memranges->listsize)
{
memranges->listsize *= 2;
- memranges->list = xrealloc (memranges->list,
+ memranges->list = (struct memrange *) xrealloc (memranges->list,
memranges->listsize);
}
@@ -1148,7 +1148,7 @@ do_collect_symbol (const char *print_name,
struct symbol *sym,
void *cb_data)
{
- struct add_local_symbols_data *p = cb_data;
+ struct add_local_symbols_data *p = (struct add_local_symbols_data *) cb_data;
collect_symbol (p->collect, sym, p->gdbarch, p->frame_regno,
p->frame_offset, p->pc, p->trace_string);
@@ -1242,7 +1242,7 @@ clear_collection_list (struct collection_list *list)
static void
do_clear_collection_list (void *list)
{
- struct collection_list *l = list;
+ struct collection_list *l = (struct collection_list *) list;
clear_collection_list (l);
}
@@ -1255,11 +1255,11 @@ init_collection_list (struct collection_list *clist)
memset (clist, 0, sizeof *clist);
clist->listsize = 128;
- clist->list = xcalloc (clist->listsize,
+ clist->list = (struct memrange *) xcalloc (clist->listsize,
sizeof (struct memrange));
clist->aexpr_listsize = 128;
- clist->aexpr_list = xcalloc (clist->aexpr_listsize,
+ clist->aexpr_list = (struct agent_expr **) xcalloc (clist->aexpr_listsize,
sizeof (struct agent_expr *));
}
@@ -1719,7 +1719,7 @@ add_aexpr (struct collection_list *collect, struct agent_expr *aexpr)
{
if (collect->next_aexpr_elt >= collect->aexpr_listsize)
{
- collect->aexpr_list =
+ collect->aexpr_list = (struct agent_expr **)
xrealloc (collect->aexpr_list,
2 * collect->aexpr_listsize * sizeof (struct agent_expr *));
collect->aexpr_listsize *= 2;
@@ -2945,7 +2945,7 @@ trace_dump_actions (struct command_line *action,
{
size_t len = next_comma - action_exp;
- cmd = xrealloc (cmd, len + 1);
+ cmd = (char *) xrealloc (cmd, len + 1);
memcpy (cmd, action_exp, len);
cmd[len] = 0;
}
@@ -2953,7 +2953,7 @@ trace_dump_actions (struct command_line *action,
{
size_t len = strlen (action_exp);
- cmd = xrealloc (cmd, len + 1);
+ cmd = (char *) xrealloc (cmd, len + 1);
memcpy (cmd, action_exp, len + 1);
}
@@ -3038,7 +3038,8 @@ all_tracepoint_actions_and_cleanup (struct breakpoint *t)
make_cleanup (xfree, default_collect_line);
validate_actionline (default_collect_line, t);
- default_collect_action = xmalloc (sizeof (struct command_line));
+ default_collect_action = (struct command_line *)
+ xmalloc (sizeof (struct command_line));
make_cleanup (xfree, default_collect_action);
default_collect_action->next = actions;
default_collect_action->line = default_collect_line;
@@ -3103,7 +3104,7 @@ encode_source_string (int tpnum, ULONGEST addr,
static void
trace_file_writer_xfree (void *arg)
{
- struct trace_file_writer *writer = arg;
+ struct trace_file_writer *writer = (struct trace_file_writer *) arg;
writer->ops->dtor (writer);
xfree (writer);
@@ -3671,7 +3672,7 @@ static struct trace_file_writer *
tfile_trace_file_writer_new (void)
{
struct tfile_trace_file_writer *writer
- = xmalloc (sizeof (struct tfile_trace_file_writer));
+ = (struct tfile_trace_file_writer *) xmalloc (sizeof (struct tfile_trace_file_writer));
writer->base.ops = &tfile_write_ops;
writer->fp = NULL;
@@ -3901,7 +3902,7 @@ struct current_traceframe_cleanup
static void
do_restore_current_traceframe_cleanup (void *arg)
{
- struct current_traceframe_cleanup *old = arg;
+ struct current_traceframe_cleanup *old = (struct current_traceframe_cleanup *) arg;
set_current_traceframe (old->traceframe_number);
}
@@ -3909,7 +3910,7 @@ do_restore_current_traceframe_cleanup (void *arg)
static void
restore_current_traceframe_cleanup_dtor (void *arg)
{
- struct current_traceframe_cleanup *old = arg;
+ struct current_traceframe_cleanup *old = (struct current_traceframe_cleanup *) arg;
xfree (old);
}
@@ -3919,7 +3920,7 @@ make_cleanup_restore_current_traceframe (void)
{
struct current_traceframe_cleanup *old;
- old = xmalloc (sizeof (struct current_traceframe_cleanup));
+ old = (struct current_traceframe_cleanup *) xmalloc (sizeof (struct current_traceframe_cleanup));
old->traceframe_number = traceframe_number;
return make_cleanup_dtor (do_restore_current_traceframe_cleanup, old,
@@ -4485,7 +4486,7 @@ Status line: '%s'\n"), p, line);
}
else if (p2 != p1)
{
- ts->stop_desc = xmalloc (strlen (line));
+ ts->stop_desc = (char *) xmalloc (strlen (line));
end = hex2bin (p1, (gdb_byte *) ts->stop_desc, (p2 - p1) / 2);
ts->stop_desc[end] = '\0';
}
@@ -4505,7 +4506,7 @@ Status line: '%s'\n"), p, line);
p2 = strchr (++p1, ':');
if (p2 != p1)
{
- ts->stop_desc = xmalloc ((p2 - p1) / 2 + 1);
+ ts->stop_desc = (char *) xmalloc ((p2 - p1) / 2 + 1);
end = hex2bin (p1, (gdb_byte *) ts->stop_desc, (p2 - p1) / 2);
ts->stop_desc[end] = '\0';
}
@@ -4559,7 +4560,7 @@ Status line: '%s'\n"), p, line);
else if (strncmp (p, "username", p1 - p) == 0)
{
++p1;
- ts->user_name = xmalloc (strlen (p) / 2);
+ ts->user_name = (char *) xmalloc (strlen (p) / 2);
end = hex2bin (p1, (gdb_byte *) ts->user_name, (p3 - p1) / 2);
ts->user_name[end] = '\0';
p = p3;
@@ -4567,7 +4568,7 @@ Status line: '%s'\n"), p, line);
else if (strncmp (p, "notes", p1 - p) == 0)
{
++p1;
- ts->notes = xmalloc (strlen (p) / 2);
+ ts->notes = (char *) xmalloc (strlen (p) / 2);
end = hex2bin (p1, (gdb_byte *) ts->notes, (p3 - p1) / 2);
ts->notes[end] = '\0';
p = p3;
@@ -4694,7 +4695,7 @@ parse_tracepoint_definition (char *line, struct uploaded_tp **utpp)
p = unpack_varlen_hex (p, &xlen);
p++; /* skip a colon */
- buf = alloca (strlen (line));
+ buf = (char *) alloca (strlen (line));
end = hex2bin (p, (gdb_byte *) buf, strlen (p) / 2);
buf[end] = '\0';
@@ -4731,7 +4732,7 @@ parse_tsv_definition (char *line, struct uploaded_tsv **utsvp)
int end;
struct uploaded_tsv *utsv = NULL;
- buf = alloca (strlen (line));
+ buf = (char *) alloca (strlen (line));
p = line;
p = unpack_varlen_hex (p, &num);
@@ -4934,7 +4935,7 @@ typedef int (*walk_blocks_callback_func) (char blocktype, void *data);
static int
match_blocktype (char blocktype, void *data)
{
- char *wantedp = data;
+ char *wantedp = (char *) data;
if (*wantedp == blocktype)
return 1;
@@ -5025,7 +5026,7 @@ tfile_fetch_registers (struct target_ops *ops,
if (!trace_regblock_size)
return;
- regs = alloca (trace_regblock_size);
+ regs = (gdb_byte *) alloca (trace_regblock_size);
if (traceframe_find_block_type ('R', 0) >= 0)
{
@@ -5251,7 +5252,7 @@ tfile_has_registers (struct target_ops *ops)
static int
build_traceframe_info (char blocktype, void *data)
{
- struct traceframe_info *info = data;
+ struct traceframe_info *info = (struct traceframe_info *) data;
switch (blocktype)
{
@@ -5337,7 +5338,7 @@ init_tfile_ops (void)
void
free_current_marker (void *arg)
{
- struct static_tracepoint_marker **marker_p = arg;
+ struct static_tracepoint_marker **marker_p = (struct static_tracepoint_marker **) arg;
if (*marker_p != NULL)
{
@@ -5372,14 +5373,14 @@ parse_static_tracepoint_marker_definition (char *line, char **pp,
if (endp == NULL)
error (_("bad marker definition: %s"), line);
- marker->str_id = xmalloc (endp - p + 1);
+ marker->str_id = (char *) xmalloc (endp - p + 1);
end = hex2bin (p, (gdb_byte *) marker->str_id, (endp - p + 1) / 2);
marker->str_id[end] = '\0';
p += 2 * end;
p++; /* skip a colon */
- marker->extra = xmalloc (strlen (p) + 1);
+ marker->extra = (char *) xmalloc (strlen (p) + 1);
end = hex2bin (p, (gdb_byte *) marker->extra, strlen (p) / 2);
marker->extra[end] = '\0';
@@ -5630,12 +5631,12 @@ traceframe_info_start_memory (struct gdb_xml_parser *parser,
const struct gdb_xml_element *element,
void *user_data, VEC(gdb_xml_value_s) *attributes)
{
- struct traceframe_info *info = user_data;
+ struct traceframe_info *info = (struct traceframe_info *) user_data;
struct mem_range *r = VEC_safe_push (mem_range_s, info->memory, NULL);
ULONGEST *start_p, *length_p;
- start_p = xml_find_attribute (attributes, "start")->value;
- length_p = xml_find_attribute (attributes, "length")->value;
+ start_p = (ULONGEST *) xml_find_attribute (attributes, "start")->value;
+ length_p = (ULONGEST *) xml_find_attribute (attributes, "length")->value;
r->start = *start_p;
r->length = *length_p;
@@ -5649,8 +5650,8 @@ traceframe_info_start_tvar (struct gdb_xml_parser *parser,
void *user_data,
VEC(gdb_xml_value_s) *attributes)
{
- struct traceframe_info *info = user_data;
- const char *id_attrib = xml_find_attribute (attributes, "id")->value;
+ struct traceframe_info *info = (struct traceframe_info *) user_data;
+ const char *id_attrib = (const char *) xml_find_attribute (attributes, "id")->value;
int id = gdb_xml_parse_ulongest (parser, id_attrib);
VEC_safe_push (int, info->tvars, id);
@@ -5661,7 +5662,7 @@ traceframe_info_start_tvar (struct gdb_xml_parser *parser,
static void
free_result (void *p)
{
- struct traceframe_info *result = p;
+ struct traceframe_info *result = (struct traceframe_info *) p;
free_traceframe_info (result);
}
--
1.8.3.1
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: C++-compat clean build
2013-10-01 11:25 C++-compat clean build Ondrej Oprala
@ 2013-10-01 11:52 ` Ondrej Oprala
2013-10-01 12:04 ` Mark Kettenis
2013-10-01 12:53 ` Jan Kratochvil
2 siblings, 0 replies; 11+ messages in thread
From: Ondrej Oprala @ 2013-10-01 11:52 UTC (permalink / raw)
To: 'gdb-patches@sourceware.org'
[-- Attachment #1: Type: text/plain, Size: 400 bytes --]
On 10/01/2013 01:25 PM, Ondrej Oprala wrote:
> Hi,
> this is the first of a few patches I intend to write to make gdb code
> compile cleanly with -Wc++-compat.
> The idea is to make separate patches for respective subdirs under
> gdb/, unless someone objects ofc.
>
> Thanks in advance for any advice/criticism.
>
> Ondrej
Forgot a few typeofs in there, sorry.
Fixed patch attached.
Thanks,
Ondrej
[-- Attachment #2: cxx-compat-rootsrcdir.patch --]
[-- Type: text/x-patch, Size: 88117 bytes --]
From f72694e650e7b6868dcda756eac10b32c28af0d6 Mon Sep 17 00:00:00 2001
From: Ondrej Oprala <ooprala@redhat.com>
Date: Sun, 29 Sep 2013 22:28:39 +0200
Subject: [PATCH] Make code compile cleanly with -Wc++-compat
---
gdb/amd64-linux-nat.c | 18 ++++-----
gdb/amd64-linux-tdep.c | 12 +++---
gdb/amd64-nat.c | 4 +-
gdb/amd64-tdep.c | 22 +++++------
gdb/ax-gdb.c | 2 +-
gdb/ax-general.c | 14 +++----
gdb/ctf.c | 4 +-
gdb/dcache.c | 4 +-
gdb/i386-linux-tdep.c | 6 +--
gdb/i386-nat.c | 14 +++----
gdb/i386-tdep.c | 28 +++++++-------
gdb/i387-tdep.c | 12 +++---
gdb/inf-ptrace.c | 6 +--
gdb/linux-fork.c | 4 +-
gdb/linux-nat.c | 47 ++++++++++++-----------
gdb/linux-record.c | 26 ++++++-------
gdb/linux-tdep.c | 16 ++++----
gdb/linux-thread-db.c | 59 +++++++++++++++++------------
gdb/proc-service.c | 2 +-
gdb/remote-fileio.c | 14 +++----
gdb/remote-notif.c | 2 +-
gdb/remote.c | 100 +++++++++++++++++++++++++------------------------
gdb/ser-base.c | 6 +--
gdb/ser-pipe.c | 2 +-
gdb/ser-tcp.c | 4 +-
gdb/solib-svr4.c | 61 ++++++++++++++++--------------
gdb/symfile-mem.c | 3 +-
gdb/tracepoint.c | 67 +++++++++++++++++----------------
28 files changed, 290 insertions(+), 269 deletions(-)
diff --git a/gdb/amd64-linux-nat.c b/gdb/amd64-linux-nat.c
index 8dfe7c5..958eec8 100644
--- a/gdb/amd64-linux-nat.c
+++ b/gdb/amd64-linux-nat.c
@@ -172,7 +172,7 @@ amd64_linux_fetch_inferior_registers (struct target_ops *ops,
{
elf_gregset_t regs;
- if (ptrace (PTRACE_GETREGS, tid, 0, (long) ®s) < 0)
+ if (ptrace ((enum __ptrace_request) PTRACE_GETREGS, tid, 0, (long) ®s) < 0)
perror_with_name (_("Couldn't get registers"));
amd64_supply_native_gregset (regcache, ®s, -1);
@@ -199,7 +199,7 @@ amd64_linux_fetch_inferior_registers (struct target_ops *ops,
}
else
{
- if (ptrace (PTRACE_GETFPREGS, tid, 0, (long) &fpregs) < 0)
+ if (ptrace ((enum __ptrace_request) PTRACE_GETFPREGS, tid, 0, (long) &fpregs) < 0)
perror_with_name (_("Couldn't get floating point status"));
amd64_supply_fxsave (regcache, -1, &fpregs);
@@ -227,12 +227,12 @@ amd64_linux_store_inferior_registers (struct target_ops *ops,
{
elf_gregset_t regs;
- if (ptrace (PTRACE_GETREGS, tid, 0, (long) ®s) < 0)
+ if (ptrace ((enum __ptrace_request) PTRACE_GETREGS, tid, 0, (long) ®s) < 0)
perror_with_name (_("Couldn't get registers"));
amd64_collect_native_gregset (regcache, ®s, regnum);
- if (ptrace (PTRACE_SETREGS, tid, 0, (long) ®s) < 0)
+ if (ptrace ((enum __ptrace_request) PTRACE_SETREGS, tid, 0, (long) ®s) < 0)
perror_with_name (_("Couldn't write registers"));
if (regnum != -1)
@@ -262,12 +262,12 @@ amd64_linux_store_inferior_registers (struct target_ops *ops,
}
else
{
- if (ptrace (PTRACE_GETFPREGS, tid, 0, (long) &fpregs) < 0)
+ if (ptrace ((enum __ptrace_request) PTRACE_GETFPREGS, tid, 0, (long) &fpregs) < 0)
perror_with_name (_("Couldn't get floating point status"));
amd64_collect_fxsave (regcache, regnum, &fpregs);
- if (ptrace (PTRACE_SETFPREGS, tid, 0, (long) &fpregs) < 0)
+ if (ptrace ((enum __ptrace_request) PTRACE_SETFPREGS, tid, 0, (long) &fpregs) < 0)
perror_with_name (_("Couldn't write floating point status"));
}
}
@@ -499,7 +499,7 @@ ps_get_thread_area (const struct ps_prochandle *ph,
#ifndef PTRACE_GET_THREAD_AREA
#define PTRACE_GET_THREAD_AREA 25
#endif
- if (ptrace (PTRACE_GET_THREAD_AREA,
+ if (ptrace ((enum __ptrace_request) PTRACE_GET_THREAD_AREA,
lwpid, (void *) (long) idx, (unsigned long) &desc) < 0)
return PS_ERR;
@@ -538,7 +538,7 @@ ps_get_thread_area (const struct ps_prochandle *ph,
}
}
#endif
- if (ptrace (PTRACE_ARCH_PRCTL, lwpid, base, ARCH_GET_FS) == 0)
+ if (ptrace ((enum __ptrace_request) PTRACE_ARCH_PRCTL, lwpid, base, ARCH_GET_FS) == 0)
return PS_OK;
break;
case GS:
@@ -555,7 +555,7 @@ ps_get_thread_area (const struct ps_prochandle *ph,
}
}
#endif
- if (ptrace (PTRACE_ARCH_PRCTL, lwpid, base, ARCH_GET_GS) == 0)
+ if (ptrace ((enum __ptrace_request) PTRACE_ARCH_PRCTL, lwpid, base, ARCH_GET_GS) == 0)
return PS_OK;
break;
default: /* Should not happen. */
diff --git a/gdb/amd64-linux-tdep.c b/gdb/amd64-linux-tdep.c
index 4f67762..bf4af3c 100644
--- a/gdb/amd64-linux-tdep.c
+++ b/gdb/amd64-linux-tdep.c
@@ -831,7 +831,7 @@ amd64_canonicalize_syscall (enum amd64_syscall syscall_number)
return gdb_sys_prctl;
case amd64_sys_arch_prctl:
- return -1; /* Note */
+ return (enum gdb_syscall) -1; /* Note */
case amd64_sys_adjtimex:
return gdb_sys_adjtimex;
@@ -1158,7 +1158,7 @@ amd64_canonicalize_syscall (enum amd64_syscall syscall_number)
return gdb_sys_move_pages;
default:
- return -1;
+ return (enum gdb_syscall) -1;
}
}
@@ -1178,7 +1178,7 @@ amd64_linux_syscall_record (struct regcache *regcache)
{
int ret;
ULONGEST syscall_native;
- enum gdb_syscall syscall_gdb = -1;
+ enum gdb_syscall syscall_gdb = (enum gdb_syscall) -1;
regcache_raw_read_unsigned (regcache, AMD64_RAX_REGNUM, &syscall_native);
@@ -1212,7 +1212,7 @@ amd64_linux_syscall_record (struct regcache *regcache)
break;
}
- syscall_gdb = amd64_canonicalize_syscall (syscall_native);
+ syscall_gdb = amd64_canonicalize_syscall ((enum amd64_syscall) syscall_native);
if (syscall_gdb < 0)
{
@@ -1531,7 +1531,7 @@ amd64_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
const struct target_desc *tdesc = info.target_desc;
- struct tdesc_arch_data *tdesc_data = (void *) info.tdep_info;
+ struct tdesc_arch_data *tdesc_data = (struct tdesc_arch_data *) info.tdep_info;
const struct tdesc_feature *feature;
int valid_p;
@@ -1572,7 +1572,7 @@ amd64_x32_linux_init_abi(struct gdbarch_info info, struct gdbarch *gdbarch)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
const struct target_desc *tdesc = info.target_desc;
- struct tdesc_arch_data *tdesc_data = (void *) info.tdep_info;
+ struct tdesc_arch_data *tdesc_data = (struct tdesc_arch_data *) info.tdep_info;
const struct tdesc_feature *feature;
int valid_p;
diff --git a/gdb/amd64-nat.c b/gdb/amd64-nat.c
index 2a9239a..b608637 100644
--- a/gdb/amd64-nat.c
+++ b/gdb/amd64-nat.c
@@ -91,7 +91,7 @@ void
amd64_supply_native_gregset (struct regcache *regcache,
const void *gregs, int regnum)
{
- const char *regs = gregs;
+ const char *regs = (const char *) gregs;
struct gdbarch *gdbarch = get_regcache_arch (regcache);
int num_regs = amd64_native_gregset64_num_regs;
int i;
@@ -122,7 +122,7 @@ void
amd64_collect_native_gregset (const struct regcache *regcache,
void *gregs, int regnum)
{
- char *regs = gregs;
+ char *regs = (char *) gregs;
struct gdbarch *gdbarch = get_regcache_arch (regcache);
int num_regs = amd64_native_gregset64_num_regs;
int i;
diff --git a/gdb/amd64-tdep.c b/gdb/amd64-tdep.c
index 91f60a1..dc68ded 100644
--- a/gdb/amd64-tdep.c
+++ b/gdb/amd64-tdep.c
@@ -762,12 +762,12 @@ amd64_push_arguments (struct regcache *regcache, int nargs,
AMD64_XMM0_REGNUM + 4, AMD64_XMM0_REGNUM + 5,
AMD64_XMM0_REGNUM + 6, AMD64_XMM0_REGNUM + 7,
};
- struct value **stack_args = alloca (nargs * sizeof (struct value *));
+ struct value **stack_args = (struct value **) alloca (nargs * sizeof (struct value *));
/* An array that mirrors the stack_args array. For all arguments
that are passed by MEMORY, if that argument's address also needs
to be stored in a register, the ARG_ADDR_REGNO array will contain
that register number (or a negative value otherwise). */
- int *arg_addr_regno = alloca (nargs * sizeof (int));
+ int *arg_addr_regno = (int *) alloca (nargs * sizeof (int));
int num_stack_args = 0;
int num_elements = 0;
int element = 0;
@@ -1302,7 +1302,7 @@ amd64_displaced_step_copy_insn (struct gdbarch *gdbarch,
/* Extra space for sentinels so fixup_{riprel,displaced_copy} don't have to
continually watch for running off the end of the buffer. */
int fixup_sentinel_space = len;
- struct displaced_step_closure *dsc =
+ struct displaced_step_closure *dsc = (struct displaced_step_closure *)
xmalloc (sizeof (*dsc) + len + fixup_sentinel_space);
gdb_byte *buf = &dsc->insn_buf[0];
struct amd64_insn *details = &dsc->insn_details;
@@ -1598,7 +1598,7 @@ amd64_relocate_instruction (struct gdbarch *gdbarch,
int len = gdbarch_max_insn_length (gdbarch);
/* Extra space for sentinels. */
int fixup_sentinel_space = len;
- gdb_byte *buf = xmalloc (len + fixup_sentinel_space);
+ gdb_byte *buf = (gdb_byte *) xmalloc (len + fixup_sentinel_space);
struct amd64_insn insn_details;
int offset = 0;
LONGEST rel32, newrel;
@@ -2357,7 +2357,7 @@ amd64_frame_cache (struct frame_info *this_frame, void **this_cache)
struct amd64_frame_cache *cache;
if (*this_cache)
- return *this_cache;
+ return (struct amd64_frame_cache *) *this_cache;
cache = amd64_alloc_frame_cache ();
*this_cache = cache;
@@ -2472,7 +2472,7 @@ amd64_sigtramp_frame_cache (struct frame_info *this_frame, void **this_cache)
int i;
if (*this_cache)
- return *this_cache;
+ return (struct amd64_frame_cache *) *this_cache;
cache = amd64_alloc_frame_cache ();
@@ -2638,7 +2638,7 @@ amd64_epilogue_frame_cache (struct frame_info *this_frame, void **this_cache)
gdb_byte buf[8];
if (*this_cache)
- return *this_cache;
+ return (struct amd64_frame_cache *) *this_cache;
cache = amd64_alloc_frame_cache ();
*this_cache = cache;
@@ -3044,7 +3044,7 @@ amd64_supply_fxsave (struct regcache *regcache, int regnum,
if (fxsave
&& gdbarch_bfd_arch_info (gdbarch)->bits_per_word == 64)
{
- const gdb_byte *regs = fxsave;
+ const gdb_byte *regs = (const gdb_byte *) fxsave;
if (regnum == -1 || regnum == I387_FISEG_REGNUM (tdep))
regcache_raw_supply (regcache, I387_FISEG_REGNUM (tdep), regs + 12);
@@ -3067,7 +3067,7 @@ amd64_supply_xsave (struct regcache *regcache, int regnum,
if (xsave
&& gdbarch_bfd_arch_info (gdbarch)->bits_per_word == 64)
{
- const gdb_byte *regs = xsave;
+ const gdb_byte *regs = (const gdb_byte *) xsave;
if (regnum == -1 || regnum == I387_FISEG_REGNUM (tdep))
regcache_raw_supply (regcache, I387_FISEG_REGNUM (tdep),
@@ -3089,7 +3089,7 @@ amd64_collect_fxsave (const struct regcache *regcache, int regnum,
{
struct gdbarch *gdbarch = get_regcache_arch (regcache);
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
- gdb_byte *regs = fxsave;
+ gdb_byte *regs = (gdb_byte *) fxsave;
i387_collect_fxsave (regcache, regnum, fxsave);
@@ -3110,7 +3110,7 @@ amd64_collect_xsave (const struct regcache *regcache, int regnum,
{
struct gdbarch *gdbarch = get_regcache_arch (regcache);
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
- gdb_byte *regs = xsave;
+ gdb_byte *regs = (gdb_byte *) xsave;
i387_collect_xsave (regcache, regnum, xsave, gcore);
diff --git a/gdb/ax-gdb.c b/gdb/ax-gdb.c
index 4196655..6ccf482 100644
--- a/gdb/ax-gdb.c
+++ b/gdb/ax-gdb.c
@@ -2564,7 +2564,7 @@ gen_printf (CORE_ADDR scope, struct gdbarch *gdbarch,
/* Issue the printf bytecode proper. */
ax_simple (ax, aop_printf);
- ax_simple (ax, nargs);
+ ax_simple (ax, (enum agent_op) nargs);
ax_string (ax, format, fmtlen);
/* And terminate. */
diff --git a/gdb/ax-general.c b/gdb/ax-general.c
index 78d7f7e..5bb3e0d 100644
--- a/gdb/ax-general.c
+++ b/gdb/ax-general.c
@@ -43,19 +43,19 @@ static void generic_ext (struct agent_expr *x, enum agent_op op, int n);
struct agent_expr *
new_agent_expr (struct gdbarch *gdbarch, CORE_ADDR scope)
{
- struct agent_expr *x = xmalloc (sizeof (*x));
+ struct agent_expr *x = (struct agent_expr *) xmalloc (sizeof (*x));
x->len = 0;
x->size = 1; /* Change this to a larger value once
reallocation code is tested. */
- x->buf = xmalloc (x->size);
+ x->buf = (unsigned char *) xmalloc (x->size);
x->gdbarch = gdbarch;
x->scope = scope;
/* Bit vector for registers used. */
x->reg_mask_len = 1;
- x->reg_mask = xmalloc (x->reg_mask_len * sizeof (x->reg_mask[0]));
+ x->reg_mask = (unsigned char *) xmalloc (x->reg_mask_len * sizeof (x->reg_mask[0]));
memset (x->reg_mask, 0, x->reg_mask_len * sizeof (x->reg_mask[0]));
x->tracing = 0;
@@ -76,7 +76,7 @@ free_agent_expr (struct agent_expr *x)
static void
do_free_agent_expr_cleanup (void *x)
{
- free_agent_expr (x);
+ free_agent_expr ((struct agent_expr *) x);
}
struct cleanup *
@@ -96,7 +96,7 @@ grow_expr (struct agent_expr *x, int n)
x->size *= 2;
if (x->size < x->len + n)
x->size = x->len + n + 10;
- x->buf = xrealloc (x->buf, x->size);
+ x->buf = (unsigned char *) xrealloc (x->buf, x->size);
}
}
@@ -393,7 +393,7 @@ ax_print (struct ui_file *f, struct agent_expr *x)
for (i = 0; i < x->len;)
{
- enum agent_op op = x->buf[i];
+ enum agent_op op = (enum agent_op) x->buf[i];
if (op >= (sizeof (aop_map) / sizeof (aop_map[0]))
|| !aop_map[op].name)
@@ -460,7 +460,7 @@ ax_reg_mask (struct agent_expr *ax, int reg)
/* It's not appropriate to double here. This isn't a
string buffer. */
int new_len = byte + 1;
- unsigned char *new_reg_mask = xrealloc (ax->reg_mask,
+ unsigned char *new_reg_mask = (unsigned char *) xrealloc (ax->reg_mask,
new_len
* sizeof (ax->reg_mask[0]));
memset (new_reg_mask + ax->reg_mask_len, 0,
diff --git a/gdb/ctf.c b/gdb/ctf.c
index 23ee36d..92c37f8 100644
--- a/gdb/ctf.c
+++ b/gdb/ctf.c
@@ -860,8 +860,8 @@ static const struct trace_file_write_ops ctf_write_ops =
struct trace_file_writer *
ctf_trace_file_writer_new (void)
{
- struct ctf_trace_file_writer *writer
- = xmalloc (sizeof (struct ctf_trace_file_writer));
+ struct ctf_trace_file_writer *writer = (struct ctf_trace_file_writer *)
+ xmalloc (sizeof (struct ctf_trace_file_writer));
writer->base.ops = &ctf_write_ops;
diff --git a/gdb/dcache.c b/gdb/dcache.c
index acb9de4..d65fd90 100644
--- a/gdb/dcache.c
+++ b/gdb/dcache.c
@@ -377,7 +377,7 @@ dcache_alloc (DCACHE *dcache, CORE_ADDR addr)
if (db)
remove_block (&dcache->freelist, db);
else
- db = xmalloc (offsetof (struct dcache_block, data) +
+ db = (struct dcache_block *) xmalloc (offsetof (struct dcache_block, data) +
dcache->line_size);
dcache->size++;
@@ -689,7 +689,7 @@ set_dcache_command (char *arg, int from_tty)
{
printf_unfiltered (
"\"set dcache\" must be followed by the name of a subcommand.\n");
- help_list (dcache_set_list, "set dcache ", -1, gdb_stdout);
+ help_list (dcache_set_list, "set dcache ", (enum command_class) -1, gdb_stdout);
}
static void
diff --git a/gdb/i386-linux-tdep.c b/gdb/i386-linux-tdep.c
index 7b69aab..b2c0023 100644
--- a/gdb/i386-linux-tdep.c
+++ b/gdb/i386-linux-tdep.c
@@ -403,9 +403,9 @@ i386_canonicalize_syscall (int syscall)
enum { i386_syscall_max = 499 };
if (syscall <= i386_syscall_max)
- return syscall;
+ return (enum gdb_syscall) syscall;
else
- return -1;
+ return (enum gdb_syscall) -1;
}
/* Parse the arguments of current system call instruction and record
@@ -708,7 +708,7 @@ i386_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
const struct target_desc *tdesc = info.target_desc;
- struct tdesc_arch_data *tdesc_data = (void *) info.tdep_info;
+ struct tdesc_arch_data *tdesc_data = (struct tdesc_arch_data *) info.tdep_info;
const struct tdesc_feature *feature;
int valid_p;
diff --git a/gdb/i386-nat.c b/gdb/i386-nat.c
index 6069350..a5bd25d 100644
--- a/gdb/i386-nat.c
+++ b/gdb/i386-nat.c
@@ -194,7 +194,7 @@ i386_add_process (pid_t pid)
{
struct i386_process_info *proc;
- proc = xcalloc (1, sizeof (*proc));
+ proc = (struct i386_process_info *) xcalloc (1, sizeof (*proc));
proc->pid = pid;
proc->next = i386_process_list;
@@ -605,10 +605,10 @@ i386_insert_watchpoint (CORE_ADDR addr, int len, int type,
if (((len != 1 && len !=2 && len !=4) && !(TARGET_HAS_DR_LEN_8 && len == 8))
|| addr % len != 0)
retval = i386_handle_nonaligned_watchpoint (&local_state,
- WP_INSERT, addr, len, type);
+ WP_INSERT, addr, len, (enum target_hw_bp_type) type);
else
{
- unsigned len_rw = i386_length_and_rw_bits (len, type);
+ unsigned len_rw = i386_length_and_rw_bits (len, (enum target_hw_bp_type) type);
retval = i386_insert_aligned_watchpoint (&local_state,
addr, len_rw);
@@ -618,7 +618,7 @@ i386_insert_watchpoint (CORE_ADDR addr, int len, int type,
i386_update_inferior_debug_regs (&local_state);
if (maint_show_dr)
- i386_show_dr (state, "insert_watchpoint", addr, len, type);
+ i386_show_dr (state, "insert_watchpoint", addr, len, (enum target_hw_bp_type) type);
return retval;
}
@@ -640,10 +640,10 @@ i386_remove_watchpoint (CORE_ADDR addr, int len, int type,
if (((len != 1 && len !=2 && len !=4) && !(TARGET_HAS_DR_LEN_8 && len == 8))
|| addr % len != 0)
retval = i386_handle_nonaligned_watchpoint (&local_state,
- WP_REMOVE, addr, len, type);
+ WP_REMOVE, addr, len, (enum target_hw_bp_type) type);
else
{
- unsigned len_rw = i386_length_and_rw_bits (len, type);
+ unsigned len_rw = i386_length_and_rw_bits (len, (enum target_hw_bp_type) type);
retval = i386_remove_aligned_watchpoint (&local_state,
addr, len_rw);
@@ -653,7 +653,7 @@ i386_remove_watchpoint (CORE_ADDR addr, int len, int type,
i386_update_inferior_debug_regs (&local_state);
if (maint_show_dr)
- i386_show_dr (state, "remove_watchpoint", addr, len, type);
+ i386_show_dr (state, "remove_watchpoint", addr, len, (enum target_hw_bp_type) type);
return retval;
}
diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c
index b159b49..ce087b9 100644
--- a/gdb/i386-tdep.c
+++ b/gdb/i386-tdep.c
@@ -552,7 +552,7 @@ i386_displaced_step_copy_insn (struct gdbarch *gdbarch,
struct regcache *regs)
{
size_t len = gdbarch_max_insn_length (gdbarch);
- gdb_byte *buf = xmalloc (len);
+ gdb_byte *buf = (gdb_byte *) xmalloc (len);
read_memory (from, buf, len);
@@ -1825,7 +1825,7 @@ i386_frame_cache (struct frame_info *this_frame, void **this_cache)
struct i386_frame_cache *cache;
if (*this_cache)
- return *this_cache;
+ return (struct i386_frame_cache *) *this_cache;
cache = i386_alloc_frame_cache ();
*this_cache = cache;
@@ -1985,7 +1985,7 @@ i386_epilogue_frame_cache (struct frame_info *this_frame, void **this_cache)
CORE_ADDR sp;
if (*this_cache)
- return *this_cache;
+ return (struct i386_frame_cache *) *this_cache;
cache = i386_alloc_frame_cache ();
*this_cache = cache;
@@ -2169,7 +2169,7 @@ i386_sigtramp_frame_cache (struct frame_info *this_frame, void **this_cache)
gdb_byte buf[4];
if (*this_cache)
- return *this_cache;
+ return (struct i386_frame_cache *) *this_cache;
cache = i386_alloc_frame_cache ();
@@ -3196,7 +3196,7 @@ i386_supply_gregset (const struct regset *regset, struct regcache *regcache,
int regnum, const void *gregs, size_t len)
{
const struct gdbarch_tdep *tdep = gdbarch_tdep (regset->arch);
- const gdb_byte *regs = gregs;
+ const gdb_byte *regs = (const gdb_byte *) gregs;
int i;
gdb_assert (len == tdep->sizeof_gregset);
@@ -3220,7 +3220,7 @@ i386_collect_gregset (const struct regset *regset,
int regnum, void *gregs, size_t len)
{
const struct gdbarch_tdep *tdep = gdbarch_tdep (regset->arch);
- gdb_byte *regs = gregs;
+ gdb_byte *regs = (gdb_byte *) gregs;
int i;
gdb_assert (len == tdep->sizeof_gregset);
@@ -3459,7 +3459,7 @@ i386_stap_parse_special_token (struct gdbarch *gdbarch,
{
/* In order to parse special tokens, we use a state-machine that go
through every known token and try to get a match. */
- enum
+ enum cur_state
{
TRIPLET,
THREE_ARG_DISPLACEMENT,
@@ -3556,7 +3556,7 @@ i386_stap_parse_special_token (struct gdbarch *gdbarch,
break;
len = s - start;
- regname = alloca (len + 1);
+ regname = (char *) alloca (len + 1);
strncpy (regname, start, len);
regname[len] = '\0';
@@ -3651,7 +3651,7 @@ i386_stap_parse_special_token (struct gdbarch *gdbarch,
break;
len_base = s - start;
- base = alloca (len_base + 1);
+ base = (char *) alloca (len_base + 1);
strncpy (base, start, len_base);
base[len_base] = '\0';
@@ -3668,7 +3668,7 @@ i386_stap_parse_special_token (struct gdbarch *gdbarch,
++s;
len_index = s - start;
- index = alloca (len_index + 1);
+ index = (char *) alloca (len_index + 1);
strncpy (index, start, len_index);
index[len_index] = '\0';
@@ -3758,7 +3758,7 @@ i386_stap_parse_special_token (struct gdbarch *gdbarch,
}
/* Advancing to the next state. */
- ++current_state;
+ current_state = (enum cur_state) (current_state + 1);
}
return 0;
@@ -7774,7 +7774,7 @@ i386_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_gen_return_address (gdbarch, i386_gen_return_address);
/* Hook in ABI-specific overrides, if they have been registered. */
- info.tdep_info = (void *) tdesc_data;
+ info.tdep_info = (struct gdbarch_tdep_info *) tdesc_data;
gdbarch_init_osabi (info, gdbarch);
if (!i386_validate_tdesc_p (tdep, tdesc_data))
@@ -7799,7 +7799,9 @@ i386_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
tdesc_use_registers (gdbarch, tdesc, tdesc_data);
/* Override gdbarch_register_reggroup_p set in tdesc_use_registers. */
- set_gdbarch_register_reggroup_p (gdbarch, tdep->register_reggroup_p);
+ set_gdbarch_register_reggroup_p (gdbarch,
+ (gdbarch_register_reggroup_p_ftype *)
+ tdep->register_reggroup_p);
/* Make %al the first pseudo-register. */
tdep->al_regnum = gdbarch_num_regs (gdbarch);
diff --git a/gdb/i387-tdep.c b/gdb/i387-tdep.c
index 48a00c3..bfa06a8 100644
--- a/gdb/i387-tdep.c
+++ b/gdb/i387-tdep.c
@@ -452,7 +452,7 @@ i387_supply_fsave (struct regcache *regcache, int regnum, const void *fsave)
struct gdbarch *gdbarch = get_regcache_arch (regcache);
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
- const gdb_byte *regs = fsave;
+ const gdb_byte *regs = (const gdb_byte *) fsave;
int i;
gdb_assert (tdep->st0_regnum >= I386_ST0_REGNUM);
@@ -505,7 +505,7 @@ void
i387_collect_fsave (const struct regcache *regcache, int regnum, void *fsave)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (get_regcache_arch (regcache));
- gdb_byte *regs = fsave;
+ gdb_byte *regs = (gdb_byte *) fsave;
int i;
gdb_assert (tdep->st0_regnum >= I386_ST0_REGNUM);
@@ -598,7 +598,7 @@ void
i387_supply_fxsave (struct regcache *regcache, int regnum, const void *fxsave)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (get_regcache_arch (regcache));
- const gdb_byte *regs = fxsave;
+ const gdb_byte *regs = (gdb_byte *) fxsave;
int i;
gdb_assert (tdep->st0_regnum >= I386_ST0_REGNUM);
@@ -681,7 +681,7 @@ void
i387_collect_fxsave (const struct regcache *regcache, int regnum, void *fxsave)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (get_regcache_arch (regcache));
- gdb_byte *regs = fxsave;
+ gdb_byte *regs = (gdb_byte *) fxsave;
int i;
gdb_assert (tdep->st0_regnum >= I386_ST0_REGNUM);
@@ -773,7 +773,7 @@ i387_supply_xsave (struct regcache *regcache, int regnum,
const void *xsave)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (get_regcache_arch (regcache));
- const gdb_byte *regs = xsave;
+ const gdb_byte *regs = (const gdb_byte *) xsave;
int i;
unsigned int clear_bv;
static const gdb_byte zero[MAX_REGISTER_SIZE] = { 0 };
@@ -980,7 +980,7 @@ i387_collect_xsave (const struct regcache *regcache, int regnum,
void *xsave, int gcore)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (get_regcache_arch (regcache));
- gdb_byte *regs = xsave;
+ gdb_byte *regs = (gdb_byte *) xsave;
int i;
enum
{
diff --git a/gdb/inf-ptrace.c b/gdb/inf-ptrace.c
index 046e0ce..de9f34e 100644
--- a/gdb/inf-ptrace.c
+++ b/gdb/inf-ptrace.c
@@ -368,7 +368,7 @@ inf_ptrace_resume (struct target_ops *ops,
where it was. If GDB wanted it to start some other way, we have
already written a new program counter value to the child. */
errno = 0;
- ptrace (request, pid, (PTRACE_TYPE_ARG3)1, gdb_signal_to_host (signal));
+ ptrace ((enum __ptrace_request)request, pid, (PTRACE_TYPE_ARG3)1, gdb_signal_to_host (signal));
if (errno != 0)
perror_with_name (("ptrace"));
}
@@ -735,7 +735,7 @@ inf_ptrace_fetch_register (struct regcache *regcache, int regnum)
size = register_size (gdbarch, regnum);
gdb_assert ((size % sizeof (PTRACE_TYPE_RET)) == 0);
- buf = alloca (size);
+ buf = (long int *) alloca (size);
/* Read the register contents from the inferior a chunk at a time. */
for (i = 0; i < size / sizeof (PTRACE_TYPE_RET); i++)
@@ -793,7 +793,7 @@ inf_ptrace_store_register (const struct regcache *regcache, int regnum)
size = register_size (gdbarch, regnum);
gdb_assert ((size % sizeof (PTRACE_TYPE_RET)) == 0);
- buf = alloca (size);
+ buf = (PTRACE_TYPE_RET *)alloca (size);
/* Write the register contents into the inferior a chunk at a time. */
regcache_raw_collect (regcache, regnum, buf);
diff --git a/gdb/linux-fork.c b/gdb/linux-fork.c
index 4100cb1..e56488a 100644
--- a/gdb/linux-fork.c
+++ b/gdb/linux-fork.c
@@ -297,7 +297,7 @@ fork_save_infrun_state (struct fork_info *fp, int clobber_regs)
fp->maxfd = tmp;
}
/* Allocate array of file positions. */
- fp->filepos = xrealloc (fp->filepos,
+ fp->filepos = (off_t *) xrealloc (fp->filepos,
(fp->maxfd + 1) * sizeof (*fp->filepos));
/* Initialize to -1 (invalid). */
@@ -416,7 +416,7 @@ linux_fork_detach (char *args, int from_tty)
static void
inferior_call_waitpid_cleanup (void *fp)
{
- struct fork_info *oldfp = fp;
+ struct fork_info *oldfp = (struct fork_info *) fp;
if (oldfp)
{
diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c
index 45a6e5f..3d03cf9 100644
--- a/gdb/linux-nat.c
+++ b/gdb/linux-nat.c
@@ -312,7 +312,7 @@ static struct lwp_info *find_lwp_pid (ptid_t ptid);
static void
add_to_pid_list (struct simple_pid_list **listp, int pid, int status)
{
- struct simple_pid_list *new_pid = xmalloc (sizeof (struct simple_pid_list));
+ struct simple_pid_list *new_pid = (struct simple_pid_list *) xmalloc (sizeof (struct simple_pid_list));
new_pid->pid = pid;
new_pid->status = status;
@@ -403,7 +403,7 @@ linux_test_for_tracefork (int original_pid)
linux_supports_tracefork_flag = 0;
linux_supports_tracevforkdone_flag = 0;
- ret = ptrace (PTRACE_SETOPTIONS, original_pid, 0, PTRACE_O_TRACEFORK);
+ ret = ptrace ((enum __ptrace_request) PTRACE_SETOPTIONS, original_pid, 0, PTRACE_O_TRACEFORK);
if (ret != 0)
{
restore_child_signals_mask (&prev_mask);
@@ -426,7 +426,7 @@ linux_test_for_tracefork (int original_pid)
error (_("linux_test_for_tracefork: waitpid: unexpected status %d."),
status);
- ret = ptrace (PTRACE_SETOPTIONS, child_pid, 0, PTRACE_O_TRACEFORK);
+ ret = ptrace ((enum __ptrace_request) PTRACE_SETOPTIONS, child_pid, 0, PTRACE_O_TRACEFORK);
if (ret != 0)
{
ret = ptrace (PTRACE_KILL, child_pid, 0, 0);
@@ -450,7 +450,7 @@ linux_test_for_tracefork (int original_pid)
}
/* Check whether PTRACE_O_TRACEVFORKDONE is available. */
- ret = ptrace (PTRACE_SETOPTIONS, child_pid, 0,
+ ret = ptrace ((enum __ptrace_request) PTRACE_SETOPTIONS, child_pid, 0,
PTRACE_O_TRACEFORK | PTRACE_O_TRACEVFORKDONE);
linux_supports_tracevforkdone_flag = (ret == 0);
@@ -464,7 +464,7 @@ linux_test_for_tracefork (int original_pid)
&& status >> 16 == PTRACE_EVENT_FORK)
{
second_pid = 0;
- ret = ptrace (PTRACE_GETEVENTMSG, child_pid, 0, &second_pid);
+ ret = ptrace ((enum __ptrace_request) PTRACE_GETEVENTMSG, child_pid, 0, &second_pid);
if (ret == 0 && second_pid != 0)
{
int second_status;
@@ -507,7 +507,7 @@ linux_test_for_tracesysgood (int original_pid)
linux_supports_tracesysgood_flag = 0;
- ret = ptrace (PTRACE_SETOPTIONS, original_pid, 0, PTRACE_O_TRACESYSGOOD);
+ ret = ptrace ((enum __ptrace_request) PTRACE_SETOPTIONS, original_pid, 0, PTRACE_O_TRACESYSGOOD);
if (ret != 0)
goto out;
@@ -559,10 +559,9 @@ linux_enable_tracesysgood (ptid_t ptid)
current_ptrace_options |= PTRACE_O_TRACESYSGOOD;
- ptrace (PTRACE_SETOPTIONS, pid, 0, current_ptrace_options);
+ ptrace ((enum __ptrace_request) PTRACE_SETOPTIONS, pid, 0, current_ptrace_options);
}
-\f
void
linux_enable_event_reporting (ptid_t ptid)
{
@@ -583,7 +582,7 @@ linux_enable_event_reporting (ptid_t ptid)
/* Do not enable PTRACE_O_TRACEEXIT until GDB is more prepared to support
read-only process state. */
- ptrace (PTRACE_SETOPTIONS, pid, 0, current_ptrace_options);
+ ptrace ((enum __ptrace_request) PTRACE_SETOPTIONS, pid, 0, current_ptrace_options);
}
static void
@@ -622,7 +621,7 @@ num_lwps (int pid)
static void
delete_lwp_cleanup (void *lp_voidp)
{
- struct lwp_info *lp = lp_voidp;
+ struct lwp_info *lp = (struct lwp_info *) lp_voidp;
delete_lwp (lp->ptid);
}
@@ -1852,7 +1851,7 @@ linux_nat_detach (struct target_ops *ops, char *args, int from_tty)
{
/* Put the signal number in ARGS so that inf_ptrace_detach will
pass it along with PTRACE_DETACH. */
- args = alloca (8);
+ args = (char *)alloca (8);
sprintf (args, "%d", (int) WSTOPSIG (status));
if (debug_linux_nat)
fprintf_unfiltered (gdb_stdlog,
@@ -2175,8 +2174,8 @@ linux_handle_syscall_trap (struct lwp_info *lp, int stopping)
if (catching_syscall_number (syscall_number))
{
/* Alright, an event to report. */
- ourstatus->kind = lp->syscall_state;
- ourstatus->value.syscall_number = syscall_number;
+ ourstatus->kind = (enum target_waitkind) lp->syscall_state;
+ ourstatus->value.syscall_number = (int) syscall_number;
if (debug_linux_nat)
fprintf_unfiltered (gdb_stdlog,
@@ -2264,7 +2263,7 @@ linux_handle_extended_wait (struct lwp_info *lp, int status,
unsigned long new_pid;
int ret;
- ptrace (PTRACE_GETEVENTMSG, pid, 0, &new_pid);
+ ptrace ((enum __ptrace_request) PTRACE_GETEVENTMSG, pid, 0, &new_pid);
/* If we haven't already seen the new PID stop, wait for it now. */
if (! pull_pid_from_list (&stopped_pids, new_pid, &status))
@@ -2950,7 +2949,7 @@ running_callback (struct lwp_info *lp, void *data)
static int
count_events_callback (struct lwp_info *lp, void *data)
{
- int *count = data;
+ int *count = (int *) data;
gdb_assert (count != NULL);
@@ -2978,7 +2977,7 @@ select_singlestep_lwp_callback (struct lwp_info *lp, void *data)
static int
select_event_lwp_callback (struct lwp_info *lp, void *data)
{
- int *selector = data;
+ int *selector = (int *) data;
gdb_assert (selector != NULL);
@@ -3026,7 +3025,7 @@ cancel_breakpoint (struct lwp_info *lp)
static int
cancel_breakpoints_callback (struct lwp_info *lp, void *data)
{
- struct lwp_info *event_lp = data;
+ struct lwp_info *event_lp = (struct lwp_info *) data;
/* Leave the LWP that has been elected to receive a SIGTRAP alone. */
if (lp == event_lp)
@@ -3121,7 +3120,7 @@ resumed_callback (struct lwp_info *lp, void *data)
static int
stop_and_resume_callback (struct lwp_info *lp, void *data)
{
- int *new_pending_p = data;
+ int *new_pending_p = (int *) data;
if (!lp->stopped)
{
@@ -3869,7 +3868,7 @@ retry:
static int
resume_stopped_resumed_lwps (struct lwp_info *lp, void *data)
{
- ptid_t *wait_ptid_p = data;
+ ptid_t *wait_ptid_p = (ptid_t *) data;
if (lp->stopped
&& lp->resumed
@@ -4150,7 +4149,7 @@ linux_xfer_siginfo (struct target_ops *ops, enum target_object object,
return -1;
errno = 0;
- ptrace (PTRACE_GETSIGINFO, pid, (PTRACE_TYPE_ARG3) 0, &siginfo);
+ ptrace ((enum __ptrace_request) PTRACE_GETSIGINFO, pid, (PTRACE_TYPE_ARG3) 0, &siginfo);
if (errno != 0)
return -1;
@@ -4175,7 +4174,7 @@ linux_xfer_siginfo (struct target_ops *ops, enum target_object object,
siginfo_fixup (&siginfo, inf_siginfo, 1);
errno = 0;
- ptrace (PTRACE_SETSIGINFO, pid, (PTRACE_TYPE_ARG3) 0, &siginfo);
+ ptrace ((enum __ptrace_request) PTRACE_SETSIGINFO, pid, (PTRACE_TYPE_ARG3) 0, &siginfo);
if (errno != 0)
return -1;
}
@@ -4305,8 +4304,8 @@ linux_child_pid_to_exec_file (int pid)
{
char *name1, *name2;
- name1 = xmalloc (PATH_MAX);
- name2 = xmalloc (PATH_MAX);
+ name1 = (char *) xmalloc (PATH_MAX);
+ name2 = (char *) xmalloc (PATH_MAX);
make_cleanup (xfree, name1);
make_cleanup (xfree, name2);
memset (name2, 0, PATH_MAX);
@@ -5203,7 +5202,7 @@ linux_nat_get_siginfo (ptid_t ptid, siginfo_t *siginfo)
pid = GET_PID (ptid);
errno = 0;
- ptrace (PTRACE_GETSIGINFO, pid, (PTRACE_TYPE_ARG3) 0, siginfo);
+ ptrace ((enum __ptrace_request) PTRACE_GETSIGINFO, pid, (PTRACE_TYPE_ARG3) 0, siginfo);
if (errno != 0)
{
memset (siginfo, 0, sizeof (*siginfo));
diff --git a/gdb/linux-record.c b/gdb/linux-record.c
index 616f08f..2ca2944 100644
--- a/gdb/linux-record.c
+++ b/gdb/linux-record.c
@@ -98,7 +98,7 @@ record_linux_sockaddr (struct regcache *regcache,
if (!addr)
return 0;
- a = alloca (tdep->size_int);
+ a = (gdb_byte *) alloca (tdep->size_int);
if (record_full_arch_list_add_mem ((CORE_ADDR) len, tdep->size_int))
return -1;
@@ -140,7 +140,7 @@ record_linux_msghdr (struct regcache *regcache,
if (record_full_arch_list_add_mem ((CORE_ADDR) addr, tdep->size_msghdr))
return -1;
- a = alloca (tdep->size_msghdr);
+ a = (gdb_byte *) alloca (tdep->size_msghdr);
if (target_read_memory ((CORE_ADDR) addr, a, tdep->size_msghdr))
{
if (record_debug)
@@ -172,7 +172,7 @@ record_linux_msghdr (struct regcache *regcache,
ULONGEST i;
ULONGEST len = extract_unsigned_integer (a, tdep->size_size_t,
byte_order);
- gdb_byte *iov = alloca (tdep->size_iovec);
+ gdb_byte *iov = (gdb_byte *) alloca (tdep->size_iovec);
for (i = 0; i < len; i++)
{
@@ -805,7 +805,7 @@ Do you want to stop the program?"),
if (tmpulongest)
{
ULONGEST optvalp;
- gdb_byte *optlenp = alloca (tdep->size_int);
+ gdb_byte *optlenp = (gdb_byte *) alloca (tdep->size_int);
if (target_read_memory ((CORE_ADDR) tmpulongest, optlenp,
tdep->size_int))
@@ -847,7 +847,7 @@ Do you want to stop the program?"),
&tmpulongest);
if (tmpulongest)
{
- gdb_byte *a = alloca (tdep->size_ulong * 2);
+ gdb_byte *a = (gdb_byte *) alloca (tdep->size_ulong * 2);
ULONGEST len;
tmpulongest += tdep->size_ulong;
@@ -875,7 +875,7 @@ Do you want to stop the program?"),
case RECORD_SYS_SOCKETPAIR:
{
- gdb_byte *a = alloca (tdep->size_ulong);
+ gdb_byte *a = (gdb_byte *) alloca (tdep->size_ulong);
regcache_raw_read_unsigned (regcache, tdep->arg2,
&tmpulongest);
@@ -909,7 +909,7 @@ Do you want to stop the program?"),
&tmpulongest);
if (tmpulongest)
{
- gdb_byte *a = alloca (tdep->size_ulong * 2);
+ gdb_byte *a = (gdb_byte *) alloca (tdep->size_ulong * 2);
ULONGEST len;
tmpulongest += tdep->size_ulong * 4;
@@ -936,7 +936,7 @@ Do you want to stop the program?"),
&tmpulongest);
if (tmpulongest)
{
- gdb_byte *a = alloca (tdep->size_ulong * 2);
+ gdb_byte *a = (gdb_byte *) alloca (tdep->size_ulong * 2);
tmpulongest += tdep->size_ulong;
if (target_read_memory ((CORE_ADDR) tmpulongest, a,
@@ -968,8 +968,8 @@ Do you want to stop the program?"),
break;
case RECORD_SYS_GETSOCKOPT:
{
- gdb_byte *a = alloca (tdep->size_ulong * 2);
- gdb_byte *av = alloca (tdep->size_int);
+ gdb_byte *a = (gdb_byte *) alloca (tdep->size_ulong * 2);
+ gdb_byte *av = (gdb_byte *) alloca (tdep->size_int);
regcache_raw_read_unsigned (regcache, tdep->arg2,
&tmpulongest);
@@ -1030,7 +1030,7 @@ Do you want to stop the program?"),
break;
case RECORD_SYS_RECVMSG:
{
- gdb_byte *a = alloca (tdep->size_ulong);
+ gdb_byte *a = (gdb_byte *) alloca (tdep->size_ulong);
regcache_raw_read_unsigned (regcache, tdep->arg2,
&tmpulongest);
@@ -1386,7 +1386,7 @@ Do you want to stop the program?"),
regcache_raw_read_unsigned (regcache, tdep->arg2, &vec);
if (vec)
{
- gdb_byte *iov = alloca (tdep->size_iovec);
+ gdb_byte *iov = (gdb_byte *) alloca (tdep->size_iovec);
regcache_raw_read_unsigned (regcache, tdep->arg3, &vlen);
for (tmpulongest = 0; tmpulongest < vlen; tmpulongest++)
@@ -1889,7 +1889,7 @@ Do you want to stop the program?"),
gdb_byte *iocbp;
regcache_raw_read_unsigned (regcache, tdep->arg2, &nr);
- iocbp = alloca (nr * tdep->size_pointer);
+ iocbp = (gdb_byte *) alloca (nr * tdep->size_pointer);
if (target_read_memory ((CORE_ADDR) tmpulongest, iocbp,
nr * tdep->size_pointer))
{
diff --git a/gdb/linux-tdep.c b/gdb/linux-tdep.c
index bfb6404..bfc5aff 100644
--- a/gdb/linux-tdep.c
+++ b/gdb/linux-tdep.c
@@ -52,7 +52,7 @@ init_linux_gdbarch_data (struct gdbarch *gdbarch)
static struct linux_gdbarch_data *
get_linux_gdbarch_data (struct gdbarch *gdbarch)
{
- return gdbarch_data (gdbarch, linux_gdbarch_data_handle);
+ return (struct linux_gdbarch_data *) gdbarch_data (gdbarch, linux_gdbarch_data_handle);
}
/* This function is suitable for architectures that don't
@@ -560,7 +560,7 @@ linux_core_info_proc_mappings (struct gdbarch *gdbarch, char *args)
if (note_size < 2 * addr_size)
error (_("malformed core note - too short for header"));
- contents = xmalloc (note_size);
+ contents = (unsigned char *) xmalloc (note_size);
cleanup = make_cleanup (xfree, contents);
if (!bfd_get_section_contents (core_bfd, section, contents, 0, note_size))
error (_("could not get core note contents"));
@@ -786,7 +786,8 @@ linux_find_memory_regions_thunk (ULONGEST vaddr, ULONGEST size,
int read, int write, int exec, int modified,
const char *filename, void *arg)
{
- struct linux_find_memory_regions_data *data = arg;
+ struct linux_find_memory_regions_data *data =
+ (struct linux_find_memory_regions_data *) arg;
return data->func (vaddr, size, read, write, exec, modified, data->obfd);
}
@@ -934,7 +935,7 @@ linux_make_mappings_callback (ULONGEST vaddr, ULONGEST size,
int read, int write, int exec, int modified,
const char *filename, void *data)
{
- struct linux_make_mappings_data *map_data = data;
+ struct linux_make_mappings_data *map_data = (struct linux_make_mappings_data *) data;
gdb_byte buf[sizeof (ULONGEST)];
if (*filename == '\0' || inode == 0)
@@ -1041,7 +1042,7 @@ linux_collect_thread_registers (const struct regcache *regcache,
sect_list->size);
gdb_assert (regset && regset->collect_regset);
- buf = xmalloc (sect_list->size);
+ buf = (char *) xmalloc (sect_list->size);
regset->collect_regset (regset, regcache, -1, buf, sect_list->size);
/* PRSTATUS still needs to be treated specially. */
@@ -1082,7 +1083,7 @@ linux_get_siginfo_data (struct gdbarch *gdbarch, LONGEST *size)
siginfo_type = gdbarch_get_siginfo_type (gdbarch);
- buf = xmalloc (TYPE_LENGTH (siginfo_type));
+ buf = (gdb_byte *) xmalloc (TYPE_LENGTH (siginfo_type));
cleanups = make_cleanup (xfree, buf);
bytes_read = target_read (¤t_target, TARGET_OBJECT_SIGNAL_INFO, NULL,
@@ -1119,7 +1120,8 @@ struct linux_corefile_thread_data
static int
linux_corefile_thread_callback (struct thread_info *info, void *data)
{
- struct linux_corefile_thread_data *args = data;
+ struct linux_corefile_thread_data *args =
+ (struct linux_corefile_thread_data *) data;
if (ptid_get_pid (info->ptid) == args->pid)
{
diff --git a/gdb/linux-thread-db.c b/gdb/linux-thread-db.c
index d64e81c..3c1bd48 100644
--- a/gdb/linux-thread-db.c
+++ b/gdb/linux-thread-db.c
@@ -215,7 +215,7 @@ add_thread_db_info (void *handle)
{
struct thread_db_info *info;
- info = xcalloc (1, sizeof (*info));
+ info = (struct thread_db_info *) xcalloc (1, sizeof (*info));
info->pid = ptid_get_pid (inferior_ptid);
info->handle = handle;
@@ -411,7 +411,7 @@ thread_get_info_callback (const td_thrhandle_t *thp, void *argp)
struct thread_get_info_inout *inout;
struct thread_db_info *info;
- inout = argp;
+ inout = (struct thread_get_info_inout *) argp;
info = inout->thread_db_info;
err = info->td_thr_get_info_p (thp, &ti);
@@ -538,7 +538,7 @@ enable_thread_event (int event, CORE_ADDR *bp)
info->proc_handle.ptid = inferior_ptid;
/* Get the breakpoint address for thread EVENT. */
- err = info->td_ta_event_addr_p (info->thread_agent, event, ¬ify);
+ err = info->td_ta_event_addr_p (info->thread_agent, (td_event_e) event, ¬ify);
if (err != TD_OK)
return err;
@@ -726,7 +726,7 @@ try_thread_db_load_1 (struct thread_db_info *info)
/* Initialize pointers to the dynamic library functions we will use.
Essential functions first. */
- info->td_init_p = verbose_dlsym (info->handle, "td_init");
+ info->td_init_p = (td_err_e (*)(void)) verbose_dlsym (info->handle, "td_init");
if (info->td_init_p == NULL)
return 0;
@@ -738,7 +738,7 @@ try_thread_db_load_1 (struct thread_db_info *info)
return 0;
}
- info->td_ta_new_p = verbose_dlsym (info->handle, "td_ta_new");
+ info->td_ta_new_p = (td_err_e (*)(struct ps_prochandle *, td_thragent_t **)) verbose_dlsym (info->handle, "td_ta_new");
if (info->td_ta_new_p == NULL)
return 0;
@@ -769,34 +769,45 @@ try_thread_db_load_1 (struct thread_db_info *info)
return 0;
}
- info->td_ta_map_id2thr_p = verbose_dlsym (info->handle, "td_ta_map_id2thr");
+ info->td_ta_map_id2thr_p = (td_ta_map_id2thr_ftype *)
+ verbose_dlsym (info->handle, "td_ta_map_id2thr");
if (info->td_ta_map_id2thr_p == NULL)
return 0;
- info->td_ta_map_lwp2thr_p = verbose_dlsym (info->handle,
- "td_ta_map_lwp2thr");
+ info->td_ta_map_lwp2thr_p = (td_ta_map_lwp2thr_ftype *)
+ verbose_dlsym (info->handle, "td_ta_map_lwp2thr");
+
if (info->td_ta_map_lwp2thr_p == NULL)
return 0;
- info->td_ta_thr_iter_p = verbose_dlsym (info->handle, "td_ta_thr_iter");
+ info->td_ta_thr_iter_p = (td_ta_thr_iter_ftype *)
+ verbose_dlsym (info->handle, "td_ta_thr_iter");
if (info->td_ta_thr_iter_p == NULL)
return 0;
- info->td_thr_validate_p = verbose_dlsym (info->handle, "td_thr_validate");
+ info->td_thr_validate_p = (td_thr_validate_ftype *)
+ verbose_dlsym (info->handle, "td_thr_validate");
if (info->td_thr_validate_p == NULL)
return 0;
- info->td_thr_get_info_p = verbose_dlsym (info->handle, "td_thr_get_info");
+ info->td_thr_get_info_p = (td_thr_get_info_ftype *)
+ verbose_dlsym (info->handle, "td_thr_get_info");
if (info->td_thr_get_info_p == NULL)
return 0;
/* These are not essential. */
- info->td_ta_event_addr_p = dlsym (info->handle, "td_ta_event_addr");
- info->td_ta_set_event_p = dlsym (info->handle, "td_ta_set_event");
- info->td_ta_clear_event_p = dlsym (info->handle, "td_ta_clear_event");
- info->td_ta_event_getmsg_p = dlsym (info->handle, "td_ta_event_getmsg");
- info->td_thr_event_enable_p = dlsym (info->handle, "td_thr_event_enable");
- info->td_thr_tls_get_addr_p = dlsym (info->handle, "td_thr_tls_get_addr");
+ info->td_ta_event_addr_p = (td_ta_event_addr_ftype *)
+ dlsym (info->handle, "td_ta_event_addr");
+ info->td_ta_set_event_p = (td_ta_set_event_ftype *)
+ dlsym (info->handle, "td_ta_set_event");
+ info->td_ta_clear_event_p = (td_ta_clear_event_ftype *)
+ dlsym (info->handle, "td_ta_clear_event");
+ info->td_ta_event_getmsg_p = (td_ta_event_getmsg_ftype *)
+ dlsym (info->handle, "td_ta_event_getmsg");
+ info->td_thr_event_enable_p = (td_thr_event_enable_ftype *)
+ dlsym (info->handle, "td_thr_event_enable");
+ info->td_thr_tls_get_addr_p = (td_thr_tls_get_addr_ftype *)
+ dlsym (info->handle, "td_thr_tls_get_addr");
if (thread_db_find_new_threads_silently (inferior_ptid) != 0)
{
@@ -900,7 +911,7 @@ try_thread_db_load_from_pdir_1 (struct objfile *obj, const char *subdir)
return 0;
}
- path = xmalloc (strlen (obj->name) + (subdir ? strlen (subdir) + 1 : 0)
+ path = (char *) xmalloc (strlen (obj->name) + (subdir ? strlen (subdir) + 1 : 0)
+ 1 + strlen (LIBTHREAD_DB_SO) + 1);
cleanup = make_cleanup (xfree, path);
@@ -983,7 +994,7 @@ try_thread_db_load_from_dir (const char *dir, size_t dir_len)
if (!auto_load_thread_db)
return 0;
- path = xmalloc (dir_len + 1 + strlen (LIBTHREAD_DB_SO) + 1);
+ path = (char *) xmalloc (dir_len + 1 + strlen (LIBTHREAD_DB_SO) + 1);
cleanup = make_cleanup (xfree, path);
memcpy (path, dir, dir_len);
@@ -1034,7 +1045,7 @@ thread_db_load_search (void)
if (this_dir[pdir_len] == '/')
{
- subdir = xmalloc (strlen (this_dir));
+ subdir = (char *) xmalloc (strlen (this_dir));
make_cleanup (xfree, subdir);
strcpy (subdir, this_dir + pdir_len + 1);
}
@@ -1282,7 +1293,7 @@ attach_thread (ptid_t ptid, const td_thrhandle_t *th_p,
}
/* Construct the thread's private data. */
- private_thr = xmalloc (sizeof (struct private_thread_info));
+ private_thr = (struct private_thread_info *) xmalloc (sizeof (struct private_thread_info));
memset (private_thr, 0, sizeof (struct private_thread_info));
/* A thread ID of zero may mean the thread library has not initialized
@@ -1550,7 +1561,7 @@ find_new_threads_callback (const td_thrhandle_t *th_p, void *data)
td_err_e err;
ptid_t ptid;
struct thread_info *tp;
- struct callback_data *cb_data = data;
+ struct callback_data *cb_data = (struct callback_data *) data;
struct thread_db_info *info = cb_data->info;
err = info->td_thr_get_info_p (th_p, &ti);
@@ -1936,7 +1947,7 @@ info_auto_load_libthread_db (char *args, int from_tty)
if (info->filename != NULL)
info_count++;
- array = xmalloc (sizeof (*array) * info_count);
+ array = (struct thread_db_info **) xmalloc (sizeof (*array) * info_count);
back_to = make_cleanup (xfree, array);
info_count = 0;
@@ -1998,7 +2009,7 @@ info_auto_load_libthread_db (char *args, int from_tty)
ui_out_table_header (uiout, pids_len, ui_left, "PIDs", "Pids");
ui_out_table_body (uiout);
- pids = xmalloc (max_pids_len + 1);
+ pids = (char *) xmalloc (max_pids_len + 1);
make_cleanup (xfree, pids);
/* Note I is incremented inside the cycle, not at its end. */
diff --git a/gdb/proc-service.c b/gdb/proc-service.c
index 83e1d67..2902265 100644
--- a/gdb/proc-service.c
+++ b/gdb/proc-service.c
@@ -227,7 +227,7 @@ ps_err_e
ps_pdread (gdb_ps_prochandle_t ph, psaddr_t addr,
gdb_ps_read_buf_t buf, gdb_ps_size_t size)
{
- return ps_xfer_memory (ph, addr, buf, size, 0);
+ return ps_xfer_memory (ph, addr, (gdb_byte *)buf, size, 0);
}
/* Write SIZE bytes from BUF into the target process PH at address ADDR. */
diff --git a/gdb/remote-fileio.c b/gdb/remote-fileio.c
index 5b7ef1d..5ed5bd6 100644
--- a/gdb/remote-fileio.c
+++ b/gdb/remote-fileio.c
@@ -614,7 +614,7 @@ remote_fileio_func_open (char *buf)
mode = remote_fileio_mode_to_host (num, 1);
/* Request pathname. */
- pathname = alloca (length);
+ pathname = (char *) alloca (length);
if (target_read_memory (ptrval, (gdb_byte *) pathname, length) != 0)
{
remote_fileio_ioerror ();
@@ -958,7 +958,7 @@ remote_fileio_func_rename (char *buf)
}
/* Request oldpath using 'm' packet */
- oldpath = alloca (old_len);
+ oldpath = (char *) alloca (old_len);
if (target_read_memory (old_ptr, (gdb_byte *) oldpath, old_len) != 0)
{
remote_fileio_ioerror ();
@@ -966,7 +966,7 @@ remote_fileio_func_rename (char *buf)
}
/* Request newpath using 'm' packet */
- newpath = alloca (new_len);
+ newpath = (char *) alloca (new_len);
if (target_read_memory (new_ptr, (gdb_byte *) newpath, new_len) != 0)
{
remote_fileio_ioerror ();
@@ -1044,7 +1044,7 @@ remote_fileio_func_unlink (char *buf)
return;
}
/* Request pathname using 'm' packet */
- pathname = alloca (length);
+ pathname = (char *) alloca (length);
if (target_read_memory (ptrval, (gdb_byte *) pathname, length) != 0)
{
remote_fileio_ioerror ();
@@ -1094,7 +1094,7 @@ remote_fileio_func_stat (char *buf)
statptr = (CORE_ADDR) lnum;
/* Request pathname using 'm' packet */
- pathname = alloca (namelength);
+ pathname = (char *) alloca (namelength);
if (target_read_memory (nameptr, (gdb_byte *) pathname, namelength) != 0)
{
remote_fileio_ioerror ();
@@ -1295,7 +1295,7 @@ remote_fileio_func_system (char *buf)
if (length)
{
/* Request commandline using 'm' packet */
- cmdline = alloca (length);
+ cmdline = (char *) alloca (length);
if (target_read_memory (ptrval, (gdb_byte *) cmdline, length) != 0)
{
remote_fileio_ioerror ();
@@ -1349,7 +1349,7 @@ static struct {
static int
do_remote_fileio_request (struct ui_out *uiout, void *buf_arg)
{
- char *buf = buf_arg;
+ char *buf = (char *) buf_arg;
char *c;
int idx;
diff --git a/gdb/remote-notif.c b/gdb/remote-notif.c
index 0f73a52..696394a 100644
--- a/gdb/remote-notif.c
+++ b/gdb/remote-notif.c
@@ -242,7 +242,7 @@ handle_notification (char *buf)
static void
do_notif_event_xfree (void *arg)
{
- struct notif_event *event = arg;
+ struct notif_event *event = (struct notif_event *) arg;
if (event && event->dtr)
event->dtr (event);
diff --git a/gdb/remote.c b/gdb/remote.c
index a1ff465..5c2e6fe 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -532,7 +532,8 @@ static struct gdbarch_data *remote_gdbarch_data_handle;
static struct remote_arch_state *
get_remote_arch_state (void)
{
- return gdbarch_data (target_gdbarch (), remote_gdbarch_data_handle);
+ return (struct remote_arch_state *)
+ gdbarch_data (target_gdbarch (), remote_gdbarch_data_handle);
}
/* Fetch the global remote target state. */
@@ -553,8 +554,8 @@ get_remote_state (void)
static int
compare_pnums (const void *lhs_, const void *rhs_)
{
- const struct packet_reg * const *lhs = lhs_;
- const struct packet_reg * const *rhs = rhs_;
+ const struct packet_reg * const *lhs = (const struct packet_reg * const*) lhs_;
+ const struct packet_reg * const *rhs = (const struct packet_reg * const*) rhs_;
if ((*lhs)->pnum < (*rhs)->pnum)
return -1;
@@ -587,7 +588,7 @@ map_regcache_remote_table (struct gdbarch *gdbarch, struct packet_reg *regs)
with a remote protocol number, in order of ascending protocol
number. */
- remote_regs = alloca (gdbarch_num_regs (gdbarch)
+ remote_regs = (struct packet_reg **) alloca (gdbarch_num_regs (gdbarch)
* sizeof (struct packet_reg *));
for (num_remote_regs = 0, regnum = 0;
regnum < gdbarch_num_regs (gdbarch);
@@ -624,7 +625,7 @@ remote_register_number_and_offset (struct gdbarch *gdbarch, int regnum,
gdb_assert (regnum < gdbarch_num_regs (gdbarch));
- regs = xcalloc (gdbarch_num_regs (gdbarch), sizeof (struct packet_reg));
+ regs = (struct packet_reg *) xcalloc (gdbarch_num_regs (gdbarch), sizeof (struct packet_reg));
old_chain = make_cleanup (xfree, regs);
sizeof_g_packet = map_regcache_remote_table (gdbarch, regs);
@@ -681,7 +682,7 @@ init_remote_state (struct gdbarch *gdbarch)
if (rs->buf_size < rsa->remote_packet_size)
{
rs->buf_size = 2 * rsa->remote_packet_size;
- rs->buf = xrealloc (rs->buf, rs->buf_size);
+ rs->buf = (char *) xrealloc (rs->buf, rs->buf_size);
}
return rsa;
@@ -922,7 +923,7 @@ get_memory_packet_size (struct memory_packet_config *config)
if (rs->buf_size < what_they_get + 1)
{
rs->buf_size = 2 * what_they_get;
- rs->buf = xrealloc (rs->buf, 2 * what_they_get);
+ rs->buf = (char *) xrealloc (rs->buf, 2 * what_they_get);
}
return what_they_get;
@@ -1615,7 +1616,8 @@ demand_private_info (ptid_t ptid)
if (!info->private_data)
{
- info->private_data = xmalloc (sizeof (*(info->private_data)));
+ info->private_data = (struct private_thread_info *)
+ xmalloc (sizeof (*(info->private_data)));
info->private_dtor = free_private_thread_info;
info->private_data->core = -1;
info->private_data->extra = 0;
@@ -1654,7 +1656,7 @@ remote_pass_signals (int numsigs, unsigned char *pass_signals)
if (pass_signals[i])
count++;
}
- pass_packet = xmalloc (count * 3 + strlen ("QPassSignals:") + 1);
+ pass_packet = (char *) xmalloc (count * 3 + strlen ("QPassSignals:") + 1);
strcpy (pass_packet, "QPassSignals:");
p = pass_packet + strlen (pass_packet);
for (i = 0; i < numsigs; i++)
@@ -1713,7 +1715,7 @@ remote_program_signals (int numsigs, unsigned char *signals)
if (signals[i])
count++;
}
- packet = xmalloc (count * 3 + strlen ("QProgramSignals:") + 1);
+ packet = (char *) xmalloc (count * 3 + strlen ("QProgramSignals:") + 1);
strcpy (packet, "QProgramSignals:");
p = packet + strlen (packet);
for (i = 0; i < numsigs; i++)
@@ -2634,13 +2636,13 @@ start_thread (struct gdb_xml_parser *parser,
const struct gdb_xml_element *element,
void *user_data, VEC(gdb_xml_value_s) *attributes)
{
- struct threads_parsing_context *data = user_data;
+ struct threads_parsing_context *data = (struct threads_parsing_context *) user_data;
struct thread_item item;
char *id;
struct gdb_xml_value *attr;
- id = xml_find_attribute (attributes, "id")->value;
+ id = (char *) xml_find_attribute (attributes, "id")->value;
item.ptid = read_ptid (id, NULL);
attr = xml_find_attribute (attributes, "core");
@@ -2659,7 +2661,7 @@ end_thread (struct gdb_xml_parser *parser,
const struct gdb_xml_element *element,
void *user_data, const char *body_text)
{
- struct threads_parsing_context *data = user_data;
+ struct threads_parsing_context *data = (struct threads_parsing_context *) user_data;
if (body_text && *body_text)
VEC_last (thread_item_t, data->items)->extra = xstrdup (body_text);
@@ -2693,7 +2695,7 @@ const struct gdb_xml_element threads_elements[] = {
static void
clear_threads_parsing_context (void *p)
{
- struct threads_parsing_context *context = p;
+ struct threads_parsing_context *context = (struct threads_parsing_context *) p;
int i;
struct thread_item *item;
@@ -3281,7 +3283,7 @@ stop_reply_extract_thread (char *stop_reply)
}
}
- return null_ptid;
+ return (ptid_t) null_ptid;
}
/* Query the remote target for which is the current thread/process,
@@ -3481,7 +3483,7 @@ remote_start_remote (int from_tty, struct target_ops *target, int extended_p)
else
{
/* Save the reply for later. */
- wait_status = alloca (strlen (rs->buf) + 1);
+ wait_status = (char *) alloca (strlen (rs->buf) + 1);
strcpy (wait_status, rs->buf);
}
@@ -3674,7 +3676,7 @@ remote_check_symbols (void)
/* Allocate a message buffer. We can't reuse the input buffer in RS,
because we need both at the same time. */
- msg = alloca (get_remote_packet_size ());
+ msg = (char *) alloca (get_remote_packet_size ());
/* Invite target to request symbol lookups. */
@@ -4210,7 +4212,7 @@ remote_query_supported (void)
if (rs->buf_size < rs->explicit_packet_size)
{
rs->buf_size = rs->explicit_packet_size;
- rs->buf = xrealloc (rs->buf, rs->buf_size);
+ rs->buf = (char *) xrealloc (rs->buf, rs->buf_size);
}
/* Handle the defaults for unmentioned features. */
@@ -4230,7 +4232,7 @@ remote_query_supported (void)
static void
remote_unpush_target (void)
{
- pop_all_targets_above (process_stratum - 1);
+ pop_all_targets_above ((enum strata) (process_stratum - 1));
}
static void
@@ -4511,7 +4513,7 @@ extended_remote_attach_1 (struct target_ops *target, char *args, int from_tty)
if (!non_stop)
{
/* Save the reply for later. */
- wait_status = alloca (strlen (rs->buf) + 1);
+ wait_status = (char *) alloca (strlen (rs->buf) + 1);
strcpy (wait_status, rs->buf);
}
else if (strcmp (rs->buf, "OK") != 0)
@@ -5371,8 +5373,8 @@ remote_notif_remove_all (QUEUE (stop_reply_p) *q,
stop_reply_p event,
void *data)
{
- struct queue_iter_param *param = data;
- struct inferior *inf = param->input;
+ struct queue_iter_param *param = (struct queue_iter_param *) data;
+ struct inferior *inf = (struct inferior *) param->input;
if (inf == NULL || ptid_get_pid (event->ptid) == inf->pid)
{
@@ -5419,8 +5421,8 @@ remote_notif_remove_once_on_match (QUEUE (stop_reply_p) *q,
stop_reply_p event,
void *data)
{
- struct queue_iter_param *param = data;
- ptid_t *ptid = param->input;
+ struct queue_iter_param *param = (struct queue_iter_param *) data;
+ ptid_t *ptid = (ptid_t *) param->input;
if (ptid_match (event->ptid, *ptid))
{
@@ -5495,7 +5497,7 @@ stop_reply_match_ptid_and_ws (QUEUE (stop_reply_p) *q,
struct stop_reply *event,
void *data)
{
- ptid_t *ptid = data;
+ ptid_t *ptid = (ptid_t *) data;
return !(ptid_equal (*ptid, event->ptid)
&& event->ws.kind == TARGET_WAITKIND_STOPPED);
@@ -6214,7 +6216,7 @@ process_g_packet (struct regcache *regcache)
}
}
- regs = alloca (rsa->sizeof_g_packet);
+ regs = (char *) alloca (rsa->sizeof_g_packet);
/* Unimplemented registers read as all bits zero. */
memset (regs, 0, rsa->sizeof_g_packet);
@@ -6421,7 +6423,7 @@ store_registers_using_G (const struct regcache *regcache)
{
int i;
- regs = alloca (rsa->sizeof_g_packet);
+ regs = (gdb_byte *) alloca (rsa->sizeof_g_packet);
memset (regs, 0, rsa->sizeof_g_packet);
for (i = 0; i < gdbarch_num_regs (get_regcache_arch (regcache)); i++)
{
@@ -7230,7 +7232,7 @@ putpkt_binary (char *buf, int cnt)
struct remote_state *rs = get_remote_state ();
int i;
unsigned char csum = 0;
- char *buf2 = alloca (cnt + 6);
+ char *buf2 = (char *) alloca (cnt + 6);
int ch;
int tcount = 0;
@@ -7560,7 +7562,7 @@ read_frame (char **buf_p,
{
/* Make some more room in the buffer. */
*sizeof_buf += repeat;
- *buf_p = xrealloc (*buf_p, *sizeof_buf);
+ *buf_p = (char *) xrealloc (*buf_p, *sizeof_buf);
buf = *buf_p;
}
@@ -7578,7 +7580,7 @@ read_frame (char **buf_p,
{
/* Make some more room in the buffer. */
*sizeof_buf *= 2;
- *buf_p = xrealloc (*buf_p, *sizeof_buf);
+ *buf_p = (char *) xrealloc (*buf_p, *sizeof_buf);
buf = *buf_p;
}
@@ -7782,7 +7784,7 @@ getpkt_or_notif_sane (char **buf, long *sizeof_buf, int forever,
static int
putpkt_for_catch_errors (void *arg)
{
- return putpkt (arg);
+ return putpkt ((char *) arg);
}
static void
@@ -8273,7 +8275,7 @@ remote_insert_watchpoint (CORE_ADDR addr, int len, int type,
struct remote_state *rs = get_remote_state ();
char *endbuf = rs->buf + get_remote_packet_size ();
char *p;
- enum Z_packet_type packet = watchpoint_to_Z_packet (type);
+ enum Z_packet_type packet = (enum Z_packet_type) watchpoint_to_Z_packet (type);
if (remote_protocol_packets[PACKET_Z0 + packet].support == PACKET_DISABLE)
return 1;
@@ -8322,7 +8324,7 @@ remote_remove_watchpoint (CORE_ADDR addr, int len, int type,
struct remote_state *rs = get_remote_state ();
char *endbuf = rs->buf + get_remote_packet_size ();
char *p;
- enum Z_packet_type packet = watchpoint_to_Z_packet (type);
+ enum Z_packet_type packet = (enum Z_packet_type) watchpoint_to_Z_packet (type);
if (remote_protocol_packets[PACKET_Z0 + packet].support == PACKET_DISABLE)
return -1;
@@ -8627,7 +8629,7 @@ compare_sections_command (char *args, int from_tty)
matched = 1; /* Do this section. */
lma = s->lma;
- sectdata = xmalloc (size);
+ sectdata = (gdb_byte *) xmalloc (size);
old_chain = make_cleanup (xfree, sectdata);
bfd_get_section_contents (exec_bfd, s, sectdata, 0, size);
@@ -9512,7 +9514,7 @@ register_remote_g_packet_guess (struct gdbarch *gdbarch, int bytes,
const struct target_desc *tdesc)
{
struct remote_g_packet_data *data
- = gdbarch_data (gdbarch, remote_g_packet_data_handle);
+ = (struct remote_g_packet_data *) gdbarch_data (gdbarch, remote_g_packet_data_handle);
struct remote_g_packet_guess new_guess, *guess;
int ix;
@@ -9537,8 +9539,8 @@ register_remote_g_packet_guess (struct gdbarch *gdbarch, int bytes,
static int
remote_read_description_p (struct target_ops *target)
{
- struct remote_g_packet_data *data
- = gdbarch_data (target_gdbarch (), remote_g_packet_data_handle);
+ struct remote_g_packet_data *data = (struct remote_g_packet_data *)
+ gdbarch_data (target_gdbarch (), remote_g_packet_data_handle);
if (!VEC_empty (remote_g_packet_guess_s, data->guesses))
return 1;
@@ -9549,8 +9551,8 @@ remote_read_description_p (struct target_ops *target)
static const struct target_desc *
remote_read_description (struct target_ops *target)
{
- struct remote_g_packet_data *data
- = gdbarch_data (target_gdbarch (), remote_g_packet_data_handle);
+ struct remote_g_packet_data *data = (struct remote_g_packet_data *)
+ gdbarch_data (target_gdbarch (), remote_g_packet_data_handle);
/* Do not try this during initial connection, when we do not know
whether there is a running but stopped thread. */
@@ -9934,7 +9936,7 @@ remote_hostio_readlink (const char *filename, int *remote_errno)
if (len < 0)
return NULL;
- ret = xmalloc (len + 1);
+ ret = (char *) xmalloc (len + 1);
read_len = remote_unescape_input ((gdb_byte *) attachment, attachment_len,
(gdb_byte *) ret, len);
@@ -10034,7 +10036,7 @@ remote_bfd_iovec_open (struct bfd *abfd, void *open_closure)
return NULL;
}
- stream = xmalloc (sizeof (int));
+ stream = (int *) xmalloc (sizeof (int));
*stream = fd;
return stream;
}
@@ -10138,7 +10140,7 @@ remote_file_put (const char *local_file, const char *remote_file, int from_tty)
/* Send up to this many bytes at once. They won't all fit in the
remote packet limit, so we'll transfer slightly fewer. */
io_size = get_remote_packet_size ();
- buffer = xmalloc (io_size);
+ buffer = (gdb_byte *) xmalloc (io_size);
make_cleanup (xfree, buffer);
close_cleanup = make_cleanup (remote_hostio_close_cleanup, &fd);
@@ -10224,7 +10226,7 @@ remote_file_get (const char *remote_file, const char *local_file, int from_tty)
/* Send up to this many bytes at once. They won't all fit in the
remote packet limit, so we'll transfer slightly fewer. */
io_size = get_remote_packet_size ();
- buffer = xmalloc (io_size);
+ buffer = (gdb_byte *) xmalloc (io_size);
make_cleanup (xfree, buffer);
close_cleanup = make_cleanup (remote_hostio_close_cleanup, &fd);
@@ -10331,7 +10333,7 @@ remote_delete_command (char *args, int from_tty)
static void
remote_command (char *args, int from_tty)
{
- help_list (remote_cmdlist, "remote ", -1, gdb_stdout);
+ help_list (remote_cmdlist, "remote ", (enum command_class) -1, gdb_stdout);
}
static int
@@ -10447,7 +10449,7 @@ static void free_actions_list_cleanup_wrapper (void *);
static void
free_actions_list_cleanup_wrapper (void *al)
{
- free_actions_list (al);
+ free_actions_list ((char **) al);
}
static void
@@ -11362,7 +11364,7 @@ remote_enable_btrace (ptid_t ptid)
target_pid_to_str (ptid));
}
- tinfo = xzalloc (sizeof (*tinfo));
+ tinfo = (struct btrace_target_info *) xzalloc (sizeof (*tinfo));
tinfo->ptid = ptid;
return tinfo;
@@ -11675,7 +11677,7 @@ remote_async (void (*callback) (enum inferior_event_type event_type,
static void
set_remote_cmd (char *args, int from_tty)
{
- help_list (remote_set_cmdlist, "set remote ", -1, gdb_stdout);
+ help_list (remote_set_cmdlist, "set remote ", (enum command_class) -1, gdb_stdout);
}
static void
@@ -11827,7 +11829,7 @@ _initialize_remote (void)
whenever a larger buffer is needed. */
rs = get_remote_state_raw ();
rs->buf_size = 400;
- rs->buf = xmalloc (rs->buf_size);
+ rs->buf = (char *) xmalloc (rs->buf_size);
init_remote_ops ();
add_target (&remote_ops);
@@ -12229,6 +12231,6 @@ stepping is supported by the target. The default is on."),
any_thread_ptid = ptid_build (42000, 1, 0);
target_buf_size = 2048;
- target_buf = xmalloc (target_buf_size);
+ target_buf = (char *) xmalloc (target_buf_size);
}
diff --git a/gdb/ser-base.c b/gdb/ser-base.c
index 52c5726..10fb0a7 100644
--- a/gdb/ser-base.c
+++ b/gdb/ser-base.c
@@ -155,7 +155,7 @@ run_async_handler_and_reschedule (struct serial *scb)
static void
fd_event (int error, void *context)
{
- struct serial *scb = context;
+ struct serial *scb = (struct serial *) context;
if (error != 0)
{
scb->bufcnt = SERIAL_ERROR;
@@ -192,7 +192,7 @@ fd_event (int error, void *context)
static void
push_event (void *context)
{
- struct serial *scb = context;
+ struct serial *scb = (struct serial *) context;
scb->async_state = NOTHING_SCHEDULED; /* Timers are one-off */
run_async_handler_and_reschedule (scb);
@@ -442,7 +442,7 @@ ser_base_readchar (struct serial *scb, int timeout)
int
ser_base_write (struct serial *scb, const void *buf, size_t count)
{
- const char *str = buf;
+ const char *str = (const char *) buf;
int cc;
while (count > 0)
diff --git a/gdb/ser-pipe.c b/gdb/ser-pipe.c
index 1b30f78..aa9c7aa 100644
--- a/gdb/ser-pipe.c
+++ b/gdb/ser-pipe.c
@@ -149,7 +149,7 @@ pipe_open (struct serial *scb, const char *name)
static void
pipe_close (struct serial *scb)
{
- struct pipe_state *state = scb->state;
+ struct pipe_state *state = (struct pipe_state *) scb->state;
close (scb->fd);
scb->fd = -1;
diff --git a/gdb/ser-tcp.c b/gdb/ser-tcp.c
index f40bfce..58bb303 100644
--- a/gdb/ser-tcp.c
+++ b/gdb/ser-tcp.c
@@ -363,13 +363,13 @@ ser_tcp_send_break (struct serial *scb)
static void
set_tcp_cmd (char *args, int from_tty)
{
- help_list (tcp_set_cmdlist, "set tcp ", -1, gdb_stdout);
+ help_list (tcp_set_cmdlist, "set tcp ", (enum command_class) -1, gdb_stdout);
}
static void
show_tcp_cmd (char *args, int from_tty)
{
- help_list (tcp_show_cmdlist, "show tcp ", -1, gdb_stdout);
+ help_list (tcp_show_cmdlist, "show tcp ", (enum command_class) -1, gdb_stdout);
}
diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c
index afe6ac9..e8db3df 100644
--- a/gdb/solib-svr4.c
+++ b/gdb/solib-svr4.c
@@ -199,7 +199,7 @@ lm_info_read (CORE_ADDR lm_addr)
struct lm_info *lm_info;
struct cleanup *back_to;
- lm = xmalloc (lmo->link_map_size);
+ lm = (gdb_byte *) xmalloc (lmo->link_map_size);
back_to = make_cleanup (xfree, lm);
if (target_read_memory (lm_addr, lm, lmo->link_map_size) != 0)
@@ -212,7 +212,7 @@ lm_info_read (CORE_ADDR lm_addr)
{
struct type *ptr_type = builtin_type (target_gdbarch ())->builtin_data_ptr;
- lm_info = xzalloc (sizeof (*lm_info));
+ lm_info = (struct lm_info *) xzalloc (sizeof (*lm_info));
lm_info->lm_addr = lm_addr;
lm_info->l_addr_inferior = extract_typed_address (&lm[lmo->l_addr_offset],
@@ -409,7 +409,7 @@ svr4_pspace_data_cleanup (struct program_space *pspace, void *arg)
{
struct svr4_info *info;
- info = program_space_data (pspace, solib_svr4_pspace_data);
+ info = (struct svr4_info *) program_space_data (pspace, solib_svr4_pspace_data);
if (info == NULL)
return;
@@ -427,7 +427,7 @@ get_svr4_info (void)
{
struct svr4_info *info;
- info = program_space_data (current_program_space, solib_svr4_pspace_data);
+ info = (struct svr4_info *) program_space_data (current_program_space, solib_svr4_pspace_data);
if (info != NULL)
return info;
@@ -571,7 +571,7 @@ read_program_header (int type, int *p_sect_size, int *p_arch_size)
}
/* Read in requested program header. */
- buf = xmalloc (sect_size);
+ buf = (gdb_byte *) xmalloc (sect_size);
if (target_read_memory (sect_addr, buf, sect_size))
{
xfree (buf);
@@ -604,7 +604,7 @@ find_program_interpreter (void)
{
int sect_size = bfd_section_size (exec_bfd, interp_sect);
- buf = xmalloc (sect_size);
+ buf = (gdb_byte *) xmalloc (sect_size);
bfd_get_section_contents (exec_bfd, interp_sect, buf, 0, sect_size);
}
}
@@ -667,7 +667,7 @@ scan_dyntag (int dyntag, bfd *abfd, CORE_ADDR *ptr)
/* Read in .dynamic from the BFD. We will get the actual value
from memory later. */
sect_size = bfd_section_size (abfd, sect);
- buf = bufstart = alloca (sect_size);
+ buf = bufstart = (gdb_byte *) alloca (sect_size);
if (!bfd_get_section_contents (abfd, sect,
buf, 0, sect_size))
return 0;
@@ -804,7 +804,7 @@ elf_locate_base (void)
gdb_byte *pbuf;
int pbuf_size = TYPE_LENGTH (ptr_type);
- pbuf = alloca (pbuf_size);
+ pbuf = (gdb_byte *) alloca (pbuf_size);
/* DT_MIPS_RLD_MAP contains a pointer to the address
of the dynamic link structure. */
if (target_read_memory (dyn_ptr, pbuf, pbuf_size))
@@ -980,7 +980,7 @@ open_symbol_file_object (void *from_ttyp)
struct link_map_offsets *lmo = svr4_fetch_link_map_offsets ();
struct type *ptr_type = builtin_type (target_gdbarch ())->builtin_data_ptr;
int l_name_size = TYPE_LENGTH (ptr_type);
- gdb_byte *l_name_buf = xmalloc (l_name_size);
+ gdb_byte *l_name_buf = (gdb_byte *) xmalloc (l_name_size);
struct cleanup *cleanups = make_cleanup (xfree, l_name_buf);
struct svr4_info *info = get_svr4_info ();
@@ -1095,10 +1095,10 @@ svr4_copy_library_list (struct so_list *src)
{
struct so_list *new_so;
- new_so = xmalloc (sizeof (struct so_list));
+ new_so = (struct so_list *) xmalloc (sizeof (struct so_list));
memcpy (new_so, src, sizeof (struct so_list));
- new_so->lm_info = xmalloc (sizeof (struct lm_info));
+ new_so->lm_info = (struct lm_info *) xmalloc (sizeof (struct lm_info));
memcpy (new_so->lm_info, src->lm_info, sizeof (struct lm_info));
new_so->next = NULL;
@@ -1123,11 +1123,11 @@ library_list_start_library (struct gdb_xml_parser *parser,
const struct gdb_xml_element *element,
void *user_data, VEC(gdb_xml_value_s) *attributes)
{
- struct svr4_library_list *list = user_data;
- const char *name = xml_find_attribute (attributes, "name")->value;
- ULONGEST *lmp = xml_find_attribute (attributes, "lm")->value;
- ULONGEST *l_addrp = xml_find_attribute (attributes, "l_addr")->value;
- ULONGEST *l_ldp = xml_find_attribute (attributes, "l_ld")->value;
+ struct svr4_library_list *list = (struct svr4_library_list *) user_data;
+ const char *name = (const char *) xml_find_attribute (attributes, "name")->value;
+ ULONGEST *lmp = (ULONGEST *) xml_find_attribute (attributes, "lm")->value;
+ ULONGEST *l_addrp = (ULONGEST *) xml_find_attribute (attributes, "l_addr")->value;
+ ULONGEST *l_ldp = (ULONGEST *) xml_find_attribute (attributes, "l_ld")->value;
struct so_list *new_elem;
new_elem = XZALLOC (struct so_list);
@@ -1151,8 +1151,8 @@ svr4_library_list_start_list (struct gdb_xml_parser *parser,
const struct gdb_xml_element *element,
void *user_data, VEC(gdb_xml_value_s) *attributes)
{
- struct svr4_library_list *list = user_data;
- const char *version = xml_find_attribute (attributes, "version")->value;
+ struct svr4_library_list *list = (struct svr4_library_list *) user_data;
+ const char *version = (const char *) xml_find_attribute (attributes, "version")->value;
struct gdb_xml_value *main_lm = xml_find_attribute (attributes, "main-lm");
if (strcmp (version, "1.0") != 0)
@@ -1285,7 +1285,7 @@ svr4_default_sos (void)
new_so = XZALLOC (struct so_list);
- new_so->lm_info = xzalloc (sizeof (struct lm_info));
+ new_so->lm_info = (struct lm_info *) xzalloc (sizeof (struct lm_info));
/* Nothing will ever check the other fields if we set l_addr_p. */
new_so->lm_info->l_addr = info->debug_loader_offset;
@@ -1574,7 +1574,7 @@ struct probe_and_action
static hashval_t
hash_probe_and_action (const void *p)
{
- const struct probe_and_action *pa = p;
+ const struct probe_and_action *pa = (const struct probe_and_action *) p;
return (hashval_t) pa->probe->address;
}
@@ -1585,8 +1585,8 @@ hash_probe_and_action (const void *p)
static int
equal_probe_and_action (const void *p1, const void *p2)
{
- const struct probe_and_action *pa1 = p1;
- const struct probe_and_action *pa2 = p2;
+ const struct probe_and_action *pa1 = (const struct probe_and_action *) p1;
+ const struct probe_and_action *pa2 = (const struct probe_and_action *) p2;
return pa1->probe->address == pa2->probe->address;
}
@@ -1890,7 +1890,7 @@ svr4_update_solib_event_breakpoint (struct breakpoint *b, void *arg)
struct svr4_info *info;
struct probe_and_action *pa;
- info = program_space_data (loc->pspace, solib_svr4_pspace_data);
+ info = (struct svr4_info *) program_space_data (loc->pspace, solib_svr4_pspace_data);
if (info == NULL || info->probes_table == NULL)
continue;
@@ -2395,7 +2395,7 @@ read_program_headers_from_bfd (bfd *abfd, int *phdrs_size)
if (*phdrs_size == 0)
return NULL;
- buf = xmalloc (*phdrs_size);
+ buf = (gdb_byte *) xmalloc (*phdrs_size);
if (bfd_seek (abfd, ehdr->e_phoff, SEEK_SET) != 0
|| bfd_bread (buf, *phdrs_size, abfd) != *phdrs_size)
{
@@ -2815,7 +2815,7 @@ svr4_relocate_main_executable (void)
struct section_offsets *new_offsets;
int i;
- new_offsets = alloca (symfile_objfile->num_sections
+ new_offsets = (struct section_offsets *) alloca (symfile_objfile->num_sections
* sizeof (*new_offsets));
for (i = 0; i < symfile_objfile->num_sections; i++)
@@ -2946,7 +2946,7 @@ solib_svr4_init (struct obstack *obstack)
{
struct solib_svr4_ops *ops;
- ops = OBSTACK_ZALLOC (obstack, struct solib_svr4_ops);
+ ops = (struct solib_svr4_ops *) OBSTACK_ZALLOC (obstack, struct solib_svr4_ops);
ops->fetch_link_map_offsets = NULL;
return ops;
}
@@ -2958,7 +2958,8 @@ void
set_solib_svr4_fetch_link_map_offsets (struct gdbarch *gdbarch,
struct link_map_offsets *(*flmo) (void))
{
- struct solib_svr4_ops *ops = gdbarch_data (gdbarch, solib_svr4_data);
+ struct solib_svr4_ops *ops = (struct solib_svr4_ops *) gdbarch_data (gdbarch,
+ solib_svr4_data);
ops->fetch_link_map_offsets = flmo;
@@ -2971,7 +2972,8 @@ set_solib_svr4_fetch_link_map_offsets (struct gdbarch *gdbarch,
static struct link_map_offsets *
svr4_fetch_link_map_offsets (void)
{
- struct solib_svr4_ops *ops = gdbarch_data (target_gdbarch (), solib_svr4_data);
+ struct solib_svr4_ops *ops = (struct solib_svr4_ops *) gdbarch_data (target_gdbarch (),
+ solib_svr4_data);
gdb_assert (ops->fetch_link_map_offsets);
return ops->fetch_link_map_offsets ();
@@ -2982,7 +2984,8 @@ svr4_fetch_link_map_offsets (void)
static int
svr4_have_link_map_offsets (void)
{
- struct solib_svr4_ops *ops = gdbarch_data (target_gdbarch (), solib_svr4_data);
+ struct solib_svr4_ops *ops = (struct solib_svr4_ops *) gdbarch_data (target_gdbarch (),
+ solib_svr4_data);
return (ops->fetch_link_map_offsets != NULL);
}
diff --git a/gdb/symfile-mem.c b/gdb/symfile-mem.c
index e148d09..fb60e1a 100644
--- a/gdb/symfile-mem.c
+++ b/gdb/symfile-mem.c
@@ -179,7 +179,8 @@ struct symbol_file_add_from_memory_args
static int
symbol_file_add_from_memory_wrapper (struct ui_out *uiout, void *data)
{
- struct symbol_file_add_from_memory_args *args = data;
+ struct symbol_file_add_from_memory_args *args =
+ (struct symbol_file_add_from_memory_args *) data;
symbol_file_add_from_memory (args->bfd, args->sysinfo_ehdr, args->name,
args->from_tty);
diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c
index ce61fb7..ccfac3e 100644
--- a/gdb/tracepoint.c
+++ b/gdb/tracepoint.c
@@ -871,7 +871,7 @@ static int memrange_cmp (const void *, const void *);
static int
memrange_cmp (const void *va, const void *vb)
{
- const struct memrange *a = va, *b = vb;
+ const struct memrange *a = (const struct memrange *) va, *b = (const struct memrange *) vb;
if (a->type < b->type)
return -1;
@@ -959,7 +959,7 @@ add_memrange (struct collection_list *memranges,
if (memranges->next_memrange >= memranges->listsize)
{
memranges->listsize *= 2;
- memranges->list = xrealloc (memranges->list,
+ memranges->list = (struct memrange *) xrealloc (memranges->list,
memranges->listsize);
}
@@ -1148,7 +1148,7 @@ do_collect_symbol (const char *print_name,
struct symbol *sym,
void *cb_data)
{
- struct add_local_symbols_data *p = cb_data;
+ struct add_local_symbols_data *p = (struct add_local_symbols_data *) cb_data;
collect_symbol (p->collect, sym, p->gdbarch, p->frame_regno,
p->frame_offset, p->pc, p->trace_string);
@@ -1242,7 +1242,7 @@ clear_collection_list (struct collection_list *list)
static void
do_clear_collection_list (void *list)
{
- struct collection_list *l = list;
+ struct collection_list *l = (struct collection_list *) list;
clear_collection_list (l);
}
@@ -1255,11 +1255,11 @@ init_collection_list (struct collection_list *clist)
memset (clist, 0, sizeof *clist);
clist->listsize = 128;
- clist->list = xcalloc (clist->listsize,
+ clist->list = (struct memrange *) xcalloc (clist->listsize,
sizeof (struct memrange));
clist->aexpr_listsize = 128;
- clist->aexpr_list = xcalloc (clist->aexpr_listsize,
+ clist->aexpr_list = (struct agent_expr **) xcalloc (clist->aexpr_listsize,
sizeof (struct agent_expr *));
}
@@ -1719,7 +1719,7 @@ add_aexpr (struct collection_list *collect, struct agent_expr *aexpr)
{
if (collect->next_aexpr_elt >= collect->aexpr_listsize)
{
- collect->aexpr_list =
+ collect->aexpr_list = (struct agent_expr **)
xrealloc (collect->aexpr_list,
2 * collect->aexpr_listsize * sizeof (struct agent_expr *));
collect->aexpr_listsize *= 2;
@@ -2945,7 +2945,7 @@ trace_dump_actions (struct command_line *action,
{
size_t len = next_comma - action_exp;
- cmd = xrealloc (cmd, len + 1);
+ cmd = (char *) xrealloc (cmd, len + 1);
memcpy (cmd, action_exp, len);
cmd[len] = 0;
}
@@ -2953,7 +2953,7 @@ trace_dump_actions (struct command_line *action,
{
size_t len = strlen (action_exp);
- cmd = xrealloc (cmd, len + 1);
+ cmd = (char *) xrealloc (cmd, len + 1);
memcpy (cmd, action_exp, len + 1);
}
@@ -3038,7 +3038,8 @@ all_tracepoint_actions_and_cleanup (struct breakpoint *t)
make_cleanup (xfree, default_collect_line);
validate_actionline (default_collect_line, t);
- default_collect_action = xmalloc (sizeof (struct command_line));
+ default_collect_action = (struct command_line *)
+ xmalloc (sizeof (struct command_line));
make_cleanup (xfree, default_collect_action);
default_collect_action->next = actions;
default_collect_action->line = default_collect_line;
@@ -3103,7 +3104,7 @@ encode_source_string (int tpnum, ULONGEST addr,
static void
trace_file_writer_xfree (void *arg)
{
- struct trace_file_writer *writer = arg;
+ struct trace_file_writer *writer = (struct trace_file_writer *) arg;
writer->ops->dtor (writer);
xfree (writer);
@@ -3671,7 +3672,7 @@ static struct trace_file_writer *
tfile_trace_file_writer_new (void)
{
struct tfile_trace_file_writer *writer
- = xmalloc (sizeof (struct tfile_trace_file_writer));
+ = (struct tfile_trace_file_writer *) xmalloc (sizeof (struct tfile_trace_file_writer));
writer->base.ops = &tfile_write_ops;
writer->fp = NULL;
@@ -3901,7 +3902,7 @@ struct current_traceframe_cleanup
static void
do_restore_current_traceframe_cleanup (void *arg)
{
- struct current_traceframe_cleanup *old = arg;
+ struct current_traceframe_cleanup *old = (struct current_traceframe_cleanup *) arg;
set_current_traceframe (old->traceframe_number);
}
@@ -3909,7 +3910,7 @@ do_restore_current_traceframe_cleanup (void *arg)
static void
restore_current_traceframe_cleanup_dtor (void *arg)
{
- struct current_traceframe_cleanup *old = arg;
+ struct current_traceframe_cleanup *old = (struct current_traceframe_cleanup *) arg;
xfree (old);
}
@@ -3919,7 +3920,7 @@ make_cleanup_restore_current_traceframe (void)
{
struct current_traceframe_cleanup *old;
- old = xmalloc (sizeof (struct current_traceframe_cleanup));
+ old = (struct current_traceframe_cleanup *) xmalloc (sizeof (struct current_traceframe_cleanup));
old->traceframe_number = traceframe_number;
return make_cleanup_dtor (do_restore_current_traceframe_cleanup, old,
@@ -4485,7 +4486,7 @@ Status line: '%s'\n"), p, line);
}
else if (p2 != p1)
{
- ts->stop_desc = xmalloc (strlen (line));
+ ts->stop_desc = (char *) xmalloc (strlen (line));
end = hex2bin (p1, (gdb_byte *) ts->stop_desc, (p2 - p1) / 2);
ts->stop_desc[end] = '\0';
}
@@ -4505,7 +4506,7 @@ Status line: '%s'\n"), p, line);
p2 = strchr (++p1, ':');
if (p2 != p1)
{
- ts->stop_desc = xmalloc ((p2 - p1) / 2 + 1);
+ ts->stop_desc = (char *) xmalloc ((p2 - p1) / 2 + 1);
end = hex2bin (p1, (gdb_byte *) ts->stop_desc, (p2 - p1) / 2);
ts->stop_desc[end] = '\0';
}
@@ -4559,7 +4560,7 @@ Status line: '%s'\n"), p, line);
else if (strncmp (p, "username", p1 - p) == 0)
{
++p1;
- ts->user_name = xmalloc (strlen (p) / 2);
+ ts->user_name = (char *) xmalloc (strlen (p) / 2);
end = hex2bin (p1, (gdb_byte *) ts->user_name, (p3 - p1) / 2);
ts->user_name[end] = '\0';
p = p3;
@@ -4567,7 +4568,7 @@ Status line: '%s'\n"), p, line);
else if (strncmp (p, "notes", p1 - p) == 0)
{
++p1;
- ts->notes = xmalloc (strlen (p) / 2);
+ ts->notes = (char *) xmalloc (strlen (p) / 2);
end = hex2bin (p1, (gdb_byte *) ts->notes, (p3 - p1) / 2);
ts->notes[end] = '\0';
p = p3;
@@ -4694,7 +4695,7 @@ parse_tracepoint_definition (char *line, struct uploaded_tp **utpp)
p = unpack_varlen_hex (p, &xlen);
p++; /* skip a colon */
- buf = alloca (strlen (line));
+ buf = (char *) alloca (strlen (line));
end = hex2bin (p, (gdb_byte *) buf, strlen (p) / 2);
buf[end] = '\0';
@@ -4731,7 +4732,7 @@ parse_tsv_definition (char *line, struct uploaded_tsv **utsvp)
int end;
struct uploaded_tsv *utsv = NULL;
- buf = alloca (strlen (line));
+ buf = (char *) alloca (strlen (line));
p = line;
p = unpack_varlen_hex (p, &num);
@@ -4934,7 +4935,7 @@ typedef int (*walk_blocks_callback_func) (char blocktype, void *data);
static int
match_blocktype (char blocktype, void *data)
{
- char *wantedp = data;
+ char *wantedp = (char *) data;
if (*wantedp == blocktype)
return 1;
@@ -5025,7 +5026,7 @@ tfile_fetch_registers (struct target_ops *ops,
if (!trace_regblock_size)
return;
- regs = alloca (trace_regblock_size);
+ regs = (gdb_byte *) alloca (trace_regblock_size);
if (traceframe_find_block_type ('R', 0) >= 0)
{
@@ -5251,7 +5252,7 @@ tfile_has_registers (struct target_ops *ops)
static int
build_traceframe_info (char blocktype, void *data)
{
- struct traceframe_info *info = data;
+ struct traceframe_info *info = (struct traceframe_info *) data;
switch (blocktype)
{
@@ -5337,7 +5338,7 @@ init_tfile_ops (void)
void
free_current_marker (void *arg)
{
- struct static_tracepoint_marker **marker_p = arg;
+ struct static_tracepoint_marker **marker_p = (struct static_tracepoint_marker **) arg;
if (*marker_p != NULL)
{
@@ -5372,14 +5373,14 @@ parse_static_tracepoint_marker_definition (char *line, char **pp,
if (endp == NULL)
error (_("bad marker definition: %s"), line);
- marker->str_id = xmalloc (endp - p + 1);
+ marker->str_id = (char *) xmalloc (endp - p + 1);
end = hex2bin (p, (gdb_byte *) marker->str_id, (endp - p + 1) / 2);
marker->str_id[end] = '\0';
p += 2 * end;
p++; /* skip a colon */
- marker->extra = xmalloc (strlen (p) + 1);
+ marker->extra = (char *) xmalloc (strlen (p) + 1);
end = hex2bin (p, (gdb_byte *) marker->extra, strlen (p) / 2);
marker->extra[end] = '\0';
@@ -5630,12 +5631,12 @@ traceframe_info_start_memory (struct gdb_xml_parser *parser,
const struct gdb_xml_element *element,
void *user_data, VEC(gdb_xml_value_s) *attributes)
{
- struct traceframe_info *info = user_data;
+ struct traceframe_info *info = (struct traceframe_info *) user_data;
struct mem_range *r = VEC_safe_push (mem_range_s, info->memory, NULL);
ULONGEST *start_p, *length_p;
- start_p = xml_find_attribute (attributes, "start")->value;
- length_p = xml_find_attribute (attributes, "length")->value;
+ start_p = (ULONGEST *) xml_find_attribute (attributes, "start")->value;
+ length_p = (ULONGEST *) xml_find_attribute (attributes, "length")->value;
r->start = *start_p;
r->length = *length_p;
@@ -5649,8 +5650,8 @@ traceframe_info_start_tvar (struct gdb_xml_parser *parser,
void *user_data,
VEC(gdb_xml_value_s) *attributes)
{
- struct traceframe_info *info = user_data;
- const char *id_attrib = xml_find_attribute (attributes, "id")->value;
+ struct traceframe_info *info = (struct traceframe_info *) user_data;
+ const char *id_attrib = (const char *) xml_find_attribute (attributes, "id")->value;
int id = gdb_xml_parse_ulongest (parser, id_attrib);
VEC_safe_push (int, info->tvars, id);
@@ -5661,7 +5662,7 @@ traceframe_info_start_tvar (struct gdb_xml_parser *parser,
static void
free_result (void *p)
{
- struct traceframe_info *result = p;
+ struct traceframe_info *result = (struct traceframe_info *) p;
free_traceframe_info (result);
}
--
1.8.3.1
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: C++-compat clean build
2013-10-01 11:25 C++-compat clean build Ondrej Oprala
2013-10-01 11:52 ` Ondrej Oprala
@ 2013-10-01 12:04 ` Mark Kettenis
2013-10-01 12:53 ` Agovic, Sanimir
2013-10-01 12:53 ` Jan Kratochvil
2 siblings, 1 reply; 11+ messages in thread
From: Mark Kettenis @ 2013-10-01 12:04 UTC (permalink / raw)
To: ooprala; +Cc: gdb-patches
> Date: Tue, 01 Oct 2013 13:25:34 +0200
> From: Ondrej Oprala <ooprala@redhat.com>
>
> Hi,
> this is the first of a few patches I intend to write to make gdb code
> compile cleanly with -Wc++-compat.
> The idea is to make separate patches for respective subdirs under gdb/,
> unless someone objects ofc.
>
> Thanks in advance for any advice/criticism.
Rejected. Introducing all these casts can't be right. They hide type
conversion issues and make the code unreadable.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: C++-compat clean build
2013-10-01 11:25 C++-compat clean build Ondrej Oprala
2013-10-01 11:52 ` Ondrej Oprala
2013-10-01 12:04 ` Mark Kettenis
@ 2013-10-01 12:53 ` Jan Kratochvil
2013-10-01 12:57 ` Ondrej Oprala
` (2 more replies)
2 siblings, 3 replies; 11+ messages in thread
From: Jan Kratochvil @ 2013-10-01 12:53 UTC (permalink / raw)
To: Ondrej Oprala; +Cc: 'gdb-patches@sourceware.org'
Hi Ondrej,
On Tue, 01 Oct 2013 13:25:34 +0200, Ondrej Oprala wrote:
> this is the first of a few patches I intend to write to make gdb
> code compile cleanly with -Wc++-compat.
> The idea is to make separate patches for respective subdirs under
> gdb/, unless someone objects ofc.
this is a too huge patch. It should import first archer/tromey/c++ which is
already separated into specific parts, that is each commit in that branch
should be a separate posted mail/patch. This could also state the gcc error
that occured, it is not always clear for review (such as the ptrace case).
According to gdb/CONTRIBUTE there should be written ChangeLog entries, that is
what will be written to gdb/ChangeLog (one writes them as plain text into the
mail, not directly patching the file gdb/ChangeLog, as the ChangeLog patch
would get immediately out of scope). Some requests for comments without
immediate check-in may got without ChangeLog entry, such as this preview
patch.
It is not a requirement but the preference is to post the patches inlined in
the mail text; just I am not sure Thunderbird will not corrupt it, your mail
body is format=flowed which would corrupt it, OTOH without format=flowed some
mailers wrap the patch to some fixed column. So maybe the attachment is the
least worst for Thunderbird.
> --- a/gdb/amd64-linux-nat.c
> +++ b/gdb/amd64-linux-nat.c
> @@ -172,7 +172,7 @@ amd64_linux_fetch_inferior_registers (struct target_ops *ops,
> {
> elf_gregset_t regs;
>
> - if (ptrace (PTRACE_GETREGS, tid, 0, (long) ®s) < 0)
> + if (ptrace ((enum __ptrace_request) PTRACE_GETREGS, tid, 0, (long) ®s) < 0)
> perror_with_name (_("Couldn't get registers"));
>
> amd64_supply_native_gregset (regcache, ®s, -1);
enum __ptrace_request it is on GNU/Linux but not on other platforms where GDB
is compilable. My guess is the right solution could be:
configure.ac:
-for gdb_arg1 in 'int' 'long'; do
+for gdb_arg1 in 'enum __ptrace_request' 'int' 'long'; do
> --- a/gdb/amd64-tdep.c
> +++ b/gdb/amd64-tdep.c
> @@ -762,12 +762,12 @@ amd64_push_arguments (struct regcache *regcache, int nargs,
> AMD64_XMM0_REGNUM + 4, AMD64_XMM0_REGNUM + 5,
> AMD64_XMM0_REGNUM + 6, AMD64_XMM0_REGNUM + 7,
> };
> - struct value **stack_args = alloca (nargs * sizeof (struct value *));
> + struct value **stack_args = (struct value **) alloca (nargs * sizeof (struct value *));
Here the line got longer than 80 columns, this is forbidden by GCS:
https://sourceware.org/gdb/wiki/Internals%20GDB-C-Coding-Standards
It is not always clear what is best in such case, it may be in some cases for
example better to move the initialization from the declaration:
struct value **stack_args;
stack_args = (struct value **) alloca (nargs * sizeof (struct value *));
Sorry for not reviewing the rest of your patch now, it should be split anyway.
Thanks,
Jan
^ permalink raw reply [flat|nested] 11+ messages in thread
* RE: C++-compat clean build
2013-10-01 12:04 ` Mark Kettenis
@ 2013-10-01 12:53 ` Agovic, Sanimir
2013-10-01 14:16 ` Pedro Alves
0 siblings, 1 reply; 11+ messages in thread
From: Agovic, Sanimir @ 2013-10-01 12:53 UTC (permalink / raw)
To: 'Mark Kettenis', ooprala; +Cc: gdb-patches
Thanks Ondrej for taking the initiative!
> -----Original Message-----
> From: gdb-patches-owner@sourceware.org [mailto:gdb-patches-owner@sourceware.org] On Behalf
> Of Mark Kettenis
> Sent: Tuesday, October 01, 2013 02:04 PM
> To: ooprala@redhat.com
> Cc: gdb-patches@sourceware.org
> Subject: Re: C++-compat clean build
>
> Rejected. Introducing all these casts can't be right. They hide type
> conversion issues and make the code unreadable.
>
Afaik, some casts are required to some extend as C++ does no implicit from/to void *
conversion. But in general I agree about using casts too vast.
@@ -1598,7 +1598,7 @@ amd64_relocate_instruction (struct gdbarch *gdbarch,
int len = gdbarch_max_insn_length (gdbarch);
/* Extra space for sentinels. */
int fixup_sentinel_space = len;
- gdb_byte *buf = xmalloc (len + fixup_sentinel_space);
+ gdb_byte *buf = (gdb_byte *) xmalloc (len + fixup_sentinel_space);
This looks OK to me and could be replaced with a type save new[] once C++ is used.
@@ -1178,7 +1178,7 @@ amd64_linux_syscall_record (struct regcache *regcache)
{
int ret;
ULONGEST syscall_native;
- enum gdb_syscall syscall_gdb = -1;
+ enum gdb_syscall syscall_gdb = (enum gdb_syscall) -1;
... whereas this looks wrong to me in both cases before/after. Here we should
add something like SYSCALL_INVALID/UNKNOWN to enum gdb_syscall.
Thanks again for your efforts Ondrej.
-Sanimir
> -----Original Message-----
> From: gdb-patches-owner@sourceware.org [mailto:gdb-patches-owner@sourceware.org] On Behalf
> Of Mark Kettenis
> Sent: Tuesday, October 01, 2013 02:04 PM
> To: ooprala@redhat.com
> Cc: gdb-patches@sourceware.org
> Subject: Re: C++-compat clean build
>
> > Date: Tue, 01 Oct 2013 13:25:34 +0200
> > From: Ondrej Oprala <ooprala@redhat.com>
> >
> > Hi,
> > this is the first of a few patches I intend to write to make gdb code
> > compile cleanly with -Wc++-compat.
> > The idea is to make separate patches for respective subdirs under gdb/,
> > unless someone objects ofc.
> >
> > Thanks in advance for any advice/criticism.
>
> Rejected. Introducing all these casts can't be right. They hide type
> conversion issues and make the code unreadable.
Intel GmbH
Dornacher Strasse 1
85622 Feldkirchen/Muenchen, Deutschland
Sitz der Gesellschaft: Feldkirchen bei Muenchen
Geschaeftsfuehrer: Christian Lamprechter, Hannes Schwaderer, Douglas Lusk
Registergericht: Muenchen HRB 47456
Ust.-IdNr./VAT Registration No.: DE129385895
Citibank Frankfurt a.M. (BLZ 502 109 00) 600119052
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: C++-compat clean build
2013-10-01 12:53 ` Jan Kratochvil
@ 2013-10-01 12:57 ` Ondrej Oprala
2013-10-01 13:06 ` Tedeschi, Walfred
2013-10-01 13:57 ` Pedro Alves
2013-10-03 20:39 ` Tom Tromey
2 siblings, 1 reply; 11+ messages in thread
From: Ondrej Oprala @ 2013-10-01 12:57 UTC (permalink / raw)
To: Jan Kratochvil; +Cc: 'gdb-patches@sourceware.org', sanimir.agovic
On 10/01/2013 02:53 PM, Jan Kratochvil wrote:
> Hi Ondrej,
>
> On Tue, 01 Oct 2013 13:25:34 +0200, Ondrej Oprala wrote:
>> this is the first of a few patches I intend to write to make gdb
>> code compile cleanly with -Wc++-compat.
>> The idea is to make separate patches for respective subdirs under
>> gdb/, unless someone objects ofc.
> this is a too huge patch. It should import first archer/tromey/c++ which is
> already separated into specific parts, that is each commit in that branch
> should be a separate posted mail/patch. This could also state the gcc error
> that occured, it is not always clear for review (such as the ptrace case).
>
> According to gdb/CONTRIBUTE there should be written ChangeLog entries, that is
> what will be written to gdb/ChangeLog (one writes them as plain text into the
> mail, not directly patching the file gdb/ChangeLog, as the ChangeLog patch
> would get immediately out of scope). Some requests for comments without
> immediate check-in may got without ChangeLog entry, such as this preview
> patch.
>
> It is not a requirement but the preference is to post the patches inlined in
> the mail text; just I am not sure Thunderbird will not corrupt it, your mail
> body is format=flowed which would corrupt it, OTOH without format=flowed some
> mailers wrap the patch to some fixed column. So maybe the attachment is the
> least worst for Thunderbird.
>
>
>> --- a/gdb/amd64-linux-nat.c
>> +++ b/gdb/amd64-linux-nat.c
>> @@ -172,7 +172,7 @@ amd64_linux_fetch_inferior_registers (struct target_ops *ops,
>> {
>> elf_gregset_t regs;
>>
>> - if (ptrace (PTRACE_GETREGS, tid, 0, (long) ®s) < 0)
>> + if (ptrace ((enum __ptrace_request) PTRACE_GETREGS, tid, 0, (long) ®s) < 0)
>> perror_with_name (_("Couldn't get registers"));
>>
>> amd64_supply_native_gregset (regcache, ®s, -1);
> enum __ptrace_request it is on GNU/Linux but not on other platforms where GDB
> is compilable. My guess is the right solution could be:
>
> configure.ac:
> -for gdb_arg1 in 'int' 'long'; do
> +for gdb_arg1 in 'enum __ptrace_request' 'int' 'long'; do
>
>
>> --- a/gdb/amd64-tdep.c
>> +++ b/gdb/amd64-tdep.c
>> @@ -762,12 +762,12 @@ amd64_push_arguments (struct regcache *regcache, int nargs,
>> AMD64_XMM0_REGNUM + 4, AMD64_XMM0_REGNUM + 5,
>> AMD64_XMM0_REGNUM + 6, AMD64_XMM0_REGNUM + 7,
>> };
>> - struct value **stack_args = alloca (nargs * sizeof (struct value *));
>> + struct value **stack_args = (struct value **) alloca (nargs * sizeof (struct value *));
> Here the line got longer than 80 columns, this is forbidden by GCS:
> https://sourceware.org/gdb/wiki/Internals%20GDB-C-Coding-Standards
>
> It is not always clear what is best in such case, it may be in some cases for
> example better to move the initialization from the declaration:
>
> struct value **stack_args;
>
> stack_args = (struct value **) alloca (nargs * sizeof (struct value *));
>
>
> Sorry for not reviewing the rest of your patch now, it should be split anyway.
>
>
> Thanks,
> Jan
Thank you for your detailed patch reviews,
I'll address the issues.
Thanks,
Ondrej
^ permalink raw reply [flat|nested] 11+ messages in thread
* RE: C++-compat clean build
2013-10-01 12:57 ` Ondrej Oprala
@ 2013-10-01 13:06 ` Tedeschi, Walfred
0 siblings, 0 replies; 11+ messages in thread
From: Tedeschi, Walfred @ 2013-10-01 13:06 UTC (permalink / raw)
To: Ondrej Oprala, Jan Kratochvil
Cc: 'gdb-patches@sourceware.org', Agovic, Sanimir
Ondrej,
I have also seem many GNU style violations in your patch like "=" followed by two spaces.
Parameters not having the right indentation on the next line and so on...
Some of them are here, just in case:
On line 606 it seems that style is off.
Line 734 seems to be too long.
On line 791 you removed a line that does not belong to this patch.
In many places you have equals followed by two spaces please change for only one, e.g. lines 952 961 970 too many spaces after equal, please verify other places.
Same as before: 1007 1008 1017 1035 1200...1210.
Line 1104 equal is on the next line.
Ax-general.c on the hunk -96,8 -> spaces and tabs are wrong and 460,8 parameters indentation.
On i386-tdep.c hunk 7799 parameters are off.
Too long lines more than 80 chars on the hunk linux-nat.c
Remote.c hunks: -587, 8 parameters are off.
Best regards,
-Fred
-----Original Message-----
From: gdb-patches-owner@sourceware.org [mailto:gdb-patches-owner@sourceware.org] On Behalf Of Ondrej Oprala
Sent: Tuesday, October 01, 2013 2:57 PM
To: Jan Kratochvil
Cc: 'gdb-patches@sourceware.org'; Agovic, Sanimir
Subject: Re: C++-compat clean build
On 10/01/2013 02:53 PM, Jan Kratochvil wrote:
> Hi Ondrej,
>
> On Tue, 01 Oct 2013 13:25:34 +0200, Ondrej Oprala wrote:
>> this is the first of a few patches I intend to write to make gdb code
>> compile cleanly with -Wc++-compat.
>> The idea is to make separate patches for respective subdirs under
>> gdb/, unless someone objects ofc.
> this is a too huge patch. It should import first archer/tromey/c++
> which is already separated into specific parts, that is each commit in
> that branch should be a separate posted mail/patch. This could also
> state the gcc error that occured, it is not always clear for review (such as the ptrace case).
>
> According to gdb/CONTRIBUTE there should be written ChangeLog entries,
> that is what will be written to gdb/ChangeLog (one writes them as
> plain text into the mail, not directly patching the file
> gdb/ChangeLog, as the ChangeLog patch would get immediately out of
> scope). Some requests for comments without immediate check-in may got
> without ChangeLog entry, such as this preview patch.
>
> It is not a requirement but the preference is to post the patches
> inlined in the mail text; just I am not sure Thunderbird will not
> corrupt it, your mail body is format=flowed which would corrupt it,
> OTOH without format=flowed some mailers wrap the patch to some fixed
> column. So maybe the attachment is the least worst for Thunderbird.
>
>
>> --- a/gdb/amd64-linux-nat.c
>> +++ b/gdb/amd64-linux-nat.c
>> @@ -172,7 +172,7 @@ amd64_linux_fetch_inferior_registers (struct target_ops *ops,
>> {
>> elf_gregset_t regs;
>>
>> - if (ptrace (PTRACE_GETREGS, tid, 0, (long) ®s) < 0)
>> + if (ptrace ((enum __ptrace_request) PTRACE_GETREGS, tid, 0,
>> + (long) ®s) < 0)
>> perror_with_name (_("Couldn't get registers"));
>>
>> amd64_supply_native_gregset (regcache, ®s, -1);
> enum __ptrace_request it is on GNU/Linux but not on other platforms
> where GDB is compilable. My guess is the right solution could be:
>
> configure.ac:
> -for gdb_arg1 in 'int' 'long'; do
> +for gdb_arg1 in 'enum __ptrace_request' 'int' 'long'; do
>
>
>> --- a/gdb/amd64-tdep.c
>> +++ b/gdb/amd64-tdep.c
>> @@ -762,12 +762,12 @@ amd64_push_arguments (struct regcache *regcache, int nargs,
>> AMD64_XMM0_REGNUM + 4, AMD64_XMM0_REGNUM + 5,
>> AMD64_XMM0_REGNUM + 6, AMD64_XMM0_REGNUM + 7,
>> };
>> - struct value **stack_args = alloca (nargs * sizeof (struct value
>> *));
>> + struct value **stack_args = (struct value **) alloca (nargs *
>> + sizeof (struct value *));
> Here the line got longer than 80 columns, this is forbidden by GCS:
> https://sourceware.org/gdb/wiki/Internals%20GDB-C-Coding-Standards
>
> It is not always clear what is best in such case, it may be in some
> cases for example better to move the initialization from the declaration:
>
> struct value **stack_args;
>
> stack_args = (struct value **) alloca (nargs * sizeof (struct value
> *));
>
>
> Sorry for not reviewing the rest of your patch now, it should be split anyway.
>
>
> Thanks,
> Jan
Thank you for your detailed patch reviews, I'll address the issues.
Thanks,
Ondrej
Intel GmbH
Dornacher Strasse 1
85622 Feldkirchen/Muenchen, Deutschland
Sitz der Gesellschaft: Feldkirchen bei Muenchen
Geschaeftsfuehrer: Christian Lamprechter, Hannes Schwaderer, Douglas Lusk
Registergericht: Muenchen HRB 47456
Ust.-IdNr./VAT Registration No.: DE129385895
Citibank Frankfurt a.M. (BLZ 502 109 00) 600119052
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: C++-compat clean build
2013-10-01 12:53 ` Jan Kratochvil
2013-10-01 12:57 ` Ondrej Oprala
@ 2013-10-01 13:57 ` Pedro Alves
2013-10-03 20:39 ` Tom Tromey
2 siblings, 0 replies; 11+ messages in thread
From: Pedro Alves @ 2013-10-01 13:57 UTC (permalink / raw)
To: Jan Kratochvil; +Cc: Ondrej Oprala, 'gdb-patches@sourceware.org'
On 10/01/2013 01:53 PM, Jan Kratochvil wrote:
> Hi Ondrej,
>
> On Tue, 01 Oct 2013 13:25:34 +0200, Ondrej Oprala wrote:
>> this is the first of a few patches I intend to write to make gdb
>> code compile cleanly with -Wc++-compat.
>> The idea is to make separate patches for respective subdirs under
>> gdb/, unless someone objects ofc.
>
> this is a too huge patch. It should import first archer/tromey/c++ which is
> already separated into specific parts, that is each commit in that branch
> should be a separate posted mail/patch. This could also state the gcc error
> that occured, it is not always clear for review (such as the ptrace case).
>
> According to gdb/CONTRIBUTE there should be written ChangeLog entries, that is
> what will be written to gdb/ChangeLog (one writes them as plain text into the
> mail, not directly patching the file gdb/ChangeLog, as the ChangeLog patch
> would get immediately out of scope). Some requests for comments without
> immediate check-in may got without ChangeLog entry, such as this preview
> patch.
See also <https://sourceware.org/gdb/wiki/ContributionChecklist>,
which talks about that and more.
>
> It is not a requirement but the preference is to post the patches inlined in
> the mail text; just I am not sure Thunderbird will not corrupt it, your mail
> body is format=flowed which would corrupt it, OTOH without format=flowed some
> mailers wrap the patch to some fixed column. So maybe the attachment is the
> least worst for Thunderbird.
At <https://sourceware.org/gdb/wiki/ContributionChecklist#Submitting_patches>
you'll find a link to mozilla's own knowledge base explaining how to configure
Thunderbird for sending patches.
--
Pedro Alves
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: C++-compat clean build
2013-10-01 12:53 ` Agovic, Sanimir
@ 2013-10-01 14:16 ` Pedro Alves
2013-10-01 16:34 ` Joel Brobecker
0 siblings, 1 reply; 11+ messages in thread
From: Pedro Alves @ 2013-10-01 14:16 UTC (permalink / raw)
To: Agovic, Sanimir; +Cc: 'Mark Kettenis', ooprala, gdb-patches
On 10/01/2013 01:53 PM, Agovic, Sanimir wrote:
> Thanks Ondrej for taking the initiative!
>
>
>> -----Original Message-----
>> From: gdb-patches-owner@sourceware.org [mailto:gdb-patches-owner@sourceware.org] On Behalf
>> Of Mark Kettenis
>> Sent: Tuesday, October 01, 2013 02:04 PM
>> To: ooprala@redhat.com
>> Cc: gdb-patches@sourceware.org
>> Subject: Re: C++-compat clean build
>>
>> Rejected. Introducing all these casts can't be right. They hide type
>> conversion issues and make the code unreadable.
>>
> Afaik, some casts are required to some extend as C++ does no implicit from/to void *
> conversion. But in general I agree about using casts too vast.
>
> @@ -1598,7 +1598,7 @@ amd64_relocate_instruction (struct gdbarch *gdbarch,
> int len = gdbarch_max_insn_length (gdbarch);
> /* Extra space for sentinels. */
> int fixup_sentinel_space = len;
> - gdb_byte *buf = xmalloc (len + fixup_sentinel_space);
> + gdb_byte *buf = (gdb_byte *) xmalloc (len + fixup_sentinel_space);
> This looks OK to me and could be replaced with a type save new[] once C++ is used.
libiberty gives us a series of macros that kind of mirror
c++ new/new[] (minus the constructors, of course):
libiberty.h:#define XALLOCA(T) ((T *) alloca (sizeof (T)))
...
libiberty.h:#define XNEW(T) ((T *) xmalloc (sizeof (T)))
libiberty.h:#define XCNEW(T) ((T *) xcalloc (1, sizeof (T)))
libiberty.h:#define XNEWVEC(T, N) ((T *) xmalloc (sizeof (T) * (N)))
libiberty.h:#define XCNEWVEC(T, N) ((T *) xcalloc ((N), sizeof (T)))
libiberty.h:#define XNEWVAR(T, S) ((T *) xmalloc ((S)))
libiberty.h:#define XCNEWVAR(T, S) ((T *) xcalloc (1, (S)))
...
etc.
so this case could be written as:
gdb_byte *buf = XNEWVAR (gdb_byte, len + fixup_sentinel_space);
This:
struct foo *f = (struct foo *) xmalloc (sizeof (struct foo));
Can be written as:
struct foo *f = XNEW (struct foo);
There are variants for alloca as well.
We have several uses of these macros already in the tree.
They seem to have the advantage that they hide the casts and perhaps
make the intention of the code clearer while we can't use new/new[].
E.g., XNEW prevents errors of the type:
struct foo *f = (struct foo *) xmalloc (sizeof (f));
We already use these macros in gdb in several places.
Not sure what people feel about using them more?
--
Pedro Alves
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: C++-compat clean build
2013-10-01 14:16 ` Pedro Alves
@ 2013-10-01 16:34 ` Joel Brobecker
0 siblings, 0 replies; 11+ messages in thread
From: Joel Brobecker @ 2013-10-01 16:34 UTC (permalink / raw)
To: Pedro Alves
Cc: Agovic, Sanimir, 'Mark Kettenis', ooprala, gdb-patches
> We have several uses of these macros already in the tree.
> They seem to have the advantage that they hide the casts and perhaps
> make the intention of the code clearer while we can't use new/new[].
> E.g., XNEW prevents errors of the type:
>
> struct foo *f = (struct foo *) xmalloc (sizeof (f));
>
> We already use these macros in gdb in several places.
> Not sure what people feel about using them more?
FWIW, I have no real strong opinion. If the casts become necessary,
and they allow us to hide them, I think they indeed would be useful.
--
Joel
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: C++-compat clean build
2013-10-01 12:53 ` Jan Kratochvil
2013-10-01 12:57 ` Ondrej Oprala
2013-10-01 13:57 ` Pedro Alves
@ 2013-10-03 20:39 ` Tom Tromey
2 siblings, 0 replies; 11+ messages in thread
From: Tom Tromey @ 2013-10-03 20:39 UTC (permalink / raw)
To: Jan Kratochvil; +Cc: Ondrej Oprala, 'gdb-patches@sourceware.org'
>>>>> "Jan" == Jan Kratochvil <jan.kratochvil@redhat.com> writes:
Jan> It is not a requirement but the preference is to post the patches
Jan> inlined in the mail text; just I am not sure Thunderbird will not
Jan> corrupt it, your mail body is format=flowed which would corrupt it,
Jan> OTOH without format=flowed some mailers wrap the patch to some
Jan> fixed column. So maybe the attachment is the least worst for
Jan> Thunderbird.
These days what I do is write the email and ChangeLog entry into the git
commit message; then use git send-email to send the whole series. This
requires minimal configuration and in particular doesn't need MUA
tweaking.
Then when the time comes to apply, I use git cvsexportcommit, and edit
in the ChangeLog entries by hand. This step is a pain.
Finally, I've taken the lead from Pedro and Joel and use the .msg file
that cvsexportcommit leaves as the commit text.
I've tried a number of workflows over the years. I find that this one
has the least amount of make-work; but naturally YMMV.
Tom
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2013-10-03 20:39 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-10-01 11:25 C++-compat clean build Ondrej Oprala
2013-10-01 11:52 ` Ondrej Oprala
2013-10-01 12:04 ` Mark Kettenis
2013-10-01 12:53 ` Agovic, Sanimir
2013-10-01 14:16 ` Pedro Alves
2013-10-01 16:34 ` Joel Brobecker
2013-10-01 12:53 ` Jan Kratochvil
2013-10-01 12:57 ` Ondrej Oprala
2013-10-01 13:06 ` Tedeschi, Walfred
2013-10-01 13:57 ` Pedro Alves
2013-10-03 20:39 ` Tom Tromey
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).