summaryrefslogtreecommitdiff
path: root/src/base
diff options
context:
space:
mode:
authorAndreas Hansson <andreas.hansson@arm.com>2012-03-19 06:36:09 -0400
committerAndreas Hansson <andreas.hansson@arm.com>2012-03-19 06:36:09 -0400
commit72538294fb1eb2e4dcd5d818c78bcdf78b0de491 (patch)
treeba95d431b41d54c7c25a3b5e84dfca9707a9feb2 /src/base
parentadb862103138caf11191da50d34eb4c93295633a (diff)
downloadgem5-72538294fb1eb2e4dcd5d818c78bcdf78b0de491.tar.xz
gcc: Clean-up of non-C++0x compliant code, first steps
This patch cleans up a number of minor issues aiming to get closer to compliance with the C++0x standard as interpreted by gcc and clang (compile with std=c++0x and -pedantic-errors). In particular, the patch cleans up enums where the last item was succeded by a comma, namespaces closed by a curcly brace followed by a semi-colon, and the use of the GNU-extension typeof (replaced by templated functions). It does not address variable-length arrays, zero-size arrays, anonymous structs, range expressions in switch statements, and the use of long long. The generated CPU code also has a large number of issues that remain to be fixed, mainly related to overflows in implicit constant conversion (due to shifts).
Diffstat (limited to 'src/base')
-rw-r--r--src/base/bitmap.cc12
-rw-r--r--src/base/callback.cc2
-rw-r--r--src/base/range.cc20
-rw-r--r--src/base/range_map.hh3
-rw-r--r--src/base/str.cc22
-rw-r--r--src/base/vnc/convert.hh2
6 files changed, 32 insertions, 29 deletions
diff --git a/src/base/bitmap.cc b/src/base/bitmap.cc
index 08425d74f..80d836b2f 100644
--- a/src/base/bitmap.cc
+++ b/src/base/bitmap.cc
@@ -70,11 +70,13 @@ Bitmap::write(std::ostream *bmp) const
// For further information see:
// http://en.wikipedia.org/wiki/BMP_file_format
Magic magic = {{'B','M'}};
- Header header = {sizeof(VideoConvert::Rgb8888) * width * height,
- 0, 0, 54};
- Info info = {sizeof(Info), width, height, 1,
- sizeof(VideoConvert::Rgb8888) * 8, 0,
- sizeof(VideoConvert::Rgb8888) * width * height, 1, 1, 0, 0};
+ Header header = {
+ static_cast<uint32_t>(sizeof(VideoConvert::Rgb8888)) *
+ width * height, 0, 0, 54};
+ Info info = {static_cast<uint32_t>(sizeof(Info)), width, height, 1,
+ static_cast<uint32_t>(sizeof(VideoConvert::Rgb8888)) * 8,
+ 0, static_cast<uint32_t>(sizeof(VideoConvert::Rgb8888)) *
+ width * height, 1, 1, 0, 0};
char *p = headerBuffer = new char[sizeofHeaderBuffer];
memcpy(p, &magic, sizeof(Magic));
diff --git a/src/base/callback.cc b/src/base/callback.cc
index e9f662b19..ec2445138 100644
--- a/src/base/callback.cc
+++ b/src/base/callback.cc
@@ -28,7 +28,7 @@
* Authors: Nathan Binkert
*/
-#import "base/callback.hh"
+#include "base/callback.hh"
CallbackQueue::~CallbackQueue()
{
diff --git a/src/base/range.cc b/src/base/range.cc
index 442e5fdf8..c50dff056 100644
--- a/src/base/range.cc
+++ b/src/base/range.cc
@@ -73,13 +73,13 @@ template<> bool \
__parse_range(const std::string &s, type &first, type &last) \
{ return __x_parse_range(s, first, last); }
-RANGE_PARSE(unsigned long long);
-RANGE_PARSE(signed long long);
-RANGE_PARSE(unsigned long);
-RANGE_PARSE(signed long);
-RANGE_PARSE(unsigned int);
-RANGE_PARSE(signed int);
-RANGE_PARSE(unsigned short);
-RANGE_PARSE(signed short);
-RANGE_PARSE(unsigned char);
-RANGE_PARSE(signed char);
+RANGE_PARSE(unsigned long long)
+RANGE_PARSE(signed long long)
+RANGE_PARSE(unsigned long)
+RANGE_PARSE(signed long)
+RANGE_PARSE(unsigned int)
+RANGE_PARSE(signed int)
+RANGE_PARSE(unsigned short)
+RANGE_PARSE(signed short)
+RANGE_PARSE(unsigned char)
+RANGE_PARSE(signed char)
diff --git a/src/base/range_map.hh b/src/base/range_map.hh
index 5d6547f9b..d6df32e08 100644
--- a/src/base/range_map.hh
+++ b/src/base/range_map.hh
@@ -32,6 +32,7 @@
#define __BASE_RANGE_MAP_HH__
#include <map>
+#include <utility>
#include "base/range.hh"
@@ -95,7 +96,7 @@ class range_map
if (intersect(r))
return tree.end();
- return tree.insert(std::make_pair<Range<T>,V>(r, d)).first;
+ return tree.insert(std::make_pair(r, d)).first;
}
size_t
diff --git a/src/base/str.cc b/src/base/str.cc
index 1e2be95a8..45d3107b0 100644
--- a/src/base/str.cc
+++ b/src/base/str.cc
@@ -324,17 +324,17 @@ template<> \
bool to_number<type>(const string &value, type &retval) \
{ return __to_number(value, retval); }
-STN(unsigned long long);
-STN(signed long long);
-STN(unsigned long);
-STN(signed long);
-STN(unsigned int);
-STN(signed int);
-STN(unsigned short);
-STN(signed short);
-STN(unsigned char);
-STN(signed char);
-STN(char);
+STN(unsigned long long)
+STN(signed long long)
+STN(unsigned long)
+STN(signed long)
+STN(unsigned int)
+STN(signed int)
+STN(unsigned short)
+STN(signed short)
+STN(unsigned char)
+STN(signed char)
+STN(char)
template<>
bool to_number<bool>(const string &value, bool &retval)
diff --git a/src/base/vnc/convert.hh b/src/base/vnc/convert.hh
index 17df0747b..d6c4ea18f 100644
--- a/src/base/vnc/convert.hh
+++ b/src/base/vnc/convert.hh
@@ -61,7 +61,7 @@ class VideoConvert
bgr444,
bgr4444,
rgb444,
- rgb4444,
+ rgb4444
};
// supports bpp32 RGB (bmp) and bpp16 5:6:5 mode BGR (linux)