summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Hansson <andreas.hansson@arm.com>2012-09-14 12:13:18 -0400
committerAndreas Hansson <andreas.hansson@arm.com>2012-09-14 12:13:18 -0400
commit806a1144ceea710cb6586fc2a80ae60a6e0be552 (patch)
tree280cdc619480f95840db6763eabc91e626770e09
parentae1652b813e461d5e8840be876d038956b64a8cc (diff)
downloadgem5-806a1144ceea710cb6586fc2a80ae60a6e0be552.tar.xz
scons: Use c++0x with gcc >= 4.4 instead of 4.6
This patch shifts the version of gcc for which we enable c++0x from 4.6 to 4.4 The more long term plan is to see what the c++0x features can bring and what level of support would be enabled simply by bumping the required version of gcc from 4.3 to 4.4. A few minor things had to be fixed in the code base, most notably the choice of a hashmap implementation. In the Ruby Sequencer there were also a few minor issues that gcc 4.4 was not too happy about.
-rwxr-xr-xSConstruct6
-rw-r--r--src/base/hashmap.hh16
-rw-r--r--src/mem/ruby/system/Sequencer.cc9
3 files changed, 20 insertions, 11 deletions
diff --git a/SConstruct b/SConstruct
index 34b333f60..ee53be196 100755
--- a/SConstruct
+++ b/SConstruct
@@ -502,7 +502,9 @@ if main['GCC']:
not compareVersions(gcc_version, '4.4.2'):
print 'Info: Tree vectorizer in GCC 4.4.1 & 4.4.2 is buggy, disabling.'
main.Append(CCFLAGS=['-fno-tree-vectorize'])
- if compareVersions(gcc_version, '4.6') >= 0:
+ # c++0x support in gcc is useful already from 4.4, see
+ # http://gcc.gnu.org/projects/cxx0x.html for details
+ if compareVersions(gcc_version, '4.4') >= 0:
main.Append(CXXFLAGS=['-std=c++0x'])
elif main['ICC']:
pass #Fix me... add warning flags once we clean up icc warnings
@@ -535,6 +537,8 @@ elif main['CLANG']:
# of if-statements
main.Append(CCFLAGS=['-Wno-parentheses'])
+ # clang 2.9 does not play well with c++0x as it ships with C++
+ # headers that produce errors, this was fixed in 3.0
if compareVersions(clang_version, "3") >= 0:
main.Append(CXXFLAGS=['-std=c++0x'])
else:
diff --git a/src/base/hashmap.hh b/src/base/hashmap.hh
index dfdf6ef90..41de40055 100644
--- a/src/base/hashmap.hh
+++ b/src/base/hashmap.hh
@@ -50,9 +50,9 @@
// clang, use unordered_map
// we need to determine what is available, as in the non-c++0x case,
-// e.g. gcc >= 4.3 and <= 4.5, the containers are in the std::tr1
-// namespace, and only gcc >= 4.6 (with -std=c++0x) adds the final
-// container implementation in the std namespace
+// i.e. gcc == 4.3, the containers are in the std::tr1 namespace, and
+// only gcc >= 4.4 (with -std=c++0x) adds the final container
+// implementation in the std namespace
#if defined(__clang__)
// align with -std=c++0x only for clang >= 3.0 in CCFLAGS and also
@@ -67,9 +67,9 @@
#define HAVE_STD_TR1_UNORDERED_MAP 1
#endif
#else
-// align with -std=c++0x only for gcc >= 4.6 in CCFLAGS, contrary to
+// align with -std=c++0x only for gcc >= 4.4 in CCFLAGS, contrary to
// clang we can rely entirely on the compiler version
-#if ((__GNUC__ == 4 && __GNUC_MINOR__ >= 6) || __GNUC__ > 4)
+#if ((__GNUC__ == 4 && __GNUC_MINOR__ >= 4) || __GNUC__ > 4)
#define HAVE_STD_UNORDERED_MAP 1
#else
#define HAVE_STD_TR1_UNORDERED_MAP 1
@@ -101,17 +101,17 @@
#if HAVE_STD_UNORDERED_MAP
-// clang or gcc >= 4.6
+// clang or gcc >= 4.4
#include <unordered_map>
#include <unordered_set>
// note that this assumes that -std=c++0x is added to the command line
-// which is done in the SConstruct CXXFLAGS for gcc >= 4.6 and clang
+// which is done in the SConstruct CXXFLAGS for gcc >= 4.4 and clang
// >= 3.0
#define __hash_namespace std
#define __hash_namespace_begin namespace std {
#define __hash_namespace_end }
#else
-// clang <= 3.0, gcc >= 4.3 and < 4.6
+// clang <= 3.0, gcc == 4.3
#include <tr1/unordered_map>
#include <tr1/unordered_set>
#define __hash_namespace std::tr1
diff --git a/src/mem/ruby/system/Sequencer.cc b/src/mem/ruby/system/Sequencer.cc
index efb0b002e..854d360ac 100644
--- a/src/mem/ruby/system/Sequencer.cc
+++ b/src/mem/ruby/system/Sequencer.cc
@@ -214,6 +214,11 @@ Sequencer::insertRequest(PacketPtr pkt, RubyRequestType request_type)
Address line_addr(pkt->getAddr());
line_addr.makeLineAddress();
+ // Create a default entry, mapping the address to NULL, the cast is
+ // there to make gcc 4.4 happy
+ RequestTable::value_type default_entry(line_addr,
+ (SequencerRequest*) NULL);
+
if ((request_type == RubyRequestType_ST) ||
(request_type == RubyRequestType_RMW_Read) ||
(request_type == RubyRequestType_RMW_Write) ||
@@ -231,7 +236,7 @@ Sequencer::insertRequest(PacketPtr pkt, RubyRequestType request_type)
}
pair<RequestTable::iterator, bool> r =
- m_writeRequestTable.insert(RequestTable::value_type(line_addr, 0));
+ m_writeRequestTable.insert(default_entry);
if (r.second) {
RequestTable::iterator i = r.first;
i->second = new SequencerRequest(pkt, request_type,
@@ -251,7 +256,7 @@ Sequencer::insertRequest(PacketPtr pkt, RubyRequestType request_type)
}
pair<RequestTable::iterator, bool> r =
- m_readRequestTable.insert(RequestTable::value_type(line_addr, 0));
+ m_readRequestTable.insert(default_entry);
if (r.second) {
RequestTable::iterator i = r.first;