diff --git a/src/base/bitunion.hh b/src/base/bitunion.hh index 3b6ca161cc..a4eb354213 100644 --- a/src/base/bitunion.hh +++ b/src/base/bitunion.hh @@ -35,6 +35,7 @@ #include #include "base/bitfield.hh" +#include "base/compiler.hh" #include "sim/serialize_handlers.hh" // The following implements the BitUnion system of defining bitfields @@ -168,7 +169,7 @@ class BitfieldWOType : public BitfieldTypeImpl //This namespace is for classes which implement the backend of the BitUnion //stuff. Don't use any of these directly. -namespace BitfieldBackend +namespace bitfield_backend { template class Unsigned @@ -382,7 +383,7 @@ namespace BitfieldBackend return *this; } }; -} +} // namespace bitfield_backend //This macro is a backend for other macros that specialize it slightly. //First, it creates/extends a namespace "BitfieldUnderlyingClasses" and @@ -401,14 +402,14 @@ namespace BitfieldBackend //overhead. #define __BitUnion(type, name) \ class BitfieldUnderlyingClasses##name : \ - public BitfieldBackend::BitfieldTypes \ + public bitfield_backend::BitfieldTypes \ { \ protected: \ typedef type __StorageType; \ - friend BitfieldBackend::BitUnionBaseType< \ - BitfieldBackend::BitUnionOperators< \ + friend bitfield_backend::BitUnionBaseType< \ + bitfield_backend::BitUnionOperators< \ BitfieldUnderlyingClasses##name> >; \ - friend BitfieldBackend::BitUnionBaseType< \ + friend bitfield_backend::BitUnionBaseType< \ BitfieldUnderlyingClasses##name>; \ public: \ union { \ @@ -425,7 +426,7 @@ namespace BitfieldBackend #define EndBitUnion(name) \ }; \ }; \ - typedef BitfieldBackend::BitUnionOperators< \ + typedef bitfield_backend::BitUnionOperators< \ BitfieldUnderlyingClasses##name> name; //This sets up a bitfield which has other bitfields nested inside of it. The @@ -495,8 +496,8 @@ namespace BitfieldBackend //These templates make it possible to define other templates related to -//BitUnions without having to refer to internal typedefs or the BitfieldBackend -//namespace. +//BitUnions without having to refer to internal typedefs or the +// bitfield_backend namespace. //To build a template specialization which works for all BitUnions, accept a //template argument T, and then use BitUnionType as an argument in the @@ -513,9 +514,9 @@ namespace BitfieldBackend * @ingroup api_bitunion */ template -using BitUnionType = BitfieldBackend::BitUnionOperators; +using BitUnionType = bitfield_backend::BitUnionOperators; -namespace BitfieldBackend +namespace bitfield_backend { template struct BitUnionBaseType @@ -528,13 +529,13 @@ namespace BitfieldBackend { typedef typename BitUnionType::__StorageType Type; }; -} +} // namespace bitfield_backend /** * @ingroup api_bitunion */ template -using BitUnionBaseType = typename BitfieldBackend::BitUnionBaseType::Type; +using BitUnionBaseType = typename bitfield_backend::BitUnionBaseType::Type; //An STL style hash structure for hashing BitUnions based on their base type. @@ -549,12 +550,10 @@ namespace std return hash >::operator()(val); } }; -} +} // namespace std - -namespace BitfieldBackend +namespace bitfield_backend { - template static inline std::ostream & bitfieldBackendPrinter(std::ostream &os, const T &t) @@ -581,11 +580,11 @@ namespace BitfieldBackend os << (unsigned int)t; return os; } -} +} // namespace bitfield_backend /** * A default << operator which casts a bitunion to its underlying type and - * passes it to BitfieldBackend::bitfieldBackendPrinter. + * passes it to bitfield_backend::bitfieldBackendPrinter. * * @ingroup api_bitunion */ @@ -593,7 +592,7 @@ template std::ostream & operator << (std::ostream &os, const BitUnionType &bu) { - return BitfieldBackend::bitfieldBackendPrinter( + return bitfield_backend::bitfieldBackendPrinter( os, (BitUnionBaseType)bu); }