tools: use C99 __VA_ARGS__
PATCH 1/1 tools: use C99 __VA_ARGS__
Hi!
Attached patch switches tools to consistently use C99 __VA_ARGS__.
Signature · 6 lines
---to satisfy European Law for business letters: Advanced Micro Devices GmbH Karl-Hammerschmidt-Str. 34, 85609 Dornach b. Muenchen Geschaeftsfuehrer: Thomas M. McCoy, Giuliano Meroni Sitz: Dornach, Gemeinde Aschheim, Landkreis Muenchen Registergericht Muenchen, HRB Nr. 43632
tools/blktap/drivers/img2qcow.c +2 -2
@@ -42,9 +42,9 @@#include "blk.h" #if 1 -#define DFPRINTF(_f, _a...) fprintf ( stderr, _f , ## _a ) +#define DFPRINTF (_f, ...) fprintf ( stderr, _f , ##__VA_ARGS__)#else -#define DFPRINTF(_f, _a...) ((void)0) +#define DFPRINTF (_f, ...) ((void)0)#endif /* *BSD has no O_LARGEFILE */
tools/blktap/drivers/qcow-create.c +2 -2
@@ -41,9 +41,9 @@#include "tapdisk.h" #if 1 -#define DFPRINTF(_f, _a...) fprintf ( stderr, _f , ## _a ) +#define DFPRINTF (_f, ...) fprintf ( stderr, _f , ##__VA_ARGS__)#else -#define DFPRINTF(_f, _a...) ((void)0) +#define DFPRINTF (_f, ...) ((void)0)#endif #define MAX_NAME_LEN 1000
tools/blktap/drivers/qcow2raw.c +2 -2
@@ -43,9 +43,9 @@#include "blk.h" #if 1 -#define DFPRINTF(_f, _a...) fprintf ( stderr, _f , ## _a ) +#define DFPRINTF (_f, ...) fprintf ( stderr, _f , ##__VA_ARGS__)#else -#define DFPRINTF(_f, _a...) ((void)0) +#define DFPRINTF (_f, ...) ((void)0)#endif
tools/blktap/drivers/tapdisk.h +2 -2
@@ -63,9 +63,9 @@/*If enabled, log all debug messages to syslog*/ #if 1 -#define DPRINTF(_f, _a...) syslog( LOG_DEBUG, __FILE__ ":%d: " _f , __LINE__, ## _a ) +#define DPRINTF (_f, ...) syslog( LOG_DEBUG, __FILE__ ":%d: " _f , __LINE__, ##__VA_ARGS__)#else -#define DPRINTF(_f, _a...) ((void)0) +#define DPRINTF (_f, ...) ((void)0)#endif /* Things disks need to know about, these should probably be in a higher-level
tools/blktap/lib/blkif.c +2 -2
@@ -39,9 +39,9 @@#include "blktaplib.h" #if 0 -#define DPRINTF(_f, _a...) printf ( _f , ## _a ) +#define DPRINTF (_f, ...) printf ( _f , ##__VA_ARGS__)#else -#define DPRINTF(_f, _a...) ((void)0) +#define DPRINTF (_f, ...) ((void)0)#endif #define BLKIF_HASHSZ 1024
tools/blktap/lib/xenbus.c +2 -2
@@ -54,9 +54,9 @@#include "xs_api.h" #if 0 -#define DPRINTF(_f, _a...) printf ( _f , ## _a ) +#define DPRINTF (_f, ...) printf ( _f , ##__VA_ARGS__)#else -#define DPRINTF(_f, _a...) ((void)0) +#define DPRINTF (_f, ...) ((void)0)#endif struct backend_info
tools/blktap/lib/xs_api.c +2 -2
@@ -48,9 +48,9 @@#include "xs_api.h" #if 0 -#define DPRINTF(_f, _a...) printf ( _f , ## _a ) +#define DPRINTF (_f, ...) printf ( _f , ##__VA_ARGS__)#else -#define DPRINTF(_f, _a...) ((void)0) +#define DPRINTF (_f, ...) ((void)0)#endif static LIST_HEAD (watches);
tools/blktap2/drivers/block-cache.c +3 -3
@@ -38,12 +38,12 @@#include "tapdisk-interface.h" #ifdef DEBUG -#define DBG(_f, _a...) tlog_write(TLOG_DBG, _f, ##_a) +#define DBG (_f, ...) tlog_write(TLOG_DBG, _f, ##__VA_ARGS__)#else -#define DBG(_f, _a...) ((void)0) +#define DBG (_f, ...) ((void)0)#endif -#define WARN(_f, _a...) tlog_write(TLOG_WARN, _f, ##_a) +#define WARN (_f, ...) tlog_write(TLOG_WARN, _f, ##__VA_ARGS__)#define RADIX_TREE_PAGE_SHIFT 12/* 4K pages */ #define RADIX_TREE_PAGE_SIZE (1 << RADIX_TREE_PAGE_SHIFT)
tools/blktap2/drivers/block-log.c +2 -2
@@ -78,9 +78,9 @@ struct tdlog_state {log_back_ring_t bring; }; -#define BDPRINTF(_f, _a...) syslog (LOG_DEBUG, "log: " _f "\n", ## _a) +#define BDPRINTF (_f, ...) syslog (LOG_DEBUG, "log: " _f "\n", ##__VA_ARGS__) -#define BWPRINTF(_f, _a...) syslog (LOG_WARNING, "log: " _f "\n", ## _a) +#define BWPRINTF (_f, ...) syslog (LOG_WARNING, "log: " _f "\n", ##__VA_ARGS__)static void ctl_accept (event_id_t ,char ,void *);static void ctl_request (event_id_t ,char ,void *);
tools/blktap2/drivers/block-vhd.c +9 -9
@@ -88,17 +88,17 @@ unsigned int SPB; }#if (DEBUGGING ==1 ) - #define DBG(level, _f, _a...) DPRINTF(_f, ##_a) - #define ERR(err, _f, _a...) DPRINTF("ERROR: %d: " _f, err, ##_a) -#define TRACE (s) ((void)0) +#define DBG (level, _f, ...) DPRINTF(_f, ##__VA_ARGS__) +#define ERR (err, _f, ...) DPRINTF("ERROR: %d: " _f, err, ##__VA_ARGS__) +#define TRACE (s) ((void)0)#elif (DEBUGGING ==2 ) - #define DBG(level, _f, _a...) tlog_write(level, _f, ##_a) - #define ERR(err, _f, _a...) tlog_error(err, _f, ##_a) -#define TRACE (s) __TRACE(s) +#define DBG (level, _f, ...) tlog_write(level, _f, ##__VA_ARGS__) +#define ERR (err, _f, ...) tlog_error(err, _f, ##__VA_ARGS__) +#define TRACE (s) __TRACE(s)#else - #define DBG(level, _f, _a...) ((void)0) - #define ERR(err, _f, _a...) ((void)0) -#define TRACE (s) ((void)0) +#define DBG (level, _f, ...) ((void)0) +#define ERR (err, _f, ...) ((void)0) +#define TRACE (s) ((void)0)#endif #if (ASSERTING ==1 )
tools/blktap2/drivers/img2qcow.c +2 -2
@@ -54,9 +54,9 @@#if 1 -#define DFPRINTF(_f, _a...) fprintf ( stderr, _f , ## _a ) +#define DFPRINTF (_f, ...) fprintf ( stderr, _f , ##__VA_ARGS__)#else -#define DFPRINTF(_f, _a...) ((void)0) +#define DFPRINTF (_f, ...) ((void)0)#endif /* *BSD has no O_LARGEFILE */
tools/blktap2/drivers/io-optimize.c +3 -3
@@ -37,11 +37,11 @@#include "tapdisk-log.h" #if (!defined(TEST ) && defined(DEBUG )) -#define DBG(ctx, f, a...) tlog_write(TLOG_DBG, f, ##a) +#define DBG (ctx, f, ...) tlog_write(TLOG_DBG, f, ##__VA_ARGS__)#elif defined(TEST ) -#define DBG(ctx, f, a...) printf(f, ##a) +#define DBG (ctx, f, ...) printf(f, ##__VA_ARGS__)#else -#define DBG(ctx, f, a...) ((void)0) +#define DBG (ctx, f, ...) ((void)0)#endif static void print_merged_iocbs(struct opioctx *ctx,
tools/blktap2/drivers/lock.c +2 -2
@@ -52,9 +52,9 @@#define RETRY_MAX 16#if defined(LOGS ) -#define LOG(format, args...) printf("%d: ", __LINE__); printf(format, ## args) +#define LOG (format, ...) printf("%d: ", __LINE__); printf(format, ##__VA_ARGS__)#else -#define LOG(format, args...) +#define LOG (format, ...)#endif /* random wait - up to .5 seconds */
tools/blktap2/drivers/qcow-create.c +2 -2
@@ -42,9 +42,9 @@#include "qcow.h" #if 1 -#define DFPRINTF(_f, _a...) fprintf ( stderr, _f , ## _a ) +#define DFPRINTF (_f, ...) fprintf ( stderr, _f , ##__VA_ARGS__)#else -#define DFPRINTF(_f, _a...) ((void)0) +#define DFPRINTF (_f, ...) ((void)0)#endif #define MAX_NAME_LEN 1000
tools/blktap2/drivers/qcow2raw.c +2 -2
@@ -50,9 +50,9 @@#include "qcow.h" #if 1 -#define DFPRINTF(_f, _a...) fprintf ( stderr, _f , ## _a ) +#define DFPRINTF (_f, ...) fprintf ( stderr, _f , ##__VA_ARGS__)#else -#define DFPRINTF(_f, _a...) ((void)0) +#define DFPRINTF (_f, ...) ((void)0)#endif
tools/blktap2/drivers/scheduler.c +1 -1
@@ -34,7 +34,7 @@#include "scheduler.h" #include "tapdisk-log.h" -#define DBG(_f, _a...) tlog_write(TLOG_DBG, _f, ##_a) +#define DBG (_f, ...) tlog_write(TLOG_DBG, _f, ##__VA_ARGS__)#define SCHEDULER_MAX_TIMEOUT 600#define SCHEDULER_POLL_FD (SCHEDULER_POLL_READ_FD | \
tools/blktap2/drivers/tapdisk-client.c +2 -2
@@ -42,9 +42,9 @@#include "log.h" -#define BDPRINTF(_f, _a...) fprintf (stderr, "log: " _f "\n", ## _a) +#define BDPRINTF (_f, ...) fprintf (stderr, "log: " _f "\n", ##__VA_ARGS__) -#define BWPRINTF(_f, _a...) fprintf (stderr, "log: " _f "\n", ## _a) +#define BWPRINTF (_f, ...) fprintf (stderr, "log: " _f "\n", ##__VA_ARGS__)struct writelog {char * shmpath;
tools/blktap2/drivers/tapdisk-filter.c +1 -1
@@ -42,7 +42,7 @@#define WRITE_INTEGRITY "buffer integrity failure after write"#define READ_INTEGRITY "disk integrity failure after read" -#define DBG(f, a...) tlog_write(TLOG_WARN, f, ##a) +#define DBG (f, ...) tlog_write(TLOG_WARN, f, ##__VA_ARGS__)/* * simulate IO errors by knocking request size to zero before
tools/blktap2/drivers/tapdisk-image.c +1 -1
@@ -33,7 +33,7 @@#include "tapdisk-driver.h" #include "tapdisk-server.h" -#define ERR(_err, _f, _a...) tlog_error(_err, _f, ##_a) +#define ERR (_err, _f, ...) tlog_error(_err, _f, ##__VA_ARGS__)td_image_t * tapdisk_image_allocate(char *file, int type, int storage,
tools/blktap2/drivers/tapdisk-log.h +4 -4
@@ -42,10 +42,10 @@ void __tlog_write(int level, const charvoid __tlog_error (int err,const char *func,const char *fmt, ...) __attribute__((format (printf,3 ,4 ))); -#define tlog_write(_level, _f, _a...) \ - __tlog_write(_level, __func__, _f, ##_a) +#define tlog_write (_level, _f, ...) \ + __tlog_write(_level, __func__, _f, ##__VA_ARGS__) -#define tlog_error(_err, _f, _a...) \ - __tlog_error(_err, __func__, _f, ##_a) +#define tlog_error (_err, _f, ...) \ + __tlog_error(_err, __func__, _f, ##__VA_ARGS__)#endif
tools/blktap2/drivers/tapdisk-queue.c +3 -3
@@ -37,9 +37,9 @@#include "tapdisk-filter.h" #include "atomicio.h" -#define WARN(_f, _a...) tlog_write(TLOG_WARN, _f, ##_a) -#define DBG(_f, _a...) tlog_write(TLOG_DBG, _f, ##_a) -#define ERR(_err, _f, _a...) tlog_error(_err, _f, ##_a) +#define WARN (_f, ...) tlog_write(TLOG_WARN, _f, ##__VA_ARGS__) +#define DBG (_f, ...) tlog_write(TLOG_DBG, _f, ##__VA_ARGS__) +#define ERR (_err, _f, ...) tlog_error(_err, _f, ##__VA_ARGS__)/* * We used a kernel patch to return an fd associated with the AIO context
tools/blktap2/drivers/tapdisk-server.c +2 -2
@@ -39,8 +39,8 @@#include "tapdisk-driver.h" #include "tapdisk-interface.h" -#define DBG(_level, _f, _a...) tlog_write(_level, _f, ##_a) -#define ERR(_err, _f, _a...) tlog_error(_err, _f, ##_a) +#define DBG (_level, _f, ...) tlog_write(_level, _f, ##__VA_ARGS__) +#define ERR (_err, _f, ...) tlog_error(_err, _f, ##__VA_ARGS__)tapdisk_server_t server;
tools/blktap2/drivers/tapdisk-vbd.c +2 -2
@@ -43,8 +43,8 @@#include "tapdisk-vbd.h" #include "blktap2.h" -#define DBG(_level, _f, _a...) tlog_write(_level, _f, ##_a) -#define ERR(_err, _f, _a...) tlog_error(_err, _f, ##_a) +#define DBG (_level, _f, ...) tlog_write(_level, _f, ##__VA_ARGS__) +#define ERR (_err, _f, ...) tlog_error(_err, _f, ##__VA_ARGS__)#if 1 #define ASSERT (p) \
tools/blktap2/drivers/tapdisk2.c +5 -5
@@ -43,18 +43,18 @@#define TAPDISK2_VBD 0 -#define cprintf(_err, _f, _a...) \ +#define cprintf (_err, _f, ...) \ do { \ if (child_out) { \ - fprintf(child_out, "%d: " _f, _err, ##_a); \ + fprintf(child_out, "%d: " _f, _err, ##__VA_ARGS__); \ fflush(child_out); \ } \ } while (0) -#define CHILD_ERR(_err, _f, _a...) \ +#define CHILD_ERR (_err, _f, ...) \ do { \ - EPRINTF(_f, ##_a); \ - cprintf(_err, _f, ##_a); \ + EPRINTF(_f, ##__VA_ARGS__); \ + cprintf(_err, _f, ##__VA_ARGS__); \ } while (0)static int channel[2 ];
tools/blktap2/drivers/td.c +2 -2
@@ -41,9 +41,9 @@#include "tapdisk-utils.h" #if 1 -#define DFPRINTF(_f, _a...) fprintf ( stdout, _f , ## _a ) +#define DFPRINTF (_f, ...) fprintf ( stdout, _f , ##__VA_ARGS__)#else -#define DFPRINTF(_f, _a...) ((void)0) +#define DFPRINTF (_f, ...) ((void)0)#endif typedef enum {
tools/blktap2/include/blktaplib.h +3 -3
@@ -37,12 +37,12 @@#include <xen/io/blkif.h> #if 1 -#define DPRINTF(_f, _a...) syslog(LOG_INFO, _f, ##_a) +#define DPRINTF (_f, ...) syslog(LOG_INFO, _f, ##__VA_ARGS__)#else -#define DPRINTF(_f, _a...) ((void)0) +#define DPRINTF (_f, ...) ((void)0)#endif -#define EPRINTF(_f, _a...) syslog(LOG_ERR, "tap-err:%s: " _f, __func__, ##_a) +#define EPRINTF (_f, ...) syslog(LOG_ERR, "tap-err:%s: " _f, __func__, ##__VA_ARGS__)#define BLK_RING_SIZE __RING_SIZE((blkif_sring_t *)0, XC_PAGE_SIZE)
tools/blktap2/include/relative-path.h +1 -1
@@ -32,7 +32,7 @@#define DELIMITER '/'#define MAX_NAME_LEN 1000 -#define EPRINTF(_f, _a...) syslog(LOG_ERR, "tap-err:%s: " _f, __func__, ##_a) +#define EPRINTF (_f, ...) syslog(LOG_ERR, "tap-err:%s: " _f, __func__, ##__VA_ARGS__)/* * returns a relative path from @src to @dest
tools/blktap2/vhd/lib/libvhd.c +2 -2
@@ -49,11 +49,11 @@ libvhd_set_log_level(int level) libvhd_dbg =1 ; } -#define VHDLOG(_f, _a...) \ +#define VHDLOG (_f, ...) \ do { \ if (libvhd_dbg) \ syslog(LOG_INFO, "libvhd::%s: "_f, \ - __func__, ##_a); \ + __func__, ##__VA_ARGS__); \ } while (0)#define BIT_MASK 0x80
tools/blktap2/vhd/lib/vhd-util-resize.c +5 -5
@@ -37,15 +37,15 @@#include "libvhd-journal.h" #if 1 -#define DFPRINTF(_f, _a...) fprintf(stdout, _f, ##_a) +#define DFPRINTF (_f, ...) fprintf(stdout, _f, ##__VA_ARGS__)#else -#define DFPRINTF(_f, _a...) ((void)0) +#define DFPRINTF (_f, ...) ((void)0)#endif -#define EPRINTF(_f, _a...) \ +#define EPRINTF (_f, ...) \ do { \ - syslog(LOG_INFO, "%s: " _f, __func__, ##_a); \ - DFPRINTF(_f, _a); \ + syslog(LOG_INFO, "%s: " _f, __func__, ##__VA_ARGS__); \ + DFPRINTF(_f, __VA_ARGS__); \ } while (0) typedef struct vhd_block {
tools/blktap2/vhd/vhd-util.c +2 -2
@@ -33,9 +33,9 @@#include "vhd-util.h" #if 1 -#define DFPRINTF(_f, _a...) fprintf(stdout, _f , ##_a) +#define DFPRINTF (_f, ...) fprintf(stdout, _f , ##__VA_ARGS__)#else -#define DFPRINTF(_f, _a...) ((void)0) +#define DFPRINTF (_f, ...) ((void)0)#endif typedef int (*vhd_util_func_t ) (int ,char **);
tools/firmware/rombios/32bit/32bitbios.c +1 -1
@@ -28,7 +28,7 @@ asm (" jmp *jumptable(,%eax,4) \n" " .data \n" "jumptable: \n" -#define X(idx, ret, fn, args...) " .long "#fn"\n" +#define X (idx, ret, fn, ...) " .long "#fn"\n"#include "32bitprotos.h" #undef X );
tools/firmware/rombios/32bit/pmm.c +2 -2
@@ -82,9 +82,9 @@ } else#if DEBUG_PMM -# define PMM_DEBUG(format, p...) printf("PMM " format, ##p) +# define PMM_DEBUG (format, ...) printf("PMM " format, ##__VA_ARGS__)#else -# define PMM_DEBUG(format, p...) +# define PMM_DEBUG (format, ...)#endif struct pmmAllocArgs {
tools/firmware/rombios/32bit/rombios_compat.h +1 -1
@@ -89,7 +89,7 @@ static inline void write_byte(Bit16u seg *addr = val; } -#define X(idx, ret, fn, args...) ret fn (args); +#define X (idx, ret, fn, ...) ret fn (__VA_ARGS__);#include "32bitprotos.h" #undef X
tools/firmware/rombios/32bitgateway.c +1 -1
@@ -172,6 +172,6 @@ MACRO DoUpcall jmp Upcall MEND -#define X(idx, ret, fn, args...) _ ## fn: DoUpcall(idx) +#define X (idx, ret, fn, ...) _ ## fn: DoUpcall(idx)#include "32bitprotos.h" #undef X
tools/firmware/rombios/rombios.c +28 -28
84 lines not on this page · raw message
tools/firmware/rombios/rombios.h +5 -5
@@ -41,18 +41,18 @@#define BIOS_PRINTF_ALL (BIOS_PRINTF_SCREEN | BIOS_PRINTF_INFO)#define BIOS_PRINTF_DEBHALT (BIOS_PRINTF_SCREEN | BIOS_PRINTF_INFO | BIOS_PRINTF_HALT) -#define printf(format, p...) bios_printf(BIOS_PRINTF_SCREEN, format, ##p) +#define printf (format, ...) bios_printf(BIOS_PRINTF_SCREEN, format, ##__VA_ARGS__)// Defines the output macros. // BX_DEBUG goes to INFO port until we can easily choose debug info on a // per-device basis. Debug info are sent only in debug mode #if DEBUG_ROMBIOS -# define BX_DEBUG(format, p...) bios_printf(BIOS_PRINTF_INFO, format, ##p) +# define BX_DEBUG (format, ...) bios_printf(BIOS_PRINTF_INFO, format, ##__VA_ARGS__)#else -# define BX_DEBUG(format, p...) +# define BX_DEBUG (format, ...)#endif -#define BX_INFO(format, p...) bios_printf(BIOS_PRINTF_INFO, format, ##p) -#define BX_PANIC(format, p...) bios_printf(BIOS_PRINTF_DEBHALT, format, ##p) +#define BX_INFO (format, ...) bios_printf(BIOS_PRINTF_INFO, format, ##__VA_ARGS__) +#define BX_PANIC (format, ...) bios_printf(BIOS_PRINTF_DEBHALT, format, ##__VA_ARGS__)#define ACPI_DATA_SIZE 0x00010000L#define PM_IO_BASE 0xb000
tools/libaio/src/syscall-alpha.h +3 -3
@@ -11,7 +11,7 @@ "$1", "$2", "$3", "$4", "$5", "$6", "$7", "$8", \ "$22", "$23", "$24", "$25", "$27", "$28", "memory" -#define inline_syscall0(name, args...) \ +#define inline_syscall0(name, ...) \ { \ register long _sc_0 inline_syscall_r0_asm; \ register long _sc_19 __asm__("$19"); \
@@ -166,10 +166,10 @@ _sc_ret = _sc_0, _sc_err = _sc_19; \ } -#define INLINE_SYSCALL1(name, nr, args...) \ +#define INLINE_SYSCALL1 (name, nr, ...) \ ({ \ long _sc_ret, _sc_err; \ - inline_syscall##nr(__NR_##name, args); \ + inline_syscall##nr(__NR_##name, __VA_ARGS__); \ if (_sc_err != 0) \ { \ _sc_ret = -(_sc_ret); \
tools/libaio/src/syscall-ppc.h +3 -3
@@ -13,7 +13,7 @@* an error return status). */ #ifndef __syscall_nr -#define __syscall_nr(nr, type, name, args...) \ +#define __syscall_nr (nr, type, name, ...) \ unsigned long __sc_ret, __sc_err; \ { \ register unsigned long __sc_0 __asm__ ("r0"); \
@@ -24,7 +24,7 @@ registerunsigned long __sc_7 __asm__ ("r7" ); \ registerunsigned long __sc_8 __asm__ ("r8" ); \ \ - __sc_loadargs_##nr(name, args); \ + __sc_loadargs_##nr(name, __VA_ARGS__); \ __asm__ __volatile__ \ ("sc \n\t" \ "mfcr %0 " \
@@ -42,7 +42,7 @@ return (type) __sc_ret#endif -#define __sc_loadargs_0(name, dummy...) \ +#define __sc_loadargs_0 (name, ...) \ __sc_0 = __NR_##name#define __sc_loadargs_1 (name, arg1) \ __sc_loadargs_0(name); \
tools/libxc/xc_dom.h +2 -2
@@ -190,8 +190,8 @@ int xc_dom_printf(const char *fmt, ...)int xc_dom_panic_func (const char *file,int line,xc_error_code err,const char *fmt, ...) __attribute__ ((format (printf,4 ,5 ))); -#define xc_dom_panic(err, fmt, args...) \ - xc_dom_panic_func(__FILE__, __LINE__, err, fmt, ## args) +#define xc_dom_panic (err, fmt, ...) \ + xc_dom_panic_func(__FILE__, __LINE__, err, fmt, ##__VA_ARGS__)#define xc_dom_trace (mark) \ xc_dom_printf("%s:%d: trace %s\n", __FILE__, __LINE__, mark)
tools/libxc/xc_private.h +9 -9
@@ -54,29 +54,29 @@#define MAX_PAGECACHE_USAGE (4*1024)#if INFO -#define IPRINTF(_f, _a...) printf(_f , ## _a) +#define IPRINTF (_f, ...) printf(_f , ##__VA_ARGS__)#else -#define IPRINTF(_f, _a...) ((void)0) +#define IPRINTF (_f, ...) ((void)0)#endif #if DEBUG -#define DPRINTF(_f, _a...) fprintf(stderr, _f , ## _a) +#define DPRINTF (_f, ...) fprintf(stderr, _f , ##__VA_ARGS__)#else -#define DPRINTF(_f, _a...) ((void)0) +#define DPRINTF (_f, ...) ((void)0)#endif #if PROGRESS -#define PPRINTF(_f, _a...) fprintf(stderr, _f , ## _a) +#define PPRINTF (_f, ...) fprintf(stderr, _f , ##__VA_ARGS__)#else -#define PPRINTF(_f, _a...) +#define PPRINTF (_f, ...)#endif char *safe_strerror (int errcode);void xc_set_error (int code,const char *fmt, ...); -#define ERROR(_m, _a...) xc_set_error(XC_INTERNAL_ERROR, _m , ## _a ) -#define PERROR(_m, _a...) xc_set_error(XC_INTERNAL_ERROR, _m " (%d = %s)", \ - ## _a , errno, safe_strerror(errno)) +#define ERROR (_m, ...) xc_set_error(XC_INTERNAL_ERROR, _m , ##__VA_ARGS__ ) +#define PERROR (_m, ...) xc_set_error(XC_INTERNAL_ERROR, _m " (%d = %s)", \ + ##__VA_ARGS__ , errno, safe_strerror(errno))int lock_pages (void *addr,size_t len);void unlock_pages (void *addr,size_t len);
tools/python/xen/lowlevel/acm/acm.c +2 -2
@@ -33,8 +33,8 @@#include <xen/xsm/acm.h> #include <xen/xsm/acm_ops.h> -#define PERROR(_m, _a...) \ -fprintf(stderr, "ERROR: " _m " (%d = %s)\n" , ## _a , \ +#define PERROR (_m, ...) \ +fprintf(stderr, "ERROR: " _m " (%d = %s)\n" , ##__VA_ARGS__, \ errno, strerror(errno))static PyObject *acm_error_obj;
tools/security/secpol_tool.c +2 -2
@@ -39,8 +39,8 @@#include <xenctrl.h> -#define PERROR(_m, _a...) \ -fprintf(stderr, "ERROR: " _m " (%d = %s)\n" , ## _a , \ +#define PERROR (_m, ...) \ +fprintf(stderr, "ERROR: " _m " (%d = %s)\n" , ##__VA_ARGS__, \ errno, strerror(errno))void usage (char *progname)
tools/vnet/libxutil/debug.h +16 -16
@@ -28,17 +28,17 @@#ifdef DEBUG -#define dprintf(fmt, args...) printk(KERN_DEBUG "[DBG] " MODULE_NAME ">%s" fmt, __FUNCTION__, ##args) -#define wprintf(fmt, args...) printk(KERN_WARNING "[WRN] " MODULE_NAME ">%s" fmt, __FUNCTION__, ##args) -#define iprintf(fmt, args...) printk(KERN_INFO "[INF] " MODULE_NAME ">%s" fmt, __FUNCTION__, ##args) -#define eprintf(fmt, args...) printk(KERN_ERR "[ERR] " MODULE_NAME ">%s" fmt, __FUNCTION__, ##args) +#define dprintf (fmt, ...) printk(KERN_DEBUG "[DBG] " MODULE_NAME ">%s" fmt, __FUNCTION__, ##__VA_ARGS__) +#define wprintf (fmt, ...) printk(KERN_WARNING "[WRN] " MODULE_NAME ">%s" fmt, __FUNCTION__, ##__VA_ARGS__) +#define iprintf (fmt, ...) printk(KERN_INFO "[INF] " MODULE_NAME ">%s" fmt, __FUNCTION__, ##__VA_ARGS__) +#define eprintf (fmt, ...) printk(KERN_ERR "[ERR] " MODULE_NAME ">%s" fmt, __FUNCTION__, ##__VA_ARGS__)#else -#define dprintf(fmt, args...) do {} while(0) -#define wprintf(fmt, args...) printk(KERN_WARNING "[WRN] " MODULE_NAME fmt, ##args) -#define iprintf(fmt, args...) printk(KERN_INFO "[INF] " MODULE_NAME fmt, ##args) -#define eprintf(fmt, args...) printk(KERN_ERR "[ERR] " MODULE_NAME fmt, ##args) +#define dprintf (fmt, ...) do {} while(0) +#define wprintf (fmt, ...) printk(KERN_WARNING "[WRN] " MODULE_NAME fmt, ##__VA_ARGS__) +#define iprintf (fmt, ...) printk(KERN_INFO "[INF] " MODULE_NAME fmt, ##__VA_ARGS__) +#define eprintf (fmt, ...) printk(KERN_ERR "[ERR] " MODULE_NAME fmt, ##__VA_ARGS__)#endif
@@ -48,17 +48,17 @@#ifdef DEBUG -#define dprintf(fmt, args...) fprintf(stdout, "%d [DBG] " MODULE_NAME ">%s" fmt, getpid(), __FUNCTION__, ##args) -#define wprintf(fmt, args...) fprintf(stderr, "%d [WRN] " MODULE_NAME ">%s" fmt, getpid(), __FUNCTION__, ##args) -#define iprintf(fmt, args...) fprintf(stderr, "%d [INF] " MODULE_NAME ">%s" fmt, getpid(), __FUNCTION__, ##args) -#define eprintf(fmt, args...) fprintf(stderr, "%d [ERR] " MODULE_NAME ">%s" fmt, getpid(), __FUNCTION__, ##args) +#define dprintf (fmt, ...) fprintf(stdout, "%d [DBG] " MODULE_NAME ">%s" fmt, getpid(), __FUNCTION__, ##__VA_ARGS__) +#define wprintf (fmt, ...) fprintf(stderr, "%d [WRN] " MODULE_NAME ">%s" fmt, getpid(), __FUNCTION__, ##__VA_ARGS__) +#define iprintf (fmt, ...) fprintf(stderr, "%d [INF] " MODULE_NAME ">%s" fmt, getpid(), __FUNCTION__, ##__VA_ARGS__) +#define eprintf (fmt, ...) fprintf(stderr, "%d [ERR] " MODULE_NAME ">%s" fmt, getpid(), __FUNCTION__, ##__VA_ARGS__)#else -#define dprintf(fmt, args...) do {} while(0) -#define wprintf(fmt, args...) fprintf(stderr, "%d [WRN] " MODULE_NAME fmt, getpid(), ##args) -#define iprintf(fmt, args...) fprintf(stderr, "%d [INF] " MODULE_NAME fmt, getpid(), ##args) -#define eprintf(fmt, args...) fprintf(stderr, "%d [ERR] " MODULE_NAME fmt, getpid(), ##args) +#define dprintf (fmt, ...) do {} while(0) +#define wprintf (fmt, ...) fprintf(stderr, "%d [WRN] " MODULE_NAME fmt, getpid(), ##__VA_ARGS__) +#define iprintf (fmt, ...) fprintf(stderr, "%d [INF] " MODULE_NAME fmt, getpid(), ##__VA_ARGS__) +#define eprintf (fmt, ...) fprintf(stderr, "%d [ERR] " MODULE_NAME fmt, getpid(), ##__VA_ARGS__)#endif
tools/vnet/libxutil/sxpr_parser.c +3 -3
@@ -45,13 +45,13 @@*/ #ifdef DEBUG -#define dprintf(fmt, args...) IOStream_print(iostdout, "[DEBUG] %s" fmt, __FUNCTION__, ##args) +#define dprintf (fmt, ...) IOStream_print(iostdout, "[DEBUG] %s" fmt, __FUNCTION__, ##__VA_ARGS__)#else -#define dprintf(fmt, args...) do{ }while(0) +#define dprintf (fmt, ...) do{ }while(0)#endif #undef printf -#define printf(fmt, args...) IOStream_print(iostdout, fmt, ##args) +#define printf (fmt, ...) IOStream_print(iostdout, fmt, ##__VA_ARGS__)static int state_start (Parser *p,char c);static int begin_start (Parser *p,char c);
tools/vtpm_manager/manager/vtpm_manager_handler.c +3 -3
@@ -51,9 +51,9 @@#include "log.h" #include "buffer.h" -#define vtpmhandlerloginfo(module,fmt,args...) vtpmloginfo (module, "[%s]: " fmt, thread_name, ##args ); -#define vtpmhandlerloginfomore(module,fmt,args...) vtpmloginfomore (module, fmt, ##args ); -#define vtpmhandlerlogerror(module,fmt,args...) vtpmlogerror (module, "[%s]: " fmt, thread_name, ##args ); +#define vtpmhandlerloginfo (module,fmt,...) vtpmloginfo (module, "[%s]: " fmt, thread_name, ##__VA_ARGS__); +#define vtpmhandlerloginfomore (module,fmt,...) vtpmloginfomore (module, fmt, ##__VA_ARGS__); +#define vtpmhandlerlogerror (module,fmt,...) vtpmlogerror (module, "[%s]: " fmt, thread_name, ##__VA_ARGS__);// ---------------------- Prototypes ------------------- TPM_RESULT vtpm_manager_handle_vtpm_cmd(VTPM_DMI_RESOURCE *dmi_res,
tools/vtpm_manager/util/log.h +6 -6
@@ -73,18 +73,18 @@ static char *module_names[] = { "",#define SETBIT (num,idx) (num) |= BITMASK(idx)#define CLEARBIT (num,idx) (num) &= ( ~ BITMASK(idx) ) -#define vtpmloginfo(module, fmt, args...) \ +#define vtpmloginfo (module, fmt, ...) \ if (GETBIT (LOGGING_MODULES, module) == 1) { \ - fprintf (stdout, "INFO[%s]: " fmt, module_names[module], ##args); \ + fprintf (stdout, "INFO[%s]: " fmt, module_names[module], ##__VA_ARGS__); \ } -#define vtpmloginfomore(module, fmt, args...) \ +#define vtpmloginfomore (module, fmt, ...) \ if (GETBIT (LOGGING_MODULES, module) == 1) { \ - fprintf (stdout, fmt,##args); \ + fprintf (stdout, fmt, ##__VA_ARGS__); \ } -#define vtpmlogerror(module, fmt, args...) \ - fprintf (stderr, "ERROR[%s]: " fmt, module_names[module], ##args); +#define vtpmlogerror (module, fmt, ...) \ + fprintf (stderr, "ERROR[%s]: " fmt, module_names[module], ##__VA_ARGS__);//typedef UINT32 tpm_size_t;
tools/xenmon/xenbaked.c +2 -2
@@ -44,10 +44,10 @@#include <sys/select.h> #include <getopt.h> -#define PERROR(_m, _a...) \ +#define PERROR (_m, ...) \ do { \ int __saved_errno = errno; \ - fprintf(stderr, "ERROR: " _m " (%d = %s)\n" , ## _a , \ + fprintf(stderr, "ERROR: " _m " (%d = %s)\n" , ##__VA_ARGS__, \ __saved_errno, strerror(__saved_errno)); \ errno = __saved_errno; \ } while (0)
tools/xenstore/utils.h +1 -1
@@ -26,7 +26,7 @@ void barf_perror(const char *fmt, ...) _void (*xprintf)(const char *fmt, ...); -#define eprintf(_fmt, _args...) xprintf("[ERR] %s" _fmt, __FUNCTION__, ##_args) +#define eprintf (_fmt, ...) xprintf("[ERR] %s" _fmt, __FUNCTION__, ##__VA_ARGS__)/* * Mux errno values onto returned pointers.
tools/xentrace/xentrace.c +2 -2
@@ -31,10 +31,10 @@#include <xenctrl.h> -#define PERROR(_m, _a...) \ +#define PERROR (_m, ...) \ do { \ int __saved_errno = errno; \ - fprintf(stderr, "ERROR: " _m " (%d = %s)\n" , ## _a , \ + fprintf(stderr, "ERROR: " _m " (%d = %s)\n" , ##__VA_ARGS__, \ __saved_errno, strerror(__saved_errno)); \ errno = __saved_errno; \ } while (0)
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
Christoph Egger writes ("[Xen-devel] [PATCH] tools: use C99 __VA_ARGS__"):
Quoted 1 line
Attached patch switches tools to consistently use C99
__VA_ARGS__.
What is the benefit of this ? Xen requires GCC and the GCC variable argument list extension has been around forever, so it doesn't seem to aid portability.
The GCC syntax is considerably prettier than the C99 one.
Ian.
Quoted 4 lines · On Tuesday 21 July 2009 15:26:14 Ian Jackson wrote:
Christoph Egger writes ("[Xen-devel] [PATCH] tools: use C99
__VA_ARGS__"):Quoted 1 line
Attached patch switches tools to consistently use C99
__VA_ARGS__.What is the benefit of this ?
Consistency in the whole tree in combination with two other patches (xen-kernel and minios) which I have not yet submitted.
Quoted 2 lines
Xen requires GCC and the GCC variable
argument list extension has been around forever,
That's not a reason to stick on old things.
Quoted 1 line
so it doesn't seem to aid portability.
No, not in this case.
But the other patch for the xen-kernel touches the public headers.
AFAIK the public headers should follow the standard.
Quoted 1 line
The GCC syntax is considerably prettier than the C99 one.
This is subjective.
Christoph
Signature · 6 lines
---to satisfy European Law for business letters: Advanced Micro Devices GmbH Karl-Hammerschmidt-Str. 34, 85609 Dornach b. Muenchen Geschaeftsfuehrer: Thomas M. McCoy, Giuliano Meroni Sitz: Dornach, Gemeinde Aschheim, Landkreis Muenchen Registergericht Muenchen, HRB Nr. 43632
Christoph Egger writes ("Re: [Xen-devel] [PATCH] tools: use C99 __VA_ARGS__"):
Quoted 8 lines · On Tuesday 21 July 2009 15:26:14 Ian Jackson wrote:
Quoted 4 lines
Christoph Egger writes ("[Xen-devel] [PATCH] tools: use C99
__VA_ARGS__"):Quoted 1 line
Attached patch switches tools to consistently use C99
__VA_ARGS__.What is the benefit of this ?
Consistency in the whole tree in combination with two other patches (xen-kernel and minios) which I have not yet submitted.
Umm, so what's the benefit of the whole patchset ?
Quoted 4 lines
Quoted 2 lines
Xen requires GCC and the GCC variable
argument list extension has been around forever,That's not a reason to stick on old things.
Neither is there apparently any reason to change.
Quoted 7 lines
Quoted 1 line
so it doesn't seem to aid portability.
No, not in this case.
But the other patch for the xen-kernel touches the public headers.
AFAIK the public headers should follow the standard.
Do the public headers currently work with other compilers ? There is an argument for using the standard syntax there to make it easier for kernels compiled with non-GCC compilers to provide Xen guest support.
Quoted 3 lines
Quoted 1 line
The GCC syntax is considerably prettier than the C99 one.
This is subjective.
Nevertheless it is true.
Ian.
Quoted 8 lines · Christoph Egger
Quoted 4 lines · On Tuesday 21 July 2009 15:26:14 Ian Jackson wrote:
Christoph Egger writes ("[Xen-devel] [PATCH] tools: use C99
__VA_ARGS__"):Quoted 1 line
Attached patch switches tools to consistently use C99
__VA_ARGS__.What is the benefit of this ?
Consistency in the whole tree in combination with two other patches (xen-kernel and minios) which I have not yet submitted.
We aren't going to change this to C99 style.
-- Keir
Quoted 1 line · On Tuesday 21 July 2009 15:50:56 Ian Jackson wrote:
Christoph Egger writes ("Re: [Xen-devel] [PATCH] tools: use C99
__VA_ARGS__"):
Quoted 2 lines
Quoted 2 lines · On Tuesday 21 July 2009 15:26:14 Ian Jackson wrote:
Quoted 1 line
Christoph Egger writes ("[Xen-devel] [PATCH] tools: use C99
__VA_ARGS__"):
Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
Quoted 1 line
Attached patch switches tools to consistently use C99
__VA_ARGS__.What is the benefit of this ?
Consistency in the whole tree in combination with two other patches (xen-kernel and minios) which I have not yet submitted.
Umm, so what's the benefit of the whole patchset ?
Consistency. :)
Quoted 9 lines
Quoted 4 lines
Quoted 2 lines
Xen requires GCC and the GCC variable
argument list extension has been around forever,That's not a reason to stick on old things.
Neither is there apparently any reason to change.
Quoted 2 lines
Quoted 1 line
so it doesn't seem to aid portability.
Quoted 7 lines
Quoted 5 lines
No, not in this case.
But the other patch for the xen-kernel touches the public headers.
AFAIK the public headers should follow the standard.Do the public headers currently work with other compilers ?
Yes, Sun compiler.
Quoted 2 lines
There is an argument for using the standard syntax there to make it easier for kernels compiled with non-GCC compilers to provide Xen guest support.
I have attached the part of the xen-kernel patch which touches the public headers only. I suppose, Sun didn't use acm or they would have noticed it.
Christoph
Signature · 6 lines
---to satisfy European Law for business letters: Advanced Micro Devices GmbH Karl-Hammerschmidt-Str. 34, 85609 Dornach b. Muenchen Geschaeftsfuehrer: Thomas M. McCoy, Giuliano Meroni Sitz: Dornach, Gemeinde Aschheim, Landkreis Muenchen Registergericht Muenchen, HRB Nr. 43632
xen/include/public/xsm/acm.h +2 -2
@@ -35,9 +35,9 @@/* #define ACM_DEBUG */ #ifdef ACM_DEBUG -# define printkd(fmt, args...) printk(fmt,## args) +# define printkd (fmt, ...) printk(fmt, ##__VA_ARGS__)#else -# define printkd(fmt, args...) +# define printkd (fmt, ...)#endif /* default ssid reference value if not supplied */
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
Quoted 2 lines · Christoph Egger
I have attached the part of the xen-kernel patch which touches the public headers only. I suppose, Sun didn't use acm or they would have noticed it.
I'll take this one.
-- Keir