From 72538294fb1eb2e4dcd5d818c78bcdf78b0de491 Mon Sep 17 00:00:00 2001 From: Andreas Hansson Date: Mon, 19 Mar 2012 06:36:09 -0400 Subject: 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). --- src/arch/arm/isa/templates/neon.isa | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'src/arch/arm/isa') diff --git a/src/arch/arm/isa/templates/neon.isa b/src/arch/arm/isa/templates/neon.isa index fe3a026b8..573d245b8 100644 --- a/src/arch/arm/isa/templates/neon.isa +++ b/src/arch/arm/isa/templates/neon.isa @@ -234,12 +234,16 @@ def template NeonEqualRegExecute {{ }}; output header {{ - uint16_t nextBiggerType(uint8_t); - uint32_t nextBiggerType(uint16_t); - uint64_t nextBiggerType(uint32_t); - int16_t nextBiggerType(int8_t); - int32_t nextBiggerType(int16_t); - int64_t nextBiggerType(int32_t); + template + struct bigger_type_t; + + template<> struct bigger_type_t { typedef uint16_t type; }; + template<> struct bigger_type_t { typedef uint32_t type; }; + template<> struct bigger_type_t { typedef uint64_t type; }; + + template<> struct bigger_type_t { typedef int16_t type; }; + template<> struct bigger_type_t { typedef int32_t type; }; + template<> struct bigger_type_t { typedef int64_t type; }; }}; def template NeonUnequalRegExecute {{ @@ -247,7 +251,7 @@ def template NeonUnequalRegExecute {{ Fault %(class_name)s::execute(%(CPU_exec_context)s *xc, Trace::InstRecord *traceData) const { - typedef typeof(nextBiggerType((Element)0)) BigElement; + typedef typename bigger_type_t::type BigElement; Fault fault = NoFault; %(op_decl)s; %(op_rd)s; -- cgit v1.2.3