1 /* Definitions of assert-like functions.
2    Copyright (C) 2001-2010 Roberto Bagnara <bagnara@cs.unipr.it>
3    Copyright (C) 2010-2016 BUGSENG srl (http://bugseng.com)
4 
5 This file is part of the Parma Polyhedra Library (PPL).
6 
7 The PPL is free software; you can redistribute it and/or modify it
8 under the terms of the GNU General Public License as published by the
9 Free Software Foundation; either version 3 of the License, or (at your
10 option) any later version.
11 
12 The PPL is distributed in the hope that it will be useful, but WITHOUT
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
15 for more details.
16 
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software Foundation,
19 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1307, USA.
20 
21 For the most up-to-date information see the Parma Polyhedra Library
22 site: http://bugseng.com/products/ppl/ . */
23 
24 #include "ppl-config.h"
25 #include "assertions.hh"
26 #include <cstdlib>
27 #include <iostream>
28 
29 namespace PPL = Parma_Polyhedra_Library;
30 
31 void
ppl_unreachable()32 PPL::ppl_unreachable() {
33   abort();
34 }
35 
36 void
ppl_unreachable_msg(const char * msg,const char * file,unsigned int line,const char * function)37 PPL::ppl_unreachable_msg(const char* msg,
38                          const char* file, unsigned int line,
39                          const char* function) {
40   std::cerr << file << ":" << line << ": " << function
41             << ": Latent fault detected: " << msg << ".\n";
42   abort();
43 }
44 
45 void
ppl_assertion_failed(const char * assertion_text,const char * file,unsigned int line,const char * function)46 PPL::ppl_assertion_failed(const char* assertion_text,
47                           const char* file, unsigned int line,
48                           const char* function) {
49   std::cerr << file << ":" << line << ": " << function
50             << ": Assertion `" << assertion_text << "' failed.\n";
51   abort();
52 }
53