diff options
author | Paolo Carlini <paolo.carlini@oracle.com> | 2011-07-15 21:52:06 +0000 |
---|---|---|
committer | Paolo Carlini <paolo@gcc.gnu.org> | 2011-07-15 21:52:06 +0000 |
commit | 6545e33e69832eb0e5f946787f1764cf0179a049 (patch) | |
tree | 332e8978eae096a928a46f6e6c23fe9e22933de4 /gcc | |
parent | d0a9fbe16c999748339a5fe77da8e6687337d0e0 (diff) | |
download | gcc-6545e33e69832eb0e5f946787f1764cf0179a049.zip gcc-6545e33e69832eb0e5f946787f1764cf0179a049.tar.gz gcc-6545e33e69832eb0e5f946787f1764cf0179a049.tar.bz2 |
re PR libstdc++/49745 (error: ‘int truncate’ redeclared as different kind of symbol)
/gcc
2011-07-15 Paolo Carlini <paolo.carlini@oracle.com>
Jakub Jelinek <jakub@redhat.com>
Jonathan Wakely <jwakely.gcc@gmail.com>
PR libstdc++/49745
* gthr-posix.h: Do not include <unistd.h> unconditionally; use
_GTHREADS_USE_MUTEX_TIMEDLOCK instead of _POSIX_TIMEOUTS.
/libstdc++-v3
2011-07-15 Paolo Carlini <paolo.carlini@oracle.com>
Jakub Jelinek <jakub@redhat.com>
PR libstdc++/49745
* acinclude.m4 ([GLIBCXX_CHECK_GTHREADS]): Check separately for
_POSIX_TIMEOUTS and define _GTHREADS_USE_MUTEX_TIMEDLOCK.
* libstdc++-v3/libsupc++/guard.cc: Include <unistd.h>.
* testsuite/17_intro/headers/c++1998/49745.cc: New.
* configure: Regenerate.
* config.h.in: Likewise.
Co-Authored-By: Jakub Jelinek <jakub@redhat.com>
Co-Authored-By: Jonathan Wakely <jwakely.gcc@gmail.com>
From-SVN: r176335
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/gthr-posix.h | 29 |
2 files changed, 23 insertions, 14 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 7d52dd3..1efbe5b 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2011-07-15 Paolo Carlini <paolo.carlini@oracle.com> + Jakub Jelinek <jakub@redhat.com> + Jonathan Wakely <jwakely.gcc@gmail.com> + + PR libstdc++/49745 + * gthr-posix.h: Do not include <unistd.h> unconditionally; use + _GTHREADS_USE_MUTEX_TIMEDLOCK instead of _POSIX_TIMEOUTS. + 2011-07-15 Jason Merrill <jason@redhat.com> PR testsuite/49741 diff --git a/gcc/gthr-posix.h b/gcc/gthr-posix.h index ecb06e2..b1d499d 100644 --- a/gcc/gthr-posix.h +++ b/gcc/gthr-posix.h @@ -1,7 +1,7 @@ /* Threads compatibility routines for libgcc2 and libobjc. */ /* Compile this one with gcc. */ /* Copyright (C) 1997, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, - 2008, 2009, 2010 Free Software Foundation, Inc. + 2008, 2009, 2010, 2011 Free Software Foundation, Inc. This file is part of GCC. @@ -39,7 +39,16 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #endif #include <pthread.h> -#include <unistd.h> + +#if ((defined(_LIBOBJC) || defined(_LIBOBJC_WEAK)) \ + || !defined(_GTHREAD_USE_MUTEX_TIMEDLOCK)) +# include <unistd.h> +# if defined(_POSIX_TIMEOUTS) && _POSIX_TIMEOUTS >= 0 +# define _GTHREAD_USE_MUTEX_TIMEDLOCK 1 +# else +# define _GTHREAD_USE_MUTEX_TIMEDLOCK 0 +# endif +#endif typedef pthread_t __gthread_t; typedef pthread_key_t __gthread_key_t; @@ -100,11 +109,9 @@ __gthrw3(sched_yield) __gthrw3(pthread_mutex_lock) __gthrw3(pthread_mutex_trylock) -#ifdef _POSIX_TIMEOUTS -#if _POSIX_TIMEOUTS >= 0 +#if _GTHREAD_USE_MUTEX_TIMEDLOCK __gthrw3(pthread_mutex_timedlock) #endif -#endif /* _POSIX_TIMEOUTS */ __gthrw3(pthread_mutex_unlock) __gthrw3(pthread_mutex_init) __gthrw3(pthread_mutex_destroy) @@ -131,11 +138,9 @@ __gthrw(sched_yield) __gthrw(pthread_mutex_lock) __gthrw(pthread_mutex_trylock) -#ifdef _POSIX_TIMEOUTS -#if _POSIX_TIMEOUTS >= 0 +#if _GTHREAD_USE_MUTEX_TIMEDLOCK __gthrw(pthread_mutex_timedlock) #endif -#endif /* _POSIX_TIMEOUTS */ __gthrw(pthread_mutex_unlock) __gthrw(pthread_mutex_init) __gthrw(pthread_mutex_destroy) @@ -753,8 +758,7 @@ __gthread_mutex_trylock (__gthread_mutex_t *__mutex) return 0; } -#ifdef _POSIX_TIMEOUTS -#if _POSIX_TIMEOUTS >= 0 +#if _GTHREAD_USE_MUTEX_TIMEDLOCK static inline int __gthread_mutex_timedlock (__gthread_mutex_t *__mutex, const __gthread_time_t *__abs_timeout) @@ -765,7 +769,6 @@ __gthread_mutex_timedlock (__gthread_mutex_t *__mutex, return 0; } #endif -#endif static inline int __gthread_mutex_unlock (__gthread_mutex_t *__mutex) @@ -811,8 +814,7 @@ __gthread_recursive_mutex_trylock (__gthread_recursive_mutex_t *__mutex) return __gthread_mutex_trylock (__mutex); } -#ifdef _POSIX_TIMEOUTS -#if _POSIX_TIMEOUTS >= 0 +#if _GTHREAD_USE_MUTEX_TIMEDLOCK static inline int __gthread_recursive_mutex_timedlock (__gthread_recursive_mutex_t *__mutex, const __gthread_time_t *__abs_timeout) @@ -820,7 +822,6 @@ __gthread_recursive_mutex_timedlock (__gthread_recursive_mutex_t *__mutex, return __gthread_mutex_timedlock (__mutex, __abs_timeout); } #endif -#endif static inline int __gthread_recursive_mutex_unlock (__gthread_recursive_mutex_t *__mutex) |