Skip to content

Commit

Permalink
Suppress gcc 4.x -Wpointer-sign (included in -Wall) warnings
Browse files Browse the repository at this point in the history
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5275 c046a42c-6fe2-441c-8c8c-71466251a162
  • Loading branch information
blueswir1 committed Sep 20, 2008
1 parent 67d8cec commit b55266b
Show file tree
Hide file tree
Showing 25 changed files with 57 additions and 50 deletions.
2 changes: 1 addition & 1 deletion exec.c
Expand Up @@ -1418,7 +1418,7 @@ void cpu_set_log(int log_flags)
#if !defined(CONFIG_SOFTMMU)
/* must avoid mmap() usage of glibc by setting a buffer "by hand" */
{
static uint8_t logfile_buf[4096];
static char logfile_buf[4096];
setvbuf(logfile, logfile_buf, _IOLBF, sizeof(logfile_buf));
}
#else
Expand Down
2 changes: 1 addition & 1 deletion fpu/softfloat.c
Expand Up @@ -4987,7 +4987,7 @@ float128 float128_rem( float128 a, float128 b STATUS_PARAM )
sub128( aSig0, aSig1, bSig0, bSig1, &aSig0, &aSig1 );
} while ( 0 <= (sbits64) aSig0 );
add128(
aSig0, aSig1, alternateASig0, alternateASig1, &sigMean0, &sigMean1 );
aSig0, aSig1, alternateASig0, alternateASig1, (bits64 *)&sigMean0, &sigMean1 );
if ( ( sigMean0 < 0 )
|| ( ( ( sigMean0 | sigMean1 ) == 0 ) && ( q & 1 ) ) ) {
aSig0 = alternateASig0;
Expand Down
3 changes: 2 additions & 1 deletion hw/mips_malta.c
Expand Up @@ -701,7 +701,8 @@ static int64_t load_kernel (CPUState *env)
ram_addr_t initrd_offset;

if (load_elf(loaderparams.kernel_filename, VIRT_TO_PHYS_ADDEND,
&kernel_entry, &kernel_low, &kernel_high) < 0) {
(uint64_t *)&kernel_entry, (uint64_t *)&kernel_low,
(uint64_t *)&kernel_high) < 0) {
fprintf(stderr, "qemu: could not load kernel '%s'\n",
loaderparams.kernel_filename);
exit(1);
Expand Down
3 changes: 2 additions & 1 deletion hw/mips_mipssim.c
Expand Up @@ -61,7 +61,8 @@ static void load_kernel (CPUState *env)
ram_addr_t initrd_offset;

kernel_size = load_elf(loaderparams.kernel_filename, VIRT_TO_PHYS_ADDEND,
&entry, &kernel_low, &kernel_high);
(uint64_t *)&entry, (uint64_t *)&kernel_low,
(uint64_t *)&kernel_high);
if (kernel_size >= 0) {
if ((entry & ~0x7fffffffULL) == 0x80000000)
entry = (int32_t)entry;
Expand Down
9 changes: 5 additions & 4 deletions hw/mips_r4k.c
Expand Up @@ -83,7 +83,8 @@ static void load_kernel (CPUState *env)
ram_addr_t initrd_offset;

kernel_size = load_elf(loaderparams.kernel_filename, VIRT_TO_PHYS_ADDEND,
&entry, &kernel_low, &kernel_high);
(uint64_t *)&entry, (uint64_t *)&kernel_low,
(uint64_t *)&kernel_high);
if (kernel_size >= 0) {
if ((entry & ~0x7fffffffULL) == 0x80000000)
entry = (int32_t)entry;
Expand Down Expand Up @@ -120,15 +121,15 @@ static void load_kernel (CPUState *env)
/* Store command line. */
if (initrd_size > 0) {
int ret;
ret = sprintf(phys_ram_base + (16 << 20) - 256,
ret = sprintf((char *)(phys_ram_base + (16 << 20) - 256),
"rd_start=0x" TARGET_FMT_lx " rd_size=%li ",
PHYS_TO_VIRT((uint32_t)initrd_offset),
initrd_size);
strcpy (phys_ram_base + (16 << 20) - 256 + ret,
strcpy ((char *)(phys_ram_base + (16 << 20) - 256 + ret),
loaderparams.kernel_cmdline);
}
else {
strcpy (phys_ram_base + (16 << 20) - 256,
strcpy ((char *)(phys_ram_base + (16 << 20) - 256),
loaderparams.kernel_cmdline);
}

Expand Down
4 changes: 2 additions & 2 deletions hw/nvram.h
Expand Up @@ -17,12 +17,12 @@ uint16_t NVRAM_get_word (nvram_t *nvram, uint32_t addr);
void NVRAM_set_lword (nvram_t *nvram, uint32_t addr, uint32_t value);
uint32_t NVRAM_get_lword (nvram_t *nvram, uint32_t addr);
void NVRAM_set_string (nvram_t *nvram, uint32_t addr,
const unsigned char *str, uint32_t max);
const char *str, uint32_t max);
int NVRAM_get_string (nvram_t *nvram, uint8_t *dst, uint16_t addr, int max);
void NVRAM_set_crc (nvram_t *nvram, uint32_t addr,
uint32_t start, uint32_t count);
int PPC_NVRAM_set_params (nvram_t *nvram, uint16_t NVRAM_size,
const unsigned char *arch,
const char *arch,
uint32_t RAM_size, int boot_device,
uint32_t kernel_image, uint32_t kernel_size,
const char *cmdline,
Expand Down
2 changes: 1 addition & 1 deletion hw/pl080.c
Expand Up @@ -80,7 +80,7 @@ static void pl080_run(pl080_state *s)
int src_id;
int dest_id;
int size;
char buff[4];
uint8_t buff[4];
uint32_t req;

s->tc_mask = 0;
Expand Down
6 changes: 3 additions & 3 deletions hw/ppc.c
Expand Up @@ -1305,7 +1305,7 @@ uint32_t NVRAM_get_lword (nvram_t *nvram, uint32_t addr)
}

void NVRAM_set_string (nvram_t *nvram, uint32_t addr,
const unsigned char *str, uint32_t max)
const char *str, uint32_t max)
{
int i;

Expand Down Expand Up @@ -1366,7 +1366,7 @@ uint16_t NVRAM_compute_crc (nvram_t *nvram, uint32_t start, uint32_t count)
#define CMDLINE_ADDR 0x017ff000

int PPC_NVRAM_set_params (nvram_t *nvram, uint16_t NVRAM_size,
const unsigned char *arch,
const char *arch,
uint32_t RAM_size, int boot_device,
uint32_t kernel_image, uint32_t kernel_size,
const char *cmdline,
Expand All @@ -1387,7 +1387,7 @@ int PPC_NVRAM_set_params (nvram_t *nvram, uint16_t NVRAM_size,
NVRAM_set_lword(nvram, 0x3C, kernel_size);
if (cmdline) {
/* XXX: put the cmdline in NVRAM too ? */
strcpy(phys_ram_base + CMDLINE_ADDR, cmdline);
strcpy((char *)(phys_ram_base + CMDLINE_ADDR), cmdline);
NVRAM_set_lword(nvram, 0x40, CMDLINE_ADDR);
NVRAM_set_lword(nvram, 0x44, strlen(cmdline));
} else {
Expand Down
2 changes: 1 addition & 1 deletion hw/ppc4xx.h
Expand Up @@ -26,7 +26,7 @@
#define PPC_4XX_H

/* PowerPC 4xx core initialization */
CPUState *ppc4xx_init (const unsigned char *cpu_model,
CPUState *ppc4xx_init (const char *cpu_model,
clk_setup_t *cpu_clk, clk_setup_t *tb_clk,
uint32_t sysclk);

Expand Down
2 changes: 1 addition & 1 deletion hw/ppc4xx_devs.c
Expand Up @@ -35,7 +35,7 @@ extern FILE *logfile;

/*****************************************************************************/
/* Generic PowerPC 4xx processor instanciation */
CPUState *ppc4xx_init (const unsigned char *cpu_model,
CPUState *ppc4xx_init (const char *cpu_model,
clk_setup_t *cpu_clk, clk_setup_t *tb_clk,
uint32_t sysclk)
{
Expand Down
2 changes: 1 addition & 1 deletion hw/pxa2xx_dma.c
Expand Up @@ -177,7 +177,7 @@ static void pxa2xx_dma_run(struct pxa2xx_dma_state_s *s)
uint32_t n, size;
uint32_t width;
uint32_t length;
char buffer[32];
uint8_t buffer[32];
struct pxa2xx_dma_channel_s *ch;

if (s->running ++)
Expand Down
4 changes: 2 additions & 2 deletions hw/usb-net.c
Expand Up @@ -681,8 +681,8 @@ static int ndis_query(USBNetState *s, uint32_t oid,

/* mandatory */
case OID_GEN_VENDOR_DESCRIPTION:
pstrcpy(outbuf, outlen, "QEMU USB RNDIS Net");
return strlen(outbuf) + 1;
pstrcpy((char *)outbuf, outlen, "QEMU USB RNDIS Net");
return strlen((char *)outbuf) + 1;

case OID_GEN_VENDOR_DRIVER_VERSION:
*((le32 *) outbuf) = cpu_to_le32(1);
Expand Down
2 changes: 1 addition & 1 deletion linux-user/elfload.c
Expand Up @@ -1240,7 +1240,7 @@ int load_elf_binary(struct linux_binprm * bprm, struct target_pt_regs * regs,
}

if (interp_elf_ex.e_ident[0] != 0x7f ||
strncmp(&interp_elf_ex.e_ident[1], "ELF",3) != 0) {
strncmp((char *)&interp_elf_ex.e_ident[1], "ELF",3) != 0) {
interpreter_type &= ~INTERPRETER_ELF;
}

Expand Down
3 changes: 2 additions & 1 deletion linux-user/syscall.c
Expand Up @@ -947,7 +947,8 @@ static abi_long do_getsockopt(int sockfd, int level, int optname,
abi_ulong optval_addr, abi_ulong optlen)
{
abi_long ret;
int len, lv, val;
int len, val;
socklen_t lv;

switch(level) {
case TARGET_SOL_SOCKET:
Expand Down
2 changes: 1 addition & 1 deletion linux-user/uaccess.c
Expand Up @@ -62,7 +62,7 @@ abi_long target_strlen(abi_ulong guest_addr1)
ptr = lock_user(VERIFY_READ, guest_addr, max_len, 1);
if (!ptr)
return -TARGET_EFAULT;
len = qemu_strnlen(ptr, max_len);
len = qemu_strnlen((const char *)ptr, max_len);
unlock_user(ptr, guest_addr, 0);
guest_addr += len;
/* we don't allow wrapping or integer overflow */
Expand Down
3 changes: 2 additions & 1 deletion slirp/bootp.c
Expand Up @@ -172,7 +172,8 @@ static void bootp_reply(struct bootp_t *bp)
}

if (bootp_filename)
snprintf(rbp->bp_file, sizeof(rbp->bp_file), "%s", bootp_filename);
snprintf((char *)rbp->bp_file, sizeof(rbp->bp_file), "%s",
bootp_filename);

dprintf("offered addr=%08x\n", ntohl(daddr.sin_addr.s_addr));

Expand Down
4 changes: 2 additions & 2 deletions slirp/tcp_subr.c
Expand Up @@ -447,7 +447,7 @@ tcp_connect(inso)
{
struct socket *so;
struct sockaddr_in addr;
int addrlen = sizeof(struct sockaddr_in);
socklen_t addrlen = sizeof(struct sockaddr_in);
struct tcpcb *tp;
int s, opt;

Expand Down Expand Up @@ -649,7 +649,7 @@ tcp_emu(so, m)
{
struct socket *tmpso;
struct sockaddr_in addr;
int addrlen = sizeof(struct sockaddr_in);
socklen_t addrlen = sizeof(struct sockaddr_in);
struct sbuf *so_rcv = &so->so_rcv;

memcpy(so_rcv->sb_wptr, m->m_data, m->m_len);
Expand Down
16 changes: 9 additions & 7 deletions slirp/tftp.c
Expand Up @@ -149,8 +149,10 @@ static int tftp_send_oack(struct tftp_session *spt,
m->m_data += sizeof(struct udpiphdr);

tp->tp_op = htons(TFTP_OACK);
n += snprintf(tp->x.tp_buf + n, sizeof(tp->x.tp_buf) - n, "%s", key) + 1;
n += snprintf(tp->x.tp_buf + n, sizeof(tp->x.tp_buf) - n, "%u", value) + 1;
n += snprintf((char *)tp->x.tp_buf + n, sizeof(tp->x.tp_buf) - n, "%s",
key) + 1;
n += snprintf((char *)tp->x.tp_buf + n, sizeof(tp->x.tp_buf) - n, "%u",
value) + 1;

saddr.sin_addr = recv_tp->ip.ip_dst;
saddr.sin_port = recv_tp->udp.uh_dport;
Expand Down Expand Up @@ -190,7 +192,7 @@ static int tftp_send_error(struct tftp_session *spt,

tp->tp_op = htons(TFTP_ERROR);
tp->x.tp_error.tp_error_code = htons(errorcode);
pstrcpy(tp->x.tp_error.tp_msg, sizeof(tp->x.tp_error.tp_msg), msg);
pstrcpy((char *)tp->x.tp_error.tp_msg, sizeof(tp->x.tp_error.tp_msg), msg);

saddr.sin_addr = recv_tp->ip.ip_dst;
saddr.sin_port = recv_tp->udp.uh_dport;
Expand Down Expand Up @@ -325,8 +327,8 @@ static void tftp_handle_rrq(struct tftp_t *tp, int pktlen)
/* do sanity checks on the filename */

if ((spt->filename[0] != '/')
|| (spt->filename[strlen(spt->filename) - 1] == '/')
|| strstr(spt->filename, "/../")) {
|| (spt->filename[strlen((char *)spt->filename) - 1] == '/')
|| strstr((char *)spt->filename, "/../")) {
tftp_send_error(spt, 2, "Access violation", tp);
return;
}
Expand All @@ -353,15 +355,15 @@ static void tftp_handle_rrq(struct tftp_t *tp, int pktlen)
while (k < n) {
const char *key, *value;

key = src + k;
key = (char *)src + k;
k += strlen(key) + 1;

if (k >= n) {
tftp_send_error(spt, 2, "Access violation", tp);
return;
}

value = src + k;
value = (char *)src + k;
k += strlen(value) + 1;

if (strcmp(key, "tsize") == 0) {
Expand Down
2 changes: 1 addition & 1 deletion softmmu-semi.h
Expand Up @@ -37,7 +37,7 @@ static inline void softmmu_tput32(CPUState *env, uint32_t addr, uint32_t val)
static void *softmmu_lock_user(CPUState *env, uint32_t addr, uint32_t len,
int copy)
{
char *p;
uint8_t *p;
/* TODO: Make this something that isn't fixed size. */
p = malloc(len);
if (copy)
Expand Down
2 changes: 1 addition & 1 deletion target-alpha/helper.c
Expand Up @@ -411,7 +411,7 @@ void cpu_dump_state (CPUState *env, FILE *f,
int (*cpu_fprintf)(FILE *f, const char *fmt, ...),
int flags)
{
static const unsigned char *linux_reg_names[] = {
static const char *linux_reg_names[] = {
"v0 ", "t0 ", "t1 ", "t2 ", "t3 ", "t4 ", "t5 ", "t6 ",
"t7 ", "s0 ", "s1 ", "s2 ", "s3 ", "s4 ", "s5 ", "fp ",
"a0 ", "a1 ", "a2 ", "a3 ", "a4 ", "a5 ", "t8 ", "t9 ",
Expand Down
4 changes: 2 additions & 2 deletions target-ppc/cpu.h
Expand Up @@ -303,7 +303,7 @@ struct ppc_spr_t {
void (*hea_read)(void *opaque, int spr_num);
void (*hea_write)(void *opaque, int spr_num);
#endif
const unsigned char *name;
const char *name;
};

/* Altivec registers (128 bits) */
Expand Down Expand Up @@ -733,7 +733,7 @@ void cpu_ppc_reset (void *opaque);

void ppc_cpu_list (FILE *f, int (*cpu_fprintf)(FILE *f, const char *fmt, ...));

const ppc_def_t *cpu_ppc_find_by_name (const unsigned char *name);
const ppc_def_t *cpu_ppc_find_by_name (const char *name);
int cpu_ppc_register_internal (CPUPPCState *env, const ppc_def_t *def);

/* Time-base and decrementer management */
Expand Down
2 changes: 1 addition & 1 deletion target-ppc/op_helper.c
Expand Up @@ -244,7 +244,7 @@ void do_mulldo (void)
int64_t th;
uint64_t tl;

muls64(&tl, &th, T0, T1);
muls64(&tl, (uint64_t *)&th, T0, T1);
T0 = (int64_t)tl;
/* If th != 0 && th != -1, then we had an overflow */
if (likely((uint64_t)(th + 1) <= 1)) {
Expand Down
4 changes: 2 additions & 2 deletions target-ppc/translate.c
Expand Up @@ -220,7 +220,7 @@ struct opc_handler_t {
/* handler */
void (*handler)(DisasContext *ctx);
#if defined(DO_PPC_STATISTICS) || defined(PPC_DUMP_CPU)
const unsigned char *oname;
const char *oname;
#endif
#if defined(DO_PPC_STATISTICS)
uint64_t count;
Expand Down Expand Up @@ -347,7 +347,7 @@ typedef struct opcode_t {
unsigned char pad[1];
#endif
opc_handler_t handler;
const unsigned char *oname;
const char *oname;
} opcode_t;

/*****************************************************************************/
Expand Down
18 changes: 9 additions & 9 deletions target-ppc/translate_init.c
Expand Up @@ -34,7 +34,7 @@
#endif

struct ppc_def_t {
const unsigned char *name;
const char *name;
uint32_t pvr;
uint32_t svr;
uint64_t insns_flags;
Expand Down Expand Up @@ -433,13 +433,13 @@ do { \
_spr_register(env, num, name, uea_read, uea_write, initial_value); \
} while (0)
static inline void _spr_register (CPUPPCState *env, int num,
const unsigned char *name,
const char *name,
void (*uea_read)(void *opaque, int sprn),
void (*uea_write)(void *opaque, int sprn),
target_ulong initial_value)
#else
static inline void spr_register (CPUPPCState *env, int num,
const unsigned char *name,
const char *name,
void (*uea_read)(void *opaque, int sprn),
void (*uea_write)(void *opaque, int sprn),
void (*oea_read)(void *opaque, int sprn),
Expand Down Expand Up @@ -1245,7 +1245,7 @@ static void gen_spr_usprgh (CPUPPCState *env)
/* PowerPC BookE SPR */
static void gen_spr_BookE (CPUPPCState *env, uint64_t ivor_mask)
{
const unsigned char *ivor_names[64] = {
const char *ivor_names[64] = {
"IVOR0", "IVOR1", "IVOR2", "IVOR3",
"IVOR4", "IVOR5", "IVOR6", "IVOR7",
"IVOR8", "IVOR9", "IVOR10", "IVOR11",
Expand Down Expand Up @@ -1407,7 +1407,7 @@ static void gen_spr_BookE (CPUPPCState *env, uint64_t ivor_mask)
static void gen_spr_BookE_FSL (CPUPPCState *env, uint32_t mas_mask)
{
#if !defined(CONFIG_USER_ONLY)
const unsigned char *mas_names[8] = {
const char *mas_names[8] = {
"MAS0", "MAS1", "MAS2", "MAS3", "MAS4", "MAS5", "MAS6", "MAS7",
};
int mas_sprn[8] = {
Expand Down Expand Up @@ -9157,7 +9157,7 @@ static int create_ppc_opcodes (CPUPPCState *env, const ppc_def_t *def)
static void dump_ppc_insns (CPUPPCState *env)
{
opc_handler_t **table, *handler;
const unsigned char *p, *q;
const char *p, *q;
uint8_t opc1, opc2, opc3;

printf("Instructions set:\n");
Expand Down Expand Up @@ -9240,7 +9240,7 @@ int cpu_ppc_register_internal (CPUPPCState *env, const ppc_def_t *def)
init_ppc_proc(env, def);
#if defined(PPC_DUMP_CPU)
{
const unsigned char *mmu_model, *excp_model, *bus_model;
const char *mmu_model, *excp_model, *bus_model;
switch (env->mmu_model) {
case POWERPC_MMU_32B:
mmu_model = "PowerPC 32";
Expand Down Expand Up @@ -9443,10 +9443,10 @@ static const ppc_def_t *ppc_find_by_pvr (uint32_t pvr)

#include <ctype.h>

const ppc_def_t *cpu_ppc_find_by_name (const unsigned char *name)
const ppc_def_t *cpu_ppc_find_by_name (const char *name)
{
const ppc_def_t *ret;
const unsigned char *p;
const char *p;
int i, max, len;

/* Check if the given name is a PVR */
Expand Down

0 comments on commit b55266b

Please sign in to comment.