76struct TStatusBitsChecker::Registry::Info {
78 Info(
const Info &) =
default;
79 Info(Info &&) =
default;
81 Info(
TClass &o, std::string &&
n,
bool intentionalDup) : fOwner(&o), fConstantName(
n), fIntentionalDup(intentionalDup)
88 std::string fConstantName;
89 bool fIntentionalDup =
false;
104 Error(
"TStatusBitsChecker::ConvertBit",
"In %s the value of %s is %lld which was not produced by BIT macro.",
105 classRef.
GetName(), constantName, constant);
110 double fraction = std::frexp(constant, &backshift);
117 if (backshift < 0 || std::abs(0.5 - fraction) > 0.00001f) {
118 Error(
"TStatusBitsChecker::ConvertBit",
"In %s the value of %s is %lld which was not produced by BIT macro.",
119 classRef.
GetName(), constantName, constant);
123 if (backshift > 24) {
124 Error(
"TStatusBitsChecker::ConvertBit",
"In %s the value of %s is %lld (>23) which is ignored by SetBit.",
125 classRef.
GetName(), constantName, constant);
146 bool intentionalDup = exceptionBits && exceptionBits->
GetConstant(constant->GetName());
154 if (reg.fOwner == &classRef) {
162 fRegister[bit].emplace_back(classRef, std::string(constant->GetName()), intentionalDup);
170 TClass *bcl = base->GetClassPointer();
184 RegisterBits(classRef);
187 for (
auto cursor : fRegister) {
188 for (
auto constant : cursor.second) {
189 Printf(
"Bit %3d declared in %s as %s", cursor.first, constant.fOwner->GetName(),
190 constant.fConstantName.c_str());
195 bool issuedHeader =
false;
197 for (
auto cursor : fRegister) {
198 unsigned int nDuplicate = 0;
199 for (
auto constant : cursor.second) {
200 if (!constant.fIntentionalDup)
203 if (nDuplicate > 1) {
205 Error(
"TStatusBitsChecker",
"In %s class hierarchy, there are duplicates bits:", classRef.
GetName());
208 for (
auto constant : cursor.second) {
209 if (!constant.fIntentionalDup) {
210 Error(
"TStatusBitsChecker",
" Bit %3d used in %s as %s", cursor.first, constant.fOwner->GetName(),
211 constant.fConstantName.c_str());
238 return Check(*cl, verbose);
255 std::set<std::string> rootLibs;
256 TList classesDeclFileNotFound;
257 TList classesImplFileNotFound;
260 for (
Int_t i = 0; i < totalNumberOfClasses; i++) {
273 result =
Check(*classPtr, verbosity) && result;
R__EXTERN TClassTable * gClassTable
void Info(const char *location, const char *msgfmt,...)
Use this function for informational messages.
void Error(const char *location, const char *msgfmt,...)
Use this function in case an error occurred.
void Printf(const char *fmt,...)
TRangeStaticCast is an adaptater class that allows the typed iteration through a TCollection.
std::map< UChar_t, std::list< Info > > fRegister
! Register of bits seen so far.
Registry()
Default constructor. Implemented in source file to allow hiding of the Info struct.
bool Check(TClass &classRef, bool verbose=false)
Return false and print error messages if there is any unexpected duplicates BIT constant in the class...
void RegisterBits(TClass &classRef)
Add to fRegister the Info about the bits in this class and its base classes.
~Registry()
Default destructor. Implemented in source file to allow hiding of the Info struct.
static bool Check(TClass &classRef, bool verbose=false)
Return false and print error messages if there is any unexpected duplicates BIT constant in the class...
static UChar_t ConvertToBit(Long64_t constant, TClass &classRef, const char *constantName)
Figure out which bit the constant has been set from/to.
static bool CheckAllClasses(bool verbosity=false)
Return false and print error messages if there is any unexpected duplicates BIT constant in any of th...
static char * Next()
Returns next class from sorted class table.
TClass instances represent classes, structs and namespaces in the ROOT type system.
TList * GetListOfEnums(Bool_t load=kTRUE)
Return a list containing the TEnums of a class.
TList * GetListOfBases()
Return list containing the TBaseClass(es) of a class.
static TClass * GetClass(const char *name, Bool_t load=kTRUE, Bool_t silent=kFALSE)
Static method returning pointer to TClass of the specified class name.
Long64_t GetValue() const
The TEnum class implements the enum type.
const TSeqCollection * GetConstants() const
const TEnumConstant * GetConstant(const char *name) const
virtual TObject * FindObject(const char *name) const
Find an object in this list using its name.
virtual const char * GetName() const
Returns name of object.
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...