Skip to content

Commit f41a042

Browse files
committed
[core] Materialize symbols for TError variables
The variables present in TError.h are used throughout the ROOT libraries. Anytime one of these variables is requested, e.g. with a simple test such as `python -c "import ROOT; ROOT.kError"`, the interpreter will lookup the corresponding symbol. Previously, the variables were declared and defined in the header directly but were not generating any symbol since the linkage was internal. With this commit, provide external linkage to these variables so that the corresponding symbols are materialized in libCore.so. As a consequence, a huge number of extra lookups by cling is avoided.
1 parent 827b7e3 commit f41a042

3 files changed

Lines changed: 18 additions & 10 deletions

File tree

core/foundation/inc/TError.h

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,14 @@
3939

4040
class TVirtualMutex;
4141

42-
constexpr Int_t kUnset = -1;
43-
constexpr Int_t kPrint = 0;
44-
constexpr Int_t kInfo = 1000;
45-
constexpr Int_t kWarning = 2000;
46-
constexpr Int_t kError = 3000;
47-
constexpr Int_t kBreak = 4000;
48-
constexpr Int_t kSysError = 5000;
49-
constexpr Int_t kFatal = 6000;
50-
42+
R__EXTERN const Int_t kUnset;
43+
R__EXTERN const Int_t kPrint;
44+
R__EXTERN const Int_t kInfo;
45+
R__EXTERN const Int_t kWarning;
46+
R__EXTERN const Int_t kError;
47+
R__EXTERN const Int_t kBreak;
48+
R__EXTERN const Int_t kSysError;
49+
R__EXTERN const Int_t kFatal;
5150

5251
// TROOT sets the error ignore level handler, the system error message handler, and the error abort handler on
5352
// construction such that the "Root.ErrorIgnoreLevel" environment variable is used for the ignore level

core/foundation/src/RLogger.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ inline bool RLogHandlerDefault::Emit(const RLogEntry &entry)
5252
if (!entry.fLocation.fFuncName.empty())
5353
strm << " in " << entry.fLocation.fFuncName;
5454

55-
static constexpr const int errorLevelOld[] = {kFatal /*unset*/, kFatal, kError, kWarning, kInfo, kInfo /*debug*/};
55+
static const int errorLevelOld[] = {kFatal /*unset*/, kFatal, kError, kWarning, kInfo, kInfo /*debug*/};
5656
(*::GetErrorHandler())(errorLevelOld[cappedLevel], entry.fLevel == ELogLevel::kFatal, strm.str().c_str(),
5757
entry.fMessage.c_str());
5858
return true;

core/foundation/src/TError.cxx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,15 @@ to be replaced by the proper DefaultErrorHandler()
2828
#include <cerrno>
2929
#include <string>
3030

31+
const Int_t kUnset = -1;
32+
const Int_t kPrint = 0;
33+
const Int_t kInfo = 1000;
34+
const Int_t kWarning = 2000;
35+
const Int_t kError = 3000;
36+
const Int_t kBreak = 4000;
37+
const Int_t kSysError = 5000;
38+
const Int_t kFatal = 6000;
39+
3140
Int_t gErrorIgnoreLevel = kUnset;
3241
Int_t gErrorAbortLevel = kSysError+1;
3342
Bool_t gPrintViaErrorHandler = kFALSE;

0 commit comments

Comments
 (0)