xref: /dflybsd-src/contrib/gcc-4.7/libstdc++-v3/include/debug/debug.h (revision 04febcfb30580676d3e95f58a16c5137ee478b32)
1*e4b17023SJohn Marino // Debugging support implementation -*- C++ -*-
2*e4b17023SJohn Marino 
3*e4b17023SJohn Marino // Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
4*e4b17023SJohn Marino // Free Software Foundation, Inc.
5*e4b17023SJohn Marino //
6*e4b17023SJohn Marino // This file is part of the GNU ISO C++ Library.  This library is free
7*e4b17023SJohn Marino // software; you can redistribute it and/or modify it under the
8*e4b17023SJohn Marino // terms of the GNU General Public License as published by the
9*e4b17023SJohn Marino // Free Software Foundation; either version 3, or (at your option)
10*e4b17023SJohn Marino // any later version.
11*e4b17023SJohn Marino 
12*e4b17023SJohn Marino // This library is distributed in the hope that it will be useful,
13*e4b17023SJohn Marino // but WITHOUT ANY WARRANTY; without even the implied warranty of
14*e4b17023SJohn Marino // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15*e4b17023SJohn Marino // GNU General Public License for more details.
16*e4b17023SJohn Marino 
17*e4b17023SJohn Marino // Under Section 7 of GPL version 3, you are granted additional
18*e4b17023SJohn Marino // permissions described in the GCC Runtime Library Exception, version
19*e4b17023SJohn Marino // 3.1, as published by the Free Software Foundation.
20*e4b17023SJohn Marino 
21*e4b17023SJohn Marino // You should have received a copy of the GNU General Public License and
22*e4b17023SJohn Marino // a copy of the GCC Runtime Library Exception along with this program;
23*e4b17023SJohn Marino // see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
24*e4b17023SJohn Marino // <http://www.gnu.org/licenses/>.
25*e4b17023SJohn Marino 
26*e4b17023SJohn Marino /** @file debug/debug.h
27*e4b17023SJohn Marino  *  This file is a GNU debug extension to the Standard C++ Library.
28*e4b17023SJohn Marino  */
29*e4b17023SJohn Marino 
30*e4b17023SJohn Marino #ifndef _GLIBCXX_DEBUG_MACRO_SWITCH_H
31*e4b17023SJohn Marino #define _GLIBCXX_DEBUG_MACRO_SWITCH_H 1
32*e4b17023SJohn Marino 
33*e4b17023SJohn Marino /** Macros and namespaces used by the implementation outside of debug
34*e4b17023SJohn Marino  *  wrappers to verify certain properties. The __glibcxx_requires_xxx
35*e4b17023SJohn Marino  *  macros are merely wrappers around the __glibcxx_check_xxx wrappers
36*e4b17023SJohn Marino  *  when we are compiling with debug mode, but disappear when we are
37*e4b17023SJohn Marino  *  in release mode so that there is no checking performed in, e.g.,
38*e4b17023SJohn Marino  *  the standard library algorithms.
39*e4b17023SJohn Marino */
40*e4b17023SJohn Marino 
41*e4b17023SJohn Marino // Debug mode namespaces.
42*e4b17023SJohn Marino 
43*e4b17023SJohn Marino /**
44*e4b17023SJohn Marino  * @namespace std::__debug
45*e4b17023SJohn Marino  * @brief GNU debug code, replaces standard behavior with debug behavior.
46*e4b17023SJohn Marino  */
47*e4b17023SJohn Marino namespace std
48*e4b17023SJohn Marino {
49*e4b17023SJohn Marino   namespace __debug { }
50*e4b17023SJohn Marino }
51*e4b17023SJohn Marino 
52*e4b17023SJohn Marino /** @namespace __gnu_debug
53*e4b17023SJohn Marino  *  @brief GNU debug classes for public use.
54*e4b17023SJohn Marino */
55*e4b17023SJohn Marino namespace __gnu_debug
56*e4b17023SJohn Marino {
57*e4b17023SJohn Marino   using namespace std::__debug;
58*e4b17023SJohn Marino }
59*e4b17023SJohn Marino 
60*e4b17023SJohn Marino #ifndef _GLIBCXX_DEBUG
61*e4b17023SJohn Marino 
62*e4b17023SJohn Marino # define _GLIBCXX_DEBUG_ASSERT(_Condition)
63*e4b17023SJohn Marino # define _GLIBCXX_DEBUG_PEDASSERT(_Condition)
64*e4b17023SJohn Marino # define _GLIBCXX_DEBUG_ONLY(_Statement) ;
65*e4b17023SJohn Marino # define __glibcxx_requires_cond(_Cond,_Msg)
66*e4b17023SJohn Marino # define __glibcxx_requires_valid_range(_First,_Last)
67*e4b17023SJohn Marino # define __glibcxx_requires_non_empty_range(_First,_Last)
68*e4b17023SJohn Marino # define __glibcxx_requires_sorted(_First,_Last)
69*e4b17023SJohn Marino # define __glibcxx_requires_sorted_pred(_First,_Last,_Pred)
70*e4b17023SJohn Marino # define __glibcxx_requires_sorted_set(_First1,_Last1,_First2)
71*e4b17023SJohn Marino # define __glibcxx_requires_sorted_set_pred(_First1,_Last1,_First2,_Pred)
72*e4b17023SJohn Marino # define __glibcxx_requires_partitioned_lower(_First,_Last,_Value)
73*e4b17023SJohn Marino # define __glibcxx_requires_partitioned_upper(_First,_Last,_Value)
74*e4b17023SJohn Marino # define __glibcxx_requires_partitioned_lower_pred(_First,_Last,_Value,_Pred)
75*e4b17023SJohn Marino # define __glibcxx_requires_partitioned_upper_pred(_First,_Last,_Value,_Pred)
76*e4b17023SJohn Marino # define __glibcxx_requires_heap(_First,_Last)
77*e4b17023SJohn Marino # define __glibcxx_requires_heap_pred(_First,_Last,_Pred)
78*e4b17023SJohn Marino # define __glibcxx_requires_nonempty()
79*e4b17023SJohn Marino # define __glibcxx_requires_string(_String)
80*e4b17023SJohn Marino # define __glibcxx_requires_string_len(_String,_Len)
81*e4b17023SJohn Marino # define __glibcxx_requires_subscript(_N)
82*e4b17023SJohn Marino 
83*e4b17023SJohn Marino #else
84*e4b17023SJohn Marino 
85*e4b17023SJohn Marino # include <debug/macros.h>
86*e4b17023SJohn Marino 
87*e4b17023SJohn Marino #define _GLIBCXX_DEBUG_ASSERT(_Condition) __glibcxx_assert(_Condition)
88*e4b17023SJohn Marino 
89*e4b17023SJohn Marino #ifdef _GLIBCXX_DEBUG_PEDANTIC
90*e4b17023SJohn Marino # define _GLIBCXX_DEBUG_PEDASSERT(_Condition) _GLIBCXX_DEBUG_ASSERT(_Condition)
91*e4b17023SJohn Marino #else
92*e4b17023SJohn Marino # define _GLIBCXX_DEBUG_PEDASSERT(_Condition)
93*e4b17023SJohn Marino #endif
94*e4b17023SJohn Marino 
95*e4b17023SJohn Marino # define _GLIBCXX_DEBUG_ONLY(_Statement) _Statement
96*e4b17023SJohn Marino 
97*e4b17023SJohn Marino # define __glibcxx_requires_cond(_Cond,_Msg) _GLIBCXX_DEBUG_VERIFY(_Cond,_Msg)
98*e4b17023SJohn Marino # define __glibcxx_requires_valid_range(_First,_Last) \
99*e4b17023SJohn Marino      __glibcxx_check_valid_range(_First,_Last)
100*e4b17023SJohn Marino # define __glibcxx_requires_non_empty_range(_First,_Last) \
101*e4b17023SJohn Marino      __glibcxx_check_non_empty_range(_First,_Last)
102*e4b17023SJohn Marino # define __glibcxx_requires_sorted(_First,_Last) \
103*e4b17023SJohn Marino      __glibcxx_check_sorted(_First,_Last)
104*e4b17023SJohn Marino # define __glibcxx_requires_sorted_pred(_First,_Last,_Pred) \
105*e4b17023SJohn Marino      __glibcxx_check_sorted_pred(_First,_Last,_Pred)
106*e4b17023SJohn Marino # define __glibcxx_requires_sorted_set(_First1,_Last1,_First2) \
107*e4b17023SJohn Marino      __glibcxx_check_sorted_set(_First1,_Last1,_First2)
108*e4b17023SJohn Marino # define __glibcxx_requires_sorted_set_pred(_First1,_Last1,_First2,_Pred) \
109*e4b17023SJohn Marino      __glibcxx_check_sorted_set_pred(_First1,_Last1,_First2,_Pred)
110*e4b17023SJohn Marino # define __glibcxx_requires_partitioned_lower(_First,_Last,_Value)	\
111*e4b17023SJohn Marino      __glibcxx_check_partitioned_lower(_First,_Last,_Value)
112*e4b17023SJohn Marino # define __glibcxx_requires_partitioned_upper(_First,_Last,_Value)	\
113*e4b17023SJohn Marino      __glibcxx_check_partitioned_upper(_First,_Last,_Value)
114*e4b17023SJohn Marino # define __glibcxx_requires_partitioned_lower_pred(_First,_Last,_Value,_Pred) \
115*e4b17023SJohn Marino      __glibcxx_check_partitioned_lower_pred(_First,_Last,_Value,_Pred)
116*e4b17023SJohn Marino # define __glibcxx_requires_partitioned_upper_pred(_First,_Last,_Value,_Pred) \
117*e4b17023SJohn Marino      __glibcxx_check_partitioned_upper_pred(_First,_Last,_Value,_Pred)
118*e4b17023SJohn Marino # define __glibcxx_requires_heap(_First,_Last) \
119*e4b17023SJohn Marino      __glibcxx_check_heap(_First,_Last)
120*e4b17023SJohn Marino # define __glibcxx_requires_heap_pred(_First,_Last,_Pred) \
121*e4b17023SJohn Marino      __glibcxx_check_heap_pred(_First,_Last,_Pred)
122*e4b17023SJohn Marino # define __glibcxx_requires_nonempty() __glibcxx_check_nonempty()
123*e4b17023SJohn Marino # define __glibcxx_requires_string(_String) __glibcxx_check_string(_String)
124*e4b17023SJohn Marino # define __glibcxx_requires_string_len(_String,_Len)	\
125*e4b17023SJohn Marino      __glibcxx_check_string_len(_String,_Len)
126*e4b17023SJohn Marino # define __glibcxx_requires_subscript(_N) __glibcxx_check_subscript(_N)
127*e4b17023SJohn Marino 
128*e4b17023SJohn Marino # include <debug/functions.h>
129*e4b17023SJohn Marino 
130*e4b17023SJohn Marino #endif
131*e4b17023SJohn Marino 
132*e4b17023SJohn Marino #endif // _GLIBCXX_DEBUG_MACRO_SWITCH_H
133