summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--misc.c2
-rw-r--r--os_dep.c8
-rw-r--r--pthread_support.c15
-rw-r--r--tests/test.c12
-rw-r--r--win32_threads.c2
5 files changed, 24 insertions, 15 deletions
diff --git a/misc.c b/misc.c
index 1f60e8ea..6c01404e 100644
--- a/misc.c
+++ b/misc.c
@@ -873,7 +873,7 @@ GC_API void GC_CALL GC_init(void)
if (0 != pthread_mutex_init(&GC_allocate_ml, &mattr)) {
ABORT("pthread_mutex_init failed");
}
- pthread_mutexattr_destroy(&mattr);
+ (void)pthread_mutexattr_destroy(&mattr);
}
# endif
# endif /* THREADS */
diff --git a/os_dep.c b/os_dep.c
index 4a77d31e..1709c8e4 100644
--- a/os_dep.c
+++ b/os_dep.c
@@ -1201,13 +1201,13 @@ GC_INNER word GC_page_size = 0;
if (pthread_getattr_np(pthread_self(), &attr) == 0) {
if (pthread_attr_getstack(&attr, &stackaddr, &size) == 0
&& stackaddr != NULL) {
- pthread_attr_destroy(&attr);
+ (void)pthread_attr_destroy(&attr);
# ifdef STACK_GROWS_DOWN
stackaddr = (char *)stackaddr + size;
# endif
return (ptr_t)stackaddr;
}
- pthread_attr_destroy(&attr);
+ (void)pthread_attr_destroy(&attr);
}
WARN("pthread_getattr_np or pthread_attr_getstack failed"
" for main thread\n", 0);
@@ -1284,7 +1284,7 @@ GC_INNER word GC_page_size = 0;
if (pthread_attr_getstack(&attr, &(b -> mem_base), &size) != 0) {
ABORT("pthread_attr_getstack failed");
}
- pthread_attr_destroy(&attr);
+ (void)pthread_attr_destroy(&attr);
# ifdef STACK_GROWS_DOWN
b -> mem_base = (char *)(b -> mem_base) + size;
# endif
@@ -4186,7 +4186,7 @@ GC_INNER void GC_dirty_init(void)
/* This will call the real pthread function, not our wrapper */
if (pthread_create(&thread, &attr, GC_mprotect_thread, NULL) != 0)
ABORT("pthread_create failed");
- pthread_attr_destroy(&attr);
+ (void)pthread_attr_destroy(&attr);
/* Setup the sigbus handler for ignoring the meaningless SIGBUSs */
# ifdef BROKEN_EXCEPTION_HANDLING
diff --git a/pthread_support.c b/pthread_support.c
index 33c8a338..2fca3602 100644
--- a/pthread_support.c
+++ b/pthread_support.c
@@ -445,7 +445,7 @@ start_mark_threads(void)
}
}
GC_markers_m1 = i;
- pthread_attr_destroy(&attr);
+ (void)pthread_attr_destroy(&attr);
GC_COND_LOG_PRINTF("Started %d mark helper threads\n", GC_markers_m1);
}
@@ -1706,14 +1706,17 @@ GC_API int WRAP_FUNC(pthread_create)(pthread_t *new_thread,
{
size_t stack_size = 0;
if (NULL != attr) {
- pthread_attr_getstacksize(attr, &stack_size);
+ if (pthread_attr_getstacksize(attr, &stack_size) != 0)
+ ABORT("pthread_attr_getstacksize failed");
}
if (0 == stack_size) {
pthread_attr_t my_attr;
- pthread_attr_init(&my_attr);
- pthread_attr_getstacksize(&my_attr, &stack_size);
- pthread_attr_destroy(&my_attr);
+ if (pthread_attr_init(&my_attr) != 0)
+ ABORT("pthread_attr_init failed");
+ if (pthread_attr_getstacksize(&my_attr, &stack_size) != 0)
+ ABORT("pthread_attr_getstacksize failed");
+ (void)pthread_attr_destroy(&my_attr);
}
/* On Solaris 10, with default attr initialization, */
/* stack_size remains 0. Fudge it. */
@@ -2034,7 +2037,7 @@ static void setup_mark_lock(void)
if (0 != pthread_mutex_init(&mark_mutex, &mattr)) {
ABORT("pthread_mutex_init failed");
}
- pthread_mutexattr_destroy(&mattr);
+ (void)pthread_mutexattr_destroy(&mattr);
}
# endif
}
diff --git a/tests/test.c b/tests/test.c
index 6f412c8f..1f006e47 100644
--- a/tests/test.c
+++ b/tests/test.c
@@ -1874,11 +1874,17 @@ int main(void)
# endif
GC_COND_INIT();
- pthread_attr_init(&attr);
+ if ((code = pthread_attr_init(&attr)) != 0) {
+ GC_printf("pthread_attr_init failed, error=%d\n", code);
+ FAIL;
+ }
# if defined(GC_IRIX_THREADS) || defined(GC_FREEBSD_THREADS) \
|| defined(GC_DARWIN_THREADS) || defined(GC_AIX_THREADS) \
|| defined(GC_OPENBSD_THREADS)
- pthread_attr_setstacksize(&attr, 1000000);
+ if ((code = pthread_attr_setstacksize(&attr, 1000000)) != 0) {
+ GC_printf("pthread_attr_setstacksize failed, error=%d\n", code);
+ FAIL;
+ }
# endif
n_tests = 0;
# if (defined(MPROTECT_VDB)) && !defined(REDIRECT_MALLOC) \
@@ -1916,7 +1922,7 @@ int main(void)
}
check_heap_stats();
(void)fflush(stdout);
- pthread_attr_destroy(&attr);
+ (void)pthread_attr_destroy(&attr);
# ifdef PTW32_STATIC_LIB
pthread_win32_thread_detach_np ();
pthread_win32_process_detach_np ();
diff --git a/win32_threads.c b/win32_threads.c
index fc65743a..31d33b65 100644
--- a/win32_threads.c
+++ b/win32_threads.c
@@ -1776,7 +1776,7 @@ GC_INNER void GC_get_next_stack(char *start, char *limit,
}
}
GC_markers_m1 = i;
- pthread_attr_destroy(&attr);
+ (void)pthread_attr_destroy(&attr);
GC_COND_LOG_PRINTF("Started %d mark helper threads\n", GC_markers_m1);
}