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

Subversion Repositories scarts

[/] [scarts/] [trunk/] [toolchain/] [scarts-gcc/] [gcc-4.1.1/] [libstdc++-v3/] [libsupc++/] [exception] - Blame information for rev 17

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 17 jlechner
// Exception Handling support header for -*- C++ -*-
2
 
3
// Copyright (C) 1995, 1996, 1997, 1998, 2000, 2001, 2002
4
// Free Software Foundation
5
//
6
// This file is part of GCC.
7
//
8
// GCC is free software; you can redistribute it and/or modify
9
// it under the terms of the GNU General Public License as published by
10
// the Free Software Foundation; either version 2, or (at your option)
11
// any later version.
12
//
13
// GCC is distributed in the hope that it will be useful,
14
// but WITHOUT ANY WARRANTY; without even the implied warranty of
15
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
// GNU General Public License for more details.
17
//
18
// You should have received a copy of the GNU General Public License
19
// along with GCC; see the file COPYING.  If not, write to
20
// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
21
// Boston, MA 02110-1301, USA.
22
 
23
// As a special exception, you may use this file as part of a free software
24
// library without restriction.  Specifically, if other files instantiate
25
// templates or use macros or inline functions from this file, or you compile
26
// this file and link it with other files to produce an executable, this
27
// file does not by itself cause the resulting executable to be covered by
28
// the GNU General Public License.  This exception does not however
29
// invalidate any other reasons why the executable file might be covered by
30
// the GNU General Public License.
31
 
32
/** @file exception
33
 *  This header defines several types and functions relating to the
34
 *  handling of exceptions in a C++ program.
35
 */
36
 
37
#ifndef __EXCEPTION__
38
#define __EXCEPTION__
39
 
40
#pragma GCC visibility push(default)
41
 
42
extern "C++" {
43
 
44
namespace std
45
{
46
  /**
47
   *  @brief Base class for all library exceptions.
48
   *
49
   *  This is the base class for all exceptions thrown by the standard
50
   *  library, and by certain language expressions.  You are free to derive
51
   *  your own %exception classes, or use a different hierarchy, or to
52
   *  throw non-class data (e.g., fundamental types).
53
   */
54
  class exception
55
  {
56
  public:
57
    exception() throw() { }
58
    virtual ~exception() throw();
59
    /** Returns a C-style character string describing the general cause
60
     *  of the current error.  */
61
    virtual const char* what() const throw();
62
  };
63
 
64
  /** If an %exception is thrown which is not listed in a function's
65
   *  %exception specification, one of these may be thrown.  */
66
  class bad_exception : public exception
67
  {
68
  public:
69
    bad_exception() throw() { }
70
    // This declaration is not useless:
71
    // http://gcc.gnu.org/onlinedocs/gcc-3.0.2/gcc_6.html#SEC118
72
    virtual ~bad_exception() throw();
73
  };
74
 
75
  /// If you write a replacement %terminate handler, it must be of this type.
76
  typedef void (*terminate_handler) ();
77
  /// If you write a replacement %unexpected handler, it must be of this type.
78
  typedef void (*unexpected_handler) ();
79
 
80
  /// Takes a new handler function as an argument, returns the old function.
81
  terminate_handler set_terminate(terminate_handler) throw();
82
  /** The runtime will call this function if %exception handling must be
83
   *  abandoned for any reason.  It can also be called by the user.  */
84
  void terminate() __attribute__ ((__noreturn__));
85
 
86
  /// Takes a new handler function as an argument, returns the old function.
87
  unexpected_handler set_unexpected(unexpected_handler) throw();
88
  /** The runtime will call this function if an %exception is thrown which
89
   *  violates the function's %exception specification.  */
90
  void unexpected() __attribute__ ((__noreturn__));
91
 
92
  /** [18.6.4]/1:  "Returns true after completing evaluation of a
93
   *  throw-expression until either completing initialization of the
94
   *  exception-declaration in the matching handler or entering @c unexpected()
95
   *  due to the throw; or after entering @c terminate() for any reason
96
   *  other than an explicit call to @c terminate().  [Note: This includes
97
   *  stack unwinding [15.2].  end note]"
98
   *
99
   *  2:  "When @c uncaught_exception() is true, throwing an %exception can
100
   *  result in a call of @c terminate() (15.5.1)."
101
   */
102
  bool uncaught_exception() throw();
103
} // namespace std
104
 
105
namespace __gnu_cxx
106
{
107
  /** A replacement for the standard terminate_handler which prints more
108
      information about the terminating exception (if any) on stderr.  Call
109
      @code
110
        std::set_terminate (__gnu_cxx::__verbose_terminate_handler)
111
      @endcode
112
      to use.  For more info, see
113
      http://gcc.gnu.org/onlinedocs/libstdc++/19_diagnostics/howto.html#4
114
 
115
      In 3.4 and later, this is on by default.
116
  */
117
  void __verbose_terminate_handler ();
118
} // namespace __gnu_cxx
119
 
120
} // extern "C++"
121
 
122
#pragma GCC visibility pop
123
 
124
#endif

powered by: WebSVN 2.1.0

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