15821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)/* libunwind - a platform-independent unwind library
246d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)   Copyright (C) 2001-2005 Hewlett-Packard Co
35821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)   Copyright (C) 2007 David Mosberger-Tang
45821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)	Contributed by David Mosberger-Tang <dmosberger@gmail.com>
55d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)
65821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)This file is part of libunwind.
75821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
85821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)Permission is hereby granted, free of charge, to any person obtaining
95821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)a copy of this software and associated documentation files (the
105d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)"Software"), to deal in the Software without restriction, including
115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)without limitation the rights to use, copy, modify, merge, publish,
122a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)distribute, sublicense, and/or sell copies of the Software, and to
132a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)permit persons to whom the Software is furnished to do so, subject to
145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)the following conditions:
155d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)
165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)The above copyright notice and this permission notice shall be
17424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)included in all copies or substantial portions of the Software.
185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
212a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
225821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
235821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
242a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
252a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.  */
262a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
272a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)/* Compiler specific useful bits that are used in libunwind, and also in the
282a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) * tests. */
292a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
302a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#ifndef COMPILER_H
312a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#define COMPILER_H
322a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
332a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#ifdef __GNUC__
342a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)# define ALIGNED(x)	__attribute__((aligned(x)))
352a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)# define CONST_ATTR	__attribute__((__const__))
362a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)# define UNUSED		__attribute__((unused))
372a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)# define NOINLINE	__attribute__((noinline))
382a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)# define NORETURN	__attribute__((noreturn))
392a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)# define ALIAS(name)	__attribute__((alias (#name)))
402a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)# if (__GNUC__ > 3) || (__GNUC__ == 3 && __GNUC_MINOR__ > 2)
412a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#  define ALWAYS_INLINE	inline __attribute__((always_inline))
425821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#  define HIDDEN	__attribute__((visibility ("hidden")))
435821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#  define PROTECTED	__attribute__((visibility ("protected")))
445821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)# else
455d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#  define ALWAYS_INLINE
465821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#  define HIDDEN
475821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#  define PROTECTED
48# endif
49# define WEAK		__attribute__((weak))
50# if (__GNUC__ >= 3)
51#  define likely(x)	__builtin_expect ((x), 1)
52#  define unlikely(x)	__builtin_expect ((x), 0)
53# else
54#  define likely(x)	(x)
55#  define unlikely(x)	(x)
56# endif
57#else
58# define ALIGNED(x)
59# define ALWAYS_INLINE
60# define CONST_ATTR
61# define UNUSED
62# define NOINLINE
63# define NORETURN
64# define ALIAS(name)
65# define HIDDEN
66# define PROTECTED
67# define WEAK
68# define likely(x)	(x)
69# define unlikely(x)	(x)
70#endif
71
72#define ARRAY_SIZE(a)	(sizeof (a) / sizeof ((a)[0]))
73
74#endif /* COMPILER_H */
75