197403Sobrien// -*- C++ -*-
297403Sobrien// Copyright (C) 2000, 2001 Free Software Foundation
397403Sobrien//
4132720Skan// This file is part of GCC.
597403Sobrien//
6132720Skan// GCC is free software; you can redistribute it and/or modify
797403Sobrien// it under the terms of the GNU General Public License as published by
897403Sobrien// the Free Software Foundation; either version 2, or (at your option)
997403Sobrien// any later version.
1097403Sobrien//
11132720Skan// GCC is distributed in the hope that it will be useful,
1297403Sobrien// but WITHOUT ANY WARRANTY; without even the implied warranty of
1397403Sobrien// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1497403Sobrien// GNU General Public License for more details.
1597403Sobrien//
1697403Sobrien// You should have received a copy of the GNU General Public License
17132720Skan// along with GCC; see the file COPYING.  If not, write to
18169691Skan// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
19169691Skan// Boston, MA 02110-1301, USA.
2097403Sobrien//
2197403Sobrien// As a special exception, you may use this file as part of a free software
2297403Sobrien// library without restriction.  Specifically, if other files instantiate
2397403Sobrien// templates or use macros or inline functions from this file, or you compile
2497403Sobrien// this file and link it with other files to produce an executable, this
2597403Sobrien// file does not by itself cause the resulting executable to be covered by
2697403Sobrien// the GNU General Public License.  This exception does not however
2797403Sobrien// invalidate any other reasons why the executable file might be covered by
2897403Sobrien// the GNU General Public License.
2997403Sobrien
3097403Sobrien#include <bits/c++config.h>
31169691Skan#include <cxxabi.h>
3297403Sobrien#include "unwind-cxx.h"
3397403Sobrien
34169691Skan#if _GLIBCXX_HOSTED
35132720Skan#ifdef _GLIBCXX_HAVE_UNISTD_H
3697403Sobrien# include <unistd.h>
3797403Sobrien# define writestr(str)	write(2, str, sizeof(str) - 1)
3897403Sobrien# ifdef __GNU_LIBRARY__
3997403Sobrien  /* Avoid forcing the library's meaning of `write' on the user program
4097403Sobrien     by using the "internal" name (for use within the library).  */
4197403Sobrien/*#  define write(fd, buf, n)	__write((fd), (buf), (n))*/
4297403Sobrien# endif
4397403Sobrien#else
44102782Skan# include <cstdio>
45102782Skan# define writestr(str)	std::fputs(str, stderr)
4697403Sobrien#endif
47169691Skan#else
48169691Skan# define writestr(str) /* Empty */
49169691Skan#endif
5097403Sobrien
5197403Sobrienextern "C" void
52169691Skan__cxxabiv1::__cxa_pure_virtual (void)
5397403Sobrien{
5497403Sobrien  writestr ("pure virtual method called\n");
5597403Sobrien  std::terminate ();
5697403Sobrien}
57