[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Libunwind-devel] [PATCH 01/57] Pull attribute macros from `libunwind_i.
From: |
Tommi Rantala |
Subject: |
[Libunwind-devel] [PATCH 01/57] Pull attribute macros from `libunwind_i.h' to new header `compiler.h' |
Date: |
Fri, 21 Sep 2012 14:11:02 +0300 |
Pull attribute macros from `libunwind_i.h' to new header `compiler.h',
to allow the macros to also be used in the tests.
---
Makefile.am | 2 +-
include/compiler.h | 66 +++++++++++++++++++++++++++++++++++++++++++++++++
include/libunwind_i.h | 35 ++------------------------
3 files changed, 69 insertions(+), 34 deletions(-)
create mode 100644 include/compiler.h
diff --git a/Makefile.am b/Makefile.am
index d0f9881..00715b2 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -36,7 +36,7 @@ nodist_include_HEADERS = include/libunwind-common.h
SUBDIRS = src tests doc
noinst_HEADERS = include/dwarf.h include/dwarf_i.h include/dwarf-eh.h \
- include/libunwind_i.h include/mempool.h \
+ include/compiler.h include/libunwind_i.h include/mempool.h \
include/remote.h \
include/tdep-arm/dwarf-config.h \
include/tdep-arm/jmpbuf.h include/tdep-arm/libunwind_i.h \
diff --git a/include/compiler.h b/include/compiler.h
new file mode 100644
index 0000000..b46d5aa
--- /dev/null
+++ b/include/compiler.h
@@ -0,0 +1,66 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2001-2005 Hewlett-Packard Co
+ Copyright (C) 2007 David Mosberger-Tang
+ Contributed by David Mosberger-Tang <address@hidden>
+
+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__
+# define UNUSED __attribute__((unused))
+# define NORETURN __attribute__((noreturn))
+# define ALIAS(name) __attribute__((alias (#name)))
+# if (__GNUC__ > 3) || (__GNUC__ == 3 && __GNUC_MINOR__ > 2)
+# define ALWAYS_INLINE inline __attribute__((always_inline))
+# define HIDDEN __attribute__((visibility ("hidden")))
+# define PROTECTED __attribute__((visibility ("protected")))
+# else
+# define ALWAYS_INLINE
+# define HIDDEN
+# define PROTECTED
+# endif
+# if (__GNUC__ >= 3)
+# define likely(x) __builtin_expect ((x), 1)
+# define unlikely(x) __builtin_expect ((x), 0)
+# else
+# define likely(x) (x)
+# define unlikely(x) (x)
+# endif
+#else
+# define ALWAYS_INLINE
+# define UNUSED
+# define NORETURN
+# define ALIAS(name)
+# define HIDDEN
+# define PROTECTED
+# define likely(x) (x)
+# define unlikely(x) (x)
+#endif
+
+#define ARRAY_SIZE(a) (sizeof (a) / sizeof ((a)[0]))
+
+#endif /* COMPILER_H */
diff --git a/include/libunwind_i.h b/include/libunwind_i.h
index 91439b1..b1f9cee 100644
--- a/include/libunwind_i.h
+++ b/include/libunwind_i.h
@@ -35,6 +35,8 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. */
# include "config.h"
#endif
+#include "compiler.h"
+
#ifdef HAVE___THREAD
/* For now, turn off per-thread caching. It uses up too much TLS
memory per thread even when the thread never uses libunwind at
@@ -70,45 +72,12 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. */
# endif
#endif
-#ifdef __GNUC__
-# define UNUSED __attribute__((unused))
-# define NORETURN __attribute__((noreturn))
-# define ALIAS(name) __attribute__((alias (#name)))
-# if (__GNUC__ > 3) || (__GNUC__ == 3 && __GNUC_MINOR__ > 2)
-# define ALWAYS_INLINE inline __attribute__((always_inline))
-# define HIDDEN __attribute__((visibility ("hidden")))
-# define PROTECTED __attribute__((visibility ("protected")))
-# else
-# define ALWAYS_INLINE
-# define HIDDEN
-# define PROTECTED
-# endif
-# if (__GNUC__ >= 3)
-# define likely(x) __builtin_expect ((x), 1)
-# define unlikely(x) __builtin_expect ((x), 0)
-# else
-# define likely(x) (x)
-# define unlikely(x) (x)
-# endif
-#else
-# define ALWAYS_INLINE
-# define UNUSED
-# define NORETURN
-# define ALIAS(name)
-# define HIDDEN
-# define PROTECTED
-# define likely(x) (x)
-# define unlikely(x) (x)
-#endif
-
#ifdef DEBUG
# define UNW_DEBUG 1
#else
# define UNW_DEBUG 0
#endif
-#define ARRAY_SIZE(a) (sizeof (a) / sizeof ((a)[0]))
-
/* Make it easy to write thread-safe code which may or may not be
linked against libpthread. The macros below can be used
unconditionally and if -lpthread is around, they'll call the
--
1.7.9.5
- [Libunwind-devel] [PATCH 00/57] patchset v2, Tommi Rantala, 2012/09/21
- [Libunwind-devel] [PATCH 02/57] Remove unneeded `atomic_ops.h' inclusion in `dwarf.h', Tommi Rantala, 2012/09/21
- [Libunwind-devel] [PATCH 03/57] Use GCC __BIGGEST_ALIGNMENT__ for sos-pool MAX_ALIGN, Tommi Rantala, 2012/09/21
- [Libunwind-devel] [PATCH 08/57] Use __sync builtin atomics on all architectures if available, Tommi Rantala, 2012/09/21
- [Libunwind-devel] [PATCH 01/57] Pull attribute macros from `libunwind_i.h' to new header `compiler.h',
Tommi Rantala <=
- [Libunwind-devel] [PATCH 07/57] Remove unneeded `cmpxchg_ptr()' from include/libunwind_i.h, Tommi Rantala, 2012/09/21
- [Libunwind-devel] [PATCH 06/57] Simplify `sos_alloc()' implementation, Tommi Rantala, 2012/09/21
- [Libunwind-devel] [PATCH 04/57] Workaround non-power-of-two i386 sizeof(long double) in src/mi/mempool.c, Tommi Rantala, 2012/09/21
- [Libunwind-devel] [PATCH 15/57] HPPA: kludge out unused variable in unw_get_save_loc() stub, Tommi Rantala, 2012/09/21
- [Libunwind-devel] [PATCH 05/57] Align `sos_memory' to MAX_ALIGN, Tommi Rantala, 2012/09/21
- [Libunwind-devel] [PATCH 10/57] Apply UNW_ALIGN more in src/mi/mempool.c, Tommi Rantala, 2012/09/21