libunwind-devel
[Top][All Lists]
Advanced

[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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]