Bug 522587 - clean up variadic macro avoidance code, r=gal.

This commit is contained in:
Graydon Hoare 2009-10-15 16:04:55 -07:00
parent 426e720124
commit a32e357aaa
7 changed files with 17 additions and 11 deletions

View File

@ -202,7 +202,7 @@ public:
void clear();
};
#if defined(JS_JIT_SPEW) || defined(MOZ_NO_VARADIC_MACROS)
#if defined(JS_JIT_SPEW) || defined(NJ_NO_VARIADIC_MACROS)
enum LC_TMBits {
/*
@ -220,7 +220,7 @@ enum LC_TMBits {
#endif
#ifdef MOZ_NO_VARADIC_MACROS
#ifdef NJ_NO_VARIADIC_MACROS
#define debug_only_stmt(action) /* */
static void debug_only_printf(int mask, const char *fmt, ...) {}

View File

@ -296,7 +296,7 @@
#ifdef _MSC_VER
# include "jscpucfg.h" /* We can't auto-detect MSVC configuration */
# if _MSC_VER < 1400
# define MOZ_NO_VARADIC_MACROS
# define NJ_NO_VARIADIC_MACROS
# endif
#else
# include "jsautocfg.h" /* Use auto-detected configuration */

View File

@ -110,7 +110,7 @@ namespace nanojit {
#define isSPorFP(r) ( (r)==SP || (r)==FP )
#ifdef MOZ_NO_VARADIC_MACROS
#ifdef NJ_NO_VARIADIC_MACROS
static void asm_output(const char *f, ...) {}
#define gpn(r) regNames[(r)]
#define fpn(r) regNames[(r)]

View File

@ -56,6 +56,7 @@
#include <ctype.h>
#include <stdlib.h>
#include <stddef.h>
#include <stdarg.h>
#if defined(AVMPLUS_UNIX) || defined(AVMPLUS_OS2)
#include <unistd.h>
@ -84,6 +85,7 @@ typedef unsigned __int64 uint64_t;
#define VMPI_strncat strncat
#define VMPI_strcpy strcpy
#define VMPI_sprintf sprintf
#define VMPI_vfprintf vfprintf
#define VMPI_memset memset
#define VMPI_isdigit isdigit
#define VMPI_getDate()

View File

@ -51,6 +51,10 @@ Config AvmCore::config;
void
avmplus::AvmLog(char const *msg, ...) {
va_list ap;
va_start(ap, msg);
VMPI_vfprintf(stderr, msg, ap);
va_end(ap);
}
#ifdef _DEBUG

View File

@ -85,7 +85,7 @@ static inline bool blx_lr_broken() {
#include <os2.h>
#endif
#if defined(DEBUG) || defined(MOZ_NO_VARADIC_MACROS)
#if defined(DEBUG) || defined(NJ_NO_VARIADIC_MACROS)
#if !defined _DEBUG
#define _DEBUG
#endif

View File

@ -91,15 +91,15 @@ namespace nanojit
const uint32_t MAXARGS = 8;
#ifdef MOZ_NO_VARADIC_MACROS
static void NanoAssertMsgf(bool a,const char *f,...) {}
static void NanoAssertMsg(bool a,const char *m) {}
static void NanoAssert(bool a) {}
#ifdef NJ_NO_VARIADIC_MACROS
inline void NanoAssertMsgf(bool a,const char *f,...) {}
inline void NanoAssertMsg(bool a,const char *m) {}
inline void NanoAssert(bool a) {}
#elif defined(_DEBUG)
#define __NanoAssertMsgf(a, file_, line_, f, ...) \
if (!(a)) { \
fprintf(stderr, "Assertion failed: " f "%s (%s:%d)\n", __VA_ARGS__, #a, file_, line_); \
avmplus::AvmLog("Assertion failed: " f "%s (%s:%d)\n", __VA_ARGS__, #a, file_, line_); \
NanoAssertFail(); \
}
@ -144,7 +144,7 @@ namespace nanojit
#endif
#endif
#ifdef MOZ_NO_VARADIC_MACROS
#ifdef NJ_NO_VARIADIC_MACROS
#include <stdio.h>
#define verbose_outputf if (_logc->lcbits & LC_Assembly) \
Assembler::outputf