From eb38c52c2a6df76928c1a4760bc87d21b256e22a Mon Sep 17 00:00:00 2001 From: blueswir1 Date: Sat, 6 Sep 2008 17:47:39 +0000 Subject: [PATCH] Fix most warnings that would be caused by gcc flag -Wundef git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5173 c046a42c-6fe2-441c-8c8c-71466251a162 --- elf.h | 3 +++ exec.c | 4 ++-- hw/omap1.c | 34 +++++++++++++++++----------------- hw/pc.c | 2 +- hw/rtl8139.c | 4 ++-- hw/usb-net.c | 10 +++++----- hw/usb-ohci.c | 2 +- linux-user/arm/nwfpe/fpa11.c | 20 ++++++++++---------- linux-user/main.c | 2 +- mips-dis.c | 2 +- slirp/ip_icmp.c | 4 ++-- slirp/slirp.h | 2 +- target-i386/op_helper.c | 2 +- vnc.c | 40 ++++++++++++++++++++-------------------- 14 files changed, 67 insertions(+), 64 deletions(-) diff --git a/elf.h b/elf.h index 1bba022..861f1d3 100644 --- a/elf.h +++ b/elf.h @@ -1123,6 +1123,7 @@ typedef struct elf64_note { Elf64_Word n_type; /* Content type */ } Elf64_Nhdr; +#ifdef ELF_CLASS #if ELF_CLASS == ELFCLASS32 #define elfhdr elf32_hdr @@ -1165,5 +1166,7 @@ typedef struct elf64_note { # endif #endif +#endif /* ELF_CLASS */ + #endif /* _QEMU_ELF_H */ diff --git a/exec.c b/exec.c index 3f686d8..5e30689 100644 --- a/exec.c +++ b/exec.c @@ -2259,7 +2259,7 @@ static uint32_t unassigned_mem_readb(void *opaque, target_phys_addr_t addr) #endif #ifdef TARGET_SPARC do_unassigned_access(addr, 0, 0, 0); -#elif TARGET_CRIS +#elif defined(TARGET_CRIS) do_unassigned_access(addr, 0, 0, 0); #endif return 0; @@ -2272,7 +2272,7 @@ static void unassigned_mem_writeb(void *opaque, target_phys_addr_t addr, uint32_ #endif #ifdef TARGET_SPARC do_unassigned_access(addr, 1, 0, 0); -#elif TARGET_CRIS +#elif defined(TARGET_CRIS) do_unassigned_access(addr, 1, 0, 0); #endif } diff --git a/hw/omap1.c b/hw/omap1.c index 5854500..101d36b 100644 --- a/hw/omap1.c +++ b/hw/omap1.c @@ -3478,7 +3478,7 @@ static void omap_rtc_write(void *opaque, target_phys_addr_t addr, switch (offset) { case 0x00: /* SECONDS_REG */ -#if ALMDEBUG +#ifdef ALMDEBUG printf("RTC SEC_REG <-- %02x\n", value); #endif s->ti -= s->current_tm.tm_sec; @@ -3486,7 +3486,7 @@ static void omap_rtc_write(void *opaque, target_phys_addr_t addr, return; case 0x04: /* MINUTES_REG */ -#if ALMDEBUG +#ifdef ALMDEBUG printf("RTC MIN_REG <-- %02x\n", value); #endif s->ti -= s->current_tm.tm_min * 60; @@ -3494,7 +3494,7 @@ static void omap_rtc_write(void *opaque, target_phys_addr_t addr, return; case 0x08: /* HOURS_REG */ -#if ALMDEBUG +#ifdef ALMDEBUG printf("RTC HRS_REG <-- %02x\n", value); #endif s->ti -= s->current_tm.tm_hour * 3600; @@ -3506,7 +3506,7 @@ static void omap_rtc_write(void *opaque, target_phys_addr_t addr, return; case 0x0c: /* DAYS_REG */ -#if ALMDEBUG +#ifdef ALMDEBUG printf("RTC DAY_REG <-- %02x\n", value); #endif s->ti -= s->current_tm.tm_mday * 86400; @@ -3514,7 +3514,7 @@ static void omap_rtc_write(void *opaque, target_phys_addr_t addr, return; case 0x10: /* MONTHS_REG */ -#if ALMDEBUG +#ifdef ALMDEBUG printf("RTC MTH_REG <-- %02x\n", value); #endif memcpy(&new_tm, &s->current_tm, sizeof(new_tm)); @@ -3533,7 +3533,7 @@ static void omap_rtc_write(void *opaque, target_phys_addr_t addr, return; case 0x14: /* YEARS_REG */ -#if ALMDEBUG +#ifdef ALMDEBUG printf("RTC YRS_REG <-- %02x\n", value); #endif memcpy(&new_tm, &s->current_tm, sizeof(new_tm)); @@ -3555,7 +3555,7 @@ static void omap_rtc_write(void *opaque, target_phys_addr_t addr, return; /* Ignored */ case 0x20: /* ALARM_SECONDS_REG */ -#if ALMDEBUG +#ifdef ALMDEBUG printf("ALM SEC_REG <-- %02x\n", value); #endif s->alarm_tm.tm_sec = omap_rtc_bin(value); @@ -3563,7 +3563,7 @@ static void omap_rtc_write(void *opaque, target_phys_addr_t addr, return; case 0x24: /* ALARM_MINUTES_REG */ -#if ALMDEBUG +#ifdef ALMDEBUG printf("ALM MIN_REG <-- %02x\n", value); #endif s->alarm_tm.tm_min = omap_rtc_bin(value); @@ -3571,7 +3571,7 @@ static void omap_rtc_write(void *opaque, target_phys_addr_t addr, return; case 0x28: /* ALARM_HOURS_REG */ -#if ALMDEBUG +#ifdef ALMDEBUG printf("ALM HRS_REG <-- %02x\n", value); #endif if (s->pm_am) @@ -3584,7 +3584,7 @@ static void omap_rtc_write(void *opaque, target_phys_addr_t addr, return; case 0x2c: /* ALARM_DAYS_REG */ -#if ALMDEBUG +#ifdef ALMDEBUG printf("ALM DAY_REG <-- %02x\n", value); #endif s->alarm_tm.tm_mday = omap_rtc_bin(value); @@ -3592,7 +3592,7 @@ static void omap_rtc_write(void *opaque, target_phys_addr_t addr, return; case 0x30: /* ALARM_MONTHS_REG */ -#if ALMDEBUG +#ifdef ALMDEBUG printf("ALM MON_REG <-- %02x\n", value); #endif s->alarm_tm.tm_mon = omap_rtc_bin(value); @@ -3600,7 +3600,7 @@ static void omap_rtc_write(void *opaque, target_phys_addr_t addr, return; case 0x34: /* ALARM_YEARS_REG */ -#if ALMDEBUG +#ifdef ALMDEBUG printf("ALM YRS_REG <-- %02x\n", value); #endif s->alarm_tm.tm_year = omap_rtc_bin(value); @@ -3608,7 +3608,7 @@ static void omap_rtc_write(void *opaque, target_phys_addr_t addr, return; case 0x40: /* RTC_CTRL_REG */ -#if ALMDEBUG +#ifdef ALMDEBUG printf("RTC CONTROL <-- %02x\n", value); #endif s->pm_am = (value >> 3) & 1; @@ -3620,7 +3620,7 @@ static void omap_rtc_write(void *opaque, target_phys_addr_t addr, return; case 0x44: /* RTC_STATUS_REG */ -#if ALMDEBUG +#ifdef ALMDEBUG printf("RTC STATUSL <-- %02x\n", value); #endif s->status &= ~((value & 0xc0) ^ 0x80); @@ -3628,14 +3628,14 @@ static void omap_rtc_write(void *opaque, target_phys_addr_t addr, return; case 0x48: /* RTC_INTERRUPTS_REG */ -#if ALMDEBUG +#ifdef ALMDEBUG printf("RTC INTRS <-- %02x\n", value); #endif s->interrupts = value; return; case 0x4c: /* RTC_COMP_LSB_REG */ -#if ALMDEBUG +#ifdef ALMDEBUG printf("RTC COMPLSB <-- %02x\n", value); #endif s->comp_reg &= 0xff00; @@ -3643,7 +3643,7 @@ static void omap_rtc_write(void *opaque, target_phys_addr_t addr, return; case 0x50: /* RTC_COMP_MSB_REG */ -#if ALMDEBUG +#ifdef ALMDEBUG printf("RTC COMPMSB <-- %02x\n", value); #endif s->comp_reg &= 0x00ff; diff --git a/hw/pc.c b/hw/pc.c index 213ead8..435c7d4 100644 --- a/hw/pc.c +++ b/hw/pc.c @@ -76,7 +76,7 @@ uint64_t cpu_get_tsc(CPUX86State *env) /* Note: when using kqemu, it is more logical to return the host TSC because kqemu does not trap the RDTSC instruction for performance reasons */ -#if USE_KQEMU +#ifdef USE_KQEMU if (env->kqemu_enabled) { return cpu_get_real_ticks(); } else diff --git a/hw/rtl8139.c b/hw/rtl8139.c index 6aec2ff..cae8788 100644 --- a/hw/rtl8139.c +++ b/hw/rtl8139.c @@ -3356,7 +3356,7 @@ static inline int64_t rtl8139_get_next_tctr_time(RTL8139State *s, int64_t curren return next_time; } -#if RTL8139_ONBOARD_TIMER +#ifdef RTL8139_ONBOARD_TIMER static void rtl8139_timer(void *opaque) { RTL8139State *s = opaque; @@ -3456,7 +3456,7 @@ void pci_rtl8139_init(PCIBus *bus, NICInfo *nd, int devfn) register_savevm("rtl8139", -1, 3, rtl8139_save, rtl8139_load, s); -#if RTL8139_ONBOARD_TIMER +#ifdef RTL8139_ONBOARD_TIMER s->timer = qemu_new_timer(vm_clock, rtl8139_timer, s); qemu_mod_timer(s->timer, diff --git a/hw/usb-net.c b/hw/usb-net.c index 27dea10..63edfd5 100644 --- a/hw/usb-net.c +++ b/hw/usb-net.c @@ -1069,7 +1069,7 @@ static int usb_net_handle_control(USBDevice *dev, int request, int value, case ClassInterfaceOutRequest | USB_CDC_SEND_ENCAPSULATED_COMMAND: if (!s->rndis || value || index != 0) goto fail; -#if TRAFFIC_DEBUG +#ifdef TRAFFIC_DEBUG { unsigned int i; fprintf(stderr, "SEND_ENCAPSULATED_COMMAND:"); @@ -1092,7 +1092,7 @@ static int usb_net_handle_control(USBDevice *dev, int request, int value, data[0] = 0; ret = 1; } -#if TRAFFIC_DEBUG +#ifdef TRAFFIC_DEBUG { unsigned int i; fprintf(stderr, "GET_ENCAPSULATED_RESPONSE:"); @@ -1219,7 +1219,7 @@ static int usb_net_handle_statusin(USBNetState *s, USBPacket *p) if (!s->rndis_resp.tqh_first) ret = USB_RET_NAK; -#if DEBUG +#ifdef TRAFFIC_DEBUG fprintf(stderr, "usbnet: interrupt poll len %u return %d", p->len, ret); { int i; @@ -1260,7 +1260,7 @@ static int usb_net_handle_datain(USBNetState *s, USBPacket *p) s->in_ptr = s->in_len = 0; } -#if TRAFFIC_DEBUG +#ifdef TRAFFIC_DEBUG fprintf(stderr, "usbnet: data in len %u return %d", p->len, ret); { int i; @@ -1285,7 +1285,7 @@ static int usb_net_handle_dataout(USBNetState *s, USBPacket *p) (struct rndis_packet_msg_type *) s->out_buf; uint32_t len; -#if TRAFFIC_DEBUG +#ifdef TRAFFIC_DEBUG fprintf(stderr, "usbnet: data out len %u\n", p->len); { int i; diff --git a/hw/usb-ohci.c b/hw/usb-ohci.c index 68995b0..afd5506 100644 --- a/hw/usb-ohci.c +++ b/hw/usb-ohci.c @@ -1598,7 +1598,7 @@ static void usb_ohci_init(OHCIState *ohci, int num_ports, int devfn, int i; if (usb_frame_time == 0) { -#if OHCI_TIME_WARP +#ifdef OHCI_TIME_WARP usb_frame_time = ticks_per_sec; usb_bit_time = muldiv64(1, ticks_per_sec, USB_HZ/1000); #else diff --git a/linux-user/arm/nwfpe/fpa11.c b/linux-user/arm/nwfpe/fpa11.c index 626a87a..beed968 100644 --- a/linux-user/arm/nwfpe/fpa11.c +++ b/linux-user/arm/nwfpe/fpa11.c @@ -54,7 +54,7 @@ void resetFPA11(void) fpa11->fpsr = FP_EMULATOR | BIT_AC; /* FPCR: set SB, AB and DA bits, clear all others */ -#if MAINTAIN_FPCR +#ifdef MAINTAIN_FPCR fpa11->fpcr = MASK_RESET; #endif } @@ -64,7 +64,7 @@ void SetRoundingMode(const unsigned int opcode) int rounding_mode; FPA11 *fpa11 = GET_FPA11(); -#if MAINTAIN_FPCR +#ifdef MAINTAIN_FPCR fpa11->fpcr &= ~MASK_ROUNDING_MODE; #endif switch (opcode & MASK_ROUNDING_MODE) @@ -72,28 +72,28 @@ void SetRoundingMode(const unsigned int opcode) default: case ROUND_TO_NEAREST: rounding_mode = float_round_nearest_even; -#if MAINTAIN_FPCR +#ifdef MAINTAIN_FPCR fpa11->fpcr |= ROUND_TO_NEAREST; #endif break; case ROUND_TO_PLUS_INFINITY: rounding_mode = float_round_up; -#if MAINTAIN_FPCR +#ifdef MAINTAIN_FPCR fpa11->fpcr |= ROUND_TO_PLUS_INFINITY; #endif break; case ROUND_TO_MINUS_INFINITY: rounding_mode = float_round_down; -#if MAINTAIN_FPCR +#ifdef MAINTAIN_FPCR fpa11->fpcr |= ROUND_TO_MINUS_INFINITY; #endif break; case ROUND_TO_ZERO: rounding_mode = float_round_to_zero; -#if MAINTAIN_FPCR +#ifdef MAINTAIN_FPCR fpa11->fpcr |= ROUND_TO_ZERO; #endif break; @@ -105,28 +105,28 @@ void SetRoundingPrecision(const unsigned int opcode) { int rounding_precision; FPA11 *fpa11 = GET_FPA11(); -#if MAINTAIN_FPCR +#ifdef MAINTAIN_FPCR fpa11->fpcr &= ~MASK_ROUNDING_PRECISION; #endif switch (opcode & MASK_ROUNDING_PRECISION) { case ROUND_SINGLE: rounding_precision = 32; -#if MAINTAIN_FPCR +#ifdef MAINTAIN_FPCR fpa11->fpcr |= ROUND_SINGLE; #endif break; case ROUND_DOUBLE: rounding_precision = 64; -#if MAINTAIN_FPCR +#ifdef MAINTAIN_FPCR fpa11->fpcr |= ROUND_DOUBLE; #endif break; case ROUND_EXTENDED: rounding_precision = 80; -#if MAINTAIN_FPCR +#ifdef MAINTAIN_FPCR fpa11->fpcr |= ROUND_EXTENDED; #endif break; diff --git a/linux-user/main.c b/linux-user/main.c index cca696c..2a30519 100644 --- a/linux-user/main.c +++ b/linux-user/main.c @@ -282,7 +282,7 @@ static void write_dt(void *ptr, unsigned long addr, unsigned long limit, p[1] = tswap32(e2); } -#if TARGET_X86_64 +#ifdef TARGET_X86_64 uint64_t idt_table[512]; static void set_gate64(void *ptr, unsigned int type, unsigned int dpl, diff --git a/mips-dis.c b/mips-dis.c index 867ecf2..5b0b247 100644 --- a/mips-dis.c +++ b/mips-dis.c @@ -3302,7 +3302,7 @@ set_default_mips_dis_options (struct disassemble_info *info) #endif /* Set ISA, architecture, and cp0 register names as best we can. */ -#if ! SYMTAB_AVAILABLE && 0 +#if !defined(SYMTAB_AVAILABLE) && 0 /* This is running out on a target machine, not in a host tool. FIXME: Where does mips_target_info come from? */ target_processor = mips_target_info.processor; diff --git a/slirp/ip_icmp.c b/slirp/ip_icmp.c index d1da0a2..53566c1 100644 --- a/slirp/ip_icmp.c +++ b/slirp/ip_icmp.c @@ -228,7 +228,7 @@ icmp_error(msrc, type, code, minsize, message) /* check msrc */ if(!msrc) goto end_error; ip = mtod(msrc, struct ip *); -#if DEBUG +#ifdef DEBUG { char bufa[20], bufb[20]; strcpy(bufa, inet_ntoa(ip->ip_src)); strcpy(bufb, inet_ntoa(ip->ip_dst)); @@ -285,7 +285,7 @@ icmp_error(msrc, type, code, minsize, message) HTONS(icp->icmp_ip.ip_id); HTONS(icp->icmp_ip.ip_off); -#if DEBUG +#ifdef DEBUG if(message) { /* DEBUG : append message to ICMP packet */ int message_len; char *cpnt; diff --git a/slirp/slirp.h b/slirp/slirp.h index 9ee240b..d49be12 100644 --- a/slirp/slirp.h +++ b/slirp/slirp.h @@ -103,7 +103,7 @@ typedef unsigned char u_int8_t; # include # include #else -# if HAVE_SYS_TIME_H +# ifdef HAVE_SYS_TIME_H # include # else # include diff --git a/target-i386/op_helper.c b/target-i386/op_helper.c index 0b5fdc0..32cdf2a 100644 --- a/target-i386/op_helper.c +++ b/target-i386/op_helper.c @@ -1217,7 +1217,7 @@ void do_interrupt(int intno, int is_int, int error_code, } } if (env->cr[0] & CR0_PE_MASK) { -#if TARGET_X86_64 +#ifdef TARGET_X86_64 if (env->hflags & HF_LMA_MASK) { do_interrupt64(intno, is_int, error_code, next_eip, is_hw); } else diff --git a/vnc.c b/vnc.c index 2fe1e51..3c029f5 100644 --- a/vnc.c +++ b/vnc.c @@ -35,14 +35,14 @@ #include "keymaps.c" #include "d3des.h" -#if CONFIG_VNC_TLS +#ifdef CONFIG_VNC_TLS #include #include #endif /* CONFIG_VNC_TLS */ // #define _VNC_DEBUG 1 -#if _VNC_DEBUG +#ifdef _VNC_DEBUG #define VNC_DEBUG(fmt, ...) do { fprintf(stderr, fmt, ## __VA_ARGS__); } while (0) #if CONFIG_VNC_TLS && _VNC_DEBUG >= 2 @@ -93,7 +93,7 @@ enum { VNC_AUTH_VENCRYPT = 19 }; -#if CONFIG_VNC_TLS +#ifdef CONFIG_VNC_TLS enum { VNC_WIREMODE_CLEAR, VNC_WIREMODE_TLS, @@ -141,7 +141,7 @@ struct VncState char *display; char *password; int auth; -#if CONFIG_VNC_TLS +#ifdef CONFIG_VNC_TLS int subauth; int x509verify; @@ -152,7 +152,7 @@ struct VncState #endif char challenge[VNC_AUTH_CHALLENGE_SIZE]; -#if CONFIG_VNC_TLS +#ifdef CONFIG_VNC_TLS int wiremode; gnutls_session_t tls_session; #endif @@ -662,7 +662,7 @@ static int vnc_client_io_error(VncState *vs, int ret, int last_errno) buffer_reset(&vs->input); buffer_reset(&vs->output); vs->need_update = 0; -#if CONFIG_VNC_TLS +#ifdef CONFIG_VNC_TLS if (vs->tls_session) { gnutls_deinit(vs->tls_session); vs->tls_session = NULL; @@ -684,7 +684,7 @@ static void vnc_client_write(void *opaque) long ret; VncState *vs = opaque; -#if CONFIG_VNC_TLS +#ifdef CONFIG_VNC_TLS if (vs->tls_session) { ret = gnutls_write(vs->tls_session, vs->output.buffer, vs->output.offset); if (ret < 0) { @@ -722,7 +722,7 @@ static void vnc_client_read(void *opaque) buffer_reserve(&vs->input, 4096); -#if CONFIG_VNC_TLS +#ifdef CONFIG_VNC_TLS if (vs->tls_session) { ret = gnutls_read(vs->tls_session, buffer_end(&vs->input), 4096); if (ret < 0) { @@ -829,7 +829,7 @@ static uint32_t read_u32(uint8_t *data, size_t offset) (data[offset + 2] << 8) | data[offset + 3]); } -#if CONFIG_VNC_TLS +#ifdef CONFIG_VNC_TLS static ssize_t vnc_tls_push(gnutls_transport_ptr_t transport, const void *data, size_t len) { @@ -1439,7 +1439,7 @@ static int start_auth_vnc(VncState *vs) } -#if CONFIG_VNC_TLS +#ifdef CONFIG_VNC_TLS #define DH_BITS 1024 static gnutls_dh_params_t dh_params; @@ -1877,7 +1877,7 @@ static int protocol_client_auth(VncState *vs, uint8_t *data, size_t len) VNC_DEBUG("Start VNC auth\n"); return start_auth_vnc(vs); -#if CONFIG_VNC_TLS +#ifdef CONFIG_VNC_TLS case VNC_AUTH_VENCRYPT: VNC_DEBUG("Accept VeNCrypt auth\n");; return start_auth_vencrypt(vs); @@ -2030,7 +2030,7 @@ void vnc_display_init(DisplayState *ds) vnc_dpy_resize(vs->ds, 640, 400); } -#if CONFIG_VNC_TLS +#ifdef CONFIG_VNC_TLS static int vnc_set_x509_credential(VncState *vs, const char *certdir, const char *filename, @@ -2107,7 +2107,7 @@ void vnc_display_close(DisplayState *ds) buffer_reset(&vs->input); buffer_reset(&vs->output); vs->need_update = 0; -#if CONFIG_VNC_TLS +#ifdef CONFIG_VNC_TLS if (vs->tls_session) { gnutls_deinit(vs->tls_session); vs->tls_session = NULL; @@ -2116,7 +2116,7 @@ void vnc_display_close(DisplayState *ds) #endif /* CONFIG_VNC_TLS */ } vs->auth = VNC_AUTH_INVALID; -#if CONFIG_VNC_TLS +#ifdef CONFIG_VNC_TLS vs->subauth = VNC_AUTH_INVALID; vs->x509verify = 0; #endif @@ -2152,7 +2152,7 @@ int vnc_display_open(DisplayState *ds, const char *display) const char *options; int password = 0; int reverse = 0; -#if CONFIG_VNC_TLS +#ifdef CONFIG_VNC_TLS int tls = 0, x509 = 0; #endif @@ -2170,7 +2170,7 @@ int vnc_display_open(DisplayState *ds, const char *display) password = 1; /* Require password auth */ } else if (strncmp(options, "reverse", 7) == 0) { reverse = 1; -#if CONFIG_VNC_TLS +#ifdef CONFIG_VNC_TLS } else if (strncmp(options, "tls", 3) == 0) { tls = 1; /* Require TLS */ } else if (strncmp(options, "x509", 4) == 0) { @@ -2208,7 +2208,7 @@ int vnc_display_open(DisplayState *ds, const char *display) } if (password) { -#if CONFIG_VNC_TLS +#ifdef CONFIG_VNC_TLS if (tls) { vs->auth = VNC_AUTH_VENCRYPT; if (x509) { @@ -2222,12 +2222,12 @@ int vnc_display_open(DisplayState *ds, const char *display) #endif VNC_DEBUG("Initializing VNC server with password auth\n"); vs->auth = VNC_AUTH_VNC; -#if CONFIG_VNC_TLS +#ifdef CONFIG_VNC_TLS vs->subauth = VNC_AUTH_INVALID; } #endif } else { -#if CONFIG_VNC_TLS +#ifdef CONFIG_VNC_TLS if (tls) { vs->auth = VNC_AUTH_VENCRYPT; if (x509) { @@ -2241,7 +2241,7 @@ int vnc_display_open(DisplayState *ds, const char *display) #endif VNC_DEBUG("Initializing VNC server with no auth\n"); vs->auth = VNC_AUTH_NONE; -#if CONFIG_VNC_TLS +#ifdef CONFIG_VNC_TLS vs->subauth = VNC_AUTH_INVALID; } #endif -- 1.7.9.5