summaryrefslogtreecommitdiff
path: root/src/base
diff options
context:
space:
mode:
authorGabe Black <gabeblack@google.com>2018-03-29 17:00:20 -0700
committerGabe Black <gabeblack@google.com>2018-03-30 19:22:46 +0000
commita82283ddbcc3f1d3b801a7c8b6b0980465bf8167 (patch)
tree624ee705891cc15d8c8573f4c378058e3aa19d2c /src/base
parent430bef385983db08bb1dd131f6b0ab5ca6d66fbe (diff)
downloadgem5-a82283ddbcc3f1d3b801a7c8b6b0980465bf8167.tar.xz
base: Make bitunion output functions static/inline.
The specializations need to be online only and not static, but the template itself is static and inline. Originally they were in an anonymous namespace, but that causes warnings when building on clang or with certain versions of gcc because the functions may not be used in every .cc. Change-Id: Iff127337f7bf0c18755de07a49d6e7a9ce6f2f0a Reviewed-on: https://gem5-review.googlesource.com/9581 Reviewed-by: Anthony Gutierrez <anthony.gutierrez@amd.com> Reviewed-by: Jason Lowe-Power <jason@lowepower.com> Maintainer: Anthony Gutierrez <anthony.gutierrez@amd.com> Maintainer: Jason Lowe-Power <jason@lowepower.com>
Diffstat (limited to 'src/base')
-rw-r--r--src/base/bitunion.hh10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/base/bitunion.hh b/src/base/bitunion.hh
index b2a2ba806..49a956eec 100644
--- a/src/base/bitunion.hh
+++ b/src/base/bitunion.hh
@@ -419,10 +419,9 @@ namespace std
namespace BitfieldBackend
{
-namespace
-{
+
template<typename T>
- std::ostream &
+ static inline std::ostream &
bitfieldBackendPrinter(std::ostream &os, const T &t)
{
os << t;
@@ -433,7 +432,7 @@ namespace
//these specializations attempt to ensure that they get cast to integers
//of the appropriate type before printing.
template <>
- std::ostream &
+ inline std::ostream &
bitfieldBackendPrinter(std::ostream &os, const char &t)
{
os << (const int)t;
@@ -441,14 +440,13 @@ namespace
}
template <>
- std::ostream &
+ inline std::ostream &
bitfieldBackendPrinter(std::ostream &os, const unsigned char &t)
{
os << (const unsigned int)t;
return os;
}
}
-}
//A default << operator which casts a bitunion to its underlying type and
//passes it to BitfieldBackend::bitfieldBackendPrinter.