OpenCores
URL https://opencores.org/ocsvn/scarts/scarts/trunk

Subversion Repositories scarts

[/] [scarts/] [trunk/] [toolchain/] [scarts-gcc/] [gcc-4.1.1/] [libstdc++-v3/] [include/] [debug/] [debug.h] - Blame information for rev 17

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 17 jlechner
// Debugging support implementation -*- C++ -*-
2
 
3
// Copyright (C) 2003, 2005
4
// Free Software Foundation, Inc.
5
//
6
// This file is part of the GNU ISO C++ Library.  This library is free
7
// software; you can redistribute it and/or modify it under the
8
// terms of the GNU General Public License as published by the
9
// Free Software Foundation; either version 2, or (at your option)
10
// any later version.
11
 
12
// This library is distributed in the hope that it will be useful,
13
// but WITHOUT ANY WARRANTY; without even the implied warranty of
14
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
// GNU General Public License for more details.
16
 
17
// You should have received a copy of the GNU General Public License along
18
// with this library; see the file COPYING.  If not, write to the Free
19
// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
20
// USA.
21
 
22
// As a special exception, you may use this file as part of a free software
23
// library without restriction.  Specifically, if other files instantiate
24
// templates or use macros or inline functions from this file, or you compile
25
// this file and link it with other files to produce an executable, this
26
// file does not by itself cause the resulting executable to be covered by
27
// the GNU General Public License.  This exception does not however
28
// invalidate any other reasons why the executable file might be covered by
29
// the GNU General Public License.
30
 
31
#ifndef _GLIBCXX_DEBUG_DEBUG_H
32
#define _GLIBCXX_DEBUG_DEBUG_H 1
33
 
34
/** Macros used by the implementation outside of debug wrappers to
35
 *  verify certain properties. The __glibcxx_requires_xxx macros are
36
 *  merely wrappers around the __glibcxx_check_xxx wrappers when we
37
 *  are compiling with debug mode, but disappear when we are in
38
 *  release mode so that there is no checking performed in, e.g., the
39
 *  standard library algorithms.
40
*/
41
 
42
#ifdef _GLIBCXX_DEBUG
43
 
44
# include <debug/macros.h>
45
# include <cstdlib>
46
# include <cstdio>
47
 
48
// Avoid the use of assert, because we're trying to keep the <cassert>
49
// include out of the mix.
50
namespace __gnu_debug
51
{
52
  inline void
53
  __replacement_assert(const char* __file, int __line, const char* __function,
54
                       const char* __condition)
55
  {
56
    std::printf("%s:%d: %s: Assertion '%s' failed.\n", __file, __line,
57
                __function, __condition);
58
    std::abort();
59
  }
60
}
61
 
62
#define _GLIBCXX_DEBUG_ASSERT(_Condition)                               \
63
  do {                                                                  \
64
    if (! (_Condition))                                                 \
65
      ::__gnu_debug::__replacement_assert(__FILE__, __LINE__,           \
66
                                   __PRETTY_FUNCTION__,                 \
67
                                   #_Condition);                        \
68
  } while (false)
69
 
70
#  ifdef _GLIBCXX_DEBUG_PEDANTIC
71
#    define _GLIBCXX_DEBUG_PEDASSERT(_Condition) _GLIBCXX_DEBUG_ASSERT(_Condition)
72
#  else
73
#    define _GLIBCXX_DEBUG_PEDASSERT(_Condition)
74
#  endif
75
 
76
#  define __glibcxx_requires_cond(_Cond,_Msg) _GLIBCXX_DEBUG_VERIFY(_Cond,_Msg)
77
#  define __glibcxx_requires_valid_range(_First,_Last) \
78
     __glibcxx_check_valid_range(_First,_Last)
79
#  define __glibcxx_requires_sorted(_First,_Last) \
80
     __glibcxx_check_sorted(_First,_Last)
81
#  define __glibcxx_requires_sorted_pred(_First,_Last,_Pred) \
82
     __glibcxx_check_sorted_pred(_First,_Last,_Pred)
83
#  define __glibcxx_requires_partitioned(_First,_Last,_Value)   \
84
     __glibcxx_check_partitioned(_First,_Last,_Value)
85
#  define __glibcxx_requires_partitioned_pred(_First,_Last,_Value,_Pred) \
86
     __glibcxx_check_partitioned_pred(_First,_Last,_Value,_Pred)
87
#  define __glibcxx_requires_heap(_First,_Last) \
88
     __glibcxx_check_heap(_First,_Last)
89
#  define __glibcxx_requires_heap_pred(_First,_Last,_Pred) \
90
     __glibcxx_check_heap_pred(_First,_Last,_Pred)
91
#  define __glibcxx_requires_nonempty() __glibcxx_check_nonempty()
92
#  define __glibcxx_requires_string(_String) __glibcxx_check_string(_String)
93
#  define __glibcxx_requires_string_len(_String,_Len)   \
94
     __glibcxx_check_string_len(_String,_Len)
95
#  define __glibcxx_requires_subscript(_N) __glibcxx_check_subscript(_N)
96
 
97
#  include <debug/functions.h>
98
#  include <debug/formatter.h>
99
#else
100
#  define _GLIBCXX_DEBUG_ASSERT(_Condition)
101
#  define _GLIBCXX_DEBUG_PEDASSERT(_Condition)
102
#  define __glibcxx_requires_cond(_Cond,_Msg)
103
#  define __glibcxx_requires_valid_range(_First,_Last)
104
#  define __glibcxx_requires_sorted(_First,_Last)
105
#  define __glibcxx_requires_sorted_pred(_First,_Last,_Pred)
106
#  define __glibcxx_requires_partitioned(_First,_Last,_Value)
107
#  define __glibcxx_requires_partitioned_pred(_First,_Last,_Value,_Pred)
108
#  define __glibcxx_requires_heap(_First,_Last)
109
#  define __glibcxx_requires_heap_pred(_First,_Last,_Pred)
110
#  define __glibcxx_requires_nonempty()
111
#  define __glibcxx_requires_string(_String)
112
#  define __glibcxx_requires_string_len(_String,_Len)
113
#  define __glibcxx_requires_subscript(_N)
114
#endif
115
 
116
#endif

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.