QMCPACK
AppAbort.h
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////////////
2 // This file is distributed under the University of Illinois/NCSA Open Source
3 // License. See LICENSE file in top directory for details.
4 //
5 // Copyright (c) 2020 QMCPACK developers.
6 //
7 // File developed by: Peter Doak, doakpw@ornl.gov, Oak Ridge National Lab
8 //
9 // File created by: Communicate.h
10 ////////////////////////////////////////////////////////////////////////////////
11 
12 #ifndef QMCPLUSPLUS_APPABORT_H
13 #define QMCPLUSPLUS_APPABORT_H
14 
15 #include <string>
16 #include <sstream>
17 
18 /** break on this function to catch any APP_ABORT call in debugger
19  */
20 void breakableAppAbort(const std::string& str_msg);
21 
22 /** Widely used but deprecated fatal error macros from legacy code
23  *
24  * they allow rather odd use of the << operator for the msg argument
25  * so removing them is non trivial.
26  */
27 #define APP_ABORT(msg) \
28  { \
29  std::ostringstream error_message; \
30  error_message << "Fatal Error. Aborting at " << msg; \
31  breakableAppAbort(error_message.str()); \
32  }
33 
34 #define APP_ABORT_TRACE(f, l, msg) \
35  { \
36  std::ostringstream error_message; \
37  error_message << "Fatal Error. Aborting at " << l << "::" << f << "\n " << msg; \
38  breakableAppAbort(error_message.str()); \
39  }
40 
41 #endif
void breakableAppAbort(const std::string &str_msg)
break on this function to catch any APP_ABORT call in debugger
Definition: AppAbort.cpp:25