diff options
author | Gabe Black <gblack@eecs.umich.edu> | 2007-01-03 00:52:30 -0500 |
---|---|---|
committer | Gabe Black <gblack@eecs.umich.edu> | 2007-01-03 00:52:30 -0500 |
commit | 8840ebcb00f3988c781063e572b6df5742968f95 (patch) | |
tree | e9711f561dff45b31489a7fb539ed98660e26d0e /src/base | |
parent | a0e8aa6737f534a8e51d866728dd6dc59bef263d (diff) | |
parent | 7d7f3d0e99eca98a5659e73bce56d615f0ed4fc3 (diff) | |
download | gem5-8840ebcb00f3988c781063e572b6df5742968f95.tar.xz |
Merge zizzer:/bk/newmem
into zower.eecs.umich.edu:/eecshome/m5/newmem
--HG--
extra : convert_revision : f4a05accb8fa24d425dd818b1b7f268378180e99
Diffstat (limited to 'src/base')
-rw-r--r-- | src/base/cprintf.hh | 30 | ||||
-rw-r--r-- | src/base/cprintf_formats.hh | 6 | ||||
-rw-r--r-- | src/base/refcnt.hh | 14 |
3 files changed, 9 insertions, 41 deletions
diff --git a/src/base/cprintf.hh b/src/base/cprintf.hh index 6b2a77f90..9967b0578 100644 --- a/src/base/cprintf.hh +++ b/src/base/cprintf.hh @@ -165,36 +165,6 @@ __csprintf(const std::string &format, ArgList &args) #define csprintf(args...) \ __csprintf__(args, cp::ArgListNull()) -template<class T> -inline ArgList & -operator<<(ArgList &list, const T &data) -{ - list.append(data); - return list; -} - -inline ArgList & -operator<<(std::ostream &str, ArgList &list) -{ - list.stream = &str; - return list; -} - -class ArgListTemp -{ - private: - std::string format; - ArgList *args; - - public: - ArgListTemp(const std::string &f) : format(f) { args = new ArgList; } - ~ArgListTemp() { args->dump(format); delete args; } - - operator ArgList *() { return args; } -}; - -#define cformat(format) \ - (*((cp::ArgList *)cp::ArgListTemp(format))) } #endif // __CPRINTF_HH__ diff --git a/src/base/cprintf_formats.hh b/src/base/cprintf_formats.hh index 58ee7f795..3ea20446d 100644 --- a/src/base/cprintf_formats.hh +++ b/src/base/cprintf_formats.hh @@ -288,13 +288,13 @@ format_integer(std::ostream &out, const T &data, Format &fmt) { _format_integer(out, data, fmt); } inline void format_integer(std::ostream &out, char data, Format &fmt) -{ _format_integer(out, data, fmt); } +{ _format_integer(out, (int)data, fmt); } inline void format_integer(std::ostream &out, unsigned char data, Format &fmt) -{ _format_integer(out, data, fmt); } +{ _format_integer(out, (int)data, fmt); } inline void format_integer(std::ostream &out, signed char data, Format &fmt) -{ _format_integer(out, data, fmt); } +{ _format_integer(out, (int)data, fmt); } #if 0 inline void format_integer(std::ostream &out, short data, Format &fmt) diff --git a/src/base/refcnt.hh b/src/base/refcnt.hh index 6672d4a5f..d1663ad72 100644 --- a/src/base/refcnt.hh +++ b/src/base/refcnt.hh @@ -28,10 +28,8 @@ * Authors: Nathan Binkert */ -#ifndef __REFCNT_HH__ -#define __REFCNT_HH__ - -#include <stddef.h> //For the NULL macro definition +#ifndef __BASE_REFCNT_HH__ +#define __BASE_REFCNT_HH__ class RefCounted { @@ -77,7 +75,7 @@ class RefCountingPtr public: - RefCountingPtr() : data(NULL) {} + RefCountingPtr() : data(0) {} RefCountingPtr(T *data) { copy(data); } RefCountingPtr(const RefCountingPtr &r) { copy(r.data); } ~RefCountingPtr() { del(); } @@ -90,8 +88,8 @@ class RefCountingPtr const T &operator*() const { return *data; } const T *get() const { return data; } - RefCountingPtr &operator=(T *p) { set(p); return *this; } - RefCountingPtr &operator=(const RefCountingPtr &r) + const RefCountingPtr &operator=(T *p) { set(p); return *this; } + const RefCountingPtr &operator=(const RefCountingPtr &r) { return operator=(r.data); } bool operator!() const { return data == 0; } @@ -122,4 +120,4 @@ template<class T> bool operator!=(const T &l, const RefCountingPtr<T> &r) { return l != r.get(); } -#endif // __REFCNT_HH__ +#endif // __BASE_REFCNT_HH__ |