2012-09-19 11:12:16 +02:00
|
|
|
/* libunwind - a platform-independent unwind library
|
|
|
|
Copyright (C) 2001-2005 Hewlett-Packard Co
|
|
|
|
Copyright (C) 2007 David Mosberger-Tang
|
2014-09-20 18:03:10 +02:00
|
|
|
Contributed by David Mosberger-Tang <dmosberger@gmail.com>
|
2012-09-19 11:12:16 +02:00
|
|
|
|
|
|
|
This file is part of libunwind.
|
|
|
|
|
|
|
|
Permission is hereby granted, free of charge, to any person obtaining
|
|
|
|
a copy of this software and associated documentation files (the
|
|
|
|
"Software"), to deal in the Software without restriction, including
|
|
|
|
without limitation the rights to use, copy, modify, merge, publish,
|
|
|
|
distribute, sublicense, and/or sell copies of the Software, and to
|
|
|
|
permit persons to whom the Software is furnished to do so, subject to
|
|
|
|
the following conditions:
|
|
|
|
|
|
|
|
The above copyright notice and this permission notice shall be
|
|
|
|
included in all copies or substantial portions of the Software.
|
|
|
|
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
|
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
|
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
|
|
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
|
|
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
|
|
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
|
|
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
|
|
|
|
|
|
|
/* Compiler specific useful bits that are used in libunwind, and also in the
|
|
|
|
* tests. */
|
|
|
|
|
|
|
|
#ifndef COMPILER_H
|
|
|
|
#define COMPILER_H
|
|
|
|
|
|
|
|
#ifdef __GNUC__
|
2014-09-20 18:03:10 +02:00
|
|
|
# define ALIGNED(x) __attribute__((aligned(x)))
|
|
|
|
# define CONST_ATTR __attribute__((__const__))
|
|
|
|
# define UNUSED __attribute__((unused))
|
|
|
|
# define NOINLINE __attribute__((noinline))
|
|
|
|
# define NORETURN __attribute__((noreturn))
|
|
|
|
# define ALIAS(name) __attribute__((alias (#name)))
|
2012-09-19 11:12:16 +02:00
|
|
|
# if (__GNUC__ > 3) || (__GNUC__ == 3 && __GNUC_MINOR__ > 2)
|
2014-09-20 18:03:10 +02:00
|
|
|
# define ALWAYS_INLINE inline __attribute__((always_inline))
|
|
|
|
# define HIDDEN __attribute__((visibility ("hidden")))
|
2012-09-19 11:12:16 +02:00
|
|
|
# else
|
|
|
|
# define ALWAYS_INLINE
|
|
|
|
# define HIDDEN
|
|
|
|
# endif
|
2014-09-20 18:03:10 +02:00
|
|
|
# define WEAK __attribute__((weak))
|
2012-09-19 11:12:16 +02:00
|
|
|
# if (__GNUC__ >= 3)
|
2014-09-20 18:03:10 +02:00
|
|
|
# define likely(x) __builtin_expect ((x), 1)
|
|
|
|
# define unlikely(x) __builtin_expect ((x), 0)
|
2012-09-19 11:12:16 +02:00
|
|
|
# else
|
2014-09-20 18:03:10 +02:00
|
|
|
# define likely(x) (x)
|
|
|
|
# define unlikely(x) (x)
|
2012-09-19 11:12:16 +02:00
|
|
|
# endif
|
|
|
|
#else
|
2012-09-19 12:59:41 +02:00
|
|
|
# define ALIGNED(x)
|
2012-09-19 11:12:16 +02:00
|
|
|
# define ALWAYS_INLINE
|
2012-09-19 12:48:33 +02:00
|
|
|
# define CONST_ATTR
|
2012-09-19 11:12:16 +02:00
|
|
|
# define UNUSED
|
2012-09-19 11:39:26 +02:00
|
|
|
# define NOINLINE
|
2012-09-19 11:12:16 +02:00
|
|
|
# define NORETURN
|
|
|
|
# define ALIAS(name)
|
|
|
|
# define HIDDEN
|
2012-09-19 13:44:33 +02:00
|
|
|
# define WEAK
|
2014-09-20 18:03:10 +02:00
|
|
|
# define likely(x) (x)
|
|
|
|
# define unlikely(x) (x)
|
2012-09-19 11:12:16 +02:00
|
|
|
#endif
|
|
|
|
|
2014-09-20 18:03:10 +02:00
|
|
|
#define ARRAY_SIZE(a) (sizeof (a) / sizeof ((a)[0]))
|
2012-09-19 11:12:16 +02:00
|
|
|
|
|
|
|
#endif /* COMPILER_H */
|