Eliminate 'value of GC_PTHREAD_EXIT_ATTRIBUTE unknown' cppcheck messages
authorIvan Maidanski <ivmai@mail.ru>
Fri, 21 Oct 2016 22:31:44 +0000 (01:31 +0300)
committerIvan Maidanski <ivmai@mail.ru>
Fri, 21 Oct 2016 22:31:44 +0000 (01:31 +0300)
* include/gc_config_macros.h [GC_PTHREAD_EXIT_ATTRIBUTE]
(GC_HAVE_PTHREAD_EXIT): New macro.
* include/gc_config_macros.h: Replace defined(GC_PTHREAD_EXIT_ATTRIBUTE)
with defined(GC_HAVE_PTHREAD_EXIT).
* include/gc_pthread_redirects.h: Likewise.
* pthread_support.c: Likewise.

include/gc_config_macros.h
include/gc_pthread_redirects.h
pthread_support.c

index 9f7f7d7..5234910 100644 (file)
 #   ifndef GC_PTHREAD_CREATE_CONST
 #     define GC_PTHREAD_CREATE_CONST /* empty */
 #   endif
-#   ifndef GC_PTHREAD_EXIT_ATTRIBUTE
+#   ifndef GC_HAVE_PTHREAD_EXIT
+#     define GC_HAVE_PTHREAD_EXIT
 #     define GC_PTHREAD_EXIT_ATTRIBUTE /* empty */
 #   endif
 # endif
 
-# if !defined(GC_PTHREAD_EXIT_ATTRIBUTE) \
+# if !defined(GC_HAVE_PTHREAD_EXIT) \
      && !defined(PLATFORM_ANDROID) && !defined(__ANDROID__) \
      && (defined(GC_LINUX_THREADS) || defined(GC_SOLARIS_THREADS))
+#   define GC_HAVE_PTHREAD_EXIT
     /* Intercept pthread_exit on Linux and Solaris.     */
 #   if defined(__GNUC__) /* since GCC v2.7 */
 #     define GC_PTHREAD_EXIT_ATTRIBUTE __attribute__((__noreturn__))
 #   endif
 # endif
 
-# if (!defined(GC_PTHREAD_EXIT_ATTRIBUTE) || defined(__native_client__)) \
+# if (!defined(GC_HAVE_PTHREAD_EXIT) || 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
index e069c57..21e2808 100644 (file)
@@ -63,7 +63,7 @@
     GC_API int GC_pthread_cancel(pthread_t);
 # endif
 
-# if defined(GC_PTHREAD_EXIT_ATTRIBUTE) && !defined(GC_PTHREAD_EXIT_DECLARED)
+# if defined(GC_HAVE_PTHREAD_EXIT) && !defined(GC_PTHREAD_EXIT_DECLARED)
 #   define GC_PTHREAD_EXIT_DECLARED
     GC_API void GC_pthread_exit(void *) GC_PTHREAD_EXIT_ATTRIBUTE;
 # endif
@@ -92,7 +92,7 @@
 #   undef pthread_cancel
 #   define pthread_cancel GC_pthread_cancel
 # endif
-# ifdef GC_PTHREAD_EXIT_ATTRIBUTE
+# ifdef GC_HAVE_PTHREAD_EXIT
 #   undef pthread_exit
 #   define pthread_exit GC_pthread_exit
 # endif
index 538f0d9..1db9af6 100644 (file)
@@ -86,7 +86,7 @@
 # ifndef GC_NO_PTHREAD_CANCEL
 #   undef pthread_cancel
 # endif
-# ifdef GC_PTHREAD_EXIT_ATTRIBUTE
+# ifdef GC_HAVE_PTHREAD_EXIT
 #   undef pthread_exit
 # endif
 # undef pthread_join
 #   ifndef GC_NO_PTHREAD_CANCEL
 #     define pthread_cancel __pthread_cancel
 #   endif
-#   ifdef GC_PTHREAD_EXIT_ATTRIBUTE
+#   ifdef GC_HAVE_PTHREAD_EXIT
 #     define pthread_exit __pthread_exit
 #   endif
 # endif
 #   ifndef GC_NO_PTHREAD_CANCEL
       int REAL_FUNC(pthread_cancel)(pthread_t);
 #   endif
-#   ifdef GC_PTHREAD_EXIT_ATTRIBUTE
+#   ifdef GC_HAVE_PTHREAD_EXIT
       void REAL_FUNC(pthread_exit)(void *) GC_PTHREAD_EXIT_ATTRIBUTE;
 #   endif
 #else
         typedef int (* GC_pthread_cancel_t)(pthread_t);
         static GC_pthread_cancel_t REAL_FUNC(pthread_cancel);
 #     endif
-#     ifdef GC_PTHREAD_EXIT_ATTRIBUTE
+#     ifdef GC_HAVE_PTHREAD_EXIT
         typedef void (* GC_pthread_exit_t)(void *) GC_PTHREAD_EXIT_ATTRIBUTE;
         static GC_pthread_exit_t REAL_FUNC(pthread_exit);
 #     endif
     }
 # endif /* !GC_NO_PTHREAD_CANCEL */
 
-# ifdef GC_PTHREAD_EXIT_ATTRIBUTE
+# ifdef GC_HAVE_PTHREAD_EXIT
     GC_API GC_PTHREAD_EXIT_ATTRIBUTE void GC_pthread_exit(void *retval)
     {
       pthread_exit(retval);
     }
-# endif /* GC_PTHREAD_EXIT_ATTRIBUTE */
+# endif
 #endif /* Linker-based interception. */
 
 #ifdef GC_USE_DLOPEN_WRAP
       REAL_FUNC(pthread_cancel) = (GC_pthread_cancel_t)
                                     dlsym(dl_handle, "pthread_cancel");
 #   endif
-#   ifdef GC_PTHREAD_EXIT_ATTRIBUTE
+#   ifdef GC_HAVE_PTHREAD_EXIT
       REAL_FUNC(pthread_exit) = (GC_pthread_exit_t)
                                   dlsym(dl_handle, "pthread_exit");
 #   endif
@@ -1384,7 +1384,7 @@ STATIC void GC_unregister_my_thread_inner(GC_thread me)
       GC_ASSERT(GC_getspecific(GC_thread_key) == &me->tlfs);
       GC_destroy_thread_local(&(me->tlfs));
 #   endif
-#   if defined(GC_PTHREAD_EXIT_ATTRIBUTE) || !defined(GC_NO_PTHREAD_CANCEL)
+#   if defined(GC_HAVE_PTHREAD_EXIT) || !defined(GC_NO_PTHREAD_CANCEL)
       /* Handle DISABLED_GC flag which is set by the    */
       /* intercepted pthread_cancel or pthread_exit.    */
       if ((me -> flags & DISABLED_GC) != 0) {
@@ -1540,7 +1540,7 @@ GC_API int WRAP_FUNC(pthread_detach)(pthread_t thread)
   }
 #endif /* !GC_NO_PTHREAD_CANCEL */
 
-#ifdef GC_PTHREAD_EXIT_ATTRIBUTE
+#ifdef GC_HAVE_PTHREAD_EXIT
   GC_API GC_PTHREAD_EXIT_ATTRIBUTE void WRAP_FUNC(pthread_exit)(void *retval)
   {
     pthread_t self = pthread_self();
@@ -1560,7 +1560,7 @@ GC_API int WRAP_FUNC(pthread_detach)(pthread_t thread)
 
     REAL_FUNC(pthread_exit)(retval);
   }
-#endif /* GC_PTHREAD_EXIT_ATTRIBUTE */
+#endif /* GC_HAVE_PTHREAD_EXIT */
 
 GC_INNER GC_bool GC_in_thread_creation = FALSE;
                                 /* Protected by allocation lock. */