Serialbox  2.2.0
Data serialization library and tools for C/C++, Python and Fortran
Unreachable.cpp
Go to the documentation of this file.
1 //===-- serialbox/core/Unreachable.cpp ----------------------------------------------*- C++ -*-===//
2 //
3 // S E R I A L B O X
4 //
5 // This file is distributed under terms of BSD license.
6 // See LICENSE.txt for more information
7 //
8 //===------------------------------------------------------------------------------------------===//
9 //
13 //===------------------------------------------------------------------------------------------===//
14 
16 #include <cstdio>
17 #include <iostream>
18 
19 namespace serialbox {
20 
21 SERIALBOX_ATTRIBUTE_NORETURN void serialbox_unreachable_internal(const char* msg, const char* file,
22  unsigned line) {
23  std::cerr << "FATAL ERROR: UNREACHABLE executed : ";
24  if(msg)
25  std::cerr << "\"" << msg << "\"";
26  if(file)
27  std::cerr << " at " << file << ":" << line;
28  std::cerr << std::endl;
29  std::abort();
30 
31 #ifdef SERIALBOX_BUILTIN_UNREACHABLE
32  SERIALBOX_BUILTIN_UNREACHABLE;
33 #endif
34 }
35 
36 } // namespace serialbox
Namespace of the serialbox library.
Definition: Archive.h:25
#define SERIALBOX_ATTRIBUTE_NORETURN
Mark a method as "no return".
Definition: Compiler.h:102