This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [v3] version atomic ops
Appended is the patch that I committed, after fixing the function
signature problem and then Ben helping fix the casting warnings.
Thanks, David
* config/os/aix/atomicity.h: Use __gnu_cxx namespace. Remove
static, and inline keyworks.
Index: atomicity.h
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/config/os/aix/atomicity.h,v
retrieving revision 1.2
diff -c -p -r1.2 atomicity.h
*** atomicity.h 2 Jun 2003 18:03:23 -0000 1.2
--- atomicity.h 27 Feb 2004 18:53:53 -0000
***************
*** 1,6 ****
// Low-level functions for atomic operations: AIX version -*- C++ -*-
! // Copyright (C) 2000, 2001 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
--- 1,6 ----
// Low-level functions for atomic operations: AIX version -*- C++ -*-
! // Copyright (C) 2000, 2001, 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
***************
*** 27,59 ****
// invalidate any other reasons why the executable file might be covered by
// the GNU General Public License.
! #ifndef _BITS_ATOMICITY_H
! #define _BITS_ATOMICITY_H 1
/* We cannot use the cpu/powerpc/bits/atomicity.h inline assembly
definitions for these operations since they depend on operations
that are not available on the original POWER architecture. AIX
still runs on the POWER architecture, so it would be incorrect to
! assume the existence of these instructions. */
! /* This should match the type pointed to by atomic_p in
! <sys/atomic_op.h>. */
! typedef int _Atomic_word;
! #include <sys/atomic_op.h>
!
! static inline int
! __attribute__ ((__unused__))
! __exchange_and_add (atomic_p __mem, int __val)
{
! return fetch_and_add (__mem, __val);
}
! static inline void
! __attribute__ ((__unused__))
! __atomic_add (atomic_p __mem, int __val)
{
! (void) fetch_and_add (__mem, __val);
! }
!
! #endif /* atomicity.h */
--- 27,61 ----
// invalidate any other reasons why the executable file might be covered by
// the GNU General Public License.
! #include <bits/atomicity.h>
/* We cannot use the cpu/powerpc/bits/atomicity.h inline assembly
definitions for these operations since they depend on operations
that are not available on the original POWER architecture. AIX
still runs on the POWER architecture, so it would be incorrect to
! assume the existence of these instructions.
! The definition of _Atomic_word must match the type pointed to by
! atomic_p in <sys/atomic_op.h>. */
! extern "C"
{
! #include <sys/atomic_op.h>
}
! namespace __gnu_cxx
{
! _Atomic_word
! __attribute__ ((__unused__))
! __exchange_and_add (volatile _Atomic_word* __mem, int __val)
! {
! return ::fetch_and_add (const_cast<atomic_p>(__mem), __val);
! }
!
! void
! __attribute__ ((__unused__))
! __atomic_add (volatile _Atomic_word* __mem, int __val)
! {
! (void) ::fetch_and_add (const_cast<atomic_p>(__mem), __val);
! }
! } // namespace __gnu_cxx