diff options
author | Matthew Dempsky <matthew@cvs.openbsd.org> | 2012-06-20 17:24:58 +0000 |
---|---|---|
committer | Matthew Dempsky <matthew@cvs.openbsd.org> | 2012-06-20 17:24:58 +0000 |
commit | 159f5470d216e7cd95c64dc10d61be4b3eab2ac2 (patch) | |
tree | 0637fe0a69222fde909999c7d2045d3c7e7892c0 /gnu | |
parent | b6a036d16968bdc07e9455937f674778d6f90e05 (diff) |
Fix GCC's use of _POSIX_PRIORITY_SCHEDULING and
_POSIX_THREAD_PRIORITY_SCHEDULING. POSIX 2001 states that they can be
defined to -1 to indicate that the feature is not supported (which is
how we define them), so it's not okay to just check whether or not
they're defined.
Arguably, SUSv2 allows GCC's usage, but we don't special case these
feature flags for SUSv2, and these files need to be compilable in BSD
and POSIX compat modes anyway.
From Brad.
Diffstat (limited to 'gnu')
-rw-r--r-- | gnu/gcc/gcc/gthr-posix.c | 6 | ||||
-rw-r--r-- | gnu/gcc/gcc/gthr-posix.h | 14 | ||||
-rw-r--r-- | gnu/gcc/gcc/gthr-posix95.h | 14 | ||||
-rw-r--r-- | gnu/usr.bin/gcc/gcc/gthr-posix.h | 8 |
4 files changed, 21 insertions, 21 deletions
diff --git a/gnu/gcc/gcc/gthr-posix.c b/gnu/gcc/gcc/gthr-posix.c index e2d731ae407..750081b2a4e 100644 --- a/gnu/gcc/gcc/gthr-posix.c +++ b/gnu/gcc/gcc/gthr-posix.c @@ -173,8 +173,8 @@ pthread_self (void) { return (pthread_t) 0; } -#ifdef _POSIX_PRIORITY_SCHEDULING -#ifdef _POSIX_THREAD_PRIORITY_SCHEDULING +#if defined(_POSIX_PRIORITY_SCHEDULING) && (_POSIX_PRIORITY_SCHEDULING > 0) +#if defined(_POSIX_THREAD_PRIORITY_SCHEDULING) && (_POSIX_THREAD_PRIORITY_SCHEDULING > 0) int sched_get_priority_max (int policy ATTRIBUTE_UNUSED) { @@ -214,7 +214,7 @@ pthread_attr_setdetachstate (pthread_attr_t *attr ATTRIBUTE_UNUSED, return 0; } -#ifdef _POSIX_THREAD_PRIORITY_SCHEDULING +#if defined(_POSIX_THREAD_PRIORITY_SCHEDULING) && (_POSIX_THREAD_PRIORITY_SCHEDULING > 0) int pthread_getschedparam (pthread_t thread ATTRIBUTE_UNUSED, int *policy ATTRIBUTE_UNUSED, diff --git a/gnu/gcc/gcc/gthr-posix.h b/gnu/gcc/gcc/gthr-posix.h index 47d38a320ba..2c86573dbe1 100644 --- a/gnu/gcc/gcc/gthr-posix.h +++ b/gnu/gcc/gcc/gthr-posix.h @@ -128,8 +128,8 @@ __gthrw(pthread_exit) __gthrw(pthread_mutex_destroy) __gthrw(pthread_self) #endif /* __osf__ && _PTHREAD_USE_MANGLED_NAMES_ */ -#ifdef _POSIX_PRIORITY_SCHEDULING -#ifdef _POSIX_THREAD_PRIORITY_SCHEDULING +#if defined(_POSIX_PRIORITY_SCHEDULING) && (_POSIX_PRIORITY_SCHEDULING > 0) +#if defined(_POSIX_THREAD_PRIORITY_SCHEDULING) && (_POSIX_THREAD_PRIORITY_SCHEDULING > 0) __gthrw(sched_get_priority_max) __gthrw(sched_get_priority_min) #endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */ @@ -138,7 +138,7 @@ __gthrw(sched_yield) __gthrw(pthread_attr_destroy) __gthrw(pthread_attr_init) __gthrw(pthread_attr_setdetachstate) -#ifdef _POSIX_THREAD_PRIORITY_SCHEDULING +#if defined(_POSIX_THREAD_PRIORITY_SCHEDULING) && (_POSIX_THREAD_PRIORITY_SCHEDULING > 0) __gthrw(pthread_getschedparam) __gthrw(pthread_setschedparam) #endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */ @@ -299,8 +299,8 @@ __gthread_objc_thread_set_priority (int priority) return -1; else { -#ifdef _POSIX_PRIORITY_SCHEDULING -#ifdef _POSIX_THREAD_PRIORITY_SCHEDULING +#if defined(_POSIX_PRIORITY_SCHEDULING) && (_POSIX_PRIORITY_SCHEDULING > 0) +#if defined(_POSIX_THREAD_PRIORITY_SCHEDULING) && (_POSIX_THREAD_PRIORITY_SCHEDULING > 0) pthread_t thread_id = __gthrw_(pthread_self) (); int policy; struct sched_param params; @@ -338,8 +338,8 @@ __gthread_objc_thread_set_priority (int priority) static inline int __gthread_objc_thread_get_priority (void) { -#ifdef _POSIX_PRIORITY_SCHEDULING -#ifdef _POSIX_THREAD_PRIORITY_SCHEDULING +#if defined(_POSIX_PRIORITY_SCHEDULING) && (_POSIX_PRIORITY_SCHEDULING > 0) +#if defined(_POSIX_THREAD_PRIORITY_SCHEDULING) && (_POSIX_THREAD_PRIORITY_SCHEDULING > 0) if (__gthread_active_p ()) { int policy; diff --git a/gnu/gcc/gcc/gthr-posix95.h b/gnu/gcc/gcc/gthr-posix95.h index fde264594f8..edb733f4e6a 100644 --- a/gnu/gcc/gcc/gthr-posix95.h +++ b/gnu/gcc/gcc/gthr-posix95.h @@ -91,8 +91,8 @@ __gthrw(pthread_cond_signal) __gthrw(pthread_cond_wait) __gthrw(pthread_exit) __gthrw(pthread_mutex_destroy) -#ifdef _POSIX_PRIORITY_SCHEDULING -#ifdef _POSIX_THREAD_PRIORITY_SCHEDULING +#if defined(_POSIX_PRIORITY_SCHEDULING) && (_POSIX_PRIORITY_SCHEDULING > 0) +#if defined(_POSIX_THREAD_PRIORITY_SCHEDULING) && (_POSIX_THREAD_PRIORITY_SCHEDULING > 0) __gthrw(sched_get_priority_max) __gthrw(sched_get_priority_min) #endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */ @@ -101,7 +101,7 @@ __gthrw(sched_yield) __gthrw(pthread_attr_destroy) __gthrw(pthread_attr_init) __gthrw(pthread_attr_setdetachstate) -#ifdef _POSIX_THREAD_PRIORITY_SCHEDULING +#if defined(_POSIX_THREAD_PRIORITY_SCHEDULING) && (_POSIX_THREAD_PRIORITY_SCHEDULING > 0) __gthrw(pthread_getschedparam) __gthrw(pthread_setschedparam) #endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */ @@ -262,8 +262,8 @@ __gthread_objc_thread_set_priority (int priority) return -1; else { -#ifdef _POSIX_PRIORITY_SCHEDULING -#ifdef _POSIX_THREAD_PRIORITY_SCHEDULING +#if defined(_POSIX_PRIORITY_SCHEDULING) && (_POSIX_PRIORITY_SCHEDULING > 0) +#if defined(_POSIX_THREAD_PRIORITY_SCHEDULING) && (_POSIX_THREAD_PRIORITY_SCHEDULING > 0) pthread_t thread_id = __gthrw_(pthread_self) (); int policy; struct sched_param params; @@ -301,8 +301,8 @@ __gthread_objc_thread_set_priority (int priority) static inline int __gthread_objc_thread_get_priority (void) { -#ifdef _POSIX_PRIORITY_SCHEDULING -#ifdef _POSIX_THREAD_PRIORITY_SCHEDULING +#if defined(_POSIX_PRIORITY_SCHEDULING) && (_POSIX_PRIORITY_SCHEDULING > 0) +#if defined(_POSIX_THREAD_PRIORITY_SCHEDULING) && (_POSIX_THREAD_PRIORITY_SCHEDULING > 0) if (__gthread_active_p ()) { int policy; diff --git a/gnu/usr.bin/gcc/gcc/gthr-posix.h b/gnu/usr.bin/gcc/gcc/gthr-posix.h index 9149e645ceb..65bebfb8baa 100644 --- a/gnu/usr.bin/gcc/gcc/gthr-posix.h +++ b/gnu/usr.bin/gcc/gcc/gthr-posix.h @@ -70,7 +70,7 @@ typedef pthread_mutex_t __gthread_mutex_t; #pragma weak pthread_self /* These really should be protected by _POSIX_PRIORITY_SCHEDULING, but we use them inside a _POSIX_THREAD_PRIORITY_SCHEDULING block. */ -#ifdef _POSIX_THREAD_PRIORITY_SCHEDULING +#if defined(_POSIX_THREAD_PRIORITY_SCHEDULING) && (_POSIX_THREAD_PRIORITY_SCHEDULING > 0) #pragma weak sched_get_priority_max #pragma weak sched_get_priority_min #endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */ @@ -78,7 +78,7 @@ typedef pthread_mutex_t __gthread_mutex_t; #pragma weak pthread_attr_destroy #pragma weak pthread_attr_init #pragma weak pthread_attr_setdetachstate -#ifdef _POSIX_THREAD_PRIORITY_SCHEDULING +#if defined(_POSIX_THREAD_PRIORITY_SCHEDULING) && (_POSIX_THREAD_PRIORITY_SCHEDULING > 0) #pragma weak pthread_getschedparam #pragma weak pthread_setschedparam #endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */ @@ -181,7 +181,7 @@ __gthread_objc_thread_set_priority (int priority) return -1; else { -#ifdef _POSIX_THREAD_PRIORITY_SCHEDULING +#if defined(_POSIX_THREAD_PRIORITY_SCHEDULING) && (_POSIX_THREAD_PRIORITY_SCHEDULING > 0) pthread_t thread_id = pthread_self (); int policy; struct sched_param params; @@ -218,7 +218,7 @@ __gthread_objc_thread_set_priority (int priority) static inline int __gthread_objc_thread_get_priority (void) { -#ifdef _POSIX_THREAD_PRIORITY_SCHEDULING +#if defined(_POSIX_THREAD_PRIORITY_SCHEDULING) && (_POSIX_THREAD_PRIORITY_SCHEDULING > 0) if (__gthread_active_p ()) { int policy; |