From a82283ddbcc3f1d3b801a7c8b6b0980465bf8167 Mon Sep 17 00:00:00 2001 From: Gabe Black Date: Thu, 29 Mar 2018 17:00:20 -0700 Subject: 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 Reviewed-by: Jason Lowe-Power Maintainer: Anthony Gutierrez Maintainer: Jason Lowe-Power --- src/base/bitunion.hh | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'src/base') 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 - 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. -- cgit v1.2.3