197403Sobrien// -*- C++ -*- std::exception implementation.
2169691Skan// Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
3169691Skan// 2003, 2004, 2005, 2006, 2007
497403Sobrien// Free Software Foundation
597403Sobrien//
6132720Skan// This file is part of GCC.
797403Sobrien//
8132720Skan// GCC is free software; you can redistribute it and/or modify
997403Sobrien// it under the terms of the GNU General Public License as published by
1097403Sobrien// the Free Software Foundation; either version 2, or (at your option)
1197403Sobrien// any later version.
1297403Sobrien//
13132720Skan// GCC is distributed in the hope that it will be useful,
1497403Sobrien// but WITHOUT ANY WARRANTY; without even the implied warranty of
1597403Sobrien// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1697403Sobrien// GNU General Public License for more details.
1797403Sobrien//
1897403Sobrien// You should have received a copy of the GNU General Public License
19132720Skan// along with GCC; see the file COPYING.  If not, write to
20169691Skan// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
21169691Skan// Boston, MA 02110-1301, USA.
2297403Sobrien
2397403Sobrien// As a special exception, you may use this file as part of a free software
2497403Sobrien// library without restriction.  Specifically, if other files instantiate
2597403Sobrien// templates or use macros or inline functions from this file, or you compile
2697403Sobrien// this file and link it with other files to produce an executable, this
2797403Sobrien// file does not by itself cause the resulting executable to be covered by
2897403Sobrien// the GNU General Public License.  This exception does not however
2997403Sobrien// invalidate any other reasons why the executable file might be covered by
3097403Sobrien// the GNU General Public License.
3197403Sobrien
3297403Sobrien#include "typeinfo"
3397403Sobrien#include "exception"
3497403Sobrien#include "unwind-cxx.h"
3597403Sobrien
3697403Sobrienstd::exception::~exception() throw() { }
3797403Sobrien
3897403Sobrienstd::bad_exception::~bad_exception() throw() { }
3997403Sobrien
4097403Sobrienconst char*
4197403Sobrienstd::exception::what() const throw()
4297403Sobrien{
43169691Skan  // NB: Another elegant option would be returning typeid(*this).name()
44169691Skan  // and not overriding what() in bad_exception, bad_alloc, etc.  In
45169691Skan  // that case, however, mangled names would be returned, PR 14493.
46169691Skan  return "std::exception";
4797403Sobrien}
48169691Skan
49169691Skanconst char*
50169691Skanstd::bad_exception::what() const throw()
51169691Skan{
52169691Skan  return "std::bad_exception";
53169691Skan}
54