Browse Source

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
blueswir1 17 năm trước cách đây
mục cha
commit
eb38c52c2a
14 tập tin đã thay đổi với 67 bổ sung64 xóa
  1. 3 0
      elf.h
  2. 2 2
      exec.c
  3. 17 17
      hw/omap1.c
  4. 1 1
      hw/pc.c
  5. 2 2
      hw/rtl8139.c
  6. 5 5
      hw/usb-net.c
  7. 1 1
      hw/usb-ohci.c
  8. 10 10
      linux-user/arm/nwfpe/fpa11.c
  9. 1 1
      linux-user/main.c
  10. 1 1
      mips-dis.c
  11. 2 2
      slirp/ip_icmp.c
  12. 1 1
      slirp/slirp.h
  13. 1 1
      target-i386/op_helper.c
  14. 20 20
      vnc.c

+ 3 - 0
elf.h

@@ -1123,6 +1123,7 @@ typedef struct elf64_note {
   Elf64_Word n_type;	/* Content type */
   Elf64_Word n_type;	/* Content type */
 } Elf64_Nhdr;
 } Elf64_Nhdr;
 
 
+#ifdef ELF_CLASS
 #if ELF_CLASS == ELFCLASS32
 #if ELF_CLASS == ELFCLASS32
 
 
 #define elfhdr		elf32_hdr
 #define elfhdr		elf32_hdr
@@ -1165,5 +1166,7 @@ typedef struct elf64_note {
 # endif
 # endif
 #endif
 #endif
 
 
+#endif /* ELF_CLASS */
+
 
 
 #endif /* _QEMU_ELF_H */
 #endif /* _QEMU_ELF_H */

+ 2 - 2
exec.c

@@ -2259,7 +2259,7 @@ static uint32_t unassigned_mem_readb(void *opaque, target_phys_addr_t addr)
 #endif
 #endif
 #ifdef TARGET_SPARC
 #ifdef TARGET_SPARC
     do_unassigned_access(addr, 0, 0, 0);
     do_unassigned_access(addr, 0, 0, 0);
-#elif TARGET_CRIS
+#elif defined(TARGET_CRIS)
     do_unassigned_access(addr, 0, 0, 0);
     do_unassigned_access(addr, 0, 0, 0);
 #endif
 #endif
     return 0;
     return 0;
@@ -2272,7 +2272,7 @@ static void unassigned_mem_writeb(void *opaque, target_phys_addr_t addr, uint32_
 #endif
 #endif
 #ifdef TARGET_SPARC
 #ifdef TARGET_SPARC
     do_unassigned_access(addr, 1, 0, 0);
     do_unassigned_access(addr, 1, 0, 0);
-#elif TARGET_CRIS
+#elif defined(TARGET_CRIS)
     do_unassigned_access(addr, 1, 0, 0);
     do_unassigned_access(addr, 1, 0, 0);
 #endif
 #endif
 }
 }

+ 17 - 17
hw/omap1.c

@@ -3478,7 +3478,7 @@ static void omap_rtc_write(void *opaque, target_phys_addr_t addr,
 
 
     switch (offset) {
     switch (offset) {
     case 0x00:	/* SECONDS_REG */
     case 0x00:	/* SECONDS_REG */
-#if ALMDEBUG
+#ifdef ALMDEBUG
         printf("RTC SEC_REG <-- %02x\n", value);
         printf("RTC SEC_REG <-- %02x\n", value);
 #endif
 #endif
         s->ti -= s->current_tm.tm_sec;
         s->ti -= s->current_tm.tm_sec;
@@ -3486,7 +3486,7 @@ static void omap_rtc_write(void *opaque, target_phys_addr_t addr,
         return;
         return;
 
 
     case 0x04:	/* MINUTES_REG */
     case 0x04:	/* MINUTES_REG */
-#if ALMDEBUG
+#ifdef ALMDEBUG
         printf("RTC MIN_REG <-- %02x\n", value);
         printf("RTC MIN_REG <-- %02x\n", value);
 #endif
 #endif
         s->ti -= s->current_tm.tm_min * 60;
         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;
         return;
 
 
     case 0x08:	/* HOURS_REG */
     case 0x08:	/* HOURS_REG */
-#if ALMDEBUG
+#ifdef ALMDEBUG
         printf("RTC HRS_REG <-- %02x\n", value);
         printf("RTC HRS_REG <-- %02x\n", value);
 #endif
 #endif
         s->ti -= s->current_tm.tm_hour * 3600;
         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;
         return;
 
 
     case 0x0c:	/* DAYS_REG */
     case 0x0c:	/* DAYS_REG */
-#if ALMDEBUG
+#ifdef ALMDEBUG
         printf("RTC DAY_REG <-- %02x\n", value);
         printf("RTC DAY_REG <-- %02x\n", value);
 #endif
 #endif
         s->ti -= s->current_tm.tm_mday * 86400;
         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;
         return;
 
 
     case 0x10:	/* MONTHS_REG */
     case 0x10:	/* MONTHS_REG */
-#if ALMDEBUG
+#ifdef ALMDEBUG
         printf("RTC MTH_REG <-- %02x\n", value);
         printf("RTC MTH_REG <-- %02x\n", value);
 #endif
 #endif
         memcpy(&new_tm, &s->current_tm, sizeof(new_tm));
         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;
         return;
 
 
     case 0x14:	/* YEARS_REG */
     case 0x14:	/* YEARS_REG */
-#if ALMDEBUG
+#ifdef ALMDEBUG
         printf("RTC YRS_REG <-- %02x\n", value);
         printf("RTC YRS_REG <-- %02x\n", value);
 #endif
 #endif
         memcpy(&new_tm, &s->current_tm, sizeof(new_tm));
         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 */
         return;	/* Ignored */
 
 
     case 0x20:	/* ALARM_SECONDS_REG */
     case 0x20:	/* ALARM_SECONDS_REG */
-#if ALMDEBUG
+#ifdef ALMDEBUG
         printf("ALM SEC_REG <-- %02x\n", value);
         printf("ALM SEC_REG <-- %02x\n", value);
 #endif
 #endif
         s->alarm_tm.tm_sec = omap_rtc_bin(value);
         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;
         return;
 
 
     case 0x24:	/* ALARM_MINUTES_REG */
     case 0x24:	/* ALARM_MINUTES_REG */
-#if ALMDEBUG
+#ifdef ALMDEBUG
         printf("ALM MIN_REG <-- %02x\n", value);
         printf("ALM MIN_REG <-- %02x\n", value);
 #endif
 #endif
         s->alarm_tm.tm_min = omap_rtc_bin(value);
         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;
         return;
 
 
     case 0x28:	/* ALARM_HOURS_REG */
     case 0x28:	/* ALARM_HOURS_REG */
-#if ALMDEBUG
+#ifdef ALMDEBUG
         printf("ALM HRS_REG <-- %02x\n", value);
         printf("ALM HRS_REG <-- %02x\n", value);
 #endif
 #endif
         if (s->pm_am)
         if (s->pm_am)
@@ -3584,7 +3584,7 @@ static void omap_rtc_write(void *opaque, target_phys_addr_t addr,
         return;
         return;
 
 
     case 0x2c:	/* ALARM_DAYS_REG */
     case 0x2c:	/* ALARM_DAYS_REG */
-#if ALMDEBUG
+#ifdef ALMDEBUG
         printf("ALM DAY_REG <-- %02x\n", value);
         printf("ALM DAY_REG <-- %02x\n", value);
 #endif
 #endif
         s->alarm_tm.tm_mday = omap_rtc_bin(value);
         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;
         return;
 
 
     case 0x30:	/* ALARM_MONTHS_REG */
     case 0x30:	/* ALARM_MONTHS_REG */
-#if ALMDEBUG
+#ifdef ALMDEBUG
         printf("ALM MON_REG <-- %02x\n", value);
         printf("ALM MON_REG <-- %02x\n", value);
 #endif
 #endif
         s->alarm_tm.tm_mon = omap_rtc_bin(value);
         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;
         return;
 
 
     case 0x34:	/* ALARM_YEARS_REG */
     case 0x34:	/* ALARM_YEARS_REG */
-#if ALMDEBUG
+#ifdef ALMDEBUG
         printf("ALM YRS_REG <-- %02x\n", value);
         printf("ALM YRS_REG <-- %02x\n", value);
 #endif
 #endif
         s->alarm_tm.tm_year = omap_rtc_bin(value);
         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;
         return;
 
 
     case 0x40:	/* RTC_CTRL_REG */
     case 0x40:	/* RTC_CTRL_REG */
-#if ALMDEBUG
+#ifdef ALMDEBUG
         printf("RTC CONTROL <-- %02x\n", value);
         printf("RTC CONTROL <-- %02x\n", value);
 #endif
 #endif
         s->pm_am = (value >> 3) & 1;
         s->pm_am = (value >> 3) & 1;
@@ -3620,7 +3620,7 @@ static void omap_rtc_write(void *opaque, target_phys_addr_t addr,
         return;
         return;
 
 
     case 0x44:	/* RTC_STATUS_REG */
     case 0x44:	/* RTC_STATUS_REG */
-#if ALMDEBUG
+#ifdef ALMDEBUG
         printf("RTC STATUSL <-- %02x\n", value);
         printf("RTC STATUSL <-- %02x\n", value);
 #endif
 #endif
         s->status &= ~((value & 0xc0) ^ 0x80);
         s->status &= ~((value & 0xc0) ^ 0x80);
@@ -3628,14 +3628,14 @@ static void omap_rtc_write(void *opaque, target_phys_addr_t addr,
         return;
         return;
 
 
     case 0x48:	/* RTC_INTERRUPTS_REG */
     case 0x48:	/* RTC_INTERRUPTS_REG */
-#if ALMDEBUG
+#ifdef ALMDEBUG
         printf("RTC INTRS <-- %02x\n", value);
         printf("RTC INTRS <-- %02x\n", value);
 #endif
 #endif
         s->interrupts = value;
         s->interrupts = value;
         return;
         return;
 
 
     case 0x4c:	/* RTC_COMP_LSB_REG */
     case 0x4c:	/* RTC_COMP_LSB_REG */
-#if ALMDEBUG
+#ifdef ALMDEBUG
         printf("RTC COMPLSB <-- %02x\n", value);
         printf("RTC COMPLSB <-- %02x\n", value);
 #endif
 #endif
         s->comp_reg &= 0xff00;
         s->comp_reg &= 0xff00;
@@ -3643,7 +3643,7 @@ static void omap_rtc_write(void *opaque, target_phys_addr_t addr,
         return;
         return;
 
 
     case 0x50:	/* RTC_COMP_MSB_REG */
     case 0x50:	/* RTC_COMP_MSB_REG */
-#if ALMDEBUG
+#ifdef ALMDEBUG
         printf("RTC COMPMSB <-- %02x\n", value);
         printf("RTC COMPMSB <-- %02x\n", value);
 #endif
 #endif
         s->comp_reg &= 0x00ff;
         s->comp_reg &= 0x00ff;

+ 1 - 1
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
     /* Note: when using kqemu, it is more logical to return the host TSC
        because kqemu does not trap the RDTSC instruction for
        because kqemu does not trap the RDTSC instruction for
        performance reasons */
        performance reasons */
-#if USE_KQEMU
+#ifdef USE_KQEMU
     if (env->kqemu_enabled) {
     if (env->kqemu_enabled) {
         return cpu_get_real_ticks();
         return cpu_get_real_ticks();
     } else
     } else

+ 2 - 2
hw/rtl8139.c

@@ -3356,7 +3356,7 @@ static inline int64_t rtl8139_get_next_tctr_time(RTL8139State *s, int64_t curren
     return next_time;
     return next_time;
 }
 }
 
 
-#if RTL8139_ONBOARD_TIMER
+#ifdef RTL8139_ONBOARD_TIMER
 static void rtl8139_timer(void *opaque)
 static void rtl8139_timer(void *opaque)
 {
 {
     RTL8139State *s = 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);
     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);
     s->timer = qemu_new_timer(vm_clock, rtl8139_timer, s);
 
 
     qemu_mod_timer(s->timer,
     qemu_mod_timer(s->timer,

+ 5 - 5
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:
     case ClassInterfaceOutRequest | USB_CDC_SEND_ENCAPSULATED_COMMAND:
         if (!s->rndis || value || index != 0)
         if (!s->rndis || value || index != 0)
             goto fail;
             goto fail;
-#if TRAFFIC_DEBUG
+#ifdef TRAFFIC_DEBUG
         {
         {
             unsigned int i;
             unsigned int i;
             fprintf(stderr, "SEND_ENCAPSULATED_COMMAND:");
             fprintf(stderr, "SEND_ENCAPSULATED_COMMAND:");
@@ -1092,7 +1092,7 @@ static int usb_net_handle_control(USBDevice *dev, int request, int value,
             data[0] = 0;
             data[0] = 0;
             ret = 1;
             ret = 1;
         }
         }
-#if TRAFFIC_DEBUG
+#ifdef TRAFFIC_DEBUG
         {
         {
             unsigned int i;
             unsigned int i;
             fprintf(stderr, "GET_ENCAPSULATED_RESPONSE:");
             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)
     if (!s->rndis_resp.tqh_first)
         ret = USB_RET_NAK;
         ret = USB_RET_NAK;
 
 
-#if DEBUG
+#ifdef TRAFFIC_DEBUG
     fprintf(stderr, "usbnet: interrupt poll len %u return %d", p->len, ret);
     fprintf(stderr, "usbnet: interrupt poll len %u return %d", p->len, ret);
     {
     {
         int i;
         int i;
@@ -1260,7 +1260,7 @@ static int usb_net_handle_datain(USBNetState *s, USBPacket *p)
         s->in_ptr = s->in_len = 0;
         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);
     fprintf(stderr, "usbnet: data in len %u return %d", p->len, ret);
     {
     {
         int i;
         int i;
@@ -1285,7 +1285,7 @@ static int usb_net_handle_dataout(USBNetState *s, USBPacket *p)
             (struct rndis_packet_msg_type *) s->out_buf;
             (struct rndis_packet_msg_type *) s->out_buf;
     uint32_t len;
     uint32_t len;
 
 
-#if TRAFFIC_DEBUG
+#ifdef TRAFFIC_DEBUG
     fprintf(stderr, "usbnet: data out len %u\n", p->len);
     fprintf(stderr, "usbnet: data out len %u\n", p->len);
     {
     {
         int i;
         int i;

+ 1 - 1
hw/usb-ohci.c

@@ -1598,7 +1598,7 @@ static void usb_ohci_init(OHCIState *ohci, int num_ports, int devfn,
     int i;
     int i;
 
 
     if (usb_frame_time == 0) {
     if (usb_frame_time == 0) {
-#if OHCI_TIME_WARP
+#ifdef OHCI_TIME_WARP
         usb_frame_time = ticks_per_sec;
         usb_frame_time = ticks_per_sec;
         usb_bit_time = muldiv64(1, ticks_per_sec, USB_HZ/1000);
         usb_bit_time = muldiv64(1, ticks_per_sec, USB_HZ/1000);
 #else
 #else

+ 10 - 10
linux-user/arm/nwfpe/fpa11.c

@@ -54,7 +54,7 @@ void resetFPA11(void)
   fpa11->fpsr = FP_EMULATOR | BIT_AC;
   fpa11->fpsr = FP_EMULATOR | BIT_AC;
 
 
   /* FPCR: set SB, AB and DA bits, clear all others */
   /* FPCR: set SB, AB and DA bits, clear all others */
-#if MAINTAIN_FPCR
+#ifdef MAINTAIN_FPCR
   fpa11->fpcr = MASK_RESET;
   fpa11->fpcr = MASK_RESET;
 #endif
 #endif
 }
 }
@@ -64,7 +64,7 @@ void SetRoundingMode(const unsigned int opcode)
     int rounding_mode;
     int rounding_mode;
    FPA11 *fpa11 = GET_FPA11();
    FPA11 *fpa11 = GET_FPA11();
 
 
-#if MAINTAIN_FPCR
+#ifdef MAINTAIN_FPCR
    fpa11->fpcr &= ~MASK_ROUNDING_MODE;
    fpa11->fpcr &= ~MASK_ROUNDING_MODE;
 #endif
 #endif
    switch (opcode & MASK_ROUNDING_MODE)
    switch (opcode & MASK_ROUNDING_MODE)
@@ -72,28 +72,28 @@ void SetRoundingMode(const unsigned int opcode)
       default:
       default:
       case ROUND_TO_NEAREST:
       case ROUND_TO_NEAREST:
          rounding_mode = float_round_nearest_even;
          rounding_mode = float_round_nearest_even;
-#if MAINTAIN_FPCR
+#ifdef MAINTAIN_FPCR
          fpa11->fpcr |= ROUND_TO_NEAREST;
          fpa11->fpcr |= ROUND_TO_NEAREST;
 #endif
 #endif
       break;
       break;
 
 
       case ROUND_TO_PLUS_INFINITY:
       case ROUND_TO_PLUS_INFINITY:
          rounding_mode = float_round_up;
          rounding_mode = float_round_up;
-#if MAINTAIN_FPCR
+#ifdef MAINTAIN_FPCR
          fpa11->fpcr |= ROUND_TO_PLUS_INFINITY;
          fpa11->fpcr |= ROUND_TO_PLUS_INFINITY;
 #endif
 #endif
       break;
       break;
 
 
       case ROUND_TO_MINUS_INFINITY:
       case ROUND_TO_MINUS_INFINITY:
          rounding_mode = float_round_down;
          rounding_mode = float_round_down;
-#if MAINTAIN_FPCR
+#ifdef MAINTAIN_FPCR
          fpa11->fpcr |= ROUND_TO_MINUS_INFINITY;
          fpa11->fpcr |= ROUND_TO_MINUS_INFINITY;
 #endif
 #endif
       break;
       break;
 
 
       case ROUND_TO_ZERO:
       case ROUND_TO_ZERO:
          rounding_mode = float_round_to_zero;
          rounding_mode = float_round_to_zero;
-#if MAINTAIN_FPCR
+#ifdef MAINTAIN_FPCR
          fpa11->fpcr |= ROUND_TO_ZERO;
          fpa11->fpcr |= ROUND_TO_ZERO;
 #endif
 #endif
       break;
       break;
@@ -105,28 +105,28 @@ void SetRoundingPrecision(const unsigned int opcode)
 {
 {
     int rounding_precision;
     int rounding_precision;
    FPA11 *fpa11 = GET_FPA11();
    FPA11 *fpa11 = GET_FPA11();
-#if MAINTAIN_FPCR
+#ifdef MAINTAIN_FPCR
    fpa11->fpcr &= ~MASK_ROUNDING_PRECISION;
    fpa11->fpcr &= ~MASK_ROUNDING_PRECISION;
 #endif
 #endif
    switch (opcode & MASK_ROUNDING_PRECISION)
    switch (opcode & MASK_ROUNDING_PRECISION)
    {
    {
       case ROUND_SINGLE:
       case ROUND_SINGLE:
          rounding_precision = 32;
          rounding_precision = 32;
-#if MAINTAIN_FPCR
+#ifdef MAINTAIN_FPCR
          fpa11->fpcr |= ROUND_SINGLE;
          fpa11->fpcr |= ROUND_SINGLE;
 #endif
 #endif
       break;
       break;
 
 
       case ROUND_DOUBLE:
       case ROUND_DOUBLE:
          rounding_precision = 64;
          rounding_precision = 64;
-#if MAINTAIN_FPCR
+#ifdef MAINTAIN_FPCR
          fpa11->fpcr |= ROUND_DOUBLE;
          fpa11->fpcr |= ROUND_DOUBLE;
 #endif
 #endif
       break;
       break;
 
 
       case ROUND_EXTENDED:
       case ROUND_EXTENDED:
          rounding_precision = 80;
          rounding_precision = 80;
-#if MAINTAIN_FPCR
+#ifdef MAINTAIN_FPCR
          fpa11->fpcr |= ROUND_EXTENDED;
          fpa11->fpcr |= ROUND_EXTENDED;
 #endif
 #endif
       break;
       break;

+ 1 - 1
linux-user/main.c

@@ -282,7 +282,7 @@ static void write_dt(void *ptr, unsigned long addr, unsigned long limit,
     p[1] = tswap32(e2);
     p[1] = tswap32(e2);
 }
 }
 
 
-#if TARGET_X86_64
+#ifdef TARGET_X86_64
 uint64_t idt_table[512];
 uint64_t idt_table[512];
 
 
 static void set_gate64(void *ptr, unsigned int type, unsigned int dpl,
 static void set_gate64(void *ptr, unsigned int type, unsigned int dpl,

+ 1 - 1
mips-dis.c

@@ -3302,7 +3302,7 @@ set_default_mips_dis_options (struct disassemble_info *info)
 #endif
 #endif
 
 
   /* Set ISA, architecture, and cp0 register names as best we can.  */
   /* 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.
   /* This is running out on a target machine, not in a host tool.
      FIXME: Where does mips_target_info come from?  */
      FIXME: Where does mips_target_info come from?  */
   target_processor = mips_target_info.processor;
   target_processor = mips_target_info.processor;

+ 2 - 2
slirp/ip_icmp.c

@@ -228,7 +228,7 @@ icmp_error(msrc, type, code, minsize, message)
   /* check msrc */
   /* check msrc */
   if(!msrc) goto end_error;
   if(!msrc) goto end_error;
   ip = mtod(msrc, struct ip *);
   ip = mtod(msrc, struct ip *);
-#if DEBUG
+#ifdef DEBUG
   { char bufa[20], bufb[20];
   { char bufa[20], bufb[20];
     strcpy(bufa, inet_ntoa(ip->ip_src));
     strcpy(bufa, inet_ntoa(ip->ip_src));
     strcpy(bufb, inet_ntoa(ip->ip_dst));
     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_id);
   HTONS(icp->icmp_ip.ip_off);
   HTONS(icp->icmp_ip.ip_off);
 
 
-#if DEBUG
+#ifdef DEBUG
   if(message) {           /* DEBUG : append message to ICMP packet */
   if(message) {           /* DEBUG : append message to ICMP packet */
     int message_len;
     int message_len;
     char *cpnt;
     char *cpnt;

+ 1 - 1
slirp/slirp.h

@@ -103,7 +103,7 @@ typedef unsigned char u_int8_t;
 # include <sys/time.h>
 # include <sys/time.h>
 # include <time.h>
 # include <time.h>
 #else
 #else
-# if HAVE_SYS_TIME_H
+# ifdef HAVE_SYS_TIME_H
 #  include <sys/time.h>
 #  include <sys/time.h>
 # else
 # else
 #  include <time.h>
 #  include <time.h>

+ 1 - 1
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 (env->cr[0] & CR0_PE_MASK) {
-#if TARGET_X86_64
+#ifdef TARGET_X86_64
         if (env->hflags & HF_LMA_MASK) {
         if (env->hflags & HF_LMA_MASK) {
             do_interrupt64(intno, is_int, error_code, next_eip, is_hw);
             do_interrupt64(intno, is_int, error_code, next_eip, is_hw);
         } else
         } else

+ 20 - 20
vnc.c

@@ -35,14 +35,14 @@
 #include "keymaps.c"
 #include "keymaps.c"
 #include "d3des.h"
 #include "d3des.h"
 
 
-#if CONFIG_VNC_TLS
+#ifdef CONFIG_VNC_TLS
 #include <gnutls/gnutls.h>
 #include <gnutls/gnutls.h>
 #include <gnutls/x509.h>
 #include <gnutls/x509.h>
 #endif /* CONFIG_VNC_TLS */
 #endif /* CONFIG_VNC_TLS */
 
 
 // #define _VNC_DEBUG 1
 // #define _VNC_DEBUG 1
 
 
-#if _VNC_DEBUG
+#ifdef _VNC_DEBUG
 #define VNC_DEBUG(fmt, ...) do { fprintf(stderr, fmt, ## __VA_ARGS__); } while (0)
 #define VNC_DEBUG(fmt, ...) do { fprintf(stderr, fmt, ## __VA_ARGS__); } while (0)
 
 
 #if CONFIG_VNC_TLS && _VNC_DEBUG >= 2
 #if CONFIG_VNC_TLS && _VNC_DEBUG >= 2
@@ -93,7 +93,7 @@ enum {
     VNC_AUTH_VENCRYPT = 19
     VNC_AUTH_VENCRYPT = 19
 };
 };
 
 
-#if CONFIG_VNC_TLS
+#ifdef CONFIG_VNC_TLS
 enum {
 enum {
     VNC_WIREMODE_CLEAR,
     VNC_WIREMODE_CLEAR,
     VNC_WIREMODE_TLS,
     VNC_WIREMODE_TLS,
@@ -141,7 +141,7 @@ struct VncState
     char *display;
     char *display;
     char *password;
     char *password;
     int auth;
     int auth;
-#if CONFIG_VNC_TLS
+#ifdef CONFIG_VNC_TLS
     int subauth;
     int subauth;
     int x509verify;
     int x509verify;
 
 
@@ -152,7 +152,7 @@ struct VncState
 #endif
 #endif
     char challenge[VNC_AUTH_CHALLENGE_SIZE];
     char challenge[VNC_AUTH_CHALLENGE_SIZE];
 
 
-#if CONFIG_VNC_TLS
+#ifdef CONFIG_VNC_TLS
     int wiremode;
     int wiremode;
     gnutls_session_t tls_session;
     gnutls_session_t tls_session;
 #endif
 #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->input);
 	buffer_reset(&vs->output);
 	buffer_reset(&vs->output);
 	vs->need_update = 0;
 	vs->need_update = 0;
-#if CONFIG_VNC_TLS
+#ifdef CONFIG_VNC_TLS
 	if (vs->tls_session) {
 	if (vs->tls_session) {
 	    gnutls_deinit(vs->tls_session);
 	    gnutls_deinit(vs->tls_session);
 	    vs->tls_session = NULL;
 	    vs->tls_session = NULL;
@@ -684,7 +684,7 @@ static void vnc_client_write(void *opaque)
     long ret;
     long ret;
     VncState *vs = opaque;
     VncState *vs = opaque;
 
 
-#if CONFIG_VNC_TLS
+#ifdef CONFIG_VNC_TLS
     if (vs->tls_session) {
     if (vs->tls_session) {
 	ret = gnutls_write(vs->tls_session, vs->output.buffer, vs->output.offset);
 	ret = gnutls_write(vs->tls_session, vs->output.buffer, vs->output.offset);
 	if (ret < 0) {
 	if (ret < 0) {
@@ -722,7 +722,7 @@ static void vnc_client_read(void *opaque)
 
 
     buffer_reserve(&vs->input, 4096);
     buffer_reserve(&vs->input, 4096);
 
 
-#if CONFIG_VNC_TLS
+#ifdef CONFIG_VNC_TLS
     if (vs->tls_session) {
     if (vs->tls_session) {
 	ret = gnutls_read(vs->tls_session, buffer_end(&vs->input), 4096);
 	ret = gnutls_read(vs->tls_session, buffer_end(&vs->input), 4096);
 	if (ret < 0) {
 	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]);
 	    (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,
 static ssize_t vnc_tls_push(gnutls_transport_ptr_t transport,
                             const void *data,
                             const void *data,
                             size_t len) {
                             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
 #define DH_BITS 1024
 static gnutls_dh_params_t dh_params;
 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");
            VNC_DEBUG("Start VNC auth\n");
            return start_auth_vnc(vs);
            return start_auth_vnc(vs);
 
 
-#if CONFIG_VNC_TLS
+#ifdef CONFIG_VNC_TLS
        case VNC_AUTH_VENCRYPT:
        case VNC_AUTH_VENCRYPT:
            VNC_DEBUG("Accept VeNCrypt auth\n");;
            VNC_DEBUG("Accept VeNCrypt auth\n");;
            return start_auth_vencrypt(vs);
            return start_auth_vencrypt(vs);
@@ -2030,7 +2030,7 @@ void vnc_display_init(DisplayState *ds)
     vnc_dpy_resize(vs->ds, 640, 400);
     vnc_dpy_resize(vs->ds, 640, 400);
 }
 }
 
 
-#if CONFIG_VNC_TLS
+#ifdef CONFIG_VNC_TLS
 static int vnc_set_x509_credential(VncState *vs,
 static int vnc_set_x509_credential(VncState *vs,
 				   const char *certdir,
 				   const char *certdir,
 				   const char *filename,
 				   const char *filename,
@@ -2107,7 +2107,7 @@ void vnc_display_close(DisplayState *ds)
 	buffer_reset(&vs->input);
 	buffer_reset(&vs->input);
 	buffer_reset(&vs->output);
 	buffer_reset(&vs->output);
 	vs->need_update = 0;
 	vs->need_update = 0;
-#if CONFIG_VNC_TLS
+#ifdef CONFIG_VNC_TLS
 	if (vs->tls_session) {
 	if (vs->tls_session) {
 	    gnutls_deinit(vs->tls_session);
 	    gnutls_deinit(vs->tls_session);
 	    vs->tls_session = NULL;
 	    vs->tls_session = NULL;
@@ -2116,7 +2116,7 @@ void vnc_display_close(DisplayState *ds)
 #endif /* CONFIG_VNC_TLS */
 #endif /* CONFIG_VNC_TLS */
     }
     }
     vs->auth = VNC_AUTH_INVALID;
     vs->auth = VNC_AUTH_INVALID;
-#if CONFIG_VNC_TLS
+#ifdef CONFIG_VNC_TLS
     vs->subauth = VNC_AUTH_INVALID;
     vs->subauth = VNC_AUTH_INVALID;
     vs->x509verify = 0;
     vs->x509verify = 0;
 #endif
 #endif
@@ -2152,7 +2152,7 @@ int vnc_display_open(DisplayState *ds, const char *display)
     const char *options;
     const char *options;
     int password = 0;
     int password = 0;
     int reverse = 0;
     int reverse = 0;
-#if CONFIG_VNC_TLS
+#ifdef CONFIG_VNC_TLS
     int tls = 0, x509 = 0;
     int tls = 0, x509 = 0;
 #endif
 #endif
 
 
@@ -2170,7 +2170,7 @@ int vnc_display_open(DisplayState *ds, const char *display)
 	    password = 1; /* Require password auth */
 	    password = 1; /* Require password auth */
 	} else if (strncmp(options, "reverse", 7) == 0) {
 	} else if (strncmp(options, "reverse", 7) == 0) {
 	    reverse = 1;
 	    reverse = 1;
-#if CONFIG_VNC_TLS
+#ifdef CONFIG_VNC_TLS
 	} else if (strncmp(options, "tls", 3) == 0) {
 	} else if (strncmp(options, "tls", 3) == 0) {
 	    tls = 1; /* Require TLS */
 	    tls = 1; /* Require TLS */
 	} else if (strncmp(options, "x509", 4) == 0) {
 	} else if (strncmp(options, "x509", 4) == 0) {
@@ -2208,7 +2208,7 @@ int vnc_display_open(DisplayState *ds, const char *display)
     }
     }
 
 
     if (password) {
     if (password) {
-#if CONFIG_VNC_TLS
+#ifdef CONFIG_VNC_TLS
 	if (tls) {
 	if (tls) {
 	    vs->auth = VNC_AUTH_VENCRYPT;
 	    vs->auth = VNC_AUTH_VENCRYPT;
 	    if (x509) {
 	    if (x509) {
@@ -2222,12 +2222,12 @@ int vnc_display_open(DisplayState *ds, const char *display)
 #endif
 #endif
 	    VNC_DEBUG("Initializing VNC server with password auth\n");
 	    VNC_DEBUG("Initializing VNC server with password auth\n");
 	    vs->auth = VNC_AUTH_VNC;
 	    vs->auth = VNC_AUTH_VNC;
-#if CONFIG_VNC_TLS
+#ifdef CONFIG_VNC_TLS
 	    vs->subauth = VNC_AUTH_INVALID;
 	    vs->subauth = VNC_AUTH_INVALID;
 	}
 	}
 #endif
 #endif
     } else {
     } else {
-#if CONFIG_VNC_TLS
+#ifdef CONFIG_VNC_TLS
 	if (tls) {
 	if (tls) {
 	    vs->auth = VNC_AUTH_VENCRYPT;
 	    vs->auth = VNC_AUTH_VENCRYPT;
 	    if (x509) {
 	    if (x509) {
@@ -2241,7 +2241,7 @@ int vnc_display_open(DisplayState *ds, const char *display)
 #endif
 #endif
 	    VNC_DEBUG("Initializing VNC server with no auth\n");
 	    VNC_DEBUG("Initializing VNC server with no auth\n");
 	    vs->auth = VNC_AUTH_NONE;
 	    vs->auth = VNC_AUTH_NONE;
-#if CONFIG_VNC_TLS
+#ifdef CONFIG_VNC_TLS
 	    vs->subauth = VNC_AUTH_INVALID;
 	    vs->subauth = VNC_AUTH_INVALID;
 	}
 	}
 #endif
 #endif