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