[PATCH 1/2] Improve __atomic_clear/test_and_set documentation

Andi Kleen andi@firstfloor.org
Thu Jun 20 13:20:00 GMT 2013


From: Andi Kleen <ak@linux.intel.com>

Document that __atomic_clear and __atomic_test_and_set should
only be used with bool.

gcc/:
2013-06-13  Andi Kleen  <ak@linux.intel.com>

	* doc/extend.texi: Document that __atomic_clear and
	  __atomic_test_and_set should only be used with bool.
---
 gcc/doc/extend.texi | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi
index 1e1f8b3..aa3abef 100644
--- a/gcc/doc/extend.texi
+++ b/gcc/doc/extend.texi
@@ -7438,6 +7438,8 @@ This built-in function performs an atomic test-and-set operation on
 the byte at @code{*@var{ptr}}.  The byte is set to some implementation
 defined nonzero ``set'' value and the return value is @code{true} if and only
 if the previous contents were ``set''.
+It should be only used for operands of type bool or atomic_flag. For 
+other types only part of the value may be set.
 
 All memory models are valid.
 
@@ -7447,6 +7449,10 @@ All memory models are valid.
 
 This built-in function performs an atomic clear operation on
 @code{*@var{ptr}}.  After the operation, @code{*@var{ptr}} contains 0.
+It should be only used for operands of type bool or atomic_flag and 
+in conjunction with __atomic_test_and_set.
+For other types it may only clear partially. If the type is not bool
+prefer using @code{__atomic_store}.
 
 The valid memory model variants are
 @code{__ATOMIC_RELAXED}, @code{__ATOMIC_SEQ_CST}, and
-- 
1.8.3



More information about the Gcc-patches mailing list