atomicity.h: New, forward declarations for __atomic_add and __exchange_and_add.

2004-02-25  Benjamin Kosnik  <bkoz@redhat.com>

	* include/bits/atomicity.h: New, forward declarations for __atomic_add
	and __exchange_and_add.
	* config/cpu/generic/atomic_word.h: New, typdef for atomic word.
	* config/cpu/cris/atomic_word.h: Same.
	* config/cpu/sparc/atomic_word.h: Same.
	* include/bits/ios_base.h (_Callback_list::_M_remove_reference):
	Qualifiy with __gnu_cxx.
	(_Callback_list::_M_add_reference): Same.
	* include/bits/locale_classes.h (locale::facet::_M_add_reference): Add.
	(locale::facet::_M_remove_reference): Same.
	(locale::_Impl::_M_add_reference): Add.
	(locale::_Impl::_M_remove_reference): Same.
	* include/bits/basic_string.h (basic_string::_Rep::_M_refcopy): Same.
	(basic_string::_Rep::_M_dispose): Same.
	* src/ios.cc (ios_base::xalloc): Same.
	* src/ios_init.cc (ios_base::Init::Init): Same.
	(ios_base::Init::~Init): Same.
	* src/locale.cc (locale:🆔:_M_id): Same.
	* config/cpu/i486/atomicity.h: Use __gnu_cxx namespace. Remove
	static, and inline keyworks.
	* config/cpu/alpha/atomicity.h: Same.
	* config/cpu/cris/atomicity.h: Same.
	* config/cpu/generic/atomicity.h: Same.
	* config/cpu/hppa/atomicity.h: Same.
	* config/cpu/i386/atomicity.h: Same.
	* config/cpu/ia64/atomicity.h: Same.
	* config/cpu/m68k/atomicity.h: Same.
	* config/cpu/mips/atomicity.h: Same.
	* config/cpu/powerpc/atomicity.h: Same.
	* config/cpu/s390/atomicity.h: Same.
	* config/cpu/sparc/atomicity.h: Same.

	* src/Makefile.am (host_sources): Add atomicity.cc.
	(atomicity.cc): New rule.
	* src/Makefile.in: Regenerate.
	* include/Makefile.am (host_headers): Remove host atomicity.h.
	(host_headers): Add atomic_word.h.
	(bits_headers): Add bits atomicity.h.
	Change ATOMICITY_INC_SRCDIR to ATOMICITY_SRCDIR.
	* include/Makefile.in: Regenerate.
	* configure.host (atomic_word_dir): Add.
	* configure.ac: Substitute ATOMIC_WORD_SRCDIR. Change
	ATOMICITY_INC_SRCDIR to ATOMICITY_SRCDIR.
	* configure: Regenerate.
	* config/linker-map.gnu: Export __exchange_and_add, and __atomic_add.

	* testsuite/27_io/ios_base/cons/assign_neg.cc: Adjust line numbers.
	* testsuite/27_io/ios_base/cons/copy_neg.cc: Same.

From-SVN: r78544
This commit is contained in:
Benjamin Kosnik 2004-02-27 00:49:50 +00:00 committed by Benjamin Kosnik
parent 4d5fe28997
commit 2c5d0ae842
34 changed files with 810 additions and 616 deletions

View File

@ -1,3 +1,54 @@
2004-02-25 Benjamin Kosnik <bkoz@redhat.com>
* include/bits/atomicity.h: New, forward declarations for __atomic_add
and __exchange_and_add.
* config/cpu/generic/atomic_word.h: New, typdef for atomic word.
* config/cpu/cris/atomic_word.h: Same.
* config/cpu/sparc/atomic_word.h: Same.
* include/bits/ios_base.h (_Callback_list::_M_remove_reference):
Qualifiy with __gnu_cxx.
(_Callback_list::_M_add_reference): Same.
* include/bits/locale_classes.h (locale::facet::_M_add_reference): Add.
(locale::facet::_M_remove_reference): Same.
(locale::_Impl::_M_add_reference): Add.
(locale::_Impl::_M_remove_reference): Same.
* include/bits/basic_string.h (basic_string::_Rep::_M_refcopy): Same.
(basic_string::_Rep::_M_dispose): Same.
* src/ios.cc (ios_base::xalloc): Same.
* src/ios_init.cc (ios_base::Init::Init): Same.
(ios_base::Init::~Init): Same.
* src/locale.cc (locale::id::_M_id): Same.
* config/cpu/i486/atomicity.h: Use __gnu_cxx namespace. Remove
static, and inline keyworks.
* config/cpu/alpha/atomicity.h: Same.
* config/cpu/cris/atomicity.h: Same.
* config/cpu/generic/atomicity.h: Same.
* config/cpu/hppa/atomicity.h: Same.
* config/cpu/i386/atomicity.h: Same.
* config/cpu/ia64/atomicity.h: Same.
* config/cpu/m68k/atomicity.h: Same.
* config/cpu/mips/atomicity.h: Same.
* config/cpu/powerpc/atomicity.h: Same.
* config/cpu/s390/atomicity.h: Same.
* config/cpu/sparc/atomicity.h: Same.
* src/Makefile.am (host_sources): Add atomicity.cc.
(atomicity.cc): New rule.
* src/Makefile.in: Regenerate.
* include/Makefile.am (host_headers): Remove host atomicity.h.
(host_headers): Add atomic_word.h.
(bits_headers): Add bits atomicity.h.
Change ATOMICITY_INC_SRCDIR to ATOMICITY_SRCDIR.
* include/Makefile.in: Regenerate.
* configure.host (atomic_word_dir): Add.
* configure.ac: Substitute ATOMIC_WORD_SRCDIR. Change
ATOMICITY_INC_SRCDIR to ATOMICITY_SRCDIR.
* configure: Regenerate.
* config/linker-map.gnu: Export __exchange_and_add, and __atomic_add.
* testsuite/27_io/ios_base/cons/assign_neg.cc: Adjust line numbers.
* testsuite/27_io/ios_base/cons/copy_neg.cc: Same.
2004-02-25 Jonathan Wakely <redi@gcc.gnu.org> 2004-02-25 Jonathan Wakely <redi@gcc.gnu.org>
* docs/html/20_util/howto.html, docs/html/20_util/allocator.html, * docs/html/20_util/howto.html, docs/html/20_util/allocator.html,

View File

@ -1,4 +1,4 @@
# generated automatically by aclocal 1.7.9 -*- Autoconf -*- # generated automatically by aclocal 1.7.8 -*- Autoconf -*-
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002
# Free Software Foundation, Inc. # Free Software Foundation, Inc.
@ -1997,7 +1997,7 @@ AC_DEFUN([AM_AUTOMAKE_VERSION],[am__api_version="1.7"])
# Call AM_AUTOMAKE_VERSION so it can be traced. # Call AM_AUTOMAKE_VERSION so it can be traced.
# This function is AC_REQUIREd by AC_INIT_AUTOMAKE. # This function is AC_REQUIREd by AC_INIT_AUTOMAKE.
AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
[AM_AUTOMAKE_VERSION([1.7.9])]) [AM_AUTOMAKE_VERSION([1.7.8])])
# Helper functions for option handling. -*- Autoconf -*- # Helper functions for option handling. -*- Autoconf -*-

View File

@ -1,6 +1,6 @@
// Low-level functions for atomic operations: Alpha version -*- C++ -*- // Low-level functions for atomic operations: Alpha version -*- C++ -*-
// Copyright (C) 1999, 2000, 2001, 2003 Free Software Foundation, Inc. // Copyright (C) 1999, 2000, 2001, 2003, 2004 Free Software Foundation, Inc.
// //
// This file is part of the GNU ISO C++ Library. This library is free // 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 // software; you can redistribute it and/or modify it under the
@ -27,23 +27,22 @@
// invalidate any other reasons why the executable file might be covered by // invalidate any other reasons why the executable file might be covered by
// the GNU General Public License. // the GNU General Public License.
#ifndef _GLIBCXX_ATOMICITY_H #include <bits/atomicity.h>
#define _GLIBCXX_ATOMICITY_H 1
/* @@@ With gas we can play nice .subsection games to get the /* @@@ With gas we can play nice .subsection games to get the
non-predicted branch pointing forward. But Digital assemblers non-predicted branch pointing forward. But Digital assemblers
don't understand those directives. This isn't a terribly don't understand those directives. This isn't a terribly
important issue, so just ignore it. */ important issue, so just ignore it. */
typedef int _Atomic_word; namespace __gnu_cxx
static inline _Atomic_word
__attribute__ ((__unused__))
__exchange_and_add(volatile _Atomic_word* __mem, int __val)
{ {
register int __result, __tmp; _Atomic_word
__attribute__ ((__unused__))
__asm__ __volatile__ ( __exchange_and_add(volatile _Atomic_word* __mem, int __val)
{
register int __result, __tmp;
__asm__ __volatile__ (
"\n$Lxadd_%=:\n\t" "\n$Lxadd_%=:\n\t"
"ldl_l %0,%3\n\t" "ldl_l %0,%3\n\t"
"addl %0,%4,%1\n\t" "addl %0,%4,%1\n\t"
@ -53,16 +52,16 @@ __exchange_and_add(volatile _Atomic_word* __mem, int __val)
: "=&r"(__result), "=&r"(__tmp), "=m"(*__mem) : "=&r"(__result), "=&r"(__tmp), "=m"(*__mem)
: "m" (*__mem), "r"(__val)); : "m" (*__mem), "r"(__val));
return __result; return __result;
} }
static inline void void
__attribute__ ((__unused__)) __attribute__ ((__unused__))
__atomic_add(volatile _Atomic_word* __mem, int __val) __atomic_add(volatile _Atomic_word* __mem, int __val)
{ {
register _Atomic_word __result; register _Atomic_word __result;
__asm__ __volatile__ ( __asm__ __volatile__ (
"\n$Ladd_%=:\n\t" "\n$Ladd_%=:\n\t"
"ldl_l %0,%2\n\t" "ldl_l %0,%2\n\t"
"addl %0,%3,%0\n\t" "addl %0,%3,%0\n\t"
@ -71,6 +70,6 @@ __atomic_add(volatile _Atomic_word* __mem, int __val)
"mb" "mb"
: "=&r"(__result), "=m"(*__mem) : "=&r"(__result), "=m"(*__mem)
: "m" (*__mem), "r"(__val)); : "m" (*__mem), "r"(__val));
} }
} // namespace __gnu_cxx
#endif /* atomicity.h */

View File

@ -0,0 +1,36 @@
// Low-level type for atomic operations -*- C++ -*-
// Copyright (C) 2004 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 2, 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 COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
// As a special exception, you may use this file as part of a free software
// library without restriction. Specifically, if other files instantiate
// templates or use macros or inline functions from this file, or you compile
// this file and link it with other files to produce an executable, this
// file does not by itself cause the resulting executable to be covered by
// the GNU General Public License. This exception does not however
// invalidate any other reasons why the executable file might be covered by
// the GNU General Public License.
#ifndef _GLIBCXX_ATOMIC_WORD_H
#define _GLIBCXX_ATOMIC_WORD_H 1
// This entity must not cross a page boundary.
typedef int _Atomic_word __attribute__ ((__aligned__ (4)));
#endif

View File

@ -1,6 +1,6 @@
// Low-level functions for atomic operations: CRIS version -*- C++ -*- // Low-level functions for atomic operations: CRIS version -*- C++ -*-
// Copyright (C) 2001, 2003 Free Software Foundation, Inc. // Copyright (C) 2001, 2003, 2004 Free Software Foundation, Inc.
// //
// This file is part of the GNU ISO C++ Library. This library is free // 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 // software; you can redistribute it and/or modify it under the
@ -27,21 +27,19 @@
// invalidate any other reasons why the executable file might be covered by // invalidate any other reasons why the executable file might be covered by
// the GNU General Public License. // the GNU General Public License.
#ifndef _GLIBCXX_ATOMICITY_H #include <bits/atomicity.h>
#define _GLIBCXX_ATOMICITY_H 1
// This entity must not cross a page boundary. namespace __gnu_cxx
typedef int _Atomic_word __attribute__ ((__aligned__ (4)));
static inline _Atomic_word
__attribute__ ((__unused__))
__exchange_and_add(_Atomic_word* __mem, int __val)
{ {
int __tmp; static inline _Atomic_word
_Atomic_word __result; __attribute__ ((__unused__))
__exchange_and_add(_Atomic_word* __mem, int __val)
{
int __tmp;
_Atomic_word __result;
#if (__CRIS_arch_version >= 10) #if (__CRIS_arch_version >= 10)
__asm__ __volatile__ (" clearf \n" __asm__ __volatile__ (" clearf \n"
"0: \n" "0: \n"
" move.d %4,%2 \n" " move.d %4,%2 \n"
" move.d [%3],%0 \n" " move.d [%3],%0 \n"
@ -53,7 +51,7 @@ __exchange_and_add(_Atomic_word* __mem, int __val)
: "=&r" (__result), "=m" (*__mem), "=&r" (__tmp) : "=&r" (__result), "=m" (*__mem), "=&r" (__tmp)
: "r" (__mem), "g" (__val), "m" (*__mem)); : "r" (__mem), "g" (__val), "m" (*__mem));
#else #else
__asm__ __volatile__ (" move $ccr,$r9 \n" __asm__ __volatile__ (" move $ccr,$r9 \n"
" di \n" " di \n"
" move.d %4,%2 \n" " move.d %4,%2 \n"
" move.d [%3],%0 \n" " move.d [%3],%0 \n"
@ -65,14 +63,11 @@ __exchange_and_add(_Atomic_word* __mem, int __val)
: "r9"); : "r9");
#endif #endif
return __result; return __result;
} }
static inline void void
__attribute__ ((__unused__)) __attribute__ ((__unused__))
__atomic_add(_Atomic_word* __mem, int __val) __atomic_add(_Atomic_word* __mem, int __val)
{ { __exchange_and_add(__mem, __val); }
__exchange_and_add(__mem, __val); } // namespace __gnu_cxx
}
#endif /* atomicity.h */

View File

@ -0,0 +1,35 @@
// Low-level type for atomic operations -*- C++ -*-
// Copyright (C) 2004 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 2, 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 COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
// As a special exception, you may use this file as part of a free software
// library without restriction. Specifically, if other files instantiate
// templates or use macros or inline functions from this file, or you compile
// this file and link it with other files to produce an executable, this
// file does not by itself cause the resulting executable to be covered by
// the GNU General Public License. This exception does not however
// invalidate any other reasons why the executable file might be covered by
// the GNU General Public License.
#ifndef _GLIBCXX_ATOMIC_WORD_H
#define _GLIBCXX_ATOMIC_WORD_H 1
typedef int _Atomic_word;
#endif

View File

@ -1,6 +1,6 @@
// Low-level functions for atomic operations: Generic version -*- C++ -*- // Low-level functions for atomic operations: Generic version -*- C++ -*-
// Copyright (C) 1999, 2001, 2002, 2003 Free Software Foundation, Inc. // Copyright (C) 1999, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
// //
// This file is part of the GNU ISO C++ Library. This library is free // 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 // software; you can redistribute it and/or modify it under the
@ -27,15 +27,11 @@
// invalidate any other reasons why the executable file might be covered by // invalidate any other reasons why the executable file might be covered by
// the GNU General Public License. // the GNU General Public License.
#ifndef _GLIBCXX_ATOMICITY_H #include <bits/atomicity.h>
#define _GLIBCXX_ATOMICITY_H 1
#include <bits/gthr.h> #include <bits/gthr.h>
#define _GLIBCXX_NEED_GENERIC_MUTEX #define _GLIBCXX_NEED_GENERIC_MUTEX
typedef int _Atomic_word;
namespace __gnu_cxx namespace __gnu_cxx
{ {
extern __gthread_mutex_t _Atomic_add_mutex; extern __gthread_mutex_t _Atomic_add_mutex;
@ -44,34 +40,27 @@ namespace __gnu_cxx
extern __gthread_once_t _Atomic_add_mutex_once; extern __gthread_once_t _Atomic_add_mutex_once;
extern void __gthread_atomic_add_mutex_once(); extern void __gthread_atomic_add_mutex_once();
#endif #endif
}
static inline _Atomic_word _Atomic_word
__attribute__ ((__unused__)) __attribute__ ((__unused__))
__exchange_and_add(volatile _Atomic_word* __mem, int __val) __exchange_and_add(volatile _Atomic_word* __mem, int __val)
{ {
#ifndef __GTHREAD_MUTEX_INIT #ifndef __GTHREAD_MUTEX_INIT
__gthread_once(&__gnu_cxx::_Atomic_add_mutex_once, __gthread_once(&__gnu_cxx::_Atomic_add_mutex_once,
__gnu_cxx::__gthread_atomic_add_mutex_once); __gnu_cxx::__gthread_atomic_add_mutex_once);
#endif #endif
_Atomic_word __result; _Atomic_word __result;
__gthread_mutex_lock(&__gnu_cxx::_Atomic_add_mutex);
__result = *__mem;
*__mem += __val;
__gthread_mutex_lock(&__gnu_cxx::_Atomic_add_mutex); __gthread_mutex_unlock(&__gnu_cxx::_Atomic_add_mutex);
return __result;
}
__result = *__mem; void
*__mem += __val; __attribute__ ((__unused__))
__atomic_add(volatile _Atomic_word* __mem, int __val)
__gthread_mutex_unlock(&__gnu_cxx::_Atomic_add_mutex); { __exchange_and_add(__mem, __val); }
return __result; } // namespace __gnu_cxx
}
static inline void
__attribute__ ((__unused__))
__atomic_add(volatile _Atomic_word* __mem, int __val)
{
(void) __exchange_and_add(__mem, __val);
}
#endif /* atomicity.h */

View File

@ -1,90 +1,98 @@
/* Low-level functions for atomic operations. PA-RISC version. -*- C++ -*- // Low-level functions for atomic operations: PA-RISC version -*- C++ -*-
Copyright 2002 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or // Copyright (C) 2002, 2004 Free Software Foundation, Inc.
modify it under the terms of the GNU Library General Public License as //
published by the Free Software Foundation; either version 2 of the // This file is part of the GNU ISO C++ Library. This library is free
License, or (at your option) any later version. // 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 2, or (at your option)
// any later version.
The GNU C Library is distributed in the hope that it will be useful, // This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
Library General Public License for more details. // GNU General Public License for more details.
You should have received a copy of the GNU Library General Public // You should have received a copy of the GNU General Public License along
License along with the GNU C Library; see the file COPYING.LIB. If not, // with this library; see the file COPYING. If not, write to the Free
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, // Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
Boston, MA 02111-1307, USA. */ // USA.
#ifndef _GLIBCXX_ATOMICITY_H // As a special exception, you may use this file as part of a free software
#define _GLIBCXX_ATOMICITY_H 1 // library without restriction. Specifically, if other files instantiate
// templates or use macros or inline functions from this file, or you compile
// this file and link it with other files to produce an executable, this
// file does not by itself cause the resulting executable to be covered by
// the GNU General Public License. This exception does not however
// invalidate any other reasons why the executable file might be covered by
// the GNU General Public License.
typedef int _Atomic_word; #include <bits/atomicity.h>
template <int __inst> namespace __gnu_cxx
struct __Atomicity_lock
{ {
static volatile int _S_atomicity_lock; template<int __inst>
}; struct __Atomicity_lock
{
static volatile int _S_atomicity_lock;
};
template<int __inst>
volatile int
__Atomicity_lock<__inst>::_S_atomicity_lock __attribute__ ((aligned (16))) = 1;
template <int __inst> /* Because of the lack of weak support when using the hpux
volatile int som linker, we explicitly instantiate the atomicity lock
__Atomicity_lock<__inst>::_S_atomicity_lock __attribute__ ((aligned (16))) = 1; in src/misc-inst.cc when _GLIBCXX_INST_ATOMICITY_LOCK
is defined. */
/* Because of the lack of weak support when using the hpux
som linker, we explicitly instantiate the atomicity lock
in src/misc-inst.cc when _GLIBCXX_INST_ATOMICITY_LOCK
is defined. */
#ifndef _GLIBCXX_INST_ATOMICITY_LOCK #ifndef _GLIBCXX_INST_ATOMICITY_LOCK
template volatile int __Atomicity_lock<0>::_S_atomicity_lock; template volatile int __Atomicity_lock<0>::_S_atomicity_lock;
#endif #endif
static inline int int
__attribute__ ((__unused__)) __attribute__ ((__unused__))
__exchange_and_add(volatile _Atomic_word* __mem, int __val) __exchange_and_add(volatile _Atomic_word* __mem, int __val)
{ {
_Atomic_word result; _Atomic_word result;
int tmp; int tmp;
volatile int& lock = __Atomicity_lock<0>::_S_atomicity_lock; volatile int& lock = __Atomicity_lock<0>::_S_atomicity_lock;
__asm__ __volatile__ ("ldcw 0(%1),%0\n\t" __asm__ __volatile__ ("ldcw 0(%1),%0\n\t"
"cmpib,<>,n 0,%0,.+20\n\t" "cmpib,<>,n 0,%0,.+20\n\t"
"ldw 0(%1),%0\n\t" "ldw 0(%1),%0\n\t"
"cmpib,= 0,%0,.-4\n\t" "cmpib,= 0,%0,.-4\n\t"
"nop\n\t" "nop\n\t"
"b,n .-20" "b,n .-20"
: "=&r" (tmp) : "=&r" (tmp)
: "r" (&lock)); : "r" (&lock));
result = *__mem; result = *__mem;
*__mem = result + __val; *__mem = result + __val;
/* Reset lock with PA 2.0 "ordered" store. */ /* Reset lock with PA 2.0 "ordered" store. */
__asm__ __volatile__ ("stw,ma %1,0(%0)" __asm__ __volatile__ ("stw,ma %1,0(%0)"
: : "r" (&lock), "r" (tmp) : "memory"); : : "r" (&lock), "r" (tmp) : "memory");
return result; return result;
} }
static inline void void
__attribute__ ((__unused__)) __attribute__ ((__unused__))
__atomic_add(_Atomic_word* __mem, int __val) __atomic_add(_Atomic_word* __mem, int __val)
{ {
int tmp; int tmp;
volatile int& lock = __Atomicity_lock<0>::_S_atomicity_lock; volatile int& lock = __Atomicity_lock<0>::_S_atomicity_lock;
__asm__ __volatile__ ("ldcw 0(%1),%0\n\t" __asm__ __volatile__ ("ldcw 0(%1),%0\n\t"
"cmpib,<>,n 0,%0,.+20\n\t" "cmpib,<>,n 0,%0,.+20\n\t"
"ldw 0(%1),%0\n\t" "ldw 0(%1),%0\n\t"
"cmpib,= 0,%0,.-4\n\t" "cmpib,= 0,%0,.-4\n\t"
"nop\n\t" "nop\n\t"
"b,n .-20" "b,n .-20"
: "=&r" (tmp) : "=&r" (tmp)
: "r" (&lock)); : "r" (&lock));
*__mem += __val; *__mem += __val;
/* Reset lock with PA 2.0 "ordered" store. */ /* Reset lock with PA 2.0 "ordered" store. */
__asm__ __volatile__ ("stw,ma %1,0(%0)" __asm__ __volatile__ ("stw,ma %1,0(%0)"
: : "r" (&lock), "r" (tmp) : "memory"); : : "r" (&lock), "r" (tmp) : "memory");
} }
} // namespace __gnu_cxx
#endif

View File

@ -1,6 +1,6 @@
// Low-level functions for atomic operations: x86, x >= 3 version -*- C++ -*- // Low-level functions for atomic operations: x86, x >= 3 version -*- C++ -*-
// Copyright (C) 2003 Free Software Foundation, Inc. // Copyright (C) 2003, 2004 Free Software Foundation, Inc.
// //
// This file is part of the GNU ISO C++ Library. This library is free // 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 // software; you can redistribute it and/or modify it under the
@ -27,50 +27,48 @@
// invalidate any other reasons why the executable file might be covered by // invalidate any other reasons why the executable file might be covered by
// the GNU General Public License. // the GNU General Public License.
#ifndef _GLIBCXX_ATOMICITY_H #include <bits/atomicity.h>
#define _GLIBCXX_ATOMICITY_H 1
typedef int _Atomic_word; namespace __gnu_cxx
{
template<int __inst>
struct __Atomicity_lock
{
static volatile _Atomic_word _S_atomicity_lock;
};
template<int __inst> template<int __inst>
struct __Atomicity_lock volatile _Atomic_word __Atomicity_lock<__inst>::_S_atomicity_lock = 0;
template volatile _Atomic_word __Atomicity_lock<0>::_S_atomicity_lock;
_Atomic_word
__attribute__ ((__unused__))
__exchange_and_add(volatile _Atomic_word* __mem, int __val)
{ {
static volatile _Atomic_word _S_atomicity_lock; register _Atomic_word __result, __tmp = 1;
};
// Obtain the atomic exchange/add spin lock.
template<int __inst> do
volatile _Atomic_word __Atomicity_lock<__inst>::_S_atomicity_lock = 0; {
__asm__ __volatile__ ("xchg{l} {%0,%1|%1,%0}"
template volatile _Atomic_word __Atomicity_lock<0>::_S_atomicity_lock; : "=m" (__Atomicity_lock<0>::_S_atomicity_lock),
"+r" (__tmp)
static inline _Atomic_word : "m" (__Atomicity_lock<0>::_S_atomicity_lock));
__attribute__ ((__unused__)) }
__exchange_and_add(volatile _Atomic_word* __mem, int __val) while (__tmp);
{
register _Atomic_word __result, __tmp = 1; __result = *__mem;
*__mem += __val;
/* obtain the atomic exchange/add spin lock */
do { // Release spin lock.
__asm__ __volatile__ ("xchg{l} {%0,%1|%1,%0}" __Atomicity_lock<0>::_S_atomicity_lock = 0;
: "=m" (__Atomicity_lock<0>::_S_atomicity_lock),
"+r" (__tmp) return __result;
: "m" (__Atomicity_lock<0>::_S_atomicity_lock)); }
} while (__tmp);
void
__result = *__mem; __attribute__ ((__unused__))
*__mem += __val; __atomic_add(volatile _Atomic_word* __mem, int __val)
{ __exchange_and_add(__mem, __val); }
/* release spin lock */ } // namespace __gnu_cxx
__Atomicity_lock<0>::_S_atomicity_lock = 0;
return __result;
}
static inline void
__attribute__ ((__unused__))
__atomic_add(volatile _Atomic_word* __mem, int __val)
{
__exchange_and_add(__mem, __val);
}
#endif /* atomicity.h */

View File

@ -1,6 +1,6 @@
// Low-level functions for atomic operations: x86, x >= 4 version -*- C++ -*- // Low-level functions for atomic operations: x86, x >= 4 version -*- C++ -*-
// Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc. // Copyright (C) 1999, 2000, 2001, 2004 Free Software Foundation, Inc.
// //
// This file is part of the GNU ISO C++ Library. This library is free // 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 // software; you can redistribute it and/or modify it under the
@ -27,28 +27,27 @@
// invalidate any other reasons why the executable file might be covered by // invalidate any other reasons why the executable file might be covered by
// the GNU General Public License. // the GNU General Public License.
#ifndef _GLIBCXX_ATOMICITY_H #include <bits/atomicity.h>
#define _GLIBCXX_ATOMICITY_H 1
typedef int _Atomic_word; namespace __gnu_cxx
static inline _Atomic_word
__attribute__ ((__unused__))
__exchange_and_add(volatile _Atomic_word* __mem, int __val)
{ {
register _Atomic_word __result; _Atomic_word
__asm__ __volatile__ ("lock; xadd{l} {%0,%1|%1,%0}" __attribute__ ((__unused__))
: "=r" (__result), "=m" (*__mem) __exchange_and_add(volatile _Atomic_word* __mem, int __val)
: "0" (__val), "m" (*__mem)); {
return __result; register _Atomic_word __result;
} __asm__ __volatile__ ("lock; xadd{l} {%0,%1|%1,%0}"
: "=r" (__result), "=m" (*__mem)
: "0" (__val), "m" (*__mem));
return __result;
}
void
__attribute__ ((__unused__))
__atomic_add(volatile _Atomic_word* __mem, int __val)
{
__asm__ __volatile__ ("lock; add{l} {%1,%0|%0,%1}"
: "=m" (*__mem) : "ir" (__val), "m" (*__mem));
}
} // namespace __gnu_cxx
static inline void
__attribute__ ((__unused__))
__atomic_add(volatile _Atomic_word* __mem, int __val)
{
__asm__ __volatile__ ("lock; add{l} {%1,%0|%0,%1}"
: "=m" (*__mem) : "ir" (__val), "m" (*__mem));
}
#endif /* atomicity.h */

View File

@ -1,6 +1,6 @@
// Low-level functions for atomic operations: IA64 version -*- C++ -*- // Low-level functions for atomic operations: IA64 version -*- C++ -*-
// Copyright (C) 2000, 2001, 2003 Free Software Foundation, Inc. // Copyright (C) 2000, 2001, 2003, 2004 Free Software Foundation, Inc.
// //
// This file is part of the GNU ISO C++ Library. This library is free // 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 // software; you can redistribute it and/or modify it under the
@ -27,25 +27,18 @@
// invalidate any other reasons why the executable file might be covered by // invalidate any other reasons why the executable file might be covered by
// the GNU General Public License. // the GNU General Public License.
#ifndef _GLIBCXX_ATOMICITY_H #include <bits/atomicity.h>
#define _GLIBCXX_ATOMICITY_H 1
#include <ia64intrin.h> #include <ia64intrin.h>
typedef int _Atomic_word; namespace __gnu_cxx
static inline _Atomic_word
__attribute__ ((__unused__))
__exchange_and_add(volatile _Atomic_word* __mem, int __val)
{ {
return __sync_fetch_and_add(__mem, __val); _Atomic_word
} __attribute__ ((__unused__))
__exchange_and_add(volatile _Atomic_word* __mem, int __val)
{ return __sync_fetch_and_add(__mem, __val); }
static inline void void
__attribute__ ((__unused__)) __attribute__ ((__unused__))
__atomic_add(volatile _Atomic_word* __mem, int __val) __atomic_add(volatile _Atomic_word* __mem, int __val)
{ { __sync_fetch_and_add(__mem, __val); }
__sync_fetch_and_add(__mem, __val);
} }
#endif /* atomicity.h */

View File

@ -1,6 +1,6 @@
// Low-level functions for atomic operations: m68k version -*- C++ -*- // Low-level functions for atomic operations: m68k version -*- C++ -*-
// Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc. // Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
// //
// This file is part of the GNU ISO C++ Library. This library is free // 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 // software; you can redistribute it and/or modify it under the
@ -27,113 +27,107 @@
// invalidate any other reasons why the executable file might be covered by // invalidate any other reasons why the executable file might be covered by
// the GNU General Public License. // the GNU General Public License.
#ifndef _GLIBCXX_ATOMICITY_H #include <bits/atomicity.h>
#define _GLIBCXX_ATOMICITY_H 1
typedef int _Atomic_word;
namespace __gnu_cxx
{
#if ( defined(__mc68020__) || defined(__mc68030__) \ #if ( defined(__mc68020__) || defined(__mc68030__) \
|| defined(__mc68040__) || defined(__mc68060__) ) \ || defined(__mc68040__) || defined(__mc68060__) ) \
&& !defined(__mcpu32__) && !defined(__mcpu32__)
// These variants support compare-and-swap. // These variants support compare-and-swap.
_Atomic_word
static inline _Atomic_word __attribute__ ((__unused__))
__attribute__ ((__unused__)) __exchange_and_add(volatile _Atomic_word* __mem, int __val)
__exchange_and_add(volatile _Atomic_word* __mem, int __val) {
{ register _Atomic_word __result = *__mem;
register _Atomic_word __result = *__mem; register _Atomic_word __temp;
register _Atomic_word __temp; __asm__ __volatile__ ("1: move%.l %0,%1\n\t"
__asm__ __volatile__ ("1: move%.l %0,%1\n\t" "add%.l %3,%1\n\t"
"add%.l %3,%1\n\t" "cas%.l %0,%1,%2\n\t"
"cas%.l %0,%1,%2\n\t" "jne 1b"
"jne 1b" : "=d" (__result), "=&d" (__temp), "=m" (*__mem)
: "=d" (__result), "=&d" (__temp), "=m" (*__mem) : "d" (__val), "0" (__result), "m" (*__mem));
: "d" (__val), "0" (__result), "m" (*__mem)); return __result;
return __result; }
}
#elif defined(__rtems__) #elif defined(__rtems__)
/* // TAS/JBNE is unsafe on systems with strict priority-based scheduling.
* TAS/JBNE is unsafe on systems with strict priority-based scheduling. // Disable interrupts, which we can do only from supervisor mode.
* Disable interrupts, which we can do only from supervisor mode. _Atomic_word
*/ __attribute__ ((__unused__))
static inline _Atomic_word __exchange_and_add(volatile _Atomic_word* __mem, int __val)
__attribute__ ((__unused__))
__exchange_and_add(volatile _Atomic_word* __mem, int __val)
{
_Atomic_word __result;
short __level, __tmpsr;
__asm__ __volatile__ ("move%.w %%sr,%0\n\tor%.l %0,%1\n\tmove%.w %1,%%sr"
: "=d"(__level), "=d"(__tmpsr) : "1"(0x700));
__result = *__mem;
*__mem = __result + __val;
__asm__ __volatile__ ("move%.w %0,%%sr" : : "d"(__level));
return __result;
}
#else
template<int __inst>
struct __Atomicity_lock
{ {
static volatile unsigned char _S_atomicity_lock; _Atomic_word __result;
}; short __level, __tmpsr;
__asm__ __volatile__ ("move%.w %%sr,%0\n\tor%.l %0,%1\n\tmove%.w %1,%%sr"
: "=d"(__level), "=d"(__tmpsr) : "1"(0x700));
__result = *__mem;
*__mem = __result + __val;
__asm__ __volatile__ ("move%.w %0,%%sr" : : "d"(__level));
return __result;
}
template<int __inst>
volatile unsigned char __Atomicity_lock<__inst>::_S_atomicity_lock = 0;
template volatile unsigned char __Atomicity_lock<0>::_S_atomicity_lock;
static inline _Atomic_word
__attribute__ ((__unused__))
__exchange_and_add(volatile _Atomic_word* __mem, int __val)
{
_Atomic_word __result;
// bset with no immediate addressing (not SMP-safe)
#if defined(__mcf5200__) || defined(__mcf5300__)
__asm__ __volatile__("1: bset.b #7,%0@\n\tjbne 1b"
: /* no outputs */
: "a"(&__Atomicity_lock<0>::_S_atomicity_lock)
: "cc", "memory");
// CPU32 and MCF5400 support test-and-set (SMP-safe).
#elif defined(__mcpu32__) || defined(__mcf5400__)
__asm__ __volatile__("1: tas %0\n\tjbne 1b"
: "+m"(__Atomicity_lock<0>::_S_atomicity_lock)
: /* none */
: "cc");
// Use bset with immediate addressing for 68000/68010 (not SMP-safe)
// NOTE: TAS is available on the 68000, but unsupported by some Amiga
// memory controllers.
#else #else
__asm__ __volatile__("1: bset.b #7,%0\n\tjbne 1b"
: "+m"(__Atomicity_lock<0>::_S_atomicity_lock) template<int __inst>
: /* none */ struct __Atomicity_lock
: "cc"); {
static volatile unsigned char _S_atomicity_lock;
};
template<int __inst>
volatile unsigned char __Atomicity_lock<__inst>::_S_atomicity_lock = 0;
template volatile unsigned char __Atomicity_lock<0>::_S_atomicity_lock;
_Atomic_word
__attribute__ ((__unused__))
__exchange_and_add(volatile _Atomic_word* __mem, int __val)
{
_Atomic_word __result;
// bset with no immediate addressing (not SMP-safe)
#if defined(__mcf5200__) || defined(__mcf5300__)
__asm__ __volatile__("1: bset.b #7,%0@\n\tjbne 1b"
: /* no outputs */
: "a"(&__Atomicity_lock<0>::_S_atomicity_lock)
: "cc", "memory");
// CPU32 and MCF5400 support test-and-set (SMP-safe).
#elif defined(__mcpu32__) || defined(__mcf5400__)
__asm__ __volatile__("1: tas %0\n\tjbne 1b"
: "+m"(__Atomicity_lock<0>::_S_atomicity_lock)
: /* none */
: "cc");
// Use bset with immediate addressing for 68000/68010 (not SMP-safe)
// NOTE: TAS is available on the 68000, but unsupported by some Amiga
// memory controllers.
#else
__asm__ __volatile__("1: bset.b #7,%0\n\tjbne 1b"
: "+m"(__Atomicity_lock<0>::_S_atomicity_lock)
: /* none */
: "cc");
#endif #endif
__result = *__mem; __result = *__mem;
*__mem = __result + __val; *__mem = __result + __val;
__Atomicity_lock<0>::_S_atomicity_lock = 0; __Atomicity_lock<0>::_S_atomicity_lock = 0;
return __result; return __result;
} }
#endif /* TAS / BSET */ #endif /* TAS / BSET */
static inline void void
__attribute__ ((__unused__)) __attribute__ ((__unused__))
__atomic_add(volatile _Atomic_word* __mem, int __val) __atomic_add(volatile _Atomic_word* __mem, int __val)
{ {
// Careful: using add.l with a memory destination is not // Careful: using add.l with a memory destination is not
// architecturally guaranteed to be atomic. // architecturally guaranteed to be atomic.
(void) __exchange_and_add(__mem, __val); __exchange_and_add(__mem, __val);
} }
} // namespace __gnu_cxx
#endif /* !_GLIBCXX_ATOMICITY_H */

View File

@ -1,6 +1,6 @@
// Low-level functions for atomic operations. // Low-level functions for atomic operations: MIPS version -*- C++ -*-
// Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc. // Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
// //
// This file is part of the GNU ISO C++ Library. This library is free // 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 // software; you can redistribute it and/or modify it under the
@ -27,57 +27,55 @@
// invalidate any other reasons why the executable file might be covered by // invalidate any other reasons why the executable file might be covered by
// the GNU General Public License. // the GNU General Public License.
#ifndef _GLIBCXX_ATOMICITY_H #include <bits/atomicity.h>
#define _GLIBCXX_ATOMICITY_H 1
typedef int _Atomic_word; namespace __gnu_cxx
static inline int
__attribute__ ((__unused__))
__exchange_and_add(volatile _Atomic_word* __mem, int __val)
{ {
int __result, __tmp; _Atomic_word
__attribute__ ((__unused__))
__asm__ __volatile__ __exchange_and_add(volatile _Atomic_word* __mem, int __val)
("/* Inline exchange & add */\n\t" {
"1:\n\t" _Atomic_word __result, __tmp;
".set push\n\t"
__asm__ __volatile__
("/* Inline exchange & add */\n\t"
"1:\n\t"
".set push\n\t"
#if _MIPS_SIM == _ABIO32 #if _MIPS_SIM == _ABIO32
".set mips2\n\t" ".set mips2\n\t"
#endif #endif
"ll %0,%3\n\t" "ll %0,%3\n\t"
"addu %1,%4,%0\n\t" "addu %1,%4,%0\n\t"
"sc %1,%2\n\t" "sc %1,%2\n\t"
".set pop\n\t" ".set pop\n\t"
"beqz %1,1b\n\t" "beqz %1,1b\n\t"
"/* End exchange & add */" "/* End exchange & add */"
: "=&r"(__result), "=&r"(__tmp), "=m"(*__mem) : "=&r"(__result), "=&r"(__tmp), "=m"(*__mem)
: "m" (*__mem), "r"(__val)); : "m" (*__mem), "r"(__val));
return __result; return __result;
} }
static inline void void
__attribute__ ((__unused__)) __attribute__ ((__unused__))
__atomic_add(volatile _Atomic_word* __mem, int __val) __atomic_add(volatile _Atomic_word* __mem, int __val)
{ {
int __result; _Atomic_word __result;
__asm__ __volatile__ __asm__ __volatile__
("/* Inline atomic add */\n\t" ("/* Inline atomic add */\n\t"
"1:\n\t" "1:\n\t"
".set push\n\t" ".set push\n\t"
#if _MIPS_SIM == _ABIO32 #if _MIPS_SIM == _ABIO32
".set mips2\n\t" ".set mips2\n\t"
#endif #endif
"ll %0,%2\n\t" "ll %0,%2\n\t"
"addu %0,%3,%0\n\t" "addu %0,%3,%0\n\t"
"sc %0,%1\n\t" "sc %0,%1\n\t"
".set pop\n\t" ".set pop\n\t"
"beqz %0,1b\n\t" "beqz %0,1b\n\t"
"/* End atomic add */" "/* End atomic add */"
: "=&r"(__result), "=m"(*__mem) : "=&r"(__result), "=m"(*__mem)
: "m" (*__mem), "r"(__val)); : "m" (*__mem), "r"(__val));
} }
} // namespace __gnu_cxx
#endif /* atomicity.h */

View File

@ -1,6 +1,6 @@
// Low-level functions for atomic operations: PowerPC version -*- C++ -*- // Low-level functions for atomic operations: PowerPC version -*- C++ -*-
// Copyright (C) 1999, 2000, 2001, 2003 Free Software Foundation, Inc. // Copyright (C) 1999, 2000, 2001, 2003, 2004 Free Software Foundation, Inc.
// //
// This file is part of the GNU ISO C++ Library. This library is free // 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 // software; you can redistribute it and/or modify it under the
@ -27,8 +27,7 @@
// invalidate any other reasons why the executable file might be covered by // invalidate any other reasons why the executable file might be covered by
// the GNU General Public License. // the GNU General Public License.
#ifndef _GLIBCXX_ATOMICITY_H #include <bits/atomicity.h>
#define _GLIBCXX_ATOMICITY_H 1
#ifdef __PPC405__ #ifdef __PPC405__
#define _STWCX "sync \n\tstwcx. " #define _STWCX "sync \n\tstwcx. "
@ -36,43 +35,42 @@
#define _STWCX "stwcx. " #define _STWCX "stwcx. "
#endif #endif
typedef int _Atomic_word; namespace __gnu_cxx
static inline _Atomic_word
__attribute__ ((__unused__))
__exchange_and_add(volatile _Atomic_word* __mem, int __val)
{ {
_Atomic_word __tmp, __res; _Atomic_word
__asm__ __volatile__ ( __attribute__ ((__unused__))
"/* Inline exchange & add */\n" __exchange_and_add(volatile _Atomic_word* __mem, int __val)
"0:\t" {
"lwarx %0,0,%3 \n\t" _Atomic_word __tmp, __res;
"add%I4 %1,%0,%4 \n\t" __asm__ __volatile__ (
_STWCX " %1,0,%3 \n\t" "/* Inline exchange & add */\n"
"bne- 0b \n\t" "0:\t"
"/* End exchange & add */" "lwarx %0,0,%3 \n\t"
: "=&b"(__res), "=&r"(__tmp), "=m" (*__mem) "add%I4 %1,%0,%4 \n\t"
: "r" (__mem), "Ir"(__val), "m" (*__mem) _STWCX " %1,0,%3 \n\t"
: "cr0"); "bne- 0b \n\t"
return __res; "/* End exchange & add */"
} : "=&b"(__res), "=&r"(__tmp), "=m" (*__mem)
: "r" (__mem), "Ir"(__val), "m" (*__mem)
static inline void : "cr0");
__attribute__ ((__unused__)) return __res;
__atomic_add(volatile _Atomic_word* __mem, int __val) }
{
_Atomic_word __tmp; void
__asm__ __volatile__ ( __attribute__ ((__unused__))
"/* Inline atomic add */\n" __atomic_add(volatile _Atomic_word* __mem, int __val)
"0:\t" {
"lwarx %0,0,%2 \n\t" _Atomic_word __tmp;
"add%I3 %0,%0,%3 \n\t" __asm__ __volatile__ (
_STWCX " %0,0,%2 \n\t" "/* Inline atomic add */\n"
"bne- 0b \n\t" "0:\t"
"/* End atomic add */" "lwarx %0,0,%2 \n\t"
: "=&b"(__tmp), "=m" (*__mem) "add%I3 %0,%0,%3 \n\t"
: "r" (__mem), "Ir"(__val), "m" (*__mem) _STWCX " %0,0,%2 \n\t"
: "cr0"); "bne- 0b \n\t"
} "/* End atomic add */"
: "=&b"(__tmp), "=m" (*__mem)
#endif /* atomicity.h */ : "r" (__mem), "Ir"(__val), "m" (*__mem)
: "cr0");
}
} // namespace __gnu_cxx

View File

@ -1,6 +1,6 @@
// Low-level functions for atomic operations: S/390 version -*- C++ -*- // Low-level functions for atomic operations: S/390 version -*- C++ -*-
// Copyright (C) 2001, 2003 Free Software Foundation, Inc. // Copyright (C) 2001, 2003, 2004 Free Software Foundation, Inc.
// //
// This file is part of the GNU ISO C++ Library. This library is free // 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 // software; you can redistribute it and/or modify it under the
@ -27,34 +27,28 @@
// invalidate any other reasons why the executable file might be covered by // invalidate any other reasons why the executable file might be covered by
// the GNU General Public License. // the GNU General Public License.
#ifndef _GLIBCXX_ATOMICITY_H #include <bits/atomicity.h>
#define _GLIBCXX_ATOMICITY_H 1
typedef int _Atomic_word; namespace __gnu_cxx
static inline _Atomic_word
__attribute__ ((__unused__))
__exchange_and_add(volatile _Atomic_word* __mem, int __val)
{ {
register _Atomic_word __old_val, __new_val; _Atomic_word
__attribute__ ((__unused__))
__asm__ __volatile__ (" l %0,0(%3)\n" __exchange_and_add(volatile _Atomic_word* __mem, int __val)
"0: lr %1,%0\n" {
" ar %1,%4\n" register _Atomic_word __old_val, __new_val;
" cs %0,%1,0(%3)\n"
" jl 0b" __asm__ __volatile__ (" l %0,0(%3)\n"
: "=&d" (__old_val), "=&d" (__new_val), "=m" (*__mem) "0: lr %1,%0\n"
: "a" (__mem), "d" (__val), "m" (*__mem) : "cc"); " ar %1,%4\n"
return __old_val; " cs %0,%1,0(%3)\n"
} " jl 0b"
: "=&d" (__old_val), "=&d" (__new_val), "=m" (*__mem)
static inline void : "a" (__mem), "d" (__val), "m" (*__mem) : "cc");
__attribute__ ((__unused__)) return __old_val;
__atomic_add(volatile _Atomic_word* __mem, int __val) }
{
__exchange_and_add(__mem, __val); void
} __attribute__ ((__unused__))
__atomic_add(volatile _Atomic_word* __mem, int __val)
#endif /* atomicity.h */ { __exchange_and_add(__mem, __val); }
} // namespace __gnu_cxx

View File

@ -0,0 +1,39 @@
// Low-level type for atomic operations -*- C++ -*-
// Copyright (C) 2004 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 2, 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 COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
// As a special exception, you may use this file as part of a free software
// library without restriction. Specifically, if other files instantiate
// templates or use macros or inline functions from this file, or you compile
// this file and link it with other files to produce an executable, this
// file does not by itself cause the resulting executable to be covered by
// the GNU General Public License. This exception does not however
// invalidate any other reasons why the executable file might be covered by
// the GNU General Public License.
#ifndef _GLIBCXX_ATOMIC_WORD_H
#define _GLIBCXX_ATOMIC_WORD_H 1
#ifdef __arch64__
typedef long _Atomic_word;
#else
typedef int _Atomic_word;
#endif
#endif

View File

@ -1,6 +1,6 @@
// Low-level functions for atomic operations: Sparc version -*- C++ -*- // Low-level functions for atomic operations: Sparc version -*- C++ -*-
// Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation, Inc. // Copyright (C) 1999, 2000, 2001, 2002, 2004 Free Software Foundation, Inc.
// //
// This file is part of the GNU ISO C++ Library. This library is free // 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 // software; you can redistribute it and/or modify it under the
@ -27,105 +27,99 @@
// invalidate any other reasons why the executable file might be covered by // invalidate any other reasons why the executable file might be covered by
// the GNU General Public License. // the GNU General Public License.
#ifndef _GLIBCXX_ATOMICITY_H #include <bits/atomicity.h>
#define _GLIBCXX_ATOMICITY_H 1
namespace __gnu_cxx
{
#ifdef __arch64__ #ifdef __arch64__
_Atomic_word
__attribute__ ((__unused__))
__exchange_and_add(volatile _Atomic_word* __mem, int __val)
{
_Atomic_word __tmp1, __tmp2;
_Atomic_word __val_extended = __val;
typedef long _Atomic_word; __asm__ __volatile__("1: ldx [%3], %0\n\t"
" add %0, %4, %1\n\t"
static inline _Atomic_word " casx [%3], %0, %1\n\t"
__attribute__ ((__unused__)) " sub %0, %1, %0\n\t"
__exchange_and_add(volatile _Atomic_word* __mem, int __val) " brnz,pn %0, 1b\n\t"
{ " nop"
_Atomic_word __tmp1, __tmp2; : "=&r" (__tmp1), "=&r" (__tmp2), "=m" (*__mem)
_Atomic_word __val_extended = __val; : "r" (__mem), "r" (__val_extended), "m" (*__mem));
return __tmp2;
__asm__ __volatile__("1: ldx [%3], %0\n\t" }
" add %0, %4, %1\n\t"
" casx [%3], %0, %1\n\t" void
" sub %0, %1, %0\n\t" __attribute__ ((__unused__))
" brnz,pn %0, 1b\n\t" __atomic_add(volatile _Atomic_word* __mem, int __val)
" nop" {
: "=&r" (__tmp1), "=&r" (__tmp2), "=m" (*__mem) _Atomic_word __tmp1, __tmp2;
: "r" (__mem), "r" (__val_extended), "m" (*__mem)); _Atomic_word __val_extended = __val;
return __tmp2;
} __asm__ __volatile__("1: ldx [%3], %0\n\t"
" add %0, %4, %1\n\t"
static inline void " casx [%3], %0, %1\n\t"
__attribute__ ((__unused__)) " sub %0, %1, %0\n\t"
__atomic_add(volatile _Atomic_word* __mem, int __val) " brnz,pn %0, 1b\n\t"
{ " nop"
_Atomic_word __tmp1, __tmp2; : "=&r" (__tmp1), "=&r" (__tmp2), "=m" (*__mem)
_Atomic_word __val_extended = __val; : "r" (__mem), "r" (__val_extended), "m" (*__mem));
}
__asm__ __volatile__("1: ldx [%3], %0\n\t"
" add %0, %4, %1\n\t"
" casx [%3], %0, %1\n\t"
" sub %0, %1, %0\n\t"
" brnz,pn %0, 1b\n\t"
" nop"
: "=&r" (__tmp1), "=&r" (__tmp2), "=m" (*__mem)
: "r" (__mem), "r" (__val_extended), "m" (*__mem));
}
#else /* __arch32__ */ #else /* __arch32__ */
typedef int _Atomic_word; template<int __inst>
struct __Atomicity_lock
{
static unsigned char _S_atomicity_lock;
};
template<int __inst> template<int __inst>
struct __Atomicity_lock unsigned char __Atomicity_lock<__inst>::_S_atomicity_lock = 0;
template unsigned char __Atomicity_lock<0>::_S_atomicity_lock;
_Atomic_word
__attribute__ ((__unused__))
__exchange_and_add(volatile _Atomic_word* __mem, int __val)
{ {
static unsigned char _S_atomicity_lock; _Atomic_word __result, __tmp;
};
__asm__ __volatile__("1: ldstub [%1], %0\n\t"
template<int __inst> " cmp %0, 0\n\t"
unsigned char __Atomicity_lock<__inst>::_S_atomicity_lock = 0; " bne 1b\n\t"
" nop"
template unsigned char __Atomicity_lock<0>::_S_atomicity_lock; : "=&r" (__tmp)
: "r" (&__Atomicity_lock<0>::_S_atomicity_lock)
static int : "memory");
__attribute__ ((__unused__)) __result = *__mem;
__exchange_and_add(volatile _Atomic_word* __mem, int __val) *__mem += __val;
{ __asm__ __volatile__("stb %%g0, [%0]"
_Atomic_word __result, __tmp; : /* no outputs */
: "r" (&__Atomicity_lock<0>::_S_atomicity_lock)
__asm__ __volatile__("1: ldstub [%1], %0\n\t" : "memory");
" cmp %0, 0\n\t" return __result;
" bne 1b\n\t" }
" nop"
: "=&r" (__tmp) void
: "r" (&__Atomicity_lock<0>::_S_atomicity_lock) __attribute__ ((__unused__))
: "memory"); __atomic_add(volatile _Atomic_word* __mem, int __val)
__result = *__mem; {
*__mem += __val; _Atomic_word __tmp;
__asm__ __volatile__("stb %%g0, [%0]"
: /* no outputs */ __asm__ __volatile__("1: ldstub [%1], %0\n\t"
: "r" (&__Atomicity_lock<0>::_S_atomicity_lock) " cmp %0, 0\n\t"
: "memory"); " bne 1b\n\t"
return __result; " nop"
} : "=&r" (__tmp)
: "r" (&__Atomicity_lock<0>::_S_atomicity_lock)
static void : "memory");
__attribute__ ((__unused__)) *__mem += __val;
__atomic_add(volatile _Atomic_word* __mem, int __val) __asm__ __volatile__("stb %%g0, [%0]"
{ : /* no outputs */
_Atomic_word __tmp; : "r" (&__Atomicity_lock<0>::_S_atomicity_lock)
: "memory");
__asm__ __volatile__("1: ldstub [%1], %0\n\t" }
" cmp %0, 0\n\t"
" bne 1b\n\t"
" nop"
: "=&r" (__tmp)
: "r" (&__Atomicity_lock<0>::_S_atomicity_lock)
: "memory");
*__mem += __val;
__asm__ __volatile__("stb %%g0, [%0]"
: /* no outputs */
: "r" (&__Atomicity_lock<0>::_S_atomicity_lock)
: "memory");
}
#endif /* __arch32__ */ #endif /* __arch32__ */
} // namespace __gnu_cxx
#endif /* atomicity.h */

View File

@ -214,10 +214,10 @@ GLIBCXX_3.4 {
# __gnu_cxx::stdio_sync_filebuf # __gnu_cxx::stdio_sync_filebuf
_ZTVN9__gnu_cxx18stdio_sync_filebufI[cw]St11char_traitsI[cw]EEE; _ZTVN9__gnu_cxx18stdio_sync_filebufI[cw]St11char_traitsI[cw]EEE;
# Needed only when generic cpu's atomicity.h is in use. # __gnu_cxx::__atomic_add
_ZN9__gnu_cxx17_Atomic_add_mutexE; # __gnu_cxx::__exchange_and_add
_ZN9__gnu_cxx22_Atomic_add_mutex_onceE; _ZN9__gnu_cxx12__atomic_addEPVii;
_ZN9__gnu_cxx31__gthread_atomic_add_mutex_onceEv; _ZN9__gnu_cxx18__exchange_and_addEPVii;
# DO NOT DELETE THIS LINE. Port-specific symbols, if any, will be here. # DO NOT DELETE THIS LINE. Port-specific symbols, if any, will be here.

View File

@ -308,7 +308,7 @@ ac_includes_default="\
# include <unistd.h> # include <unistd.h>
#endif" #endif"
ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS libtool_VERSION multi_basedir build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO AMTAR install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM AWK SET_MAKE am__leading_dot glibcxx_builddir glibcxx_srcdir toplevel_srcdir CC ac_ct_CC EXEEXT OBJEXT CXX ac_ct_CXX CFLAGS CXXFLAGS LN_S AS ac_ct_AS AR ac_ct_AR RANLIB ac_ct_RANLIB MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT LIBTOOL CXXCPP CPPFLAGS enable_shared enable_static GLIBCXX_HOSTED_TRUE GLIBCXX_HOSTED_FALSE GLIBCXX_BUILD_PCH_TRUE GLIBCXX_BUILD_PCH_FALSE glibcxx_PCHFLAGS CSTDIO_H BASIC_FILE_H BASIC_FILE_CC CPP EGREP check_msgfmt glibcxx_MOFILES glibcxx_POFILES glibcxx_localedir USE_NLS CLOCALE_H CCODECVT_H CMESSAGES_H CCODECVT_CC CCOLLATE_CC CCTYPE_CC CMESSAGES_CC CMONEY_CC CNUMERIC_CC CTIME_H CTIME_CC CLOCALE_CC CLOCALE_INTERNAL_H C_INCLUDE_DIR GLIBCXX_C_HEADERS_C_TRUE GLIBCXX_C_HEADERS_C_FALSE GLIBCXX_C_HEADERS_C_STD_TRUE GLIBCXX_C_HEADERS_C_STD_FALSE GLIBCXX_C_HEADERS_COMPATIBILITY_TRUE GLIBCXX_C_HEADERS_COMPATIBILITY_FALSE glibcxx_thread_h DEBUG_FLAGS GLIBCXX_BUILD_DEBUG_TRUE GLIBCXX_BUILD_DEBUG_FALSE EXTRA_CXX_FLAGS WERROR SECTION_FLAGS SECTION_LDFLAGS OPT_LDFLAGS LIBMATHOBJS SYMVER_MAP port_specific_symbol_files GLIBCXX_BUILD_VERSIONED_SHLIB_TRUE GLIBCXX_BUILD_VERSIONED_SHLIB_FALSE baseline_dir GLIBCXX_TEST_WCHAR_T_TRUE GLIBCXX_TEST_WCHAR_T_FALSE GLIBCXX_TEST_ABI_TRUE GLIBCXX_TEST_ABI_FALSE ATOMICITY_INC_SRCDIR OS_INC_SRCDIR glibcxx_prefixdir gxx_include_dir glibcxx_toolexecdir glibcxx_toolexeclibdir GLIBCXX_INCLUDES TOPLEVEL_INCLUDES OPTIMIZE_CXXFLAGS WARN_FLAGS LIBSUPCXX_PICFLAGS LIBOBJS LTLIBOBJS' ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS libtool_VERSION multi_basedir build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO AMTAR install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM AWK SET_MAKE am__leading_dot glibcxx_builddir glibcxx_srcdir toplevel_srcdir CC ac_ct_CC EXEEXT OBJEXT CXX ac_ct_CXX CFLAGS CXXFLAGS LN_S AS ac_ct_AS AR ac_ct_AR RANLIB ac_ct_RANLIB MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT LIBTOOL CXXCPP CPPFLAGS enable_shared enable_static GLIBCXX_HOSTED_TRUE GLIBCXX_HOSTED_FALSE GLIBCXX_BUILD_PCH_TRUE GLIBCXX_BUILD_PCH_FALSE glibcxx_PCHFLAGS CSTDIO_H BASIC_FILE_H BASIC_FILE_CC CPP EGREP check_msgfmt glibcxx_MOFILES glibcxx_POFILES glibcxx_localedir USE_NLS CLOCALE_H CCODECVT_H CMESSAGES_H CCODECVT_CC CCOLLATE_CC CCTYPE_CC CMESSAGES_CC CMONEY_CC CNUMERIC_CC CTIME_H CTIME_CC CLOCALE_CC CLOCALE_INTERNAL_H C_INCLUDE_DIR GLIBCXX_C_HEADERS_C_TRUE GLIBCXX_C_HEADERS_C_FALSE GLIBCXX_C_HEADERS_C_STD_TRUE GLIBCXX_C_HEADERS_C_STD_FALSE GLIBCXX_C_HEADERS_COMPATIBILITY_TRUE GLIBCXX_C_HEADERS_COMPATIBILITY_FALSE glibcxx_thread_h DEBUG_FLAGS GLIBCXX_BUILD_DEBUG_TRUE GLIBCXX_BUILD_DEBUG_FALSE EXTRA_CXX_FLAGS WERROR SECTION_FLAGS SECTION_LDFLAGS OPT_LDFLAGS LIBMATHOBJS SYMVER_MAP port_specific_symbol_files GLIBCXX_BUILD_VERSIONED_SHLIB_TRUE GLIBCXX_BUILD_VERSIONED_SHLIB_FALSE baseline_dir GLIBCXX_TEST_WCHAR_T_TRUE GLIBCXX_TEST_WCHAR_T_FALSE GLIBCXX_TEST_ABI_TRUE GLIBCXX_TEST_ABI_FALSE ATOMICITY_SRCDIR ATOMIC_WORD_SRCDIR OS_INC_SRCDIR glibcxx_prefixdir gxx_include_dir glibcxx_toolexecdir glibcxx_toolexeclibdir GLIBCXX_INCLUDES TOPLEVEL_INCLUDES OPTIMIZE_CXXFLAGS WARN_FLAGS LIBSUPCXX_PICFLAGS LIBOBJS LTLIBOBJS'
ac_subst_files='' ac_subst_files=''
# Initialize some variables set by options. # Initialize some variables set by options.
@ -7439,7 +7439,7 @@ echo "${ECHO_T}$EXTRA_CXX_FLAGS" >&6
# No surprises, no surprises... # No surprises, no surprises...
if test $atomicity_include_dir = cpu/generic ; then if test $atomicity_dir = cpu/generic ; then
{ echo "$as_me:$LINENO: WARNING: No native atomic operations are provided for this platform." >&5 { echo "$as_me:$LINENO: WARNING: No native atomic operations are provided for this platform." >&5
echo "$as_me: WARNING: No native atomic operations are provided for this platform." >&2;} echo "$as_me: WARNING: No native atomic operations are provided for this platform." >&2;}
if test $target_thread_file = single; then if test $target_thread_file = single; then
@ -64090,11 +64090,13 @@ done
# Propagate the target-specific source directories through the build chain. # Propagate the target-specific source directories through the build chain.
# (Nothing currently uses cpu_include_dir directly; only atomicity_include_dir # (Nothing currently uses cpu_include_dir directly; only atomicity_include_dir
# uses it, and it only gets used in this file.) # uses it, and it only gets used in this file.)
ATOMICITY_INC_SRCDIR=config/${atomicity_include_dir} ATOMICITY_SRCDIR=config/${atomicity_dir}
ATOMIC_WORD_SRCDIR=config/${atomic_word_dir}
OS_INC_SRCDIR=config/${os_include_dir} OS_INC_SRCDIR=config/${os_include_dir}
# Determine cross-compile flags and AM_CONDITIONALs. # Determine cross-compile flags and AM_CONDITIONALs.
#AC_SUBST(GLIBCXX_IS_NATIVE) #AC_SUBST(GLIBCXX_IS_NATIVE)
#AM_CONDITIONAL(CANADIAN, test $CANADIAN = yes) #AM_CONDITIONAL(CANADIAN, test $CANADIAN = yes)
@ -65233,7 +65235,8 @@ s,@GLIBCXX_TEST_WCHAR_T_TRUE@,$GLIBCXX_TEST_WCHAR_T_TRUE,;t t
s,@GLIBCXX_TEST_WCHAR_T_FALSE@,$GLIBCXX_TEST_WCHAR_T_FALSE,;t t s,@GLIBCXX_TEST_WCHAR_T_FALSE@,$GLIBCXX_TEST_WCHAR_T_FALSE,;t t
s,@GLIBCXX_TEST_ABI_TRUE@,$GLIBCXX_TEST_ABI_TRUE,;t t s,@GLIBCXX_TEST_ABI_TRUE@,$GLIBCXX_TEST_ABI_TRUE,;t t
s,@GLIBCXX_TEST_ABI_FALSE@,$GLIBCXX_TEST_ABI_FALSE,;t t s,@GLIBCXX_TEST_ABI_FALSE@,$GLIBCXX_TEST_ABI_FALSE,;t t
s,@ATOMICITY_INC_SRCDIR@,$ATOMICITY_INC_SRCDIR,;t t s,@ATOMICITY_SRCDIR@,$ATOMICITY_SRCDIR,;t t
s,@ATOMIC_WORD_SRCDIR@,$ATOMIC_WORD_SRCDIR,;t t
s,@OS_INC_SRCDIR@,$OS_INC_SRCDIR,;t t s,@OS_INC_SRCDIR@,$OS_INC_SRCDIR,;t t
s,@glibcxx_prefixdir@,$glibcxx_prefixdir,;t t s,@glibcxx_prefixdir@,$glibcxx_prefixdir,;t t
s,@gxx_include_dir@,$gxx_include_dir,;t t s,@gxx_include_dir@,$gxx_include_dir,;t t

View File

@ -95,7 +95,7 @@ GLIBCXX_ENABLE_DEBUG([no])
GLIBCXX_ENABLE_CXX_FLAGS GLIBCXX_ENABLE_CXX_FLAGS
# No surprises, no surprises... # No surprises, no surprises...
if test $atomicity_include_dir = cpu/generic ; then if test $atomicity_dir = cpu/generic ; then
AC_MSG_WARN([No native atomic operations are provided for this platform.]) AC_MSG_WARN([No native atomic operations are provided for this platform.])
if test $target_thread_file = single; then if test $target_thread_file = single; then
AC_MSG_WARN([They cannot be faked when thread support is disabled.]) AC_MSG_WARN([They cannot be faked when thread support is disabled.])
@ -268,9 +268,11 @@ GLIBCXX_CONFIGURE_TESTSUITE
# Propagate the target-specific source directories through the build chain. # Propagate the target-specific source directories through the build chain.
# (Nothing currently uses cpu_include_dir directly; only atomicity_include_dir # (Nothing currently uses cpu_include_dir directly; only atomicity_include_dir
# uses it, and it only gets used in this file.) # uses it, and it only gets used in this file.)
ATOMICITY_INC_SRCDIR=config/${atomicity_include_dir} ATOMICITY_SRCDIR=config/${atomicity_dir}
ATOMIC_WORD_SRCDIR=config/${atomic_word_dir}
OS_INC_SRCDIR=config/${os_include_dir} OS_INC_SRCDIR=config/${os_include_dir}
AC_SUBST(ATOMICITY_INC_SRCDIR) AC_SUBST(ATOMICITY_SRCDIR)
AC_SUBST(ATOMIC_WORD_SRCDIR)
AC_SUBST(OS_INC_SRCDIR) AC_SUBST(OS_INC_SRCDIR)
# Determine cross-compile flags and AM_CONDITIONALs. # Determine cross-compile flags and AM_CONDITIONALs.

View File

@ -30,9 +30,12 @@
# abi_baseline_pair directory name for ABI compat testing, # abi_baseline_pair directory name for ABI compat testing,
# defaults to host_cpu-host_os (as per config.guess) # defaults to host_cpu-host_os (as per config.guess)
# #
# atomicity_include_dir location of atomicity.h, # atomicity_dir location of atomicity.h,
# defaults to cpu_include_dir # defaults to cpu_include_dir
# #
# atomic_word_dir location of atomic_word.h
# defaults to generic.
#
# It possibly modifies the following variables: # It possibly modifies the following variables:
# #
# OPT_LDFLAGS extra flags to pass when linking the library, of # OPT_LDFLAGS extra flags to pass when linking the library, of
@ -57,6 +60,7 @@
# systems out there. :-) # systems out there. :-)
c_model=c_std c_model=c_std
c_compatibility=no c_compatibility=no
atomic_word_dir=cpu/generic
# HOST-SPECIFIC OVERRIDES # HOST-SPECIFIC OVERRIDES
# Set any CPU-dependent bits. # Set any CPU-dependent bits.
@ -102,11 +106,22 @@ case "${host_cpu}" in
;; ;;
esac esac
# Set specific CPU overrides for atomic_word_dir. Most can just use generic.
# THIS TABLE IS SORTED. KEEP IT THAT WAY.
case "${host_cpu}" in
cris*)
atomic_word_dir=cpu/cris
;;
sparc* | ultrasparc)
atomic_word_dir=cpu/sparc
;;
esac
# Now look for the file(s) usually tied to a CPU model, and make # Now look for the file(s) usually tied to a CPU model, and make
# default choices for those if they haven't been explicitly set # default choices for those if they haven't been explicitly set
# already. # already.
cpu_include_dir="cpu/${try_cpu}" cpu_include_dir="cpu/${try_cpu}"
atomicity_include_dir=$cpu_include_dir atomicity_dir=$cpu_include_dir
abi_baseline_pair=${try_cpu}-${host_os} abi_baseline_pair=${try_cpu}-${host_os}
@ -122,16 +137,16 @@ case "${host_os}" in
# os/aix/atomicity.h works on earlier versions of AIX 4.*, so we # os/aix/atomicity.h works on earlier versions of AIX 4.*, so we
# explicitly duplicate the directory for 4.[<3]. # explicitly duplicate the directory for 4.[<3].
os_include_dir="os/aix" os_include_dir="os/aix"
atomicity_include_dir="os/aix" atomicity_dir="os/aix"
OPT_LDFLAGS="-Wl,-G" OPT_LDFLAGS="-Wl,-G"
;; ;;
aix4.*) aix4.*)
os_include_dir="os/generic" os_include_dir="os/generic"
atomicity_include_dir="os/aix" atomicity_dir="os/aix"
;; ;;
aix*) aix*)
os_include_dir="os/generic" os_include_dir="os/generic"
atomicity_include_dir="cpu/generic" atomicity_dir="cpu/generic"
;; ;;
bsd*) bsd*)
# Plain BSD attempts to share FreeBSD files. # Plain BSD attempts to share FreeBSD files.
@ -155,11 +170,11 @@ case "${host_os}" in
irix[1-6] | irix[1-5].* | irix6.[0-4]*) irix[1-6] | irix[1-5].* | irix6.[0-4]*)
# This is known to work on at least IRIX 5.2 and 6.3. # This is known to work on at least IRIX 5.2 and 6.3.
os_include_dir="os/irix/irix5.2" os_include_dir="os/irix/irix5.2"
atomicity_include_dir=$os_include_dir atomicity_dir=$os_include_dir
;; ;;
irix6.5*) irix6.5*)
os_include_dir="os/irix/irix6.5" os_include_dir="os/irix/irix6.5"
atomicity_include_dir=$os_include_dir atomicity_dir=$os_include_dir
;; ;;
mingw32*) mingw32*)
os_include_dir="os/mingw32" os_include_dir="os/mingw32"
@ -205,7 +220,7 @@ esac
# THIS TABLE IS SORTED. KEEP IT THAT WAY. # THIS TABLE IS SORTED. KEEP IT THAT WAY.
case "${host}" in case "${host}" in
mips*-*-linux*) mips*-*-linux*)
atomicity_include_dir="cpu/mips" atomicity_dir="cpu/mips"
;; ;;
x86_64-*-linux*) x86_64-*-linux*)
abi_baseline_pair="x86_64-linux-gnu" abi_baseline_pair="x86_64-linux-gnu"

View File

@ -92,6 +92,7 @@ bits_srcdir = ${glibcxx_srcdir}/include/bits
bits_builddir = ./bits bits_builddir = ./bits
bits_headers = \ bits_headers = \
${bits_srcdir}/allocator.h \ ${bits_srcdir}/allocator.h \
${bits_srcdir}/atomicity.h \
${bits_srcdir}/basic_ios.h \ ${bits_srcdir}/basic_ios.h \
${bits_srcdir}/basic_ios.tcc \ ${bits_srcdir}/basic_ios.tcc \
${bits_srcdir}/basic_string.h \ ${bits_srcdir}/basic_string.h \
@ -339,7 +340,7 @@ host_headers = \
${host_srcdir}/ctype_inline.h \ ${host_srcdir}/ctype_inline.h \
${host_srcdir}/ctype_noninline.h \ ${host_srcdir}/ctype_noninline.h \
${host_srcdir}/os_defines.h \ ${host_srcdir}/os_defines.h \
${glibcxx_srcdir}/$(ATOMICITY_INC_SRCDIR)/atomicity.h ${glibcxx_srcdir}/$(ATOMIC_WORD_SRCDIR)/atomic_word.h
# Non-installed host_header files. # Non-installed host_header files.
host_headers_noinst = \ host_headers_noinst = \

View File

@ -42,7 +42,8 @@ ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@ AMTAR = @AMTAR@
AR = @AR@ AR = @AR@
AS = @AS@ AS = @AS@
ATOMICITY_INC_SRCDIR = @ATOMICITY_INC_SRCDIR@ ATOMICITY_SRCDIR = @ATOMICITY_SRCDIR@
ATOMIC_WORD_SRCDIR = @ATOMIC_WORD_SRCDIR@
AUTOCONF = @AUTOCONF@ AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@ AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@ AUTOMAKE = @AUTOMAKE@
@ -287,6 +288,7 @@ bits_srcdir = ${glibcxx_srcdir}/include/bits
bits_builddir = ./bits bits_builddir = ./bits
bits_headers = \ bits_headers = \
${bits_srcdir}/allocator.h \ ${bits_srcdir}/allocator.h \
${bits_srcdir}/atomicity.h \
${bits_srcdir}/basic_ios.h \ ${bits_srcdir}/basic_ios.h \
${bits_srcdir}/basic_ios.tcc \ ${bits_srcdir}/basic_ios.tcc \
${bits_srcdir}/basic_string.h \ ${bits_srcdir}/basic_string.h \
@ -524,9 +526,9 @@ debug_headers = \
# For --enable-cheaders=c_std # For --enable-cheaders=c_std
@GLIBCXX_C_HEADERS_C_STD_TRUE@c_base_headers_extra = ${c_base_srcdir}/cmath.tcc @GLIBCXX_C_HEADERS_C_STD_TRUE@c_base_headers_extra = ${c_base_srcdir}/cmath.tcc
@GLIBCXX_C_HEADERS_C_STD_FALSE@c_base_headers_extra = @GLIBCXX_C_HEADERS_C_STD_FALSE@c_base_headers_extra =
@GLIBCXX_C_HEADERS_COMPATIBILITY_FALSE@c_compatibility_headers_extra =
@GLIBCXX_C_HEADERS_COMPATIBILITY_TRUE@c_compatibility_headers_extra = ${c_compatibility_headers} @GLIBCXX_C_HEADERS_COMPATIBILITY_TRUE@c_compatibility_headers_extra = ${c_compatibility_headers}
@GLIBCXX_C_HEADERS_COMPATIBILITY_FALSE@c_compatibility_headers_extra =
host_srcdir = ${glibcxx_srcdir}/$(OS_INC_SRCDIR) host_srcdir = ${glibcxx_srcdir}/$(OS_INC_SRCDIR)
host_builddir = ./${host_alias}/bits host_builddir = ./${host_alias}/bits
@ -535,7 +537,7 @@ host_headers = \
${host_srcdir}/ctype_inline.h \ ${host_srcdir}/ctype_inline.h \
${host_srcdir}/ctype_noninline.h \ ${host_srcdir}/ctype_noninline.h \
${host_srcdir}/os_defines.h \ ${host_srcdir}/os_defines.h \
${glibcxx_srcdir}/$(ATOMICITY_INC_SRCDIR)/atomicity.h ${glibcxx_srcdir}/$(ATOMIC_WORD_SRCDIR)/atomic_word.h
# Non-installed host_header files. # Non-installed host_header files.

View File

@ -0,0 +1,46 @@
// Low-level functions for atomic operations -*- C++ -*-
// Copyright (C) 2004 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 2, 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 COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
// As a special exception, you may use this file as part of a free software
// library without restriction. Specifically, if other files instantiate
// templates or use macros or inline functions from this file, or you compile
// this file and link it with other files to produce an executable, this
// file does not by itself cause the resulting executable to be covered by
// the GNU General Public License. This exception does not however
// invalidate any other reasons why the executable file might be covered by
// the GNU General Public License.
#ifndef _GLIBCXX_ATOMICITY_H
#define _GLIBCXX_ATOMICITY_H 1
#include <bits/atomic_word.h>
namespace __gnu_cxx
{
_Atomic_word
__attribute__ ((__unused__))
__exchange_and_add(volatile _Atomic_word* __mem, int __val);
void
__attribute__ ((__unused__))
__atomic_add(volatile _Atomic_word* __mem, int __val);
} // namespace __gnu_cxx
#endif

View File

@ -212,7 +212,7 @@ namespace std
_M_dispose(const _Alloc& __a) _M_dispose(const _Alloc& __a)
{ {
if (__builtin_expect(this != &_S_empty_rep(), false)) if (__builtin_expect(this != &_S_empty_rep(), false))
if (__exchange_and_add(&this->_M_refcount, -1) <= 0) if (__gnu_cxx::__exchange_and_add(&this->_M_refcount, -1) <= 0)
_M_destroy(__a); _M_destroy(__a);
} // XXX MT } // XXX MT
@ -223,7 +223,7 @@ namespace std
_M_refcopy() throw() _M_refcopy() throw()
{ {
if (__builtin_expect(this != &_S_empty_rep(), false)) if (__builtin_expect(this != &_S_empty_rep(), false))
__atomic_add(&this->_M_refcount, 1); __gnu_cxx::__atomic_add(&this->_M_refcount, 1);
return _M_refdata(); return _M_refdata();
} // XXX MT } // XXX MT

View File

@ -1,6 +1,6 @@
// Iostreams base classes -*- C++ -*- // Iostreams base classes -*- C++ -*-
// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003 // Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
// Free Software Foundation, Inc. // Free Software Foundation, Inc.
// //
// This file is part of the GNU ISO C++ Library. This library is free // This file is part of the GNU ISO C++ Library. This library is free
@ -435,11 +435,12 @@ namespace std
: _M_next(__cb), _M_fn(__fn), _M_index(__index), _M_refcount(0) { } : _M_next(__cb), _M_fn(__fn), _M_index(__index), _M_refcount(0) { }
void void
_M_add_reference() { __atomic_add(&_M_refcount, 1); } _M_add_reference() { __gnu_cxx::__atomic_add(&_M_refcount, 1); }
// 0 => OK to delete. // 0 => OK to delete.
int int
_M_remove_reference() { return __exchange_and_add(&_M_refcount, -1); } _M_remove_reference()
{ return __gnu_cxx::__exchange_and_add(&_M_refcount, -1); }
}; };
_Callback_list* _M_callbacks; _Callback_list* _M_callbacks;

View File

@ -400,12 +400,12 @@ namespace std
private: private:
inline void inline void
_M_add_reference() const throw() _M_add_reference() const throw()
{ __atomic_add(&_M_refcount, 1); } { __gnu_cxx::__atomic_add(&_M_refcount, 1); }
inline void inline void
_M_remove_reference() const throw() _M_remove_reference() const throw()
{ {
if (__exchange_and_add(&_M_refcount, -1) == 1) if (__gnu_cxx::__exchange_and_add(&_M_refcount, -1) == 1)
{ {
try try
{ delete this; } { delete this; }
@ -505,12 +505,12 @@ namespace std
inline void inline void
_M_add_reference() throw() _M_add_reference() throw()
{ __atomic_add(&_M_refcount, 1); } { __gnu_cxx::__atomic_add(&_M_refcount, 1); }
inline void inline void
_M_remove_reference() throw() _M_remove_reference() throw()
{ {
if (__exchange_and_add(&_M_refcount, -1) == 1) if (__gnu_cxx::__exchange_and_add(&_M_refcount, -1) == 1)
{ {
try try
{ delete this; } { delete this; }

View File

@ -48,13 +48,14 @@ endif
# Source files linked in via configuration/make substitution for a # Source files linked in via configuration/make substitution for a
# particular host. # particular host.
host_sources = \ host_sources = \
atomicity.cc \
codecvt_members.cc \ codecvt_members.cc \
collate_members.cc \ collate_members.cc \
ctype_members.cc \ ctype_members.cc \
messages_members.cc \ messages_members.cc \
monetary_members.cc \ monetary_members.cc \
numeric_members.cc \ numeric_members.cc \
time_members.cc time_members.cc
codecvt_members.cc: ${glibcxx_srcdir}/$(CCODECVT_CC) codecvt_members.cc: ${glibcxx_srcdir}/$(CCODECVT_CC)
$(LN_S) ${glibcxx_srcdir}/$(CCODECVT_CC) . || true $(LN_S) ${glibcxx_srcdir}/$(CCODECVT_CC) . || true
@ -77,6 +78,10 @@ numeric_members.cc: ${glibcxx_srcdir}/$(CNUMERIC_CC)
time_members.cc: ${glibcxx_srcdir}/$(CTIME_CC) time_members.cc: ${glibcxx_srcdir}/$(CTIME_CC)
$(LN_S) ${glibcxx_srcdir}/$(CTIME_CC) . || true $(LN_S) ${glibcxx_srcdir}/$(CTIME_CC) . || true
atomicity_file = ${glibcxx_srcdir}/$(ATOMICITY_SRCDIR)/atomicity.h
atomicity.cc: ${atomicity_file}
$(LN_S) ${atomicity_file} ./atomicity.cc || true
# Source files linked in via configuration/make substitution for a # Source files linked in via configuration/make substitution for a
# particular host, but with ad hoc naming rules. # particular host, but with ad hoc naming rules.
host_sources_extra = \ host_sources_extra = \

View File

@ -43,7 +43,8 @@ ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@ AMTAR = @AMTAR@
AR = @AR@ AR = @AR@
AS = @AS@ AS = @AS@
ATOMICITY_INC_SRCDIR = @ATOMICITY_INC_SRCDIR@ ATOMICITY_SRCDIR = @ATOMICITY_SRCDIR@
ATOMIC_WORD_SRCDIR = @ATOMIC_WORD_SRCDIR@
AUTOCONF = @AUTOCONF@ AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@ AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@ AUTOMAKE = @AUTOMAKE@
@ -219,25 +220,28 @@ AM_CPPFLAGS = $(GLIBCXX_INCLUDES)
# Cross compiler support. # Cross compiler support.
toolexeclib_LTLIBRARIES = libstdc++.la toolexeclib_LTLIBRARIES = libstdc++.la
@GLIBCXX_BUILD_VERSIONED_SHLIB_FALSE@version_arg =
# Symbol versioning for shared libraries. # Symbol versioning for shared libraries.
@GLIBCXX_BUILD_VERSIONED_SHLIB_TRUE@version_arg = -Wl,--version-script=libstdc++-symbol.ver @GLIBCXX_BUILD_VERSIONED_SHLIB_TRUE@version_arg = -Wl,--version-script=libstdc++-symbol.ver
@GLIBCXX_BUILD_VERSIONED_SHLIB_FALSE@version_dep = @GLIBCXX_BUILD_VERSIONED_SHLIB_FALSE@version_arg =
@GLIBCXX_BUILD_VERSIONED_SHLIB_TRUE@version_dep = libstdc++-symbol.ver @GLIBCXX_BUILD_VERSIONED_SHLIB_TRUE@version_dep = libstdc++-symbol.ver
@GLIBCXX_BUILD_VERSIONED_SHLIB_FALSE@version_dep =
# Source files linked in via configuration/make substitution for a # Source files linked in via configuration/make substitution for a
# particular host. # particular host.
host_sources = \ host_sources = \
atomicity.cc \
codecvt_members.cc \ codecvt_members.cc \
collate_members.cc \ collate_members.cc \
ctype_members.cc \ ctype_members.cc \
messages_members.cc \ messages_members.cc \
monetary_members.cc \ monetary_members.cc \
numeric_members.cc \ numeric_members.cc \
time_members.cc time_members.cc
atomicity_file = ${glibcxx_srcdir}/$(ATOMICITY_SRCDIR)/atomicity.h
# Source files linked in via configuration/make substitution for a # Source files linked in via configuration/make substitution for a
# particular host, but with ad hoc naming rules. # particular host, but with ad hoc naming rules.
host_sources_extra = \ host_sources_extra = \
@ -306,13 +310,6 @@ libstdc___la_LDFLAGS = \
# deprecated include files. # deprecated include files.
GLIBCXX_INCLUDE_DIR = $(glibcxx_builddir)/include GLIBCXX_INCLUDE_DIR = $(glibcxx_builddir)/include
# Use special rules for the demangler, so that an additional implicit
# instantiation file is not necessary.
#demangle.lo: demangle.cc
# $(LTCXXCOMPILE) -fimplicit-templates -c $<
#demangle.o: demangle.cc
# $(CXXCOMPILE) -fimplicit-templates -c $<
# AM_CXXFLAGS needs to be in each subdirectory so that it can be # AM_CXXFLAGS needs to be in each subdirectory so that it can be
# modified in a per-library or per-sub-library way. Need to manually # modified in a per-library or per-sub-library way. Need to manually
# set this option because CONFIG_CXXFLAGS has to be after # set this option because CONFIG_CXXFLAGS has to be after
@ -364,9 +361,9 @@ CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES = CONFIG_CLEAN_FILES =
LTLIBRARIES = $(toolexeclib_LTLIBRARIES) LTLIBRARIES = $(toolexeclib_LTLIBRARIES)
am__objects_1 = codecvt_members.lo collate_members.lo ctype_members.lo \ am__objects_1 = atomicity.lo codecvt_members.lo collate_members.lo \
messages_members.lo monetary_members.lo numeric_members.lo \ ctype_members.lo messages_members.lo monetary_members.lo \
time_members.lo numeric_members.lo time_members.lo
am__objects_2 = basic_file.lo c++locale.lo am__objects_2 = basic_file.lo c++locale.lo
am__objects_3 = allocator.lo codecvt.lo complex_io.lo ctype.lo debug.lo \ am__objects_3 = allocator.lo codecvt.lo complex_io.lo ctype.lo debug.lo \
demangle.lo functexcept.lo globals_locale.lo globals_io.lo \ demangle.lo functexcept.lo globals_locale.lo globals_io.lo \
@ -662,6 +659,8 @@ numeric_members.cc: ${glibcxx_srcdir}/$(CNUMERIC_CC)
time_members.cc: ${glibcxx_srcdir}/$(CTIME_CC) time_members.cc: ${glibcxx_srcdir}/$(CTIME_CC)
$(LN_S) ${glibcxx_srcdir}/$(CTIME_CC) . || true $(LN_S) ${glibcxx_srcdir}/$(CTIME_CC) . || true
atomicity.cc: ${atomicity_file}
$(LN_S) ${atomicity_file} ./atomicity.cc || true
c++locale.cc: ${glibcxx_srcdir}/$(CLOCALE_CC) c++locale.cc: ${glibcxx_srcdir}/$(CLOCALE_CC)
$(LN_S) ${glibcxx_srcdir}/$(CLOCALE_CC) ./$@ || true $(LN_S) ${glibcxx_srcdir}/$(CLOCALE_CC) ./$@ || true

View File

@ -1,6 +1,6 @@
// Iostreams base classes -*- C++ -*- // Iostreams base classes -*- C++ -*-
// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003 // Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
// Free Software Foundation, Inc. // Free Software Foundation, Inc.
// //
// This file is part of the GNU ISO C++ Library. This library is free // This file is part of the GNU ISO C++ Library. This library is free
@ -138,7 +138,7 @@ namespace std
// Implementation note: Initialize top to zero to ensure that // Implementation note: Initialize top to zero to ensure that
// initialization occurs before main() is started. // initialization occurs before main() is started.
static _Atomic_word _S_top = 0; static _Atomic_word _S_top = 0;
return __exchange_and_add(&_S_top, 1) + 4; return __gnu_cxx::__exchange_and_add(&_S_top, 1) + 4;
} }
void void

View File

@ -1,6 +1,6 @@
// Iostreams base classes -*- C++ -*- // Iostreams base classes -*- C++ -*-
// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003 // Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
// Free Software Foundation, Inc. // Free Software Foundation, Inc.
// //
// This file is part of the GNU ISO C++ Library. This library is free // This file is part of the GNU ISO C++ Library. This library is free
@ -82,7 +82,7 @@ namespace std
ios_base::Init::Init() ios_base::Init::Init()
{ {
if (__exchange_and_add(&_S_refcount, 1) == 0) if (__gnu_cxx::__exchange_and_add(&_S_refcount, 1) == 0)
{ {
// Standard streams default to synced with "C" operations. // Standard streams default to synced with "C" operations.
_S_synced_with_stdio = true; _S_synced_with_stdio = true;
@ -117,13 +117,13 @@ namespace std
// streams are not re-initialized with uses of ios_base::Init // streams are not re-initialized with uses of ios_base::Init
// besides <iostream> static object, ie just using <ios> with // besides <iostream> static object, ie just using <ios> with
// ios_base::Init objects. // ios_base::Init objects.
__atomic_add(&_S_refcount, 1); __gnu_cxx::__atomic_add(&_S_refcount, 1);
} }
} }
ios_base::Init::~Init() ios_base::Init::~Init()
{ {
if (__exchange_and_add(&_S_refcount, -1) == 2) if (__gnu_cxx::__exchange_and_add(&_S_refcount, -1) == 2)
{ {
// Catch any exceptions thrown by basic_ostream::flush() // Catch any exceptions thrown by basic_ostream::flush()
try try

View File

@ -1,4 +1,4 @@
// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003 // Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
// Free Software Foundation, Inc. // Free Software Foundation, Inc.
// //
// This file is part of the GNU ISO C++ Library. This library is free // This file is part of the GNU ISO C++ Library. This library is free
@ -356,7 +356,7 @@ namespace std
locale::id::_M_id() const locale::id::_M_id() const
{ {
if (!_M_index) if (!_M_index)
_M_index = 1 + __exchange_and_add(&_S_refcount, 1); _M_index = 1 + __gnu_cxx::__exchange_and_add(&_S_refcount, 1);
return _M_index - 1; return _M_index - 1;
} }
} // namespace std } // namespace std

View File

@ -1,6 +1,6 @@
// { dg-do compile } // { dg-do compile }
// Copyright (C) 2003 Free Software Foundation, Inc. // Copyright (C) 2003, 2004 Free Software Foundation, Inc.
// //
// This file is part of the GNU ISO C++ Library. This library is free // 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 // software; you can redistribute it and/or modify it under the
@ -41,5 +41,5 @@ void test01()
io1 = io2; io1 = io2;
} }
// { dg-error "within this context" "" { target *-*-* } 41 } // { dg-error "within this context" "" { target *-*-* } 41 }
// { dg-error "is private" "" { target *-*-* } 740 } // { dg-error "is private" "" { target *-*-* } 741 }
// { dg-error "operator=" "" { target *-*-* } 0 } // { dg-error "operator=" "" { target *-*-* } 0 }

View File

@ -1,6 +1,6 @@
// { dg-do compile } // { dg-do compile }
// Copyright (C) 2003 Free Software Foundation, Inc. // Copyright (C) 2003, 2004 Free Software Foundation, Inc.
// //
// This file is part of the GNU ISO C++ Library. This library is free // 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 // software; you can redistribute it and/or modify it under the
@ -41,5 +41,5 @@ void test02()
test_base io2 = io1; test_base io2 = io1;
} }
// { dg-error "within this context" "" { target *-*-* } 41 } // { dg-error "within this context" "" { target *-*-* } 41 }
// { dg-error "is private" "" { target *-*-* } 737 } // { dg-error "is private" "" { target *-*-* } 738 }
// { dg-error "copy constructor" "" { target *-*-* } 0 } // { dg-error "copy constructor" "" { target *-*-* } 0 }