From: Gabe Black Date: Fri, 30 Mar 2018 00:00:20 +0000 (-0700) Subject: base: Make bitunion output functions static/inline. X-Git-Tag: v19.0.0.0~2188 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=a82283ddbcc3f1d3b801a7c8b6b0980465bf8167;p=gem5.git 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 --- 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.