libstdc++
debug.h
Go to the documentation of this file.
00001 // Debugging support implementation -*- C++ -*-
00002 
00003 // Copyright (C) 2003-2018 Free Software Foundation, Inc.
00004 //
00005 // This file is part of the GNU ISO C++ Library.  This library is free
00006 // software; you can redistribute it and/or modify it under the
00007 // terms of the GNU General Public License as published by the
00008 // Free Software Foundation; either version 3, or (at your option)
00009 // any later version.
00010 
00011 // This library is distributed in the hope that it will be useful,
00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014 // GNU General Public License for more details.
00015 
00016 // Under Section 7 of GPL version 3, you are granted additional
00017 // permissions described in the GCC Runtime Library Exception, version
00018 // 3.1, as published by the Free Software Foundation.
00019 
00020 // You should have received a copy of the GNU General Public License and
00021 // a copy of the GCC Runtime Library Exception along with this program;
00022 // see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
00023 // <http://www.gnu.org/licenses/>.
00024 
00025 /** @file debug/debug.h
00026  *  This file is a GNU debug extension to the Standard C++ Library.
00027  */
00028 
00029 #ifndef _GLIBCXX_DEBUG_MACRO_SWITCH_H
00030 #define _GLIBCXX_DEBUG_MACRO_SWITCH_H 1
00031 
00032 /** Macros and namespaces used by the implementation outside of debug
00033  *  wrappers to verify certain properties. The __glibcxx_requires_xxx
00034  *  macros are merely wrappers around the __glibcxx_check_xxx wrappers
00035  *  when we are compiling with debug mode, but disappear when we are
00036  *  in release mode so that there is no checking performed in, e.g.,
00037  *  the standard library algorithms.
00038 */
00039 
00040 #include <debug/assertions.h>
00041 
00042 // Debug mode namespaces.
00043 
00044 /**
00045  * @namespace std::__debug
00046  * @brief GNU debug code, replaces standard behavior with debug behavior.
00047  */
00048 namespace std
00049 { 
00050   namespace __debug { } 
00051 }
00052 
00053 /** @namespace __gnu_debug
00054  *  @brief GNU debug classes for public use.
00055 */
00056 namespace __gnu_debug
00057 {
00058   using namespace std::__debug;
00059 }
00060 
00061 #ifndef _GLIBCXX_DEBUG
00062 
00063 # define __glibcxx_requires_cond(_Cond,_Msg)
00064 # define __glibcxx_requires_valid_range(_First,_Last)
00065 # define __glibcxx_requires_sorted(_First,_Last)
00066 # define __glibcxx_requires_sorted_pred(_First,_Last,_Pred)
00067 # define __glibcxx_requires_sorted_set(_First1,_Last1,_First2)
00068 # define __glibcxx_requires_sorted_set_pred(_First1,_Last1,_First2,_Pred)
00069 # define __glibcxx_requires_partitioned_lower(_First,_Last,_Value)
00070 # define __glibcxx_requires_partitioned_upper(_First,_Last,_Value)
00071 # define __glibcxx_requires_partitioned_lower_pred(_First,_Last,_Value,_Pred)
00072 # define __glibcxx_requires_partitioned_upper_pred(_First,_Last,_Value,_Pred)
00073 # define __glibcxx_requires_heap(_First,_Last)
00074 # define __glibcxx_requires_heap_pred(_First,_Last,_Pred)
00075 # define __glibcxx_requires_string(_String)
00076 # define __glibcxx_requires_string_len(_String,_Len)
00077 # define __glibcxx_requires_irreflexive(_First,_Last)
00078 # define __glibcxx_requires_irreflexive2(_First,_Last)
00079 # define __glibcxx_requires_irreflexive_pred(_First,_Last,_Pred)
00080 # define __glibcxx_requires_irreflexive_pred2(_First,_Last,_Pred)
00081 
00082 #else
00083 
00084 # include <debug/macros.h>
00085 
00086 # define __glibcxx_requires_cond(_Cond,_Msg) _GLIBCXX_DEBUG_VERIFY(_Cond,_Msg)
00087 # define __glibcxx_requires_valid_range(_First,_Last)   \
00088   __glibcxx_check_valid_range(_First,_Last)
00089 # define __glibcxx_requires_sorted(_First,_Last)        \
00090   __glibcxx_check_sorted(_First,_Last)
00091 # define __glibcxx_requires_sorted_pred(_First,_Last,_Pred)     \
00092   __glibcxx_check_sorted_pred(_First,_Last,_Pred)
00093 # define __glibcxx_requires_sorted_set(_First1,_Last1,_First2)  \
00094   __glibcxx_check_sorted_set(_First1,_Last1,_First2)
00095 # define __glibcxx_requires_sorted_set_pred(_First1,_Last1,_First2,_Pred) \
00096   __glibcxx_check_sorted_set_pred(_First1,_Last1,_First2,_Pred)
00097 # define __glibcxx_requires_partitioned_lower(_First,_Last,_Value)      \
00098   __glibcxx_check_partitioned_lower(_First,_Last,_Value)
00099 # define __glibcxx_requires_partitioned_upper(_First,_Last,_Value)      \
00100   __glibcxx_check_partitioned_upper(_First,_Last,_Value)
00101 # define __glibcxx_requires_partitioned_lower_pred(_First,_Last,_Value,_Pred) \
00102   __glibcxx_check_partitioned_lower_pred(_First,_Last,_Value,_Pred)
00103 # define __glibcxx_requires_partitioned_upper_pred(_First,_Last,_Value,_Pred) \
00104   __glibcxx_check_partitioned_upper_pred(_First,_Last,_Value,_Pred)
00105 # define __glibcxx_requires_heap(_First,_Last)  \
00106   __glibcxx_check_heap(_First,_Last)
00107 # define __glibcxx_requires_heap_pred(_First,_Last,_Pred)       \
00108   __glibcxx_check_heap_pred(_First,_Last,_Pred)
00109 # define __glibcxx_requires_string(_String) __glibcxx_check_string(_String)
00110 # define __glibcxx_requires_string_len(_String,_Len)    \
00111   __glibcxx_check_string_len(_String,_Len)
00112 # define __glibcxx_requires_irreflexive(_First,_Last)   \
00113   __glibcxx_check_irreflexive(_First,_Last)
00114 # define __glibcxx_requires_irreflexive2(_First,_Last)  \
00115   __glibcxx_check_irreflexive2(_First,_Last)
00116 # define __glibcxx_requires_irreflexive_pred(_First,_Last,_Pred)        \
00117   __glibcxx_check_irreflexive_pred(_First,_Last,_Pred)
00118 # define __glibcxx_requires_irreflexive_pred2(_First,_Last,_Pred)       \
00119   __glibcxx_check_irreflexive_pred2(_First,_Last,_Pred)
00120 
00121 # include <debug/functions.h>
00122 
00123 #endif
00124 
00125 #endif // _GLIBCXX_DEBUG_MACRO_SWITCH_H