Skip to content

Commit

Permalink
Replace gcc variadic macro extension with C99 version
Browse files Browse the repository at this point in the history
Signed-off-by: Blue Swirl <[email protected]>
  • Loading branch information
blueswirl committed May 13, 2009
1 parent 4cfce48 commit 001faf3
Show file tree
Hide file tree
Showing 70 changed files with 268 additions and 268 deletions.
6 changes: 3 additions & 3 deletions block-raw-posix.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,10 @@

//#define DEBUG_BLOCK
#if defined(DEBUG_BLOCK)
#define DEBUG_BLOCK_PRINT(formatCstr, args...) do { if (qemu_log_enabled()) \
{ qemu_log(formatCstr, ##args); qemu_log_flush(); } } while (0)
#define DEBUG_BLOCK_PRINT(formatCstr, ...) do { if (qemu_log_enabled()) \
{ qemu_log(formatCstr, ## __VA_ARGS__); qemu_log_flush(); } } while (0)
#else
#define DEBUG_BLOCK_PRINT(formatCstr, args...)
#define DEBUG_BLOCK_PRINT(formatCstr, ...)
#endif

/* OS X does not have O_DSYNC */
Expand Down
12 changes: 6 additions & 6 deletions darwin-user/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -158,12 +158,12 @@ int ppc_dcr_write (ppc_dcr_t *dcr_env, int dcrn, target_ulong val)
return -1;
}

#define EXCP_DUMP(env, fmt, args...) \
do { \
fprintf(stderr, fmt , ##args); \
cpu_dump_state(env, stderr, fprintf, 0); \
qemu_log(fmt, ##args); \
log_cpu_state(env, 0); \
#define EXCP_DUMP(env, fmt, ...) \
do { \
fprintf(stderr, fmt , ## __VA_ARGS__); \
cpu_dump_state(env, stderr, fprintf, 0); \
qemu_log(fmt, ## __VA_ARGS__); \
log_cpu_state(env, 0); \
} while (0)

void cpu_loop(CPUPPCState *env)
Expand Down
18 changes: 9 additions & 9 deletions darwin-user/syscall.c
Original file line number Diff line number Diff line change
Expand Up @@ -627,15 +627,15 @@ static inline void byteswap_winsize(struct winsize *w)
tswap16s(&w->ws_ypixel);
}

#define STRUCT(name, list...) STRUCT_ ## name,
#define STRUCT(name, ...) STRUCT_ ## name,
#define STRUCT_SPECIAL(name) STRUCT_ ## name,
enum {
#include "ioctls_types.h"
};
#undef STRUCT
#undef STRUCT_SPECIAL

#define STRUCT(name, list...) const argtype struct_ ## name ## _def[] = { list, TYPE_NULL };
#define STRUCT(name, ...) const argtype struct_ ## name ## _def[] = { __VA_ARGS__, TYPE_NULL };
#define STRUCT_SPECIAL(name)
#include "ioctls_types.h"
#undef STRUCT
Expand All @@ -656,8 +656,8 @@ typedef struct IOCTLEntry {
#define MAX_STRUCT_SIZE 4096

static IOCTLEntry ioctl_entries[] = {
#define IOCTL(cmd, access, types...) \
{ cmd, cmd, #cmd, access, { types } },
#define IOCTL(cmd, access, ...) \
{ cmd, cmd, #cmd, access, { __VA_ARGS__ } },
#include "ioctls.h"
{ 0, 0, },
};
Expand Down Expand Up @@ -898,10 +898,10 @@ typedef long (*syscall_function_t)(void *cpu_env, int num);
#define WRAPPER_CALL_DIRECT_6(function, _arg1, _arg2, _arg3, _arg4, _arg5, _arg6) long __qemu_##function(void *cpu_env) { int i = 0; typeof(_arg1) arg1 = _arg1; typeof(_arg2) arg2 = _arg2; typeof(_arg3) arg3 = _arg3; typeof(_arg4) arg4 = _arg4; typeof(_arg5) arg5 = _arg5; typeof(_arg6) arg6 = _arg6; return (long)function(arg1, arg2, arg3, arg4, arg5, arg6); }
#define WRAPPER_CALL_DIRECT_7(function, _arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7) long __qemu_##function(void *cpu_env) { int i = 0; typeof(_arg1) arg1 = _arg1; typeof(_arg2) arg2 = _arg2; typeof(_arg3) arg3 = _arg3; typeof(_arg4) arg4 = _arg4; typeof(_arg5) arg5 = _arg5; typeof(_arg6) arg6 = _arg6; typeof(_arg7) arg7 = _arg7; return (long)function(arg1, arg2, arg3, arg4, arg5, arg6, arg7); }
#define WRAPPER_CALL_DIRECT_8(function, _arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8) long __qemu_##function(void *cpu_env) { int i = 0; typeof(_arg1) arg1 = _arg1; typeof(_arg2) arg2 = _arg2; typeof(_arg3) arg3 = _arg3; typeof(_arg4) arg4 = _arg4; typeof(_arg5) arg5 = _arg5; typeof(_arg6) arg6 = _arg6; typeof(_arg7) arg7 = _arg7; typeof(_arg8) arg8 = _arg8; return (long)function(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8); }
#define WRAPPER_CALL_DIRECT(function, nargs, args...) WRAPPER_CALL_DIRECT_##nargs(function, args)
#define WRAPPER_CALL_NOERRNO(function, nargs, args...) WRAPPER_CALL_DIRECT(function, nargs, args)
#define WRAPPER_CALL_INDIRECT(function, nargs, args...)
#define ENTRY(name, number, function, nargs, call_type, args...) WRAPPER_##call_type(function, nargs, args)
#define WRAPPER_CALL_DIRECT(function, nargs, ...) WRAPPER_CALL_DIRECT_##nargs(function, __VA_ARGS__)
#define WRAPPER_CALL_NOERRNO(function, nargs, ...) WRAPPER_CALL_DIRECT(function, nargs, __VA_ARGS__)
#define WRAPPER_CALL_INDIRECT(function, nargs, ...)
#define ENTRY(name, number, function, nargs, call_type, ...) WRAPPER_##call_type(function, nargs, __VA_ARGS__)

#include "syscalls.h"

Expand All @@ -926,7 +926,7 @@ typedef long (*syscall_function_t)(void *cpu_env, int num);
#define ENTRY_CALL_DIRECT(name, number, function, nargs, call_type) _ENTRY(name, number, __qemu_##function, nargs, call_type)
#define ENTRY_CALL_NOERRNO(name, number, function, nargs, call_type) ENTRY_CALL_DIRECT(name, number, function, nargs, call_type)
#define ENTRY_CALL_INDIRECT(name, number, function, nargs, call_type) _ENTRY(name, number, function, nargs, call_type)
#define ENTRY(name, number, function, nargs, call_type, args...) ENTRY_##call_type(name, number, function, nargs, call_type)
#define ENTRY(name, number, function, nargs, call_type, ...) ENTRY_##call_type(name, number, function, nargs, call_type)

#define CALL_DIRECT 1
#define CALL_INDIRECT 2
Expand Down
6 changes: 3 additions & 3 deletions hw/adb.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@
//#define DEBUG_ADB

#ifdef DEBUG_ADB
#define ADB_DPRINTF(fmt, args...) \
do { printf("ADB: " fmt , ##args); } while (0)
#define ADB_DPRINTF(fmt, ...) \
do { printf("ADB: " fmt , ## __VA_ARGS__); } while (0)
#else
#define ADB_DPRINTF(fmt, args...)
#define ADB_DPRINTF(fmt, ...)
#endif

/* ADB commands */
Expand Down
6 changes: 3 additions & 3 deletions hw/apb_pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@
//#define DEBUG_APB

#ifdef DEBUG_APB
#define APB_DPRINTF(fmt, args...) \
do { printf("APB: " fmt , ##args); } while (0)
#define APB_DPRINTF(fmt, ...) \
do { printf("APB: " fmt , ## __VA_ARGS__); } while (0)
#else
#define APB_DPRINTF(fmt, args...)
#define APB_DPRINTF(fmt, ...)
#endif

typedef target_phys_addr_t pci_addr_t;
Expand Down
6 changes: 3 additions & 3 deletions hw/arm_gic.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
//#define DEBUG_GIC

#ifdef DEBUG_GIC
#define DPRINTF(fmt, args...) \
do { printf("arm_gic: " fmt , ##args); } while (0)
#define DPRINTF(fmt, ...) \
do { printf("arm_gic: " fmt , ## __VA_ARGS__); } while (0)
#else
#define DPRINTF(fmt, args...) do {} while(0)
#define DPRINTF(fmt, ...) do {} while(0)
#endif

#ifdef NVIC
Expand Down
6 changes: 3 additions & 3 deletions hw/cs4231.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ typedef struct CSState {
#define CS_CDC_VER 0x8a

#ifdef DEBUG_CS
#define DPRINTF(fmt, args...) \
do { printf("CS: " fmt , ##args); } while (0)
#define DPRINTF(fmt, ...) \
do { printf("CS: " fmt , ## __VA_ARGS__); } while (0)
#else
#define DPRINTF(fmt, args...)
#define DPRINTF(fmt, ...)
#endif

static void cs_reset(void *opaque)
Expand Down
6 changes: 3 additions & 3 deletions hw/cuda.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@
//#define DEBUG_CUDA_PACKET

#ifdef DEBUG_CUDA
#define CUDA_DPRINTF(fmt, args...) \
do { printf("CUDA: " fmt , ##args); } while (0)
#define CUDA_DPRINTF(fmt, ...) \
do { printf("CUDA: " fmt , ## __VA_ARGS__); } while (0)
#else
#define CUDA_DPRINTF(fmt, args...)
#define CUDA_DPRINTF(fmt, ...)
#endif

/* Bits in B data register: all active low */
Expand Down
10 changes: 5 additions & 5 deletions hw/dp8393x.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@
#endif

#ifdef DEBUG_SONIC
#define DPRINTF(fmt, args...) \
do { printf("sonic: " fmt , ##args); } while (0)
#define DPRINTF(fmt, ...) \
do { printf("sonic: " fmt , ## __VA_ARGS__); } while (0)
static const char* reg_names[] = {
"CR", "DCR", "RCR", "TCR", "IMR", "ISR", "UTDA", "CTDA",
"TPS", "TFC", "TSA0", "TSA1", "TFS", "URDA", "CRDA", "CRBA0",
Expand All @@ -46,11 +46,11 @@ static const char* reg_names[] = {
"0x30", "0x31", "0x32", "0x33", "0x34", "0x35", "0x36", "0x37",
"0x38", "0x39", "0x3a", "0x3b", "0x3c", "0x3d", "0x3e", "DCR2" };
#else
#define DPRINTF(fmt, args...) do {} while (0)
#define DPRINTF(fmt, ...) do {} while (0)
#endif

#define SONIC_ERROR(fmt, args...) \
do { printf("sonic ERROR: %s: " fmt, __func__ , ##args); } while (0)
#define SONIC_ERROR(fmt, ...) \
do { printf("sonic ERROR: %s: " fmt, __func__ , ## __VA_ARGS__); } while (0)

#define SONIC_CR 0x00
#define SONIC_DCR 0x01
Expand Down
6 changes: 3 additions & 3 deletions hw/eccmemctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@
//#define DEBUG_ECC

#ifdef DEBUG_ECC
#define DPRINTF(fmt, args...) \
do { printf("ECC: " fmt , ##args); } while (0)
#define DPRINTF(fmt, ...) \
do { printf("ECC: " fmt , ## __VA_ARGS__); } while (0)
#else
#define DPRINTF(fmt, args...)
#define DPRINTF(fmt, ...)
#endif

/* There are 3 versions of this chip used in SMP sun4m systems:
Expand Down
4 changes: 2 additions & 2 deletions hw/eepro100.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@
//~ #define DEBUG_EEPRO100

#ifdef DEBUG_EEPRO100
#define logout(fmt, args...) fprintf(stderr, "EE100\t%-24s" fmt, __func__, ##args)
#define logout(fmt, ...) fprintf(stderr, "EE100\t%-24s" fmt, __func__, ## __VA_ARGS__)
#else
#define logout(fmt, args...) ((void)0)
#define logout(fmt, ...) ((void)0)
#endif

/* Set flags to 0 to disable debug output. */
Expand Down
4 changes: 2 additions & 2 deletions hw/eeprom93xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@
//~ #define DEBUG_EEPROM

#ifdef DEBUG_EEPROM
#define logout(fmt, args...) fprintf(stderr, "EEPROM\t%-24s" fmt, __func__, ##args)
#define logout(fmt, ...) fprintf(stderr, "EEPROM\t%-24s" fmt, __func__, ## __VA_ARGS__)
#else
#define logout(fmt, args...) ((void)0)
#define logout(fmt, ...) ((void)0)
#endif

#define EEPROM_INSTANCE 0
Expand Down
18 changes: 9 additions & 9 deletions hw/escc.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,22 +62,22 @@
*/

#ifdef DEBUG_SERIAL
#define SER_DPRINTF(fmt, args...) \
do { printf("SER: " fmt , ##args); } while (0)
#define SER_DPRINTF(fmt, ...) \
do { printf("SER: " fmt , ## __VA_ARGS__); } while (0)
#else
#define SER_DPRINTF(fmt, args...)
#define SER_DPRINTF(fmt, ...)
#endif
#ifdef DEBUG_KBD
#define KBD_DPRINTF(fmt, args...) \
do { printf("KBD: " fmt , ##args); } while (0)
#define KBD_DPRINTF(fmt, ...) \
do { printf("KBD: " fmt , ## __VA_ARGS__); } while (0)
#else
#define KBD_DPRINTF(fmt, args...)
#define KBD_DPRINTF(fmt, ...)
#endif
#ifdef DEBUG_MOUSE
#define MS_DPRINTF(fmt, args...) \
do { printf("MSC: " fmt , ##args); } while (0)
#define MS_DPRINTF(fmt, ...) \
do { printf("MSC: " fmt , ## __VA_ARGS__); } while (0)
#else
#define MS_DPRINTF(fmt, args...)
#define MS_DPRINTF(fmt, ...)
#endif

typedef enum {
Expand Down
10 changes: 5 additions & 5 deletions hw/esp.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,14 @@
*/

#ifdef DEBUG_ESP
#define DPRINTF(fmt, args...) \
do { printf("ESP: " fmt , ##args); } while (0)
#define DPRINTF(fmt, ...) \
do { printf("ESP: " fmt , ## __VA_ARGS__); } while (0)
#else
#define DPRINTF(fmt, args...) do {} while (0)
#define DPRINTF(fmt, ...) do {} while (0)
#endif

#define ESP_ERROR(fmt, args...) \
do { printf("ESP ERROR: %s: " fmt, __func__ , ##args); } while (0)
#define ESP_ERROR(fmt, ...) \
do { printf("ESP ERROR: %s: " fmt, __func__ , ## __VA_ARGS__); } while (0)

#define ESP_REGS 16
#define TI_BUFSZ 16
Expand Down
10 changes: 5 additions & 5 deletions hw/fdc.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,14 @@
//#define DEBUG_FLOPPY

#ifdef DEBUG_FLOPPY
#define FLOPPY_DPRINTF(fmt, args...) \
do { printf("FLOPPY: " fmt , ##args); } while (0)
#define FLOPPY_DPRINTF(fmt, ...) \
do { printf("FLOPPY: " fmt , ## __VA_ARGS__); } while (0)
#else
#define FLOPPY_DPRINTF(fmt, args...)
#define FLOPPY_DPRINTF(fmt, ...)
#endif

#define FLOPPY_ERROR(fmt, args...) \
do { printf("FLOPPY ERROR: %s: " fmt, __func__ , ##args); } while (0)
#define FLOPPY_ERROR(fmt, ...) \
do { printf("FLOPPY ERROR: %s: " fmt, __func__ , ## __VA_ARGS__); } while (0)

/********************************************************/
/* Floppy drive emulation */
Expand Down
6 changes: 3 additions & 3 deletions hw/fw_cfg.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@
//#define DEBUG_FW_CFG

#ifdef DEBUG_FW_CFG
#define FW_CFG_DPRINTF(fmt, args...) \
do { printf("FW_CFG: " fmt , ##args); } while (0)
#define FW_CFG_DPRINTF(fmt, ...) \
do { printf("FW_CFG: " fmt , ## __VA_ARGS__); } while (0)
#else
#define FW_CFG_DPRINTF(fmt, args...)
#define FW_CFG_DPRINTF(fmt, ...)
#endif

#define FW_CFG_SIZE 2
Expand Down
10 changes: 5 additions & 5 deletions hw/g364fb.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@
//#define DEBUG_G364

#ifdef DEBUG_G364
#define DPRINTF(fmt, args...) \
do { printf("g364: " fmt , ##args); } while (0)
#define DPRINTF(fmt, ...) \
do { printf("g364: " fmt , ## __VA_ARGS__); } while (0)
#else
#define DPRINTF(fmt, args...) do {} while (0)
#define DPRINTF(fmt, ...) do {} while (0)
#endif
#define BADF(fmt, args...) \
do { fprintf(stderr, "g364 ERROR: " fmt , ##args);} while (0)
#define BADF(fmt, ...) \
do { fprintf(stderr, "g364 ERROR: " fmt , ## __VA_ARGS__);} while (0)

typedef struct G364State {
/* hardware */
Expand Down
6 changes: 3 additions & 3 deletions hw/grackle_pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@
//#define DEBUG_GRACKLE

#ifdef DEBUG_GRACKLE
#define GRACKLE_DPRINTF(fmt, args...) \
do { printf("GRACKLE: " fmt , ##args); } while (0)
#define GRACKLE_DPRINTF(fmt, ...) \
do { printf("GRACKLE: " fmt , ## __VA_ARGS__); } while (0)
#else
#define GRACKLE_DPRINTF(fmt, args...)
#define GRACKLE_DPRINTF(fmt, ...)
#endif

typedef target_phys_addr_t pci_addr_t;
Expand Down
6 changes: 3 additions & 3 deletions hw/heathrow_pic.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@
//#define DEBUG_PIC

#ifdef DEBUG_PIC
#define PIC_DPRINTF(fmt, args...) \
do { printf("PIC: " fmt , ##args); } while (0)
#define PIC_DPRINTF(fmt, ...) \
do { printf("PIC: " fmt , ## __VA_ARGS__); } while (0)
#else
#define PIC_DPRINTF(fmt, args...)
#define PIC_DPRINTF(fmt, ...)
#endif

typedef struct HeathrowPIC {
Expand Down
6 changes: 3 additions & 3 deletions hw/iommu.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@
//#define DEBUG_IOMMU

#ifdef DEBUG_IOMMU
#define DPRINTF(fmt, args...) \
do { printf("IOMMU: " fmt , ##args); } while (0)
#define DPRINTF(fmt, ...) \
do { printf("IOMMU: " fmt , ## __VA_ARGS__); } while (0)
#else
#define DPRINTF(fmt, args...)
#define DPRINTF(fmt, ...)
#endif

#define IOMMU_NREGS (4*4096/4)
Expand Down
14 changes: 7 additions & 7 deletions hw/lsi53c895a.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@
//#define DEBUG_LSI_REG

#ifdef DEBUG_LSI
#define DPRINTF(fmt, args...) \
do { printf("lsi_scsi: " fmt , ##args); } while (0)
#define BADF(fmt, args...) \
do { fprintf(stderr, "lsi_scsi: error: " fmt , ##args); exit(1);} while (0)
#define DPRINTF(fmt, ...) \
do { printf("lsi_scsi: " fmt , ## __VA_ARGS__); } while (0)
#define BADF(fmt, ...) \
do { fprintf(stderr, "lsi_scsi: error: " fmt , ## __VA_ARGS__); exit(1);} while (0)
#else
#define DPRINTF(fmt, args...) do {} while(0)
#define BADF(fmt, args...) \
do { fprintf(stderr, "lsi_scsi: error: " fmt , ##args);} while (0)
#define DPRINTF(fmt, ...) do {} while(0)
#define BADF(fmt, ...) \
do { fprintf(stderr, "lsi_scsi: error: " fmt , ## __VA_ARGS__);} while (0)
#endif

#define LSI_SCNTL0_TRG 0x01
Expand Down
Loading

0 comments on commit 001faf3

Please sign in to comment.