All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
StatusCode.cpp
Go to the documentation of this file.
1 #define GAUDIKERNEL_STATUSCODE_CPP 1
2 
3 #include "GaudiKernel/StatusCode.h"
4 #include "GaudiKernel/System.h"
5 #include "GaudiKernel/Bootstrap.h"
6 #include "GaudiKernel/IMessageSvc.h"
7 #include "GaudiKernel/IStatusCodeSvc.h"
8 #include "GaudiKernel/ISvcLocator.h"
9 #include "GaudiKernel/MsgStream.h"
10 #include "GaudiKernel/IssueSeverity.h"
11 #include <fstream>
12 #include <iostream>
13 #include <sstream>
14 #include <stdlib.h>
15 #include <exception>
16 
17 bool StatusCode::s_checking(false);
18 
20  s_checking = true;
21 }
22 
24  s_checking = false;
25 }
26 
28  return s_checking;
29 }
30 
32  static IssueSeverity dummy;
33  if (m_severity) return *m_severity;
34  else return dummy;
35 }
36 
38 
39  if (!m_checked && !GaudiException::s_proc && !std::uncaught_exception() ) {
40 
42 
43  SmartIF<IStatusCodeSvc> scs(Gaudi::svcLocator()->service("StatusCodeSvc"));
44 
45  const size_t depth = 21;
46  void* addresses[depth];
47 
48  std::string lib, fnc;
49  void* addr = 0;
51  if (System::backTrace(addresses, depth)) {
52 
53  for(size_t idx: {2, 3})
54  if (System::getStackLevel(addresses[idx], addr, fnc, lib) &&
55  fnc != "StatusCode::~StatusCode()") {
56 
57  if (scs) {
58  scs->regFnc(fnc, lib);
59  } else {
60  MsgStream log(msg, "StatusCode");
61  log << MSG::WARNING << "Unchecked in " << fnc
62  << " (" << lib << ")" << endmsg;
63  }
64  break;
65  }
66 
67  }
68  }
69 }