]> granicus.if.org Git - gc/commitdiff
2011-03-08 Ivan Maidanski <ivmai@mail.ru>
authorivmai <ivmai>
Tue, 8 Mar 2011 08:45:31 +0000 (08:45 +0000)
committerIvan Maidanski <ivmai@mail.ru>
Tue, 26 Jul 2011 17:06:56 +0000 (21:06 +0400)
* include/gc_pthread_redirects.h (GC_NO_DLOPEN,
GC_NO_PTHREAD_SIGMASK, GC_PTHREAD_CREATE_CONST,
GC_PTHREAD_EXIT_ATTRIBUTE, GC_NO_PTHREAD_CANCEL): Move the
definition to gc_config_macros.

ChangeLog
include/gc_config_macros.h
include/gc_pthread_redirects.h

index a7a1ee293801dec47e4ed6c221fc657fe25b14d6..3af29f12b78cf61065f8c8568395d2c77980ac10 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2011-03-08  Ivan Maidanski  <ivmai@mail.ru>
+
+       * include/gc_pthread_redirects.h (GC_NO_DLOPEN,
+       GC_NO_PTHREAD_SIGMASK, GC_PTHREAD_CREATE_CONST,
+       GC_PTHREAD_EXIT_ATTRIBUTE, GC_NO_PTHREAD_CANCEL): Move the
+       definition to gc_config_macros.
+
 2011-03-08  Ivan Maidanski  <ivmai@mail.ru>
 
        * pthread_support.c (pthread_cancel, GC_pthread_cancel_t,
index e08b9f70b7960586522513ce5d6c39ff91437355..030218e4d9f7878145b2233571774ea633b65e12 100644 (file)
     && !defined(GC_CAN_SAVE_CALL_STACKS)
 # define GC_ADD_CALLER
 # if __GNUC__ >= 3 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95)
-    /* gcc knows how to retrieve return address, but we don't know */
-    /* how to generate call stacks.                                */
+    /* gcc knows how to retrieve return address, but we don't know      */
+    /* how to generate call stacks.                                     */
 #   define GC_RETURN_ADDR (GC_word)__builtin_return_address(0)
 # else
-    /* Just pass 0 for gcc compatibility. */
+    /* Just pass 0 for gcc compatibility.       */
 #   define GC_RETURN_ADDR 0
 # endif
 #endif /* !GC_CAN_SAVE_CALL_STACKS */
 
+#ifdef GC_PTHREADS
+
+# if (defined(GC_DARWIN_THREADS) || defined(GC_WIN32_PTHREADS) \
+      || defined(__native_client__)) && !defined(GC_NO_DLOPEN)
+    /* Either there is no dlopen() or we do not need to intercept it.   */
+#   define GC_NO_DLOPEN
+# endif
+
+# if (defined(GC_DARWIN_THREADS) || defined(GC_WIN32_PTHREADS) \
+      || defined(GC_OPENBSD_THREADS) || defined(__native_client__)) \
+     && !defined(GC_NO_PTHREAD_SIGMASK)
+    /* Either there is no pthread_sigmask() or no need to intercept it. */
+#   define GC_NO_PTHREAD_SIGMASK
+# endif
+
+# if defined(__native_client__)
+    /* At present, NaCl pthread_create() prototype does not have        */
+    /* "const" for its "attr" argument; also, NaCl pthread_exit() one   */
+    /* does not have "noreturn" attribute.                              */
+#   ifndef GC_PTHREAD_CREATE_CONST
+#     define GC_PTHREAD_CREATE_CONST /* empty */
+#   endif
+#   ifndef GC_PTHREAD_EXIT_ATTRIBUTE
+#     define GC_PTHREAD_EXIT_ATTRIBUTE /* empty */
+#   endif
+# endif
+
+# if !defined(GC_PTHREAD_EXIT_ATTRIBUTE) && !defined(PLATFORM_ANDROID) \
+     && (defined(GC_LINUX_THREADS) || defined(GC_SOLARIS_THREADS))
+    /* Intercept pthread_exit on Linux and Solaris.     */
+#   if defined(__GNUC__) /* since GCC v2.7 */
+#     define GC_PTHREAD_EXIT_ATTRIBUTE __attribute__((__noreturn__))
+#   elif defined(__NORETURN) /* used in Solaris */
+#     define GC_PTHREAD_EXIT_ATTRIBUTE __NORETURN
+#   else
+#     define GC_PTHREAD_EXIT_ATTRIBUTE /* empty */
+#   endif
+# endif
+
+# if (!defined(GC_PTHREAD_EXIT_ATTRIBUTE) || defined(__native_client__)) \
+     && !defined(GC_NO_PTHREAD_CANCEL)
+    /* Either there is no pthread_cancel() or no need to intercept it.  */
+#   define GC_NO_PTHREAD_CANCEL
+# endif
+
+#endif /* GC_PTHREADS */
+
 #endif
index 82de3ee4510959bb47269331dc86bb505b0d3005..b4b2b1312d52ec8c578fea44dc5f2befb4636d06 100644 (file)
 
 #include <pthread.h>
 
-#if (defined(GC_DARWIN_THREADS) || defined(GC_WIN32_PTHREADS) \
-     || defined(__native_client__)) && !defined(GC_NO_DLOPEN)
-  /* Either there is no dlopen() or we do not need to intercept it.     */
-# define GC_NO_DLOPEN
-#endif
-
-#if (defined(GC_DARWIN_THREADS) || defined(GC_WIN32_PTHREADS) \
-     || defined(GC_OPENBSD_THREADS) || defined(__native_client__)) \
-    && !defined(GC_NO_PTHREAD_SIGMASK)
-  /* Either there is no pthread_sigmask() or no need to intercept it.   */
-# define GC_NO_PTHREAD_SIGMASK
-#endif
-
-#if defined(__native_client__)
-  /* At present, NaCl pthread_create() prototype does not have "const"  */
-  /* for its "attr" argument; also, NaCl pthread_exit() one does not    */
-  /* have "noreturn" attribute.                                         */
-# ifndef GC_PTHREAD_CREATE_CONST
-#   define GC_PTHREAD_CREATE_CONST /* empty */
-# endif
-# ifndef GC_PTHREAD_EXIT_ATTRIBUTE
-#   define GC_PTHREAD_EXIT_ATTRIBUTE /* empty */
-# endif
-#endif
-
 #ifndef GC_NO_DLOPEN
 # include <dlfcn.h>
   GC_API void *GC_dlopen(const char * /* path */, int /* mode */);
@@ -79,24 +54,6 @@ GC_API int GC_pthread_create(pthread_t *,
 GC_API int GC_pthread_join(pthread_t, void ** /* retval */);
 GC_API int GC_pthread_detach(pthread_t);
 
-#if !defined(GC_PTHREAD_EXIT_ATTRIBUTE) && !defined(PLATFORM_ANDROID) \
-        && (defined(GC_LINUX_THREADS) || defined(GC_SOLARIS_THREADS))
-  /* Intercept pthread_exit on Linux and Solaris.       */
-# if defined(__GNUC__) /* since GCC v2.7 */
-#   define GC_PTHREAD_EXIT_ATTRIBUTE __attribute__((__noreturn__))
-# elif defined(__NORETURN) /* used in Solaris */
-#   define GC_PTHREAD_EXIT_ATTRIBUTE __NORETURN
-# else
-#   define GC_PTHREAD_EXIT_ATTRIBUTE /* empty */
-# endif
-#endif
-
-#if (!defined(GC_PTHREAD_EXIT_ATTRIBUTE) || defined(__native_client__)) \
-    && !defined(GC_NO_PTHREAD_CANCEL)
-  /* Either there is no pthread_cancel() or no need to intercept it.    */
-# define GC_NO_PTHREAD_CANCEL
-#endif
-
 #ifndef GC_NO_PTHREAD_CANCEL
   GC_API int GC_pthread_cancel(pthread_t);
 #endif