summaryrefslogtreecommitdiff
path: root/base
diff options
context:
space:
mode:
authorKevin Lim <ktlim@umich.edu>2005-01-14 18:34:56 -0500
committerKevin Lim <ktlim@umich.edu>2005-01-14 18:34:56 -0500
commitf58d85128dde9aebb5b161aa51799309d5c16d67 (patch)
treea5d9242a2dc42ba5a58f6ab3509a95d55d7c28bf /base
parent3e5a3df24f06b22ee1c155f3e3d3948d9140754a (diff)
downloadgem5-f58d85128dde9aebb5b161aa51799309d5c16d67.tar.xz
Fixes so m5 compiles on gcc 3.4, which has much stricter syntax. Most changes come from templated code,
which is evaluated slightly differently than in previous versions of gcc. arch/alpha/alpha_linux_process.cc: Alphabetize includes. arch/alpha/vptr.hh: Change the constants that are being used for alpha pagebytes to come from the ISA. base/random.hh: cpu/static_inst.cc: sim/param.cc: Fix up template syntax. base/range.hh: Include iostream for << operator. base/res_list.hh: base/statistics.hh: cpu/simple_cpu/simple_cpu.hh: cpu/static_inst.hh: sim/eventq.hh: sim/param.hh: Fixup for templated code to resolve different scope lookup in gcc 3.4. This defers the lookup of the function/variable until actual instantiation time by making it dependent on the templated class/function. base/trace.cc: Fix call to new. base/trace.hh: Fix up #define to have full path. cpu/base_cpu.cc: Fix up call to new. dev/etherlink.hh: dev/ns_gige.hh: dev/sinic.hh: Fixup for friend class/function declaration. g++ 3.4 no longer allows typedefs to be declared as a friend class. dev/pcidev.hh: Fix up re-definition of access level to params. kern/linux/linux_syscalls.hh: kern/tru64/tru64_syscalls.hh: Fix up header. Fix up template syntax. sim/serialize.cc: Include errno.h. sim/startup.cc: Change startupq. queue was getting destructed before all things had called ~StartupCallback(), which lead to a segfault. This puts startupq in global space, and we allocate it ourselves. Other code may be similar to this and may need changing in the future. sim/syscall_emul.hh: Include cpu/exec_context.hh and sim/process.hh, as forward declarations are no longer sufficient. sim/universe.cc: Include errno.h --HG-- extra : convert_revision : e49d08ee89eb06a28351f02bafc028ca6652d5af
Diffstat (limited to 'base')
-rw-r--r--base/random.hh20
-rw-r--r--base/range.hh1
-rw-r--r--base/res_list.hh2
-rw-r--r--base/statistics.hh128
-rw-r--r--base/trace.cc2
-rw-r--r--base/trace.hh6
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 bc6c9aa7a..aa4e7b2af 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__