Commit b55266b5a235afe7b0aa946e2a6d49010f35e71c

Authored by blueswir1
1 parent 67d8cec3

Suppress gcc 4.x -Wpointer-sign (included in -Wall) warnings

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5275 c046a42c-6fe2-441c-8c8c-71466251a162
... ... @@ -1418,7 +1418,7 @@ void cpu_set_log(int log_flags)
1418 1418 #if !defined(CONFIG_SOFTMMU)
1419 1419 /* must avoid mmap() usage of glibc by setting a buffer "by hand" */
1420 1420 {
1421   - static uint8_t logfile_buf[4096];
  1421 + static char logfile_buf[4096];
1422 1422 setvbuf(logfile, logfile_buf, _IOLBF, sizeof(logfile_buf));
1423 1423 }
1424 1424 #else
... ...
fpu/softfloat.c
... ... @@ -4987,7 +4987,7 @@ float128 float128_rem( float128 a, float128 b STATUS_PARAM )
4987 4987 sub128( aSig0, aSig1, bSig0, bSig1, &aSig0, &aSig1 );
4988 4988 } while ( 0 <= (sbits64) aSig0 );
4989 4989 add128(
4990   - aSig0, aSig1, alternateASig0, alternateASig1, &sigMean0, &sigMean1 );
  4990 + aSig0, aSig1, alternateASig0, alternateASig1, (bits64 *)&sigMean0, &sigMean1 );
4991 4991 if ( ( sigMean0 < 0 )
4992 4992 || ( ( ( sigMean0 | sigMean1 ) == 0 ) && ( q & 1 ) ) ) {
4993 4993 aSig0 = alternateASig0;
... ...
hw/mips_malta.c
... ... @@ -701,7 +701,8 @@ static int64_t load_kernel (CPUState *env)
701 701 ram_addr_t initrd_offset;
702 702  
703 703 if (load_elf(loaderparams.kernel_filename, VIRT_TO_PHYS_ADDEND,
704   - &kernel_entry, &kernel_low, &kernel_high) < 0) {
  704 + (uint64_t *)&kernel_entry, (uint64_t *)&kernel_low,
  705 + (uint64_t *)&kernel_high) < 0) {
705 706 fprintf(stderr, "qemu: could not load kernel '%s'\n",
706 707 loaderparams.kernel_filename);
707 708 exit(1);
... ...
hw/mips_mipssim.c
... ... @@ -61,7 +61,8 @@ static void load_kernel (CPUState *env)
61 61 ram_addr_t initrd_offset;
62 62  
63 63 kernel_size = load_elf(loaderparams.kernel_filename, VIRT_TO_PHYS_ADDEND,
64   - &entry, &kernel_low, &kernel_high);
  64 + (uint64_t *)&entry, (uint64_t *)&kernel_low,
  65 + (uint64_t *)&kernel_high);
65 66 if (kernel_size >= 0) {
66 67 if ((entry & ~0x7fffffffULL) == 0x80000000)
67 68 entry = (int32_t)entry;
... ...
hw/mips_r4k.c
... ... @@ -83,7 +83,8 @@ static void load_kernel (CPUState *env)
83 83 ram_addr_t initrd_offset;
84 84  
85 85 kernel_size = load_elf(loaderparams.kernel_filename, VIRT_TO_PHYS_ADDEND,
86   - &entry, &kernel_low, &kernel_high);
  86 + (uint64_t *)&entry, (uint64_t *)&kernel_low,
  87 + (uint64_t *)&kernel_high);
87 88 if (kernel_size >= 0) {
88 89 if ((entry & ~0x7fffffffULL) == 0x80000000)
89 90 entry = (int32_t)entry;
... ... @@ -120,15 +121,15 @@ static void load_kernel (CPUState *env)
120 121 /* Store command line. */
121 122 if (initrd_size > 0) {
122 123 int ret;
123   - ret = sprintf(phys_ram_base + (16 << 20) - 256,
  124 + ret = sprintf((char *)(phys_ram_base + (16 << 20) - 256),
124 125 "rd_start=0x" TARGET_FMT_lx " rd_size=%li ",
125 126 PHYS_TO_VIRT((uint32_t)initrd_offset),
126 127 initrd_size);
127   - strcpy (phys_ram_base + (16 << 20) - 256 + ret,
  128 + strcpy ((char *)(phys_ram_base + (16 << 20) - 256 + ret),
128 129 loaderparams.kernel_cmdline);
129 130 }
130 131 else {
131   - strcpy (phys_ram_base + (16 << 20) - 256,
  132 + strcpy ((char *)(phys_ram_base + (16 << 20) - 256),
132 133 loaderparams.kernel_cmdline);
133 134 }
134 135  
... ...
hw/nvram.h
... ... @@ -17,12 +17,12 @@ uint16_t NVRAM_get_word (nvram_t *nvram, uint32_t addr);
17 17 void NVRAM_set_lword (nvram_t *nvram, uint32_t addr, uint32_t value);
18 18 uint32_t NVRAM_get_lword (nvram_t *nvram, uint32_t addr);
19 19 void NVRAM_set_string (nvram_t *nvram, uint32_t addr,
20   - const unsigned char *str, uint32_t max);
  20 + const char *str, uint32_t max);
21 21 int NVRAM_get_string (nvram_t *nvram, uint8_t *dst, uint16_t addr, int max);
22 22 void NVRAM_set_crc (nvram_t *nvram, uint32_t addr,
23 23 uint32_t start, uint32_t count);
24 24 int PPC_NVRAM_set_params (nvram_t *nvram, uint16_t NVRAM_size,
25   - const unsigned char *arch,
  25 + const char *arch,
26 26 uint32_t RAM_size, int boot_device,
27 27 uint32_t kernel_image, uint32_t kernel_size,
28 28 const char *cmdline,
... ...
hw/pl080.c
... ... @@ -80,7 +80,7 @@ static void pl080_run(pl080_state *s)
80 80 int src_id;
81 81 int dest_id;
82 82 int size;
83   - char buff[4];
  83 + uint8_t buff[4];
84 84 uint32_t req;
85 85  
86 86 s->tc_mask = 0;
... ...
hw/ppc.c
... ... @@ -1305,7 +1305,7 @@ uint32_t NVRAM_get_lword (nvram_t *nvram, uint32_t addr)
1305 1305 }
1306 1306  
1307 1307 void NVRAM_set_string (nvram_t *nvram, uint32_t addr,
1308   - const unsigned char *str, uint32_t max)
  1308 + const char *str, uint32_t max)
1309 1309 {
1310 1310 int i;
1311 1311  
... ... @@ -1366,7 +1366,7 @@ uint16_t NVRAM_compute_crc (nvram_t *nvram, uint32_t start, uint32_t count)
1366 1366 #define CMDLINE_ADDR 0x017ff000
1367 1367  
1368 1368 int PPC_NVRAM_set_params (nvram_t *nvram, uint16_t NVRAM_size,
1369   - const unsigned char *arch,
  1369 + const char *arch,
1370 1370 uint32_t RAM_size, int boot_device,
1371 1371 uint32_t kernel_image, uint32_t kernel_size,
1372 1372 const char *cmdline,
... ... @@ -1387,7 +1387,7 @@ int PPC_NVRAM_set_params (nvram_t *nvram, uint16_t NVRAM_size,
1387 1387 NVRAM_set_lword(nvram, 0x3C, kernel_size);
1388 1388 if (cmdline) {
1389 1389 /* XXX: put the cmdline in NVRAM too ? */
1390   - strcpy(phys_ram_base + CMDLINE_ADDR, cmdline);
  1390 + strcpy((char *)(phys_ram_base + CMDLINE_ADDR), cmdline);
1391 1391 NVRAM_set_lword(nvram, 0x40, CMDLINE_ADDR);
1392 1392 NVRAM_set_lword(nvram, 0x44, strlen(cmdline));
1393 1393 } else {
... ...
hw/ppc4xx.h
... ... @@ -26,7 +26,7 @@
26 26 #define PPC_4XX_H
27 27  
28 28 /* PowerPC 4xx core initialization */
29   -CPUState *ppc4xx_init (const unsigned char *cpu_model,
  29 +CPUState *ppc4xx_init (const char *cpu_model,
30 30 clk_setup_t *cpu_clk, clk_setup_t *tb_clk,
31 31 uint32_t sysclk);
32 32  
... ...
hw/ppc4xx_devs.c
... ... @@ -35,7 +35,7 @@ extern FILE *logfile;
35 35  
36 36 /*****************************************************************************/
37 37 /* Generic PowerPC 4xx processor instanciation */
38   -CPUState *ppc4xx_init (const unsigned char *cpu_model,
  38 +CPUState *ppc4xx_init (const char *cpu_model,
39 39 clk_setup_t *cpu_clk, clk_setup_t *tb_clk,
40 40 uint32_t sysclk)
41 41 {
... ...
hw/pxa2xx_dma.c
... ... @@ -177,7 +177,7 @@ static void pxa2xx_dma_run(struct pxa2xx_dma_state_s *s)
177 177 uint32_t n, size;
178 178 uint32_t width;
179 179 uint32_t length;
180   - char buffer[32];
  180 + uint8_t buffer[32];
181 181 struct pxa2xx_dma_channel_s *ch;
182 182  
183 183 if (s->running ++)
... ...
hw/usb-net.c
... ... @@ -681,8 +681,8 @@ static int ndis_query(USBNetState *s, uint32_t oid,
681 681  
682 682 /* mandatory */
683 683 case OID_GEN_VENDOR_DESCRIPTION:
684   - pstrcpy(outbuf, outlen, "QEMU USB RNDIS Net");
685   - return strlen(outbuf) + 1;
  684 + pstrcpy((char *)outbuf, outlen, "QEMU USB RNDIS Net");
  685 + return strlen((char *)outbuf) + 1;
686 686  
687 687 case OID_GEN_VENDOR_DRIVER_VERSION:
688 688 *((le32 *) outbuf) = cpu_to_le32(1);
... ...
linux-user/elfload.c
... ... @@ -1240,7 +1240,7 @@ int load_elf_binary(struct linux_binprm * bprm, struct target_pt_regs * regs,
1240 1240 }
1241 1241  
1242 1242 if (interp_elf_ex.e_ident[0] != 0x7f ||
1243   - strncmp(&interp_elf_ex.e_ident[1], "ELF",3) != 0) {
  1243 + strncmp((char *)&interp_elf_ex.e_ident[1], "ELF",3) != 0) {
1244 1244 interpreter_type &= ~INTERPRETER_ELF;
1245 1245 }
1246 1246  
... ...
linux-user/syscall.c
... ... @@ -947,7 +947,8 @@ static abi_long do_getsockopt(int sockfd, int level, int optname,
947 947 abi_ulong optval_addr, abi_ulong optlen)
948 948 {
949 949 abi_long ret;
950   - int len, lv, val;
  950 + int len, val;
  951 + socklen_t lv;
951 952  
952 953 switch(level) {
953 954 case TARGET_SOL_SOCKET:
... ...
linux-user/uaccess.c
... ... @@ -62,7 +62,7 @@ abi_long target_strlen(abi_ulong guest_addr1)
62 62 ptr = lock_user(VERIFY_READ, guest_addr, max_len, 1);
63 63 if (!ptr)
64 64 return -TARGET_EFAULT;
65   - len = qemu_strnlen(ptr, max_len);
  65 + len = qemu_strnlen((const char *)ptr, max_len);
66 66 unlock_user(ptr, guest_addr, 0);
67 67 guest_addr += len;
68 68 /* we don't allow wrapping or integer overflow */
... ...
slirp/bootp.c
... ... @@ -172,7 +172,8 @@ static void bootp_reply(struct bootp_t *bp)
172 172 }
173 173  
174 174 if (bootp_filename)
175   - snprintf(rbp->bp_file, sizeof(rbp->bp_file), "%s", bootp_filename);
  175 + snprintf((char *)rbp->bp_file, sizeof(rbp->bp_file), "%s",
  176 + bootp_filename);
176 177  
177 178 dprintf("offered addr=%08x\n", ntohl(daddr.sin_addr.s_addr));
178 179  
... ...
slirp/tcp_subr.c
... ... @@ -447,7 +447,7 @@ tcp_connect(inso)
447 447 {
448 448 struct socket *so;
449 449 struct sockaddr_in addr;
450   - int addrlen = sizeof(struct sockaddr_in);
  450 + socklen_t addrlen = sizeof(struct sockaddr_in);
451 451 struct tcpcb *tp;
452 452 int s, opt;
453 453  
... ... @@ -649,7 +649,7 @@ tcp_emu(so, m)
649 649 {
650 650 struct socket *tmpso;
651 651 struct sockaddr_in addr;
652   - int addrlen = sizeof(struct sockaddr_in);
  652 + socklen_t addrlen = sizeof(struct sockaddr_in);
653 653 struct sbuf *so_rcv = &so->so_rcv;
654 654  
655 655 memcpy(so_rcv->sb_wptr, m->m_data, m->m_len);
... ...
slirp/tftp.c
... ... @@ -149,8 +149,10 @@ static int tftp_send_oack(struct tftp_session *spt,
149 149 m->m_data += sizeof(struct udpiphdr);
150 150  
151 151 tp->tp_op = htons(TFTP_OACK);
152   - n += snprintf(tp->x.tp_buf + n, sizeof(tp->x.tp_buf) - n, "%s", key) + 1;
153   - n += snprintf(tp->x.tp_buf + n, sizeof(tp->x.tp_buf) - n, "%u", value) + 1;
  152 + n += snprintf((char *)tp->x.tp_buf + n, sizeof(tp->x.tp_buf) - n, "%s",
  153 + key) + 1;
  154 + n += snprintf((char *)tp->x.tp_buf + n, sizeof(tp->x.tp_buf) - n, "%u",
  155 + value) + 1;
154 156  
155 157 saddr.sin_addr = recv_tp->ip.ip_dst;
156 158 saddr.sin_port = recv_tp->udp.uh_dport;
... ... @@ -190,7 +192,7 @@ static int tftp_send_error(struct tftp_session *spt,
190 192  
191 193 tp->tp_op = htons(TFTP_ERROR);
192 194 tp->x.tp_error.tp_error_code = htons(errorcode);
193   - pstrcpy(tp->x.tp_error.tp_msg, sizeof(tp->x.tp_error.tp_msg), msg);
  195 + pstrcpy((char *)tp->x.tp_error.tp_msg, sizeof(tp->x.tp_error.tp_msg), msg);
194 196  
195 197 saddr.sin_addr = recv_tp->ip.ip_dst;
196 198 saddr.sin_port = recv_tp->udp.uh_dport;
... ... @@ -325,8 +327,8 @@ static void tftp_handle_rrq(struct tftp_t *tp, int pktlen)
325 327 /* do sanity checks on the filename */
326 328  
327 329 if ((spt->filename[0] != '/')
328   - || (spt->filename[strlen(spt->filename) - 1] == '/')
329   - || strstr(spt->filename, "/../")) {
  330 + || (spt->filename[strlen((char *)spt->filename) - 1] == '/')
  331 + || strstr((char *)spt->filename, "/../")) {
330 332 tftp_send_error(spt, 2, "Access violation", tp);
331 333 return;
332 334 }
... ... @@ -353,7 +355,7 @@ static void tftp_handle_rrq(struct tftp_t *tp, int pktlen)
353 355 while (k < n) {
354 356 const char *key, *value;
355 357  
356   - key = src + k;
  358 + key = (char *)src + k;
357 359 k += strlen(key) + 1;
358 360  
359 361 if (k >= n) {
... ... @@ -361,7 +363,7 @@ static void tftp_handle_rrq(struct tftp_t *tp, int pktlen)
361 363 return;
362 364 }
363 365  
364   - value = src + k;
  366 + value = (char *)src + k;
365 367 k += strlen(value) + 1;
366 368  
367 369 if (strcmp(key, "tsize") == 0) {
... ...
softmmu-semi.h
... ... @@ -37,7 +37,7 @@ static inline void softmmu_tput32(CPUState *env, uint32_t addr, uint32_t val)
37 37 static void *softmmu_lock_user(CPUState *env, uint32_t addr, uint32_t len,
38 38 int copy)
39 39 {
40   - char *p;
  40 + uint8_t *p;
41 41 /* TODO: Make this something that isn't fixed size. */
42 42 p = malloc(len);
43 43 if (copy)
... ...
target-alpha/helper.c
... ... @@ -411,7 +411,7 @@ void cpu_dump_state (CPUState *env, FILE *f,
411 411 int (*cpu_fprintf)(FILE *f, const char *fmt, ...),
412 412 int flags)
413 413 {
414   - static const unsigned char *linux_reg_names[] = {
  414 + static const char *linux_reg_names[] = {
415 415 "v0 ", "t0 ", "t1 ", "t2 ", "t3 ", "t4 ", "t5 ", "t6 ",
416 416 "t7 ", "s0 ", "s1 ", "s2 ", "s3 ", "s4 ", "s5 ", "fp ",
417 417 "a0 ", "a1 ", "a2 ", "a3 ", "a4 ", "a5 ", "t8 ", "t9 ",
... ...
target-ppc/cpu.h
... ... @@ -303,7 +303,7 @@ struct ppc_spr_t {
303 303 void (*hea_read)(void *opaque, int spr_num);
304 304 void (*hea_write)(void *opaque, int spr_num);
305 305 #endif
306   - const unsigned char *name;
  306 + const char *name;
307 307 };
308 308  
309 309 /* Altivec registers (128 bits) */
... ... @@ -733,7 +733,7 @@ void cpu_ppc_reset (void *opaque);
733 733  
734 734 void ppc_cpu_list (FILE *f, int (*cpu_fprintf)(FILE *f, const char *fmt, ...));
735 735  
736   -const ppc_def_t *cpu_ppc_find_by_name (const unsigned char *name);
  736 +const ppc_def_t *cpu_ppc_find_by_name (const char *name);
737 737 int cpu_ppc_register_internal (CPUPPCState *env, const ppc_def_t *def);
738 738  
739 739 /* Time-base and decrementer management */
... ...
target-ppc/op_helper.c
... ... @@ -244,7 +244,7 @@ void do_mulldo (void)
244 244 int64_t th;
245 245 uint64_t tl;
246 246  
247   - muls64(&tl, &th, T0, T1);
  247 + muls64(&tl, (uint64_t *)&th, T0, T1);
248 248 T0 = (int64_t)tl;
249 249 /* If th != 0 && th != -1, then we had an overflow */
250 250 if (likely((uint64_t)(th + 1) <= 1)) {
... ...
target-ppc/translate.c
... ... @@ -220,7 +220,7 @@ struct opc_handler_t {
220 220 /* handler */
221 221 void (*handler)(DisasContext *ctx);
222 222 #if defined(DO_PPC_STATISTICS) || defined(PPC_DUMP_CPU)
223   - const unsigned char *oname;
  223 + const char *oname;
224 224 #endif
225 225 #if defined(DO_PPC_STATISTICS)
226 226 uint64_t count;
... ... @@ -347,7 +347,7 @@ typedef struct opcode_t {
347 347 unsigned char pad[1];
348 348 #endif
349 349 opc_handler_t handler;
350   - const unsigned char *oname;
  350 + const char *oname;
351 351 } opcode_t;
352 352  
353 353 /*****************************************************************************/
... ...
target-ppc/translate_init.c
... ... @@ -34,7 +34,7 @@
34 34 #endif
35 35  
36 36 struct ppc_def_t {
37   - const unsigned char *name;
  37 + const char *name;
38 38 uint32_t pvr;
39 39 uint32_t svr;
40 40 uint64_t insns_flags;
... ... @@ -433,13 +433,13 @@ do { \
433 433 _spr_register(env, num, name, uea_read, uea_write, initial_value); \
434 434 } while (0)
435 435 static inline void _spr_register (CPUPPCState *env, int num,
436   - const unsigned char *name,
  436 + const char *name,
437 437 void (*uea_read)(void *opaque, int sprn),
438 438 void (*uea_write)(void *opaque, int sprn),
439 439 target_ulong initial_value)
440 440 #else
441 441 static inline void spr_register (CPUPPCState *env, int num,
442   - const unsigned char *name,
  442 + const char *name,
443 443 void (*uea_read)(void *opaque, int sprn),
444 444 void (*uea_write)(void *opaque, int sprn),
445 445 void (*oea_read)(void *opaque, int sprn),
... ... @@ -1245,7 +1245,7 @@ static void gen_spr_usprgh (CPUPPCState *env)
1245 1245 /* PowerPC BookE SPR */
1246 1246 static void gen_spr_BookE (CPUPPCState *env, uint64_t ivor_mask)
1247 1247 {
1248   - const unsigned char *ivor_names[64] = {
  1248 + const char *ivor_names[64] = {
1249 1249 "IVOR0", "IVOR1", "IVOR2", "IVOR3",
1250 1250 "IVOR4", "IVOR5", "IVOR6", "IVOR7",
1251 1251 "IVOR8", "IVOR9", "IVOR10", "IVOR11",
... ... @@ -1407,7 +1407,7 @@ static void gen_spr_BookE (CPUPPCState *env, uint64_t ivor_mask)
1407 1407 static void gen_spr_BookE_FSL (CPUPPCState *env, uint32_t mas_mask)
1408 1408 {
1409 1409 #if !defined(CONFIG_USER_ONLY)
1410   - const unsigned char *mas_names[8] = {
  1410 + const char *mas_names[8] = {
1411 1411 "MAS0", "MAS1", "MAS2", "MAS3", "MAS4", "MAS5", "MAS6", "MAS7",
1412 1412 };
1413 1413 int mas_sprn[8] = {
... ... @@ -9157,7 +9157,7 @@ static int create_ppc_opcodes (CPUPPCState *env, const ppc_def_t *def)
9157 9157 static void dump_ppc_insns (CPUPPCState *env)
9158 9158 {
9159 9159 opc_handler_t **table, *handler;
9160   - const unsigned char *p, *q;
  9160 + const char *p, *q;
9161 9161 uint8_t opc1, opc2, opc3;
9162 9162  
9163 9163 printf("Instructions set:\n");
... ... @@ -9240,7 +9240,7 @@ int cpu_ppc_register_internal (CPUPPCState *env, const ppc_def_t *def)
9240 9240 init_ppc_proc(env, def);
9241 9241 #if defined(PPC_DUMP_CPU)
9242 9242 {
9243   - const unsigned char *mmu_model, *excp_model, *bus_model;
  9243 + const char *mmu_model, *excp_model, *bus_model;
9244 9244 switch (env->mmu_model) {
9245 9245 case POWERPC_MMU_32B:
9246 9246 mmu_model = "PowerPC 32";
... ... @@ -9443,10 +9443,10 @@ static const ppc_def_t *ppc_find_by_pvr (uint32_t pvr)
9443 9443  
9444 9444 #include <ctype.h>
9445 9445  
9446   -const ppc_def_t *cpu_ppc_find_by_name (const unsigned char *name)
  9446 +const ppc_def_t *cpu_ppc_find_by_name (const char *name)
9447 9447 {
9448 9448 const ppc_def_t *ret;
9449   - const unsigned char *p;
  9449 + const char *p;
9450 9450 int i, max, len;
9451 9451  
9452 9452 /* Check if the given name is a PVR */
... ...
target-sh4/translate.c
... ... @@ -183,7 +183,7 @@ void cpu_sh4_reset(CPUSH4State * env)
183 183 }
184 184  
185 185 typedef struct {
186   - const unsigned char *name;
  186 + const char *name;
187 187 int id;
188 188 uint32_t pvr;
189 189 uint32_t prr;
... ... @@ -206,7 +206,7 @@ static sh4_def_t sh4_defs[] = {
206 206 },
207 207 };
208 208  
209   -static const sh4_def_t *cpu_sh4_find_by_name(const unsigned char *name)
  209 +static const sh4_def_t *cpu_sh4_find_by_name(const char *name)
210 210 {
211 211 int i;
212 212  
... ...