summaryrefslogtreecommitdiff
path: root/gnu/usr.bin/gcc
diff options
context:
space:
mode:
authorMatthew Dempsky <matthew@cvs.openbsd.org>2012-06-20 17:24:58 +0000
committerMatthew Dempsky <matthew@cvs.openbsd.org>2012-06-20 17:24:58 +0000
commit159f5470d216e7cd95c64dc10d61be4b3eab2ac2 (patch)
tree0637fe0a69222fde909999c7d2045d3c7e7892c0 /gnu/usr.bin/gcc
parentb6a036d16968bdc07e9455937f674778d6f90e05 (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/usr.bin/gcc')
-rw-r--r--gnu/usr.bin/gcc/gcc/gthr-posix.h8
1 files changed, 4 insertions, 4 deletions
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;