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
This commit is contained in:
parent
d0a9fbe16c
commit
6545e33e69
@ -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>
|
2011-07-15 Jason Merrill <jason@redhat.com>
|
||||||
|
|
||||||
PR testsuite/49741
|
PR testsuite/49741
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/* Threads compatibility routines for libgcc2 and libobjc. */
|
/* Threads compatibility routines for libgcc2 and libobjc. */
|
||||||
/* Compile this one with gcc. */
|
/* Compile this one with gcc. */
|
||||||
/* Copyright (C) 1997, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
|
/* 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.
|
This file is part of GCC.
|
||||||
|
|
||||||
@ -39,7 +39,16 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <pthread.h>
|
#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_t __gthread_t;
|
||||||
typedef pthread_key_t __gthread_key_t;
|
typedef pthread_key_t __gthread_key_t;
|
||||||
@ -100,11 +109,9 @@ __gthrw3(sched_yield)
|
|||||||
|
|
||||||
__gthrw3(pthread_mutex_lock)
|
__gthrw3(pthread_mutex_lock)
|
||||||
__gthrw3(pthread_mutex_trylock)
|
__gthrw3(pthread_mutex_trylock)
|
||||||
#ifdef _POSIX_TIMEOUTS
|
#if _GTHREAD_USE_MUTEX_TIMEDLOCK
|
||||||
#if _POSIX_TIMEOUTS >= 0
|
|
||||||
__gthrw3(pthread_mutex_timedlock)
|
__gthrw3(pthread_mutex_timedlock)
|
||||||
#endif
|
#endif
|
||||||
#endif /* _POSIX_TIMEOUTS */
|
|
||||||
__gthrw3(pthread_mutex_unlock)
|
__gthrw3(pthread_mutex_unlock)
|
||||||
__gthrw3(pthread_mutex_init)
|
__gthrw3(pthread_mutex_init)
|
||||||
__gthrw3(pthread_mutex_destroy)
|
__gthrw3(pthread_mutex_destroy)
|
||||||
@ -131,11 +138,9 @@ __gthrw(sched_yield)
|
|||||||
|
|
||||||
__gthrw(pthread_mutex_lock)
|
__gthrw(pthread_mutex_lock)
|
||||||
__gthrw(pthread_mutex_trylock)
|
__gthrw(pthread_mutex_trylock)
|
||||||
#ifdef _POSIX_TIMEOUTS
|
#if _GTHREAD_USE_MUTEX_TIMEDLOCK
|
||||||
#if _POSIX_TIMEOUTS >= 0
|
|
||||||
__gthrw(pthread_mutex_timedlock)
|
__gthrw(pthread_mutex_timedlock)
|
||||||
#endif
|
#endif
|
||||||
#endif /* _POSIX_TIMEOUTS */
|
|
||||||
__gthrw(pthread_mutex_unlock)
|
__gthrw(pthread_mutex_unlock)
|
||||||
__gthrw(pthread_mutex_init)
|
__gthrw(pthread_mutex_init)
|
||||||
__gthrw(pthread_mutex_destroy)
|
__gthrw(pthread_mutex_destroy)
|
||||||
@ -753,8 +758,7 @@ __gthread_mutex_trylock (__gthread_mutex_t *__mutex)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _POSIX_TIMEOUTS
|
#if _GTHREAD_USE_MUTEX_TIMEDLOCK
|
||||||
#if _POSIX_TIMEOUTS >= 0
|
|
||||||
static inline int
|
static inline int
|
||||||
__gthread_mutex_timedlock (__gthread_mutex_t *__mutex,
|
__gthread_mutex_timedlock (__gthread_mutex_t *__mutex,
|
||||||
const __gthread_time_t *__abs_timeout)
|
const __gthread_time_t *__abs_timeout)
|
||||||
@ -765,7 +769,6 @@ __gthread_mutex_timedlock (__gthread_mutex_t *__mutex,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
|
|
||||||
static inline int
|
static inline int
|
||||||
__gthread_mutex_unlock (__gthread_mutex_t *__mutex)
|
__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);
|
return __gthread_mutex_trylock (__mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _POSIX_TIMEOUTS
|
#if _GTHREAD_USE_MUTEX_TIMEDLOCK
|
||||||
#if _POSIX_TIMEOUTS >= 0
|
|
||||||
static inline int
|
static inline int
|
||||||
__gthread_recursive_mutex_timedlock (__gthread_recursive_mutex_t *__mutex,
|
__gthread_recursive_mutex_timedlock (__gthread_recursive_mutex_t *__mutex,
|
||||||
const __gthread_time_t *__abs_timeout)
|
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);
|
return __gthread_mutex_timedlock (__mutex, __abs_timeout);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
|
|
||||||
static inline int
|
static inline int
|
||||||
__gthread_recursive_mutex_unlock (__gthread_recursive_mutex_t *__mutex)
|
__gthread_recursive_mutex_unlock (__gthread_recursive_mutex_t *__mutex)
|
||||||
|
@ -1,3 +1,14 @@
|
|||||||
|
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.
|
||||||
|
|
||||||
2011-07-11 Paolo Carlini <paolo.carlini@oracle.com>
|
2011-07-11 Paolo Carlini <paolo.carlini@oracle.com>
|
||||||
|
|
||||||
PR libstdc++/49559
|
PR libstdc++/49559
|
||||||
|
@ -3155,6 +3155,22 @@ AC_DEFUN([GLIBCXX_CHECK_GTHREADS], [
|
|||||||
ac_save_CXXFLAGS="$CXXFLAGS"
|
ac_save_CXXFLAGS="$CXXFLAGS"
|
||||||
CXXFLAGS="$CXXFLAGS -fno-exceptions -I${toplevel_srcdir}/gcc"
|
CXXFLAGS="$CXXFLAGS -fno-exceptions -I${toplevel_srcdir}/gcc"
|
||||||
|
|
||||||
|
AC_MSG_CHECKING([check whether it can be safely assumed that mutex_timedlock is available])
|
||||||
|
|
||||||
|
AC_TRY_COMPILE([#include <unistd.h>],
|
||||||
|
[
|
||||||
|
#if !defined(_POSIX_TIMEOUTS) || _POSIX_TIMEOUTS < 0
|
||||||
|
#error
|
||||||
|
#endif
|
||||||
|
], [ac_gthread_use_mutex_timedlock=1], [ac_gthread_use_mutex_timedlock=0])
|
||||||
|
|
||||||
|
AC_DEFINE_UNQUOTED(_GTHREAD_USE_MUTEX_TIMEDLOCK, $ac_gthread_use_mutex_timedlock,
|
||||||
|
[Define to 1 if mutex_timedlock is available.])
|
||||||
|
|
||||||
|
if test $ac_gthread_use_mutex_timedlock = 1 ; then res_mutex_timedlock=yes ;
|
||||||
|
else res_mutex_timedlock=no ; fi
|
||||||
|
AC_MSG_RESULT([$res_mutex_timedlock])
|
||||||
|
|
||||||
target_thread_file=`$CXX -v 2>&1 | sed -n 's/^Thread model: //p'`
|
target_thread_file=`$CXX -v 2>&1 | sed -n 's/^Thread model: //p'`
|
||||||
case $target_thread_file in
|
case $target_thread_file in
|
||||||
posix)
|
posix)
|
||||||
@ -3163,7 +3179,10 @@ AC_DEFUN([GLIBCXX_CHECK_GTHREADS], [
|
|||||||
|
|
||||||
AC_MSG_CHECKING([for gthreads library])
|
AC_MSG_CHECKING([for gthreads library])
|
||||||
|
|
||||||
AC_TRY_COMPILE([#include "gthr.h"],
|
AC_TRY_COMPILE([
|
||||||
|
#include "gthr.h"
|
||||||
|
#include <unistd.h>
|
||||||
|
],
|
||||||
[
|
[
|
||||||
#ifndef __GTHREADS_CXX0X
|
#ifndef __GTHREADS_CXX0X
|
||||||
#error
|
#error
|
||||||
|
@ -823,6 +823,9 @@
|
|||||||
/* Define if code specialized for wchar_t should be used. */
|
/* Define if code specialized for wchar_t should be used. */
|
||||||
#undef _GLIBCXX_USE_WCHAR_T
|
#undef _GLIBCXX_USE_WCHAR_T
|
||||||
|
|
||||||
|
/* Define to 1 if mutex_timedlock is available. */
|
||||||
|
#undef _GTHREAD_USE_MUTEX_TIMEDLOCK
|
||||||
|
|
||||||
#if defined (HAVE__ACOSF) && ! defined (HAVE_ACOSF)
|
#if defined (HAVE__ACOSF) && ! defined (HAVE_ACOSF)
|
||||||
# define HAVE_ACOSF 1
|
# define HAVE_ACOSF 1
|
||||||
# define acosf _acosf
|
# define acosf _acosf
|
||||||
|
41
libstdc++-v3/configure
vendored
41
libstdc++-v3/configure
vendored
@ -19427,6 +19427,42 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
|
|||||||
ac_save_CXXFLAGS="$CXXFLAGS"
|
ac_save_CXXFLAGS="$CXXFLAGS"
|
||||||
CXXFLAGS="$CXXFLAGS -fno-exceptions -I${toplevel_srcdir}/gcc"
|
CXXFLAGS="$CXXFLAGS -fno-exceptions -I${toplevel_srcdir}/gcc"
|
||||||
|
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking check whether it can be safely assumed that mutex_timedlock is available" >&5
|
||||||
|
$as_echo_n "checking check whether it can be safely assumed that mutex_timedlock is available... " >&6; }
|
||||||
|
|
||||||
|
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||||
|
/* end confdefs.h. */
|
||||||
|
#include <unistd.h>
|
||||||
|
int
|
||||||
|
main ()
|
||||||
|
{
|
||||||
|
|
||||||
|
#if !defined(_POSIX_TIMEOUTS) || _POSIX_TIMEOUTS < 0
|
||||||
|
#error
|
||||||
|
#endif
|
||||||
|
|
||||||
|
;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
_ACEOF
|
||||||
|
if ac_fn_cxx_try_compile "$LINENO"; then :
|
||||||
|
ac_gthread_use_mutex_timedlock=1
|
||||||
|
else
|
||||||
|
ac_gthread_use_mutex_timedlock=0
|
||||||
|
fi
|
||||||
|
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
|
||||||
|
|
||||||
|
|
||||||
|
cat >>confdefs.h <<_ACEOF
|
||||||
|
#define _GTHREAD_USE_MUTEX_TIMEDLOCK $ac_gthread_use_mutex_timedlock
|
||||||
|
_ACEOF
|
||||||
|
|
||||||
|
|
||||||
|
if test $ac_gthread_use_mutex_timedlock = 1 ; then res_mutex_timedlock=yes ;
|
||||||
|
else res_mutex_timedlock=no ; fi
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $res_mutex_timedlock" >&5
|
||||||
|
$as_echo "$res_mutex_timedlock" >&6; }
|
||||||
|
|
||||||
target_thread_file=`$CXX -v 2>&1 | sed -n 's/^Thread model: //p'`
|
target_thread_file=`$CXX -v 2>&1 | sed -n 's/^Thread model: //p'`
|
||||||
case $target_thread_file in
|
case $target_thread_file in
|
||||||
posix)
|
posix)
|
||||||
@ -19438,7 +19474,10 @@ $as_echo_n "checking for gthreads library... " >&6; }
|
|||||||
|
|
||||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||||
/* end confdefs.h. */
|
/* end confdefs.h. */
|
||||||
#include "gthr.h"
|
|
||||||
|
#include "gthr.h"
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
int
|
int
|
||||||
main ()
|
main ()
|
||||||
{
|
{
|
||||||
|
@ -35,6 +35,7 @@
|
|||||||
&& defined(_GLIBCXX_ATOMIC_BUILTINS_4) && defined(_GLIBCXX_HAVE_LINUX_FUTEX)
|
&& defined(_GLIBCXX_ATOMIC_BUILTINS_4) && defined(_GLIBCXX_HAVE_LINUX_FUTEX)
|
||||||
# include <climits>
|
# include <climits>
|
||||||
# include <syscall.h>
|
# include <syscall.h>
|
||||||
|
# include <unistd.h>
|
||||||
# define _GLIBCXX_USE_FUTEX
|
# define _GLIBCXX_USE_FUTEX
|
||||||
# define _GLIBCXX_FUTEX_WAIT 0
|
# define _GLIBCXX_FUTEX_WAIT 0
|
||||||
# define _GLIBCXX_FUTEX_WAKE 1
|
# define _GLIBCXX_FUTEX_WAKE 1
|
||||||
|
22
libstdc++-v3/testsuite/17_intro/headers/c++1998/49745.cc
Normal file
22
libstdc++-v3/testsuite/17_intro/headers/c++1998/49745.cc
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
// { dg-do compile { target *-*-linux* } }
|
||||||
|
|
||||||
|
// Copyright (C) 2011 Free Software Foundation, Inc.
|
||||||
|
//
|
||||||
|
// This file is part of the GNU ISO C++ Library. This library is free
|
||||||
|
// software; you can redistribute it and/or modify it under the
|
||||||
|
// terms of the GNU General Public License as published by the
|
||||||
|
// Free Software Foundation; either version 3, or (at your option)
|
||||||
|
// any later version.
|
||||||
|
|
||||||
|
// This library is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU General Public License for more details.
|
||||||
|
|
||||||
|
// You should have received a copy of the GNU General Public License along
|
||||||
|
// with this library; see the file COPYING3. If not see
|
||||||
|
// <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
// libstdc++/49745
|
||||||
|
#include <iostream>
|
||||||
|
int truncate = 0;
|
Loading…
Reference in New Issue
Block a user