Commit eb38c52c2a6df76928c1a4760bc87d21b256e22a
1 parent
5bfd5521
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
Showing
14 changed files
with
67 additions
and
64 deletions
elf.h
... | ... | @@ -1123,6 +1123,7 @@ typedef struct elf64_note { |
1123 | 1123 | Elf64_Word n_type; /* Content type */ |
1124 | 1124 | } Elf64_Nhdr; |
1125 | 1125 | |
1126 | +#ifdef ELF_CLASS | |
1126 | 1127 | #if ELF_CLASS == ELFCLASS32 |
1127 | 1128 | |
1128 | 1129 | #define elfhdr elf32_hdr |
... | ... | @@ -1165,5 +1166,7 @@ typedef struct elf64_note { |
1165 | 1166 | # endif |
1166 | 1167 | #endif |
1167 | 1168 | |
1169 | +#endif /* ELF_CLASS */ | |
1170 | + | |
1168 | 1171 | |
1169 | 1172 | #endif /* _QEMU_ELF_H */ | ... | ... |
exec.c
... | ... | @@ -2259,7 +2259,7 @@ static uint32_t unassigned_mem_readb(void *opaque, target_phys_addr_t addr) |
2259 | 2259 | #endif |
2260 | 2260 | #ifdef TARGET_SPARC |
2261 | 2261 | do_unassigned_access(addr, 0, 0, 0); |
2262 | -#elif TARGET_CRIS | |
2262 | +#elif defined(TARGET_CRIS) | |
2263 | 2263 | do_unassigned_access(addr, 0, 0, 0); |
2264 | 2264 | #endif |
2265 | 2265 | return 0; |
... | ... | @@ -2272,7 +2272,7 @@ static void unassigned_mem_writeb(void *opaque, target_phys_addr_t addr, uint32_ |
2272 | 2272 | #endif |
2273 | 2273 | #ifdef TARGET_SPARC |
2274 | 2274 | do_unassigned_access(addr, 1, 0, 0); |
2275 | -#elif TARGET_CRIS | |
2275 | +#elif defined(TARGET_CRIS) | |
2276 | 2276 | do_unassigned_access(addr, 1, 0, 0); |
2277 | 2277 | #endif |
2278 | 2278 | } | ... | ... |
hw/omap1.c
... | ... | @@ -3478,7 +3478,7 @@ static void omap_rtc_write(void *opaque, target_phys_addr_t addr, |
3478 | 3478 | |
3479 | 3479 | switch (offset) { |
3480 | 3480 | case 0x00: /* SECONDS_REG */ |
3481 | -#if ALMDEBUG | |
3481 | +#ifdef ALMDEBUG | |
3482 | 3482 | printf("RTC SEC_REG <-- %02x\n", value); |
3483 | 3483 | #endif |
3484 | 3484 | s->ti -= s->current_tm.tm_sec; |
... | ... | @@ -3486,7 +3486,7 @@ static void omap_rtc_write(void *opaque, target_phys_addr_t addr, |
3486 | 3486 | return; |
3487 | 3487 | |
3488 | 3488 | case 0x04: /* MINUTES_REG */ |
3489 | -#if ALMDEBUG | |
3489 | +#ifdef ALMDEBUG | |
3490 | 3490 | printf("RTC MIN_REG <-- %02x\n", value); |
3491 | 3491 | #endif |
3492 | 3492 | s->ti -= s->current_tm.tm_min * 60; |
... | ... | @@ -3494,7 +3494,7 @@ static void omap_rtc_write(void *opaque, target_phys_addr_t addr, |
3494 | 3494 | return; |
3495 | 3495 | |
3496 | 3496 | case 0x08: /* HOURS_REG */ |
3497 | -#if ALMDEBUG | |
3497 | +#ifdef ALMDEBUG | |
3498 | 3498 | printf("RTC HRS_REG <-- %02x\n", value); |
3499 | 3499 | #endif |
3500 | 3500 | s->ti -= s->current_tm.tm_hour * 3600; |
... | ... | @@ -3506,7 +3506,7 @@ static void omap_rtc_write(void *opaque, target_phys_addr_t addr, |
3506 | 3506 | return; |
3507 | 3507 | |
3508 | 3508 | case 0x0c: /* DAYS_REG */ |
3509 | -#if ALMDEBUG | |
3509 | +#ifdef ALMDEBUG | |
3510 | 3510 | printf("RTC DAY_REG <-- %02x\n", value); |
3511 | 3511 | #endif |
3512 | 3512 | s->ti -= s->current_tm.tm_mday * 86400; |
... | ... | @@ -3514,7 +3514,7 @@ static void omap_rtc_write(void *opaque, target_phys_addr_t addr, |
3514 | 3514 | return; |
3515 | 3515 | |
3516 | 3516 | case 0x10: /* MONTHS_REG */ |
3517 | -#if ALMDEBUG | |
3517 | +#ifdef ALMDEBUG | |
3518 | 3518 | printf("RTC MTH_REG <-- %02x\n", value); |
3519 | 3519 | #endif |
3520 | 3520 | 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, |
3533 | 3533 | return; |
3534 | 3534 | |
3535 | 3535 | case 0x14: /* YEARS_REG */ |
3536 | -#if ALMDEBUG | |
3536 | +#ifdef ALMDEBUG | |
3537 | 3537 | printf("RTC YRS_REG <-- %02x\n", value); |
3538 | 3538 | #endif |
3539 | 3539 | 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, |
3555 | 3555 | return; /* Ignored */ |
3556 | 3556 | |
3557 | 3557 | case 0x20: /* ALARM_SECONDS_REG */ |
3558 | -#if ALMDEBUG | |
3558 | +#ifdef ALMDEBUG | |
3559 | 3559 | printf("ALM SEC_REG <-- %02x\n", value); |
3560 | 3560 | #endif |
3561 | 3561 | 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, |
3563 | 3563 | return; |
3564 | 3564 | |
3565 | 3565 | case 0x24: /* ALARM_MINUTES_REG */ |
3566 | -#if ALMDEBUG | |
3566 | +#ifdef ALMDEBUG | |
3567 | 3567 | printf("ALM MIN_REG <-- %02x\n", value); |
3568 | 3568 | #endif |
3569 | 3569 | 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, |
3571 | 3571 | return; |
3572 | 3572 | |
3573 | 3573 | case 0x28: /* ALARM_HOURS_REG */ |
3574 | -#if ALMDEBUG | |
3574 | +#ifdef ALMDEBUG | |
3575 | 3575 | printf("ALM HRS_REG <-- %02x\n", value); |
3576 | 3576 | #endif |
3577 | 3577 | if (s->pm_am) |
... | ... | @@ -3584,7 +3584,7 @@ static void omap_rtc_write(void *opaque, target_phys_addr_t addr, |
3584 | 3584 | return; |
3585 | 3585 | |
3586 | 3586 | case 0x2c: /* ALARM_DAYS_REG */ |
3587 | -#if ALMDEBUG | |
3587 | +#ifdef ALMDEBUG | |
3588 | 3588 | printf("ALM DAY_REG <-- %02x\n", value); |
3589 | 3589 | #endif |
3590 | 3590 | 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, |
3592 | 3592 | return; |
3593 | 3593 | |
3594 | 3594 | case 0x30: /* ALARM_MONTHS_REG */ |
3595 | -#if ALMDEBUG | |
3595 | +#ifdef ALMDEBUG | |
3596 | 3596 | printf("ALM MON_REG <-- %02x\n", value); |
3597 | 3597 | #endif |
3598 | 3598 | 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, |
3600 | 3600 | return; |
3601 | 3601 | |
3602 | 3602 | case 0x34: /* ALARM_YEARS_REG */ |
3603 | -#if ALMDEBUG | |
3603 | +#ifdef ALMDEBUG | |
3604 | 3604 | printf("ALM YRS_REG <-- %02x\n", value); |
3605 | 3605 | #endif |
3606 | 3606 | 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, |
3608 | 3608 | return; |
3609 | 3609 | |
3610 | 3610 | case 0x40: /* RTC_CTRL_REG */ |
3611 | -#if ALMDEBUG | |
3611 | +#ifdef ALMDEBUG | |
3612 | 3612 | printf("RTC CONTROL <-- %02x\n", value); |
3613 | 3613 | #endif |
3614 | 3614 | s->pm_am = (value >> 3) & 1; |
... | ... | @@ -3620,7 +3620,7 @@ static void omap_rtc_write(void *opaque, target_phys_addr_t addr, |
3620 | 3620 | return; |
3621 | 3621 | |
3622 | 3622 | case 0x44: /* RTC_STATUS_REG */ |
3623 | -#if ALMDEBUG | |
3623 | +#ifdef ALMDEBUG | |
3624 | 3624 | printf("RTC STATUSL <-- %02x\n", value); |
3625 | 3625 | #endif |
3626 | 3626 | s->status &= ~((value & 0xc0) ^ 0x80); |
... | ... | @@ -3628,14 +3628,14 @@ static void omap_rtc_write(void *opaque, target_phys_addr_t addr, |
3628 | 3628 | return; |
3629 | 3629 | |
3630 | 3630 | case 0x48: /* RTC_INTERRUPTS_REG */ |
3631 | -#if ALMDEBUG | |
3631 | +#ifdef ALMDEBUG | |
3632 | 3632 | printf("RTC INTRS <-- %02x\n", value); |
3633 | 3633 | #endif |
3634 | 3634 | s->interrupts = value; |
3635 | 3635 | return; |
3636 | 3636 | |
3637 | 3637 | case 0x4c: /* RTC_COMP_LSB_REG */ |
3638 | -#if ALMDEBUG | |
3638 | +#ifdef ALMDEBUG | |
3639 | 3639 | printf("RTC COMPLSB <-- %02x\n", value); |
3640 | 3640 | #endif |
3641 | 3641 | s->comp_reg &= 0xff00; |
... | ... | @@ -3643,7 +3643,7 @@ static void omap_rtc_write(void *opaque, target_phys_addr_t addr, |
3643 | 3643 | return; |
3644 | 3644 | |
3645 | 3645 | case 0x50: /* RTC_COMP_MSB_REG */ |
3646 | -#if ALMDEBUG | |
3646 | +#ifdef ALMDEBUG | |
3647 | 3647 | printf("RTC COMPMSB <-- %02x\n", value); |
3648 | 3648 | #endif |
3649 | 3649 | s->comp_reg &= 0x00ff; | ... | ... |
hw/pc.c
... | ... | @@ -76,7 +76,7 @@ uint64_t cpu_get_tsc(CPUX86State *env) |
76 | 76 | /* Note: when using kqemu, it is more logical to return the host TSC |
77 | 77 | because kqemu does not trap the RDTSC instruction for |
78 | 78 | performance reasons */ |
79 | -#if USE_KQEMU | |
79 | +#ifdef USE_KQEMU | |
80 | 80 | if (env->kqemu_enabled) { |
81 | 81 | return cpu_get_real_ticks(); |
82 | 82 | } else | ... | ... |
hw/rtl8139.c
... | ... | @@ -3356,7 +3356,7 @@ static inline int64_t rtl8139_get_next_tctr_time(RTL8139State *s, int64_t curren |
3356 | 3356 | return next_time; |
3357 | 3357 | } |
3358 | 3358 | |
3359 | -#if RTL8139_ONBOARD_TIMER | |
3359 | +#ifdef RTL8139_ONBOARD_TIMER | |
3360 | 3360 | static void rtl8139_timer(void *opaque) |
3361 | 3361 | { |
3362 | 3362 | RTL8139State *s = opaque; |
... | ... | @@ -3456,7 +3456,7 @@ void pci_rtl8139_init(PCIBus *bus, NICInfo *nd, int devfn) |
3456 | 3456 | |
3457 | 3457 | register_savevm("rtl8139", -1, 3, rtl8139_save, rtl8139_load, s); |
3458 | 3458 | |
3459 | -#if RTL8139_ONBOARD_TIMER | |
3459 | +#ifdef RTL8139_ONBOARD_TIMER | |
3460 | 3460 | s->timer = qemu_new_timer(vm_clock, rtl8139_timer, s); |
3461 | 3461 | |
3462 | 3462 | qemu_mod_timer(s->timer, | ... | ... |
hw/usb-net.c
... | ... | @@ -1069,7 +1069,7 @@ static int usb_net_handle_control(USBDevice *dev, int request, int value, |
1069 | 1069 | case ClassInterfaceOutRequest | USB_CDC_SEND_ENCAPSULATED_COMMAND: |
1070 | 1070 | if (!s->rndis || value || index != 0) |
1071 | 1071 | goto fail; |
1072 | -#if TRAFFIC_DEBUG | |
1072 | +#ifdef TRAFFIC_DEBUG | |
1073 | 1073 | { |
1074 | 1074 | unsigned int i; |
1075 | 1075 | fprintf(stderr, "SEND_ENCAPSULATED_COMMAND:"); |
... | ... | @@ -1092,7 +1092,7 @@ static int usb_net_handle_control(USBDevice *dev, int request, int value, |
1092 | 1092 | data[0] = 0; |
1093 | 1093 | ret = 1; |
1094 | 1094 | } |
1095 | -#if TRAFFIC_DEBUG | |
1095 | +#ifdef TRAFFIC_DEBUG | |
1096 | 1096 | { |
1097 | 1097 | unsigned int i; |
1098 | 1098 | fprintf(stderr, "GET_ENCAPSULATED_RESPONSE:"); |
... | ... | @@ -1219,7 +1219,7 @@ static int usb_net_handle_statusin(USBNetState *s, USBPacket *p) |
1219 | 1219 | if (!s->rndis_resp.tqh_first) |
1220 | 1220 | ret = USB_RET_NAK; |
1221 | 1221 | |
1222 | -#if DEBUG | |
1222 | +#ifdef TRAFFIC_DEBUG | |
1223 | 1223 | fprintf(stderr, "usbnet: interrupt poll len %u return %d", p->len, ret); |
1224 | 1224 | { |
1225 | 1225 | int i; |
... | ... | @@ -1260,7 +1260,7 @@ static int usb_net_handle_datain(USBNetState *s, USBPacket *p) |
1260 | 1260 | s->in_ptr = s->in_len = 0; |
1261 | 1261 | } |
1262 | 1262 | |
1263 | -#if TRAFFIC_DEBUG | |
1263 | +#ifdef TRAFFIC_DEBUG | |
1264 | 1264 | fprintf(stderr, "usbnet: data in len %u return %d", p->len, ret); |
1265 | 1265 | { |
1266 | 1266 | int i; |
... | ... | @@ -1285,7 +1285,7 @@ static int usb_net_handle_dataout(USBNetState *s, USBPacket *p) |
1285 | 1285 | (struct rndis_packet_msg_type *) s->out_buf; |
1286 | 1286 | uint32_t len; |
1287 | 1287 | |
1288 | -#if TRAFFIC_DEBUG | |
1288 | +#ifdef TRAFFIC_DEBUG | |
1289 | 1289 | fprintf(stderr, "usbnet: data out len %u\n", p->len); |
1290 | 1290 | { |
1291 | 1291 | int i; | ... | ... |
hw/usb-ohci.c
... | ... | @@ -1598,7 +1598,7 @@ static void usb_ohci_init(OHCIState *ohci, int num_ports, int devfn, |
1598 | 1598 | int i; |
1599 | 1599 | |
1600 | 1600 | if (usb_frame_time == 0) { |
1601 | -#if OHCI_TIME_WARP | |
1601 | +#ifdef OHCI_TIME_WARP | |
1602 | 1602 | usb_frame_time = ticks_per_sec; |
1603 | 1603 | usb_bit_time = muldiv64(1, ticks_per_sec, USB_HZ/1000); |
1604 | 1604 | #else | ... | ... |
linux-user/arm/nwfpe/fpa11.c
... | ... | @@ -54,7 +54,7 @@ void resetFPA11(void) |
54 | 54 | fpa11->fpsr = FP_EMULATOR | BIT_AC; |
55 | 55 | |
56 | 56 | /* FPCR: set SB, AB and DA bits, clear all others */ |
57 | -#if MAINTAIN_FPCR | |
57 | +#ifdef MAINTAIN_FPCR | |
58 | 58 | fpa11->fpcr = MASK_RESET; |
59 | 59 | #endif |
60 | 60 | } |
... | ... | @@ -64,7 +64,7 @@ void SetRoundingMode(const unsigned int opcode) |
64 | 64 | int rounding_mode; |
65 | 65 | FPA11 *fpa11 = GET_FPA11(); |
66 | 66 | |
67 | -#if MAINTAIN_FPCR | |
67 | +#ifdef MAINTAIN_FPCR | |
68 | 68 | fpa11->fpcr &= ~MASK_ROUNDING_MODE; |
69 | 69 | #endif |
70 | 70 | switch (opcode & MASK_ROUNDING_MODE) |
... | ... | @@ -72,28 +72,28 @@ void SetRoundingMode(const unsigned int opcode) |
72 | 72 | default: |
73 | 73 | case ROUND_TO_NEAREST: |
74 | 74 | rounding_mode = float_round_nearest_even; |
75 | -#if MAINTAIN_FPCR | |
75 | +#ifdef MAINTAIN_FPCR | |
76 | 76 | fpa11->fpcr |= ROUND_TO_NEAREST; |
77 | 77 | #endif |
78 | 78 | break; |
79 | 79 | |
80 | 80 | case ROUND_TO_PLUS_INFINITY: |
81 | 81 | rounding_mode = float_round_up; |
82 | -#if MAINTAIN_FPCR | |
82 | +#ifdef MAINTAIN_FPCR | |
83 | 83 | fpa11->fpcr |= ROUND_TO_PLUS_INFINITY; |
84 | 84 | #endif |
85 | 85 | break; |
86 | 86 | |
87 | 87 | case ROUND_TO_MINUS_INFINITY: |
88 | 88 | rounding_mode = float_round_down; |
89 | -#if MAINTAIN_FPCR | |
89 | +#ifdef MAINTAIN_FPCR | |
90 | 90 | fpa11->fpcr |= ROUND_TO_MINUS_INFINITY; |
91 | 91 | #endif |
92 | 92 | break; |
93 | 93 | |
94 | 94 | case ROUND_TO_ZERO: |
95 | 95 | rounding_mode = float_round_to_zero; |
96 | -#if MAINTAIN_FPCR | |
96 | +#ifdef MAINTAIN_FPCR | |
97 | 97 | fpa11->fpcr |= ROUND_TO_ZERO; |
98 | 98 | #endif |
99 | 99 | break; |
... | ... | @@ -105,28 +105,28 @@ void SetRoundingPrecision(const unsigned int opcode) |
105 | 105 | { |
106 | 106 | int rounding_precision; |
107 | 107 | FPA11 *fpa11 = GET_FPA11(); |
108 | -#if MAINTAIN_FPCR | |
108 | +#ifdef MAINTAIN_FPCR | |
109 | 109 | fpa11->fpcr &= ~MASK_ROUNDING_PRECISION; |
110 | 110 | #endif |
111 | 111 | switch (opcode & MASK_ROUNDING_PRECISION) |
112 | 112 | { |
113 | 113 | case ROUND_SINGLE: |
114 | 114 | rounding_precision = 32; |
115 | -#if MAINTAIN_FPCR | |
115 | +#ifdef MAINTAIN_FPCR | |
116 | 116 | fpa11->fpcr |= ROUND_SINGLE; |
117 | 117 | #endif |
118 | 118 | break; |
119 | 119 | |
120 | 120 | case ROUND_DOUBLE: |
121 | 121 | rounding_precision = 64; |
122 | -#if MAINTAIN_FPCR | |
122 | +#ifdef MAINTAIN_FPCR | |
123 | 123 | fpa11->fpcr |= ROUND_DOUBLE; |
124 | 124 | #endif |
125 | 125 | break; |
126 | 126 | |
127 | 127 | case ROUND_EXTENDED: |
128 | 128 | rounding_precision = 80; |
129 | -#if MAINTAIN_FPCR | |
129 | +#ifdef MAINTAIN_FPCR | |
130 | 130 | fpa11->fpcr |= ROUND_EXTENDED; |
131 | 131 | #endif |
132 | 132 | break; | ... | ... |
linux-user/main.c
... | ... | @@ -282,7 +282,7 @@ static void write_dt(void *ptr, unsigned long addr, unsigned long limit, |
282 | 282 | p[1] = tswap32(e2); |
283 | 283 | } |
284 | 284 | |
285 | -#if TARGET_X86_64 | |
285 | +#ifdef TARGET_X86_64 | |
286 | 286 | uint64_t idt_table[512]; |
287 | 287 | |
288 | 288 | static void set_gate64(void *ptr, unsigned int type, unsigned int dpl, | ... | ... |
mips-dis.c
... | ... | @@ -3302,7 +3302,7 @@ set_default_mips_dis_options (struct disassemble_info *info) |
3302 | 3302 | #endif |
3303 | 3303 | |
3304 | 3304 | /* Set ISA, architecture, and cp0 register names as best we can. */ |
3305 | -#if ! SYMTAB_AVAILABLE && 0 | |
3305 | +#if !defined(SYMTAB_AVAILABLE) && 0 | |
3306 | 3306 | /* This is running out on a target machine, not in a host tool. |
3307 | 3307 | FIXME: Where does mips_target_info come from? */ |
3308 | 3308 | target_processor = mips_target_info.processor; | ... | ... |
slirp/ip_icmp.c
... | ... | @@ -228,7 +228,7 @@ icmp_error(msrc, type, code, minsize, message) |
228 | 228 | /* check msrc */ |
229 | 229 | if(!msrc) goto end_error; |
230 | 230 | ip = mtod(msrc, struct ip *); |
231 | -#if DEBUG | |
231 | +#ifdef DEBUG | |
232 | 232 | { char bufa[20], bufb[20]; |
233 | 233 | strcpy(bufa, inet_ntoa(ip->ip_src)); |
234 | 234 | strcpy(bufb, inet_ntoa(ip->ip_dst)); |
... | ... | @@ -285,7 +285,7 @@ icmp_error(msrc, type, code, minsize, message) |
285 | 285 | HTONS(icp->icmp_ip.ip_id); |
286 | 286 | HTONS(icp->icmp_ip.ip_off); |
287 | 287 | |
288 | -#if DEBUG | |
288 | +#ifdef DEBUG | |
289 | 289 | if(message) { /* DEBUG : append message to ICMP packet */ |
290 | 290 | int message_len; |
291 | 291 | char *cpnt; | ... | ... |
slirp/slirp.h
target-i386/op_helper.c
... | ... | @@ -1217,7 +1217,7 @@ void do_interrupt(int intno, int is_int, int error_code, |
1217 | 1217 | } |
1218 | 1218 | } |
1219 | 1219 | if (env->cr[0] & CR0_PE_MASK) { |
1220 | -#if TARGET_X86_64 | |
1220 | +#ifdef TARGET_X86_64 | |
1221 | 1221 | if (env->hflags & HF_LMA_MASK) { |
1222 | 1222 | do_interrupt64(intno, is_int, error_code, next_eip, is_hw); |
1223 | 1223 | } else | ... | ... |
vnc.c
... | ... | @@ -35,14 +35,14 @@ |
35 | 35 | #include "keymaps.c" |
36 | 36 | #include "d3des.h" |
37 | 37 | |
38 | -#if CONFIG_VNC_TLS | |
38 | +#ifdef CONFIG_VNC_TLS | |
39 | 39 | #include <gnutls/gnutls.h> |
40 | 40 | #include <gnutls/x509.h> |
41 | 41 | #endif /* CONFIG_VNC_TLS */ |
42 | 42 | |
43 | 43 | // #define _VNC_DEBUG 1 |
44 | 44 | |
45 | -#if _VNC_DEBUG | |
45 | +#ifdef _VNC_DEBUG | |
46 | 46 | #define VNC_DEBUG(fmt, ...) do { fprintf(stderr, fmt, ## __VA_ARGS__); } while (0) |
47 | 47 | |
48 | 48 | #if CONFIG_VNC_TLS && _VNC_DEBUG >= 2 |
... | ... | @@ -93,7 +93,7 @@ enum { |
93 | 93 | VNC_AUTH_VENCRYPT = 19 |
94 | 94 | }; |
95 | 95 | |
96 | -#if CONFIG_VNC_TLS | |
96 | +#ifdef CONFIG_VNC_TLS | |
97 | 97 | enum { |
98 | 98 | VNC_WIREMODE_CLEAR, |
99 | 99 | VNC_WIREMODE_TLS, |
... | ... | @@ -141,7 +141,7 @@ struct VncState |
141 | 141 | char *display; |
142 | 142 | char *password; |
143 | 143 | int auth; |
144 | -#if CONFIG_VNC_TLS | |
144 | +#ifdef CONFIG_VNC_TLS | |
145 | 145 | int subauth; |
146 | 146 | int x509verify; |
147 | 147 | |
... | ... | @@ -152,7 +152,7 @@ struct VncState |
152 | 152 | #endif |
153 | 153 | char challenge[VNC_AUTH_CHALLENGE_SIZE]; |
154 | 154 | |
155 | -#if CONFIG_VNC_TLS | |
155 | +#ifdef CONFIG_VNC_TLS | |
156 | 156 | int wiremode; |
157 | 157 | gnutls_session_t tls_session; |
158 | 158 | #endif |
... | ... | @@ -662,7 +662,7 @@ static int vnc_client_io_error(VncState *vs, int ret, int last_errno) |
662 | 662 | buffer_reset(&vs->input); |
663 | 663 | buffer_reset(&vs->output); |
664 | 664 | vs->need_update = 0; |
665 | -#if CONFIG_VNC_TLS | |
665 | +#ifdef CONFIG_VNC_TLS | |
666 | 666 | if (vs->tls_session) { |
667 | 667 | gnutls_deinit(vs->tls_session); |
668 | 668 | vs->tls_session = NULL; |
... | ... | @@ -684,7 +684,7 @@ static void vnc_client_write(void *opaque) |
684 | 684 | long ret; |
685 | 685 | VncState *vs = opaque; |
686 | 686 | |
687 | -#if CONFIG_VNC_TLS | |
687 | +#ifdef CONFIG_VNC_TLS | |
688 | 688 | if (vs->tls_session) { |
689 | 689 | ret = gnutls_write(vs->tls_session, vs->output.buffer, vs->output.offset); |
690 | 690 | if (ret < 0) { |
... | ... | @@ -722,7 +722,7 @@ static void vnc_client_read(void *opaque) |
722 | 722 | |
723 | 723 | buffer_reserve(&vs->input, 4096); |
724 | 724 | |
725 | -#if CONFIG_VNC_TLS | |
725 | +#ifdef CONFIG_VNC_TLS | |
726 | 726 | if (vs->tls_session) { |
727 | 727 | ret = gnutls_read(vs->tls_session, buffer_end(&vs->input), 4096); |
728 | 728 | if (ret < 0) { |
... | ... | @@ -829,7 +829,7 @@ static uint32_t read_u32(uint8_t *data, size_t offset) |
829 | 829 | (data[offset + 2] << 8) | data[offset + 3]); |
830 | 830 | } |
831 | 831 | |
832 | -#if CONFIG_VNC_TLS | |
832 | +#ifdef CONFIG_VNC_TLS | |
833 | 833 | static ssize_t vnc_tls_push(gnutls_transport_ptr_t transport, |
834 | 834 | const void *data, |
835 | 835 | size_t len) { |
... | ... | @@ -1439,7 +1439,7 @@ static int start_auth_vnc(VncState *vs) |
1439 | 1439 | } |
1440 | 1440 | |
1441 | 1441 | |
1442 | -#if CONFIG_VNC_TLS | |
1442 | +#ifdef CONFIG_VNC_TLS | |
1443 | 1443 | #define DH_BITS 1024 |
1444 | 1444 | static gnutls_dh_params_t dh_params; |
1445 | 1445 | |
... | ... | @@ -1877,7 +1877,7 @@ static int protocol_client_auth(VncState *vs, uint8_t *data, size_t len) |
1877 | 1877 | VNC_DEBUG("Start VNC auth\n"); |
1878 | 1878 | return start_auth_vnc(vs); |
1879 | 1879 | |
1880 | -#if CONFIG_VNC_TLS | |
1880 | +#ifdef CONFIG_VNC_TLS | |
1881 | 1881 | case VNC_AUTH_VENCRYPT: |
1882 | 1882 | VNC_DEBUG("Accept VeNCrypt auth\n");; |
1883 | 1883 | return start_auth_vencrypt(vs); |
... | ... | @@ -2030,7 +2030,7 @@ void vnc_display_init(DisplayState *ds) |
2030 | 2030 | vnc_dpy_resize(vs->ds, 640, 400); |
2031 | 2031 | } |
2032 | 2032 | |
2033 | -#if CONFIG_VNC_TLS | |
2033 | +#ifdef CONFIG_VNC_TLS | |
2034 | 2034 | static int vnc_set_x509_credential(VncState *vs, |
2035 | 2035 | const char *certdir, |
2036 | 2036 | const char *filename, |
... | ... | @@ -2107,7 +2107,7 @@ void vnc_display_close(DisplayState *ds) |
2107 | 2107 | buffer_reset(&vs->input); |
2108 | 2108 | buffer_reset(&vs->output); |
2109 | 2109 | vs->need_update = 0; |
2110 | -#if CONFIG_VNC_TLS | |
2110 | +#ifdef CONFIG_VNC_TLS | |
2111 | 2111 | if (vs->tls_session) { |
2112 | 2112 | gnutls_deinit(vs->tls_session); |
2113 | 2113 | vs->tls_session = NULL; |
... | ... | @@ -2116,7 +2116,7 @@ void vnc_display_close(DisplayState *ds) |
2116 | 2116 | #endif /* CONFIG_VNC_TLS */ |
2117 | 2117 | } |
2118 | 2118 | vs->auth = VNC_AUTH_INVALID; |
2119 | -#if CONFIG_VNC_TLS | |
2119 | +#ifdef CONFIG_VNC_TLS | |
2120 | 2120 | vs->subauth = VNC_AUTH_INVALID; |
2121 | 2121 | vs->x509verify = 0; |
2122 | 2122 | #endif |
... | ... | @@ -2152,7 +2152,7 @@ int vnc_display_open(DisplayState *ds, const char *display) |
2152 | 2152 | const char *options; |
2153 | 2153 | int password = 0; |
2154 | 2154 | int reverse = 0; |
2155 | -#if CONFIG_VNC_TLS | |
2155 | +#ifdef CONFIG_VNC_TLS | |
2156 | 2156 | int tls = 0, x509 = 0; |
2157 | 2157 | #endif |
2158 | 2158 | |
... | ... | @@ -2170,7 +2170,7 @@ int vnc_display_open(DisplayState *ds, const char *display) |
2170 | 2170 | password = 1; /* Require password auth */ |
2171 | 2171 | } else if (strncmp(options, "reverse", 7) == 0) { |
2172 | 2172 | reverse = 1; |
2173 | -#if CONFIG_VNC_TLS | |
2173 | +#ifdef CONFIG_VNC_TLS | |
2174 | 2174 | } else if (strncmp(options, "tls", 3) == 0) { |
2175 | 2175 | tls = 1; /* Require TLS */ |
2176 | 2176 | } else if (strncmp(options, "x509", 4) == 0) { |
... | ... | @@ -2208,7 +2208,7 @@ int vnc_display_open(DisplayState *ds, const char *display) |
2208 | 2208 | } |
2209 | 2209 | |
2210 | 2210 | if (password) { |
2211 | -#if CONFIG_VNC_TLS | |
2211 | +#ifdef CONFIG_VNC_TLS | |
2212 | 2212 | if (tls) { |
2213 | 2213 | vs->auth = VNC_AUTH_VENCRYPT; |
2214 | 2214 | if (x509) { |
... | ... | @@ -2222,12 +2222,12 @@ int vnc_display_open(DisplayState *ds, const char *display) |
2222 | 2222 | #endif |
2223 | 2223 | VNC_DEBUG("Initializing VNC server with password auth\n"); |
2224 | 2224 | vs->auth = VNC_AUTH_VNC; |
2225 | -#if CONFIG_VNC_TLS | |
2225 | +#ifdef CONFIG_VNC_TLS | |
2226 | 2226 | vs->subauth = VNC_AUTH_INVALID; |
2227 | 2227 | } |
2228 | 2228 | #endif |
2229 | 2229 | } else { |
2230 | -#if CONFIG_VNC_TLS | |
2230 | +#ifdef CONFIG_VNC_TLS | |
2231 | 2231 | if (tls) { |
2232 | 2232 | vs->auth = VNC_AUTH_VENCRYPT; |
2233 | 2233 | if (x509) { |
... | ... | @@ -2241,7 +2241,7 @@ int vnc_display_open(DisplayState *ds, const char *display) |
2241 | 2241 | #endif |
2242 | 2242 | VNC_DEBUG("Initializing VNC server with no auth\n"); |
2243 | 2243 | vs->auth = VNC_AUTH_NONE; |
2244 | -#if CONFIG_VNC_TLS | |
2244 | +#ifdef CONFIG_VNC_TLS | |
2245 | 2245 | vs->subauth = VNC_AUTH_INVALID; |
2246 | 2246 | } |
2247 | 2247 | #endif | ... | ... |