ATLAS Offline Software
Check.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef ASGMESSAGING_CHECK_H
6 #define ASGMESSAGING_CHECK_H
7 
8 // Local include(s):
10 
11 #include "boost/preprocessor/facilities/overload.hpp"
13 
40 
41 #ifndef __CPPCHECK__ // The varadic macros here confuse cppcheck.
42 
43 #define ASG_CHECK(...) \
44  BOOST_PP_OVERLOAD(ASG_CHECK_, __VA_ARGS__)(__VA_ARGS__)
45 
46 #define ASG_CHECK_1( EXP ) \
47  do { \
48  const StatusCode sc__(EXP); \
49  if( ATH_UNLIKELY ( ! sc__.isSuccess() ) ) { \
50  ATH_MSG_ERROR( "Failed to call \"" << #EXP << "\"" ); \
51  return sc__; \
52  } \
53  } while( 0 )
54 
55 #define ASG_CHECK_2( EXP, RET ) \
56  do { \
57  const StatusCode sc__(EXP); \
58  if( ATH_UNLIKELY ( ! sc__.isSuccess() ) ) { \
59  ATH_MSG_ERROR( "Failed to call \"" << #EXP << "\"" ); \
60  return RET; \
61  } \
62  } while( 0 )
63 
64 #endif // __CPPCHECK__
65 
66 
76 #define ASG_CHECK_SA( SOURCE, EXP ) \
77  do { \
78  const StatusCode sc__(EXP); \
79  if( ATH_UNLIKELY ( ! sc__.isSuccess() ) ) { \
80  static MsgStream msg( SOURCE ); \
81  msg << MSGSTREAM_REPORT_PREFIX << MSG::ERROR \
82  << "Failed to call \"" << #EXP << "\"" << endmsg; \
83  return sc__; \
84  } \
85  } while( 0 )
86 
88 #ifdef XAOD_STANDALONE
89 # define ATH_CHECK ASG_CHECK
90 #else
92 #endif
93 
94 #endif // ASGMESSAGING_CHECK_H
AthCheckMacros.h
AthUnlikelyMacros.h
MsgStreamMacros.h