]> git.ipfire.org Git - thirdparty/gcc.git/blob - libstdc++-v3/libsupc++/guard.cc
target-def.h (TARGET_CXX_GUARD_TYPE, [...]): Define.
[thirdparty/gcc.git] / libstdc++-v3 / libsupc++ / guard.cc
1 // Copyright (C) 2002 Free Software Foundation, Inc.
2 //
3 // This file is part of GCC.
4 //
5 // GCC is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation; either version 2, or (at your option)
8 // any later version.
9
10 // GCC is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
14
15 // You should have received a copy of the GNU General Public License
16 // along with GCC; see the file COPYING. If not, write to
17 // the Free Software Foundation, 59 Temple Place - Suite 330,
18 // Boston, MA 02111-1307, USA.
19
20 // As a special exception, you may use this file as part of a free software
21 // library without restriction. Specifically, if other files instantiate
22 // templates or use macros or inline functions from this file, or you compile
23 // this file and link it with other files to produce an executable, this
24 // file does not by itself cause the resulting executable to be covered by
25 // the GNU General Public License. This exception does not however
26 // invalidate any other reasons why the executable file might be covered by
27 // the GNU General Public License.
28
29 // Written by Mark Mitchell, CodeSourcery LLC, <mark@codesourcery.com>
30
31 #include <cxxabi.h>
32
33 // The IA64/generic ABI uses the fist byte of the guard variable.
34 // The ARM EABI uses the least significant bit.
35
36 namespace __cxxabiv1
37 {
38 extern "C"
39 int __cxa_guard_acquire (__guard *g)
40 {
41 #ifdef __ARM_EABI__
42 return !(*g & 1);
43 #else
44 return !*(char *)(g);
45 #endif
46 }
47
48 extern "C"
49 void __cxa_guard_release (__guard *g)
50 {
51 #ifdef __ARM_EABI__
52 *g = 1;
53 #else
54 *(char *)g = 1;
55 #endif
56 }
57
58 extern "C"
59 void __cxa_guard_abort (__guard *)
60 {
61 }
62 }