debug.h

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

Generated on Thu Jul 23 21:16:02 2009 for libstdc++ by  doxygen 1.5.8