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).
This commit is contained in:
Andreas Hansson
2012-03-19 06:36:09 -04:00
parent adb8621031
commit 72538294fb
56 changed files with 204 additions and 186 deletions

View File

@@ -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));

View File

@@ -28,7 +28,7 @@
* Authors: Nathan Binkert
*/
#import "base/callback.hh"
#include "base/callback.hh"
CallbackQueue::~CallbackQueue()
{

View File

@@ -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)

View File

@@ -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

View File

@@ -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)

View File

@@ -61,7 +61,7 @@ class VideoConvert
bgr444,
bgr4444,
rgb444,
rgb4444,
rgb4444
};
// supports bpp32 RGB (bmp) and bpp16 5:6:5 mode BGR (linux)