diff options
author | Kevin Lim <ktlim@umich.edu> | 2005-01-18 13:02:47 -0500 |
---|---|---|
committer | Kevin Lim <ktlim@umich.edu> | 2005-01-18 13:02:47 -0500 |
commit | aed3e6780a54f2d4f008a8cf7f66e2bbdc788a0d (patch) | |
tree | f48c9d361d04cc6276ef33a9898eb0ac61de36d7 /base | |
parent | 783f701247a1013a32d7caab324660c211215a11 (diff) | |
parent | f31a27a030d2e93fef2934aa8642609bb38974af (diff) | |
download | gem5-aed3e6780a54f2d4f008a8cf7f66e2bbdc788a0d.tar.xz |
Merge changes to make m5 g++ 3.4 compatible.
sim/param.cc:
Merge changes.
--HG--
extra : convert_revision : b5044e1f7c48ae2d74d5233dd4fabfb7a801d7c8
Diffstat (limited to 'base')
-rw-r--r-- | base/random.hh | 20 | ||||
-rw-r--r-- | base/range.hh | 1 | ||||
-rw-r--r-- | base/res_list.hh | 2 | ||||
-rw-r--r-- | base/statistics.hh | 128 | ||||
-rw-r--r-- | base/trace.cc | 2 | ||||
-rw-r--r-- | base/trace.hh | 6 |
6 files changed, 80 insertions, 79 deletions
diff --git a/base/random.hh b/base/random.hh index 0bfed100c..fe93a98a6 100644 --- a/base/random.hh +++ b/base/random.hh @@ -37,61 +37,61 @@ double getDouble(); template <typename T> struct Random; -struct Random<int8_t> +template<> struct Random<int8_t> { static int8_t get() { return getLong() & (int8_t)-1; } }; -struct Random<uint8_t> +template<> struct Random<uint8_t> { static uint8_t get() { return getLong() & (uint8_t)-1; } }; -struct Random<int16_t> +template<> struct Random<int16_t> { static int16_t get() { return getLong() & (int16_t)-1; } }; -struct Random<uint16_t> +template<> struct Random<uint16_t> { static uint16_t get() { return getLong() & (uint16_t)-1; } }; -struct Random<int32_t> +template<> struct Random<int32_t> { static int32_t get() { return (int32_t)getLong(); } }; -struct Random<uint32_t> +template<> struct Random<uint32_t> { static uint32_t get() { return (uint32_t)getLong(); } }; -struct Random<int64_t> +template<> struct Random<int64_t> { static int64_t get() { return (int64_t)getLong() << 32 || (uint64_t)getLong(); } }; -struct Random<uint64_t> +template<> struct Random<uint64_t> { static uint64_t get() { return (uint64_t)getLong() << 32 || (uint64_t)getLong(); } }; -struct Random<float> +template<> struct Random<float> { static float get() { return getDouble(); } }; -struct Random<double> +template<> struct Random<double> { static double get() { return getDouble(); } diff --git a/base/range.hh b/base/range.hh index 9289792ea..57b6e6a77 100644 --- a/base/range.hh +++ b/base/range.hh @@ -30,6 +30,7 @@ #define __BASE_RANGE_HH__ #include <cassert> +#include <iostream> #include <string> /** diff --git a/base/res_list.hh b/base/res_list.hh index 7080a3ba7..5dc798fed 100644 --- a/base/res_list.hh +++ b/base/res_list.hh @@ -352,7 +352,7 @@ res_list<T>::insert_after(iterator prev, T *d) iterator p; if (!allocate_storage) - panic("Can't copy data... not allocating storage"); + this->panic("Can't copy data... not allocating storage"); p = insert_after(prev); if (p.notnull()) diff --git a/base/statistics.hh b/base/statistics.hh index f3b8a3922..9ec26eb4d 100644 --- a/base/statistics.hh +++ b/base/statistics.hh @@ -407,7 +407,7 @@ class Wrap : public Child public: Wrap() { - map(new Data<Child>(*this)); + map(new Data<Child>(*this)); } /** @@ -417,10 +417,10 @@ class Wrap : public Child */ Parent &name(const std::string &_name) { - Data<Child> *data = statData(); + Data<Child> *data = this->statData(); data->name = _name; - setPrint(); - return self(); + this->setPrint(); + return this->self(); } /** @@ -431,8 +431,8 @@ class Wrap : public Child */ Parent &desc(const std::string &_desc) { - statData()->desc = _desc; - return self(); + this->statData()->desc = _desc; + return this->self(); } /** @@ -442,8 +442,8 @@ class Wrap : public Child */ Parent &precision(int _precision) { - statData()->precision = _precision; - return self(); + this->statData()->precision = _precision; + return this->self(); } /** @@ -453,8 +453,8 @@ class Wrap : public Child */ Parent &flags(StatFlags _flags) { - statData()->flags |= _flags; - return self(); + this->statData()->flags |= _flags; + return this->self(); } /** @@ -466,8 +466,8 @@ class Wrap : public Child template <class Stat> Parent &prereq(const Stat &prereq) { - statData()->prereq = prereq.statData(); - return self(); + this->statData()->prereq = prereq.statData(); + return this->self(); } }; @@ -487,11 +487,11 @@ class WrapVec : public Wrap<Parent, Child, Data> */ Parent &subname(int index, const std::string &name) { - std::vector<std::string> &subn = statData()->subnames; + std::vector<std::string> &subn = this->statData()->subnames; if (subn.size() <= index) subn.resize(index + 1); subn[index] = name; - return self(); + return this->self(); } /** @@ -503,12 +503,12 @@ class WrapVec : public Wrap<Parent, Child, Data> */ Parent &subdesc(int index, const std::string &desc) { - std::vector<std::string> &subd = statData()->subdescs; + std::vector<std::string> &subd = this->statData()->subdescs; if (subd.size() <= index) subd.resize(index + 1); subd[index] = desc; - return self(); + return this->self(); } }; @@ -523,19 +523,19 @@ class WrapVec2d : public WrapVec<Parent, Child, Data> */ Parent &ysubnames(const char **names) { - Data<Child> *data = statData(); - data->y_subnames.resize(y); - for (int i = 0; i < y; ++i) + Data<Child> *data = this->statData(); + data->y_subnames.resize(this->y); + for (int i = 0; i < this->y; ++i) data->y_subnames[i] = names[i]; - return self(); + return this->self(); } Parent &ysubname(int index, const std::string subname) { - Data<Child> *data = statData(); - assert(index < y); - data->y_subnames.resize(y); + Data<Child> *data = this->statData(); + assert(index < this->y); + data->y_subnames.resize(this->y); data->y_subnames[index] = subname.c_str(); - return self(); + return this->self(); } }; @@ -711,7 +711,7 @@ class ScalarBase : public DataAccess /** Define the params of the storage class. */ typedef typename Storage::Params params_t; /** Define the bin type. */ - typedef typename Bin::Bin<Storage> bin_t; + typedef typename Bin::template Bin<Storage> bin_t; protected: /** The bin of this stat. */ @@ -914,7 +914,7 @@ class VectorBase : public DataAccess /** Define the params of the storage class. */ typedef typename Storage::Params params_t; /** Define the bin type. */ - typedef typename Bin::VectorBin<Storage> bin_t; + typedef typename Bin::template VectorBin<Storage> bin_t; protected: /** The bin of this stat. */ @@ -1022,7 +1022,7 @@ class ScalarProxy /** Define the params of the storage class. */ typedef typename Storage::Params params_t; /** Define the bin type. */ - typedef typename Bin::VectorBin<Storage> bin_t; + typedef typename Bin::template VectorBin<Storage> bin_t; private: /** Pointer to the bin in the parent VectorBase. */ @@ -1155,7 +1155,7 @@ class ScalarProxy const StatData *statData() const { return getStatData(stat); } std::string str() const { - return csprintf("%s[%d]", statData()->name, index); + return csprintf("%s[%d]", this->statData()->name, index); } }; @@ -1176,7 +1176,7 @@ class Vector2dBase : public DataAccess { public: typedef typename Storage::Params params_t; - typedef typename Bin::VectorBin<Storage> bin_t; + typedef typename Bin::template VectorBin<Storage> bin_t; protected: size_t x; @@ -1204,7 +1204,7 @@ class Vector2dBase : public DataAccess data->cvec[i] = this->data(i)->value(params); } - std::string ysubname(int i) const { return (*y_subnames)[i]; } + std::string ysubname(int i) const { return (*this->y_subnames)[i]; } friend class VectorProxy<Storage, Bin>; VectorProxy<Storage, Bin> operator[](int index); @@ -1225,7 +1225,7 @@ class VectorProxy { public: typedef typename Storage::Params params_t; - typedef typename Bin::VectorBin<Storage> bin_t; + typedef typename Bin::template VectorBin<Storage> bin_t; private: bin_t *bin; @@ -1622,7 +1622,7 @@ class DistBase : public DataAccess /** Define the params of the storage class. */ typedef typename Storage::Params params_t; /** Define the bin type. */ - typedef typename Bin::Bin<Storage> bin_t; + typedef typename Bin::template Bin<Storage> bin_t; protected: /** The bin of this stat. */ @@ -1698,7 +1698,7 @@ class VectorDistBase : public DataAccess { public: typedef typename Storage::Params params_t; - typedef typename Bin::VectorBin<Storage> bin_t; + typedef typename Bin::template VectorBin<Storage> bin_t; protected: bin_t bin; @@ -1749,7 +1749,7 @@ class DistProxy { public: typedef typename Storage::Params params_t; - typedef typename Bin::Bin<Storage> bin_t; + typedef typename Bin::template Bin<Storage> bin_t; typedef VectorDistBase<Storage, Bin> base_t; private: @@ -2206,7 +2206,7 @@ class Scalar Scalar() { - setInit(); + this->setInit(); } /** @@ -2258,7 +2258,7 @@ class Average Average() { - setInit(); + this->setInit(); } /** @@ -2290,8 +2290,8 @@ class Vector * @return A reference to this stat. */ Vector &init(size_t size) { - bin.init(size, params); - setInit(); + this->bin.init(size, this->params); + this->setInit(); return *this; } @@ -2314,8 +2314,8 @@ class AverageVector * @return A reference to this stat. */ AverageVector &init(size_t size) { - bin.init(size, params); - setInit(); + this->bin.init(size, this->params); + this->setInit(); return *this; } @@ -2333,10 +2333,10 @@ class Vector2d { public: Vector2d &init(size_t _x, size_t _y) { - statData()->x = x = _x; - statData()->y = y = _y; - bin.init(x * y, params); - setInit(); + this->statData()->x = this->x = _x; + this->statData()->y = this->y = _y; + this->bin.init(this->x * this->y, this->params); + this->setInit(); return *this; } @@ -2367,12 +2367,12 @@ class Distribution * @return A reference to this distribution. */ Distribution &init(Counter min, Counter max, Counter bkt) { - params.min = min; - params.max = max; - params.bucket_size = bkt; - params.size = (int)rint((max - min) / bkt + 1.0); - bin.init(params); - setInit(); + this->params.min = min; + this->params.max = max; + this->params.bucket_size = bkt; + this->params.size = (int)rint((max - min) / bkt + 1.0); + this->bin.init(this->params); + this->setInit(); return *this; } @@ -2399,8 +2399,8 @@ class StandardDeviation * Construct and initialize this distribution. */ StandardDeviation() { - bin.init(params); - setInit(); + this->bin.init(this->params); + this->setInit(); } }; @@ -2426,8 +2426,8 @@ class AverageDeviation */ AverageDeviation() { - bin.init(params); - setInit(); + this->bin.init(this->params); + this->setInit(); } }; @@ -2457,12 +2457,12 @@ class VectorDistribution * @return A reference to this distribution. */ VectorDistribution &init(int size, Counter min, Counter max, Counter bkt) { - params.min = min; - params.max = max; - params.bucket_size = bkt; - params.size = (int)rint((max - min) / bkt + 1.0); - bin.init(size, params); - setInit(); + this->params.min = min; + this->params.max = max; + this->params.bucket_size = bkt; + this->params.size = (int)rint((max - min) / bkt + 1.0); + this->bin.init(size, this->params); + this->setInit(); return *this; } @@ -2491,8 +2491,8 @@ class VectorStandardDeviation * @return A reference to this distribution. */ VectorStandardDeviation &init(int size) { - bin.init(size, params); - setInit(); + this->bin.init(size, this->params); + this->setInit(); return *this; } @@ -2521,8 +2521,8 @@ class VectorAverageDeviation * @return A reference to this distribution. */ VectorAverageDeviation &init(int size) { - bin.init(size, params); - setInit(); + this->bin.init(size, this->params); + this->setInit(); return *this; } diff --git a/base/trace.cc b/base/trace.cc index 1c07e408f..c9d4a0f78 100644 --- a/base/trace.cc +++ b/base/trace.cc @@ -71,7 +71,7 @@ Log::init(int _size) size = _size; - buffer = new (Record *)[size]; + buffer = new Record *[size]; for (int i = 0; i < size; ++i) { buffer[i] = NULL; diff --git a/base/trace.hh b/base/trace.hh index 5e05d6e5e..054b14546 100644 --- a/base/trace.hh +++ b/base/trace.hh @@ -26,8 +26,8 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef __TRACE_HH__ -#define __TRACE_HH__ +#ifndef __BASE_TRACE_HH__ +#define __BASE_TRACE_HH__ #include <vector> @@ -228,4 +228,4 @@ do { \ #endif // TRACING_ON -#endif // __TRACE_HH__ +#endif // __BASE_TRACE_HH__ |