diff options
Diffstat (limited to 'src/base')
-rw-r--r-- | src/base/compiler.hh | 53 | ||||
-rw-r--r-- | src/base/compression/lzss_compression.cc | 6 | ||||
-rw-r--r-- | src/base/compression/null_compression.hh | 2 | ||||
-rw-r--r-- | src/base/cprintf.hh | 24 | ||||
-rw-r--r-- | src/base/cprintf_formats.hh | 22 | ||||
-rw-r--r-- | src/base/hashmap.hh | 2 | ||||
-rw-r--r-- | src/base/hostinfo.cc | 1 | ||||
-rw-r--r-- | src/base/loader/object_file.cc | 4 | ||||
-rw-r--r-- | src/base/misc.hh | 45 | ||||
-rw-r--r-- | src/base/pollevent.cc | 2 | ||||
-rw-r--r-- | src/base/random.cc | 13 | ||||
-rw-r--r-- | src/base/remote_gdb.cc | 54 | ||||
-rw-r--r-- | src/base/remote_gdb.hh | 5 | ||||
-rw-r--r-- | src/base/statistics.hh | 7 | ||||
-rw-r--r-- | src/base/stats/text.cc | 4 | ||||
-rw-r--r-- | src/base/time.cc | 4 | ||||
-rw-r--r-- | src/base/time.hh | 2 | ||||
-rw-r--r-- | src/base/timebuf.hh | 5 | ||||
-rw-r--r-- | src/base/trace.hh | 28 |
19 files changed, 197 insertions, 86 deletions
diff --git a/src/base/compiler.hh b/src/base/compiler.hh new file mode 100644 index 000000000..dc23ed7b3 --- /dev/null +++ b/src/base/compiler.hh @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2006 The Regents of The University of Michigan + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer; + * redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution; + * neither the name of the copyright holders nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Authors: Ali Saidi + */ + +#ifndef __BASE_COMPILER_HH__ +#define __BASE_COMPILER_HH__ + +//http://msdn2.microsoft.com/en-us/library/ms937669.aspx +//http://msdn2.microsoft.com/en-us/library/aa448724.aspx +//http://docs.sun.com/source/819-3688/sun.specific.html#marker-998278 +//http://gcc.gnu.org/onlinedocs/gcc-3.3.1/gcc/Function-Attributes.html#Function%20Attributes + +#if defined(__GNUC__) +#define M5_ATTR_NORETURN __attribute__((noreturn)) +#define M5_PRAGMA_NORETURN(x) +#define M5_DUMMY_RETURN +#elif defined(__SUNPRO_CC) +// this doesn't do anything with sun cc, but why not +#define M5_ATTR_NORETURN __sun_attr__((__noreturn__)) +#define M5_DUMMY_RETURN return (0); +#define DO_PRAGMA(x) _Pragma(#x) +#define M5_PRAGMA_NORETURN(x) DO_PRAGMA(does_not_return(x)) +#else +#error "Need to define compiler options in base/compiler.hh" +#endif + +#endif // __BASE_COMPILER_HH__ diff --git a/src/base/compression/lzss_compression.cc b/src/base/compression/lzss_compression.cc index eb35fb8f1..bd16d82c9 100644 --- a/src/base/compression/lzss_compression.cc +++ b/src/base/compression/lzss_compression.cc @@ -32,8 +32,8 @@ * LZSSCompression definitions. */ -#include <assert.h> - +#include <cassert> +#include <cstring> #include "base/compression/lzss_compression.hh" #include "base/misc.hh" //for fatal @@ -134,7 +134,7 @@ LZSSCompression::compress(uint8_t *dest, uint8_t *src, int size) if (dest_index >= size) { // Have expansion instead of compression, just copy. - memcpy(dest,src,size); + std::memcpy(dest,src,size); return size; } return dest_index; diff --git a/src/base/compression/null_compression.hh b/src/base/compression/null_compression.hh index ff110807a..798acb77a 100644 --- a/src/base/compression/null_compression.hh +++ b/src/base/compression/null_compression.hh @@ -50,11 +50,13 @@ class NullCompression : public CompressionAlgorithm int uncompress(uint8_t * dest, uint8_t *src, int size) { fatal("Can't uncompress data"); + M5_DUMMY_RETURN } int compress(uint8_t *dest, uint8_t *src, int size) { fatal("Can't compress data"); + M5_DUMMY_RETURN } }; diff --git a/src/base/cprintf.hh b/src/base/cprintf.hh index 9967b0578..dd2256e69 100644 --- a/src/base/cprintf.hh +++ b/src/base/cprintf.hh @@ -136,10 +136,10 @@ operator,(ArgList &alist, ArgListNull) inline void __cprintf(const std::string &format, ArgList &args) { args.dump(format); delete &args; } -#define __cprintf__(format, args...) \ - cp::__cprintf(format, (*(new cp::ArgList), args)) -#define cprintf(args...) \ - __cprintf__(args, cp::ArgListNull()) +#define __cprintf__(format, ...) \ + cp::__cprintf(format, (*(new cp::ArgList), __VA_ARGS__)) +#define cprintf(...) \ + __cprintf__(__VA_ARGS__, cp::ArgListNull()) // // ccprintf(stream, format, args, ...) prints to the specified stream @@ -148,10 +148,10 @@ __cprintf(const std::string &format, ArgList &args) inline void __ccprintf(std::ostream &stream, const std::string &format, ArgList &args) { args.dump(stream, format); delete &args; } -#define __ccprintf__(stream, format, args...) \ - cp::__ccprintf(stream, format, (*(new cp::ArgList), args)) -#define ccprintf(stream, args...) \ - __ccprintf__(stream, args, cp::ArgListNull()) +#define __ccprintf__(stream, format, ...) \ + cp::__ccprintf(stream, format, (*(new cp::ArgList), __VA_ARGS__)) +#define ccprintf(stream, ...) \ + __ccprintf__(stream, __VA_ARGS__, cp::ArgListNull()) // // csprintf(format, args, ...) returns a string @@ -160,10 +160,10 @@ __ccprintf(std::ostream &stream, const std::string &format, ArgList &args) inline std::string __csprintf(const std::string &format, ArgList &args) { std::string s = args.dumpToString(format); delete &args; return s; } -#define __csprintf__(format, args...) \ - cp::__csprintf(format, (*(new cp::ArgList), args)) -#define csprintf(args...) \ - __csprintf__(args, cp::ArgListNull()) +#define __csprintf__(format, ...) \ + cp::__csprintf(format, (*(new cp::ArgList), __VA_ARGS__)) +#define csprintf(...) \ + __csprintf__(__VA_ARGS__, cp::ArgListNull()) } diff --git a/src/base/cprintf_formats.hh b/src/base/cprintf_formats.hh index 3ea20446d..0af493217 100644 --- a/src/base/cprintf_formats.hh +++ b/src/base/cprintf_formats.hh @@ -84,21 +84,21 @@ _format_integer(std::ostream &out, const T &data, Format &fmt) switch (fmt.base) { case Format::hex: - out.setf(ios::hex, ios::basefield); + out.setf(std::ios::hex, std::ios::basefield); break; case Format::oct: - out.setf(ios::oct, ios::basefield); + out.setf(std::ios::oct, std::ios::basefield); break; case Format::dec: - out.setf(ios::dec, ios::basefield); + out.setf(std::ios::dec, std::ios::basefield); break; } if (fmt.alternate_form) { if (!fmt.fill_zero) - out.setf(ios::showbase); + out.setf(std::ios::showbase); else { switch (fmt.base) { case Format::hex: @@ -122,13 +122,13 @@ _format_integer(std::ostream &out, const T &data, Format &fmt) out.width(fmt.width); if (fmt.flush_left && !fmt.fill_zero) - out.setf(ios::left); + out.setf(std::ios::left); if (fmt.print_sign) - out.setf(ios::showpos); + out.setf(std::ios::showpos); if (fmt.uppercase) - out.setf(ios::uppercase); + out.setf(std::ios::uppercase); out << data; } @@ -148,7 +148,7 @@ _format_float(std::ostream &out, const T &data, Format &fmt) if (fmt.precision == 0) fmt.precision = 1; else - out.setf(ios::scientific); + out.setf(std::ios::scientific); out.precision(fmt.precision); } else @@ -156,7 +156,7 @@ _format_float(std::ostream &out, const T &data, Format &fmt) out.width(fmt.width); if (fmt.uppercase) - out.setf(ios::uppercase); + out.setf(std::ios::uppercase); break; case Format::fixed: @@ -164,7 +164,7 @@ _format_float(std::ostream &out, const T &data, Format &fmt) if (fmt.width > 0) out.width(fmt.width); - out.setf(ios::fixed); + out.setf(std::ios::fixed); out.precision(fmt.precision); } else if (fmt.width > 0) @@ -216,7 +216,7 @@ _format_string(std::ostream &out, const T &data, Format &fmt) if (fmt.width > 0) out.width(fmt.width); if (fmt.flush_left) - out.setf(ios::left); + out.setf(std::ios::left); out << data; #endif diff --git a/src/base/hashmap.hh b/src/base/hashmap.hh index 570cbc152..b78cc02e8 100644 --- a/src/base/hashmap.hh +++ b/src/base/hashmap.hh @@ -59,7 +59,7 @@ namespace m5 { // namespace __hash_namespace { -#if !defined(__LP64__) && !defined(__alpha__) +#if !defined(__LP64__) && !defined(__alpha__) && !defined(__SUNPRO_CC) template<> struct hash<uint64_t> { size_t operator()(uint64_t r) const { diff --git a/src/base/hostinfo.cc b/src/base/hostinfo.cc index a7c93e712..7cc07c11e 100644 --- a/src/base/hostinfo.cc +++ b/src/base/hostinfo.cc @@ -33,6 +33,7 @@ #include <math.h> #include <unistd.h> +#include <stdio.h> #include <cstdlib> #include <cstring> #include <string> diff --git a/src/base/loader/object_file.cc b/src/base/loader/object_file.cc index da5aa9552..7424b9305 100644 --- a/src/base/loader/object_file.cc +++ b/src/base/loader/object_file.cc @@ -101,7 +101,7 @@ ObjectFile::close() } if (fileData) { - ::munmap(fileData, len); + ::munmap((char*)fileData, len); fileData = NULL; } } @@ -147,7 +147,7 @@ createObjectFile(const string &fname, bool raw) // don't know what it is close(fd); - munmap(fileData, len); + munmap((char*)fileData, len); return NULL; } diff --git a/src/base/misc.hh b/src/base/misc.hh index 1c5720ce1..c12c2fe20 100644 --- a/src/base/misc.hh +++ b/src/base/misc.hh @@ -33,8 +33,13 @@ #define __MISC_HH__ #include <assert.h> +#include "base/compiler.hh" #include "base/cprintf.hh" +#if defined(__SUNPRO_CC) +#define __FUNCTION__ "how to fix me?" +#endif + // // This implements a cprintf based panic() function. panic() should // be called when something happens that should never ever happen @@ -43,12 +48,13 @@ // // void __panic(const std::string&, cp::ArgList &, const char*, const char*, int) - __attribute__((noreturn)); -#define __panic__(format, args...) \ - __panic(format, (*(new cp::ArgList), args), \ - __FUNCTION__, __FILE__, __LINE__) -#define panic(args...) \ - __panic__(args, cp::ArgListNull()) + M5_ATTR_NORETURN; +#define __panic__(format, ...) \ + __panic(format, (*(new cp::ArgList), __VA_ARGS__), \ + __FUNCTION__ , __FILE__, __LINE__) +#define panic(...) \ + __panic__(__VA_ARGS__, cp::ArgListNull()) +M5_PRAGMA_NORETURN(__panic) // // This implements a cprintf based fatal() function. fatal() should @@ -59,32 +65,33 @@ void __panic(const std::string&, cp::ArgList &, const char*, const char*, int) // panic() does. // void __fatal(const std::string&, cp::ArgList &, const char*, const char*, int) - __attribute__((noreturn)); -#define __fatal__(format, args...) \ - __fatal(format, (*(new cp::ArgList), args), \ - __FUNCTION__, __FILE__, __LINE__) -#define fatal(args...) \ - __fatal__(args, cp::ArgListNull()) + M5_ATTR_NORETURN; +#define __fatal__(format, ...) \ + __fatal(format, (*(new cp::ArgList), __VA_ARGS__), \ + __FUNCTION__ , __FILE__, __LINE__) +#define fatal(...) \ + __fatal__(__VA_ARGS__, cp::ArgListNull()) +M5_PRAGMA_NORETURN(__fatal) // // This implements a cprintf based warn // void __warn(const std::string&, cp::ArgList &, const char*, const char*, int); -#define __warn__(format, args...) \ - __warn(format, (*(new cp::ArgList), args), \ - __FUNCTION__, __FILE__, __LINE__) -#define warn(args...) \ - __warn__(args, cp::ArgListNull()) +#define __warn__(format, ...) \ + __warn(format, (*(new cp::ArgList), __VA_ARGS__), \ + __FUNCTION__ , __FILE__, __LINE__) +#define warn(...) \ + __warn__(__VA_ARGS__, cp::ArgListNull()) // Only print the warning message the first time it is seen. This // doesn't check the warning string itself, it just only lets one // warning come from the statement. So, even if the arguments change // and that would have resulted in a different warning message, // subsequent messages would still be supressed. -#define warn_once(args...) do { \ +#define warn_once(...) do { \ static bool once = false; \ if (!once) { \ - __warn__(args, cp::ArgListNull()); \ + __warn__(__VA_ARGS__, cp::ArgListNull()); \ once = true; \ } \ } while (0) diff --git a/src/base/pollevent.cc b/src/base/pollevent.cc index fd5b09d28..32724b74d 100644 --- a/src/base/pollevent.cc +++ b/src/base/pollevent.cc @@ -30,7 +30,7 @@ #include <sys/ioctl.h> #include <sys/types.h> -#if defined(__sun__) +#if defined(__sun__) || defined(__SUNPRO_CC) #include <sys/file.h> #endif diff --git a/src/base/random.cc b/src/base/random.cc index 82c9e3566..0ccedcb00 100644 --- a/src/base/random.cc +++ b/src/base/random.cc @@ -29,12 +29,17 @@ * Ali Saidi */ +#if defined(__sun) +#include <ieeefp.h> +#endif +#ifdef __SUNPRO_CC +#include <stdlib.h> +#include <math.h> +#endif + #include <cstdlib> #include <cmath> -#if defined(__sun__) -#include <ieeefp.h> -#endif #include "sim/param.hh" #include "base/random.hh" @@ -72,7 +77,7 @@ getLong() double m5round(double r) { -#if defined(__sun__) +#if defined(__sun) double val; fp_rnd oldrnd = fpsetround(FP_RN); val = rint(r); diff --git a/src/base/remote_gdb.cc b/src/base/remote_gdb.cc index 59a9b87d5..b28beba89 100644 --- a/src/base/remote_gdb.cc +++ b/src/base/remote_gdb.cc @@ -121,16 +121,21 @@ #include <string> #include <unistd.h> +#include "config/full_system.hh" + +#if FULL_SYSTEM #include "arch/vtophys.hh" +#endif + #include "base/intmath.hh" #include "base/remote_gdb.hh" #include "base/socket.hh" #include "base/trace.hh" -#include "config/full_system.hh" #include "cpu/thread_context.hh" #include "cpu/static_inst.hh" -#include "mem/physical.hh" +//#include "mem/physical.hh" #include "mem/port.hh" +#include "mem/translating_port.hh" #include "sim/system.hh" using namespace std; @@ -448,9 +453,17 @@ BaseRemoteGDB::read(Addr vaddr, size_t size, char *data) DPRINTF(GDBRead, "read: addr=%#x, size=%d", vaddr, size); - VirtualPort *vp = context->getVirtPort(context); - vp->readBlob(vaddr, (uint8_t*)data, size); - context->delVirtPort(vp); +#if FULL_SYSTEM + VirtualPort *port = context->getVirtPort(context); +#else + TranslatingPort *port = context->getMemPort(); +#endif + port->readBlob(vaddr, (uint8_t*)data, size); +#if FULL_SYSTEM + context->delVirtPort(port); +#else + delete port; +#endif #if TRACING_ON if (DTRACE(GDBRead)) { @@ -487,9 +500,17 @@ BaseRemoteGDB::write(Addr vaddr, size_t size, const char *data) } else DPRINTFNR("\n"); } - VirtualPort *vp = context->getVirtPort(context); - vp->writeBlob(vaddr, (uint8_t*)data, size); - context->delVirtPort(vp); +#if FULL_SYSTEM + VirtualPort *port = context->getVirtPort(context); +#else + TranslatingPort *port = context->getMemPort(); +#endif + port->writeBlob(vaddr, (uint8_t*)data, size); +#if FULL_SYSTEM + context->delVirtPort(port); +#else + delete port; +#endif return true; } @@ -610,7 +631,8 @@ BaseRemoteGDB::trap(int type) uint64_t val; size_t datalen, len; char data[GDBPacketBufLen + 1]; - char buffer[gdbregs.bytes() * 2 + 256]; + char *buffer; + int bufferSize; const char *p; char command, subcmd; string var; @@ -619,6 +641,9 @@ BaseRemoteGDB::trap(int type) if (!attached) return false; + bufferSize = gdbregs.bytes() * 2 + 256; + buffer = (char*)malloc(bufferSize); + DPRINTF(GDBMisc, "trap: PC=%#x NPC=%#x\n", context->readPC(), context->readNextPC()); @@ -638,7 +663,7 @@ BaseRemoteGDB::trap(int type) active = true; else // Tell remote host that an exception has occurred. - snprintf((char *)buffer, sizeof(buffer), "S%02x", type); + snprintf((char *)buffer, bufferSize, "S%02x", type); send(buffer); // Stick frame regs into our reg cache. @@ -656,13 +681,13 @@ BaseRemoteGDB::trap(int type) // if this command came from a running gdb, answer it -- // the other guy has no way of knowing if we're in or out // of this loop when he issues a "remote-signal". - snprintf((char *)buffer, sizeof(buffer), + snprintf((char *)buffer, bufferSize, "S%02x", type); send(buffer); continue; case GDBRegR: - if (2 * gdbregs.bytes() > sizeof(buffer)) + if (2 * gdbregs.bytes() > bufferSize) panic("buffer too small"); mem2hex(buffer, gdbregs.regs, gdbregs.bytes()); @@ -709,7 +734,7 @@ BaseRemoteGDB::trap(int type) send("E03"); continue; } - if (len > sizeof(buffer)) { + if (len > bufferSize) { send("E04"); continue; } @@ -745,7 +770,7 @@ BaseRemoteGDB::trap(int type) send("E08"); continue; } - p = hex2mem(buffer, p, sizeof(buffer)); + p = hex2mem(buffer, p, bufferSize); if (p == NULL) { send("E09"); continue; @@ -916,6 +941,7 @@ BaseRemoteGDB::trap(int type) } out: + free(buffer); return true; } diff --git a/src/base/remote_gdb.hh b/src/base/remote_gdb.hh index 9a3201c95..92e599585 100644 --- a/src/base/remote_gdb.hh +++ b/src/base/remote_gdb.hh @@ -32,6 +32,7 @@ #define __REMOTE_GDB_HH__ #include <map> +#include <sys/signal.h> #include "arch/types.hh" #include "cpu/pc_event.hh" @@ -177,6 +178,10 @@ class BaseRemoteGDB virtual bool acc(Addr addr, size_t len) = 0; bool trap(int type); + virtual bool breakpoint() + { + return trap(SIGTRAP); + } protected: virtual void getregs() = 0; diff --git a/src/base/statistics.hh b/src/base/statistics.hh index 577ea5eab..2b1b327e5 100644 --- a/src/base/statistics.hh +++ b/src/base/statistics.hh @@ -50,6 +50,9 @@ #include <algorithm> #include <cassert> +#ifdef __SUNPRO_CC +#include <math.h> +#endif #include <cmath> #include <functional> #include <iosfwd> @@ -395,7 +398,7 @@ class Wrap : public Child public: Wrap() { - map(new Data<Child>(*this)); + this->map(new Data<Child>(*this)); } /** @@ -1410,7 +1413,7 @@ struct DistStor else if (val > params.max) overflow += number; else { - int index = (int)floor((val - params.min) / params.bucket_size); + int index = (int)std::floor((val - params.min) / params.bucket_size); assert(index < size(params)); cvec[index] += number; } diff --git a/src/base/stats/text.cc b/src/base/stats/text.cc index c4448efc9..ae0d65537 100644 --- a/src/base/stats/text.cc +++ b/src/base/stats/text.cc @@ -32,6 +32,10 @@ #define _GLIBCPP_USE_C99 1 #endif +#if defined(__sun) +#include <math.h> +#endif + #include <iostream> #include <sstream> #include <fstream> diff --git a/src/base/time.cc b/src/base/time.cc index cbc7256ee..76ba355b7 100644 --- a/src/base/time.cc +++ b/src/base/time.cc @@ -105,7 +105,11 @@ Time::date(string format) const char buf[256]; if (format.empty()) { +#ifdef __SUNPRO_CC + ctime_r(&sec, buf, 256); +#else ctime_r(&sec, buf); +#endif buf[24] = '\0'; return buf; } diff --git a/src/base/time.hh b/src/base/time.hh index 7aa4c50db..f10cc5d6c 100644 --- a/src/base/time.hh +++ b/src/base/time.hh @@ -97,7 +97,7 @@ std::ostream &operator<<(std::ostream &out, const Time &time); * @(#)time.h 8.2 (Berkeley) 7/10/94 */ -#if defined(__sun__) +#if defined(__sun) #define timersub(tvp, uvp, vvp) \ do { \ (vvp)->tv_sec = (tvp)->tv_sec - (uvp)->tv_sec; \ diff --git a/src/base/timebuf.hh b/src/base/timebuf.hh index 1d0de8278..348f7a673 100644 --- a/src/base/timebuf.hh +++ b/src/base/timebuf.hh @@ -33,6 +33,7 @@ #define __BASE_TIMEBUF_HH__ #include <cassert> +#include <cstring> #include <vector> template <class T> @@ -143,7 +144,7 @@ class TimeBuffer char *ptr = data; for (int i = 0; i < size; i++) { index[i] = ptr; - memset(ptr, 0, sizeof(T)); + std::memset(ptr, 0, sizeof(T)); new (ptr) T; ptr += sizeof(T); } @@ -171,7 +172,7 @@ class TimeBuffer if (ptr >= size) ptr -= size; (reinterpret_cast<T *>(index[ptr]))->~T(); - memset(index[ptr], 0, sizeof(T)); + std::memset(index[ptr], 0, sizeof(T)); new (index[ptr]) T; } diff --git a/src/base/trace.hh b/src/base/trace.hh index 9b053990c..a46643159 100644 --- a/src/base/trace.hh +++ b/src/base/trace.hh @@ -186,39 +186,39 @@ do { \ Trace::dataDump(curTick, name(), data, count); \ } while (0) -#define __dprintf(cycle, name, format, args...) \ - Trace::dprintf(format, (*(new cp::ArgList), args), cycle, name) +#define __dprintf(cycle, name, format, ...) \ + Trace::dprintf(format, (*(new cp::ArgList), __VA_ARGS__), cycle, name) -#define DPRINTF(x, args...) \ +#define DPRINTF(x, ...) \ do { \ if (Trace::IsOn(Trace::x)) \ - __dprintf(curTick, name(), args, cp::ArgListNull()); \ + __dprintf(curTick, name(), __VA_ARGS__, cp::ArgListNull()); \ } while (0) -#define DPRINTFR(x, args...) \ +#define DPRINTFR(x, ...) \ do { \ if (Trace::IsOn(Trace::x)) \ - __dprintf((Tick)-1, std::string(), args, cp::ArgListNull()); \ + __dprintf((Tick)-1, std::string(), __VA_ARGS__, cp::ArgListNull()); \ } while (0) -#define DPRINTFN(args...) \ +#define DPRINTFN(...) \ do { \ - __dprintf(curTick, name(), args, cp::ArgListNull()); \ + __dprintf(curTick, name(), __VA_ARGS__, cp::ArgListNull()); \ } while (0) -#define DPRINTFNR(args...) \ +#define DPRINTFNR(...) \ do { \ - __dprintf((Tick)-1, string(), args, cp::ArgListNull()); \ + __dprintf((Tick)-1, string(), __VA_ARGS__, cp::ArgListNull()); \ } while (0) #else // !TRACING_ON #define DTRACE(x) (false) #define DCOUT(x) if (0) DebugOut() -#define DPRINTF(x, args...) do {} while (0) -#define DPRINTFR(args...) do {} while (0) -#define DPRINTFN(args...) do {} while (0) -#define DPRINTFNR(args...) do {} while (0) +#define DPRINTF(x, ...) do {} while (0) +#define DPRINTFR(...) do {} while (0) +#define DPRINTFN(...) do {} while (0) +#define DPRINTFNR(...) do {} while (0) #define DDUMP(x, data, count) do {} while (0) #endif // TRACING_ON |