debug.hh

Go to the documentation of this file.
1 
6 #ifndef debug_hh
7 #define debug_hh
8 
9 #ifdef DEBUG
10 
11 #include <iomanip>
12 #include <sys/types.h>
13 
14 #if defined (__GNUC__) || defined(__SUNPRO_CC)
15 // # ifdef __GNUC__
16 // # define DEBUG_FUNCTION __PRETTY_FUNCTION__
17 // # else
18 # define DEBUG_FUNCTION __func__
19 // # endif
20 #else
21 # define __PRETTY_FUNCTION__ "(unknown)"
22 # define DEBUG_FUNCTION __PRETTY_FUNCTION__
23 #endif
24 
25 namespace concepts {
26  char* shorten(const char* FILE);
27 }
28 
29 #define DEBUGL(doit, msg)\
30 DPL(doit, "[" << concepts::shorten(__FILE__) << ':' << std::setw(4) \
31  << __LINE__ << "] " << DEBUG_FUNCTION << " --", msg)
32 
33 #define DPL(doit, msg, var)\
34 if(doit!=0) std::cout << msg << " " << var << std::endl;
35 
36 #define DP(doit, msg, var)\
37 if(doit!=0) std::cout << msg << " " << var;
38 
39 #else
40 # define DEBUGL(doit, msg)
41 # define DP(doit, msg, var)
42 # define DPL(doit, msg, var)
43 # ifndef NDEBUG
44 # define NDEBUG // discard assertions
45 # endif
46 #endif
47 
48 #include <iostream>
49 #include <cassert>
50 #include <iomanip>
51 #include <cstring>
52 
53 #endif // debug_hh
54 
Basic namespace for Concepts-2.
Definition: pml_formula.h:16
Page URL: http://wiki.math.ethz.ch/bin/view/Concepts/WebHome
21 August 2020
© 2020 Eidgenössische Technische Hochschule Zürich