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>
namespace BitfieldBackend
{
-namespace
-{
+
template<typename T>
- std::ostream &
+ static inline std::ostream &
bitfieldBackendPrinter(std::ostream &os, const T &t)
{
os << t;
//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;
}
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.