ATLAS Offline Software
CheckRootVersion.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 
7 
8 //
9 // includes
10 //
11 
13 
14 #include <cstdlib>
15 #include <iostream>
16 #include <atomic>
17 #include <TROOT.h>
18 #include <RootCoreUtils/Assert.h>
19 
20 //
21 // method implementations
22 //
23 
24 namespace RCU
25 {
26  namespace
27  {
28  std::atomic<bool> checked = false;
29  }
30 
32  {
33  if (checked)
34  return;
35  if (gROOT->GetVersionCode() != Int_t(ROOT_VERSION_CODE))
36  {
37  std::cout
38  << "root version used is not compatible with the one used for\n"
39  << "compilation. please load either the correct root version, or\n"
40  << "recompile with the new version\n\n"
41  << "alternatively deactivate this check using:\n"
42  << "#include <RootCoreUtils/CheckRootVersion.hh>\n"
43  << " RCU::disable_root_version_check()\n"
44  << std::flush;
45  std::abort ();
46  }
47  checked = true;
48  }
49 
50 
51 
53  {
54  checked = true;
55  }
56 }
FullCPAlgorithmsTest_eljob.flush
flush
Definition: FullCPAlgorithmsTest_eljob.py:182
CheckRootVersion.h
RCU
This module defines a variety of assert style macros.
Definition: Assert.cxx:26
Assert.h
RCU::check_root_version
void check_root_version()
effects: check whether we are using a consistent root version guarantee: strong failures: version mis...
Definition: CheckRootVersion.cxx:31
RCU::disable_root_version_check
void disable_root_version_check()
effects: disable the root version check guarantee: no-fail
Definition: CheckRootVersion.cxx:52