public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] c/52190  update __atomic documentation
@ 2012-02-10 17:25 Andrew MacLeod
  2012-02-10 17:54 ` Joseph S. Myers
  0 siblings, 1 reply; 2+ messages in thread
From: Andrew MacLeod @ 2012-02-10 17:25 UTC (permalink / raw)
  To: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 236 bytes --]


Updated the extra parameter to __atomic_{is,always}_lock_free , and bkoz 
noted that the __atomic_compare_exchange documentation did not document 
the 'weak' parameter.

Fixed as such, seems to format fine.  OK for mainline?

Andrew



[-- Attachment #2: doc.diff --]
[-- Type: text/plain, Size: 3592 bytes --]

	PR c/52190
	* doc/extend.texi : Update comments for __atomic_compare_exchange and
	__atomic_{is,always}_lock_free.

Index: doc/extend.texi
===================================================================
*** doc/extend.texi	(revision 183969)
--- doc/extend.texi	(working copy)
*************** This built-in function implements an ato
*** 7146,7152 ****
  This compares the contents of @code{*@var{ptr}} with the contents of
  @code{*@var{expected}} and if equal, writes @var{desired} into
  @code{*@var{ptr}}.  If they are not equal, the current contents of
! @code{*@var{ptr}} is written into @code{*@var{expected}}.
  
  True is returned if @code{*@var{desired}} is written into
  @code{*@var{ptr}} and the execution is considered to conform to the
--- 7146,7155 ----
  This compares the contents of @code{*@var{ptr}} with the contents of
  @code{*@var{expected}} and if equal, writes @var{desired} into
  @code{*@var{ptr}}.  If they are not equal, the current contents of
! @code{*@var{ptr}} is written into @code{*@var{expected}}.  @var{weak} is true
! for weak compare_exchange, and false for the strong variation.  Many targets 
! only offer the strong variation and ignore the parameter.  When in doubt, use
! the strong variation.
  
  True is returned if @code{*@var{desired}} is written into
  @code{*@var{ptr}} and the execution is considered to conform to the
*************** All memory orders are valid.
*** 7242,7268 ****
  
  @end deftypefn
  
! @deftypefn {Built-in Function} bool __atomic_always_lock_free (size_t size)
  
! This built-in function returns true if objects of size bytes will always
! generate lock free atomic instructions for the target architecture.
! Otherwise false is returned.
  
! size must resolve to a compile time constant.
  
  @smallexample
! if (_atomic_always_lock_free (sizeof (long long)))
  @end smallexample
  
  @end deftypefn
  
! @deftypefn {Built-in Function} bool __atomic_is_lock_free (size_t size)
  
! This built-in function returns true if objects of size bytes will always
  generate lock free atomic instructions for the target architecture.  If
  it is not known to be lock free a call is made to a runtime routine named
  @code{__atomic_is_lock_free}.
  
  @end deftypefn
  
  @node Object Size Checking
--- 7245,7276 ----
  
  @end deftypefn
  
! @deftypefn {Built-in Function} bool __atomic_always_lock_free (size_t size,  void *ptr)
  
! This built-in function returns true if objects of @var{size} bytes will always
! generate lock free atomic instructions for the target architecture.  
! @var{size} must resolve to a compile time constant and the result also resolves to compile time constant.
  
! @var{ptr} is an optional pointer to the object which may be used to determine
! alignment.  A value of 0 indicates typical alignment should be used.  The 
! compiler may also ignore this parameter.
  
  @smallexample
! if (_atomic_always_lock_free (sizeof (long long), 0))
  @end smallexample
  
  @end deftypefn
  
! @deftypefn {Built-in Function} bool __atomic_is_lock_free (size_t size, void *ptr)
  
! This built-in function returns true if objects of @var{size} bytes will always
  generate lock free atomic instructions for the target architecture.  If
  it is not known to be lock free a call is made to a runtime routine named
  @code{__atomic_is_lock_free}.
  
+ @var{ptr} is an optional pointer to the object which may be used to determine
+ alignment.  A value of 0 indicates typical alignment should be used.  The 
+ compiler may also ignore this parameter.
  @end deftypefn
  
  @node Object Size Checking

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] c/52190  update __atomic documentation
  2012-02-10 17:25 [PATCH] c/52190 update __atomic documentation Andrew MacLeod
@ 2012-02-10 17:54 ` Joseph S. Myers
  0 siblings, 0 replies; 2+ messages in thread
From: Joseph S. Myers @ 2012-02-10 17:54 UTC (permalink / raw)
  To: Andrew MacLeod; +Cc: gcc-patches

On Fri, 10 Feb 2012, Andrew MacLeod wrote:

> Updated the extra parameter to __atomic_{is,always}_lock_free , and bkoz noted
> that the __atomic_compare_exchange documentation did not document the 'weak'
> parameter.
> 
> Fixed as such, seems to format fine.  OK for mainline?

OK.

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-02-10 17:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-02-10 17:25 [PATCH] c/52190 update __atomic documentation Andrew MacLeod
2012-02-10 17:54 ` Joseph S. Myers

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).