20 Commits

Author SHA1 Message Date
Andrey Semashev
b24cea0af1 Changed the result of (op)_and_test operations to the opposite.
This makes the result of (op)_and_test more consistent with other
methods such as test_and_set and bit_test_and_set, as well as the
methods used in the C++ standard library.

This is a breaking change. The users are able to define
BOOST_ATOMIC_HIGHLIGHT_OP_AND_TEST macro to generate warnings on each
use of the changed functions. This will help users to port from Boost
1.66 to newer Boost releases.

More info at:

https://github.com/boostorg/atomic/issues/11
http://boost.2283326.n4.nabble.com/atomic-op-and-test-naming-
tc4701445.html
2018-01-28 20:50:12 +03:00
Andrey Semashev
573732ea4a Added a workaround for libstdc++ not specializing numeric_limits for __int128 in strict mode. 2017-07-29 18:13:27 +03:00
Andrey Semashev
a980d1c3ba Attempt to work around absent opereator<< for __int128 in some libstdc++ versions. 2017-07-20 23:46:54 +03:00
Andrey Semashev
c172831e5d Added a workaround for gcc on PPC not providing operator<< for __int128. 2017-07-17 01:15:04 +03:00
Andrey Semashev
5b28e12f1d Fixed tests to accommodate MSVC bugs and improved diagnostics.
Fixed incorrect calculation of the min distance limit for arithmetic tests.

Moved some of the arithmetic tests to a separate function because
otherwise MSVC-10 for x64 generated broken code (the code would use
garbage values in registers to pass arguments to
add_and_test/sub_and_test).

Added output operators and employed newer test macros that output compared
values in case of test failure.
2017-07-11 23:00:52 +03:00
Andrey Semashev
3622ce85c7 Updated test to avoid signed overflows when add_and_test/sub_and_test is
called on pointer types.
2017-07-11 23:00:52 +03:00
Andrey Semashev
65d0d557f1 Fixed a test constant, added a few more checks. 2017-07-11 23:00:52 +03:00
Andrey Semashev
158a114325 Corrected test constants. 2017-07-11 23:00:52 +03:00
Andrey Semashev
add6f5640c Added tests for the new operations. 2017-07-11 23:00:52 +03:00
Andrey Semashev
ca151bedb4 Fixed warnings about left-shifting negative signed integers. 2017-05-22 15:21:22 +03:00
Andrey Semashev
11c785768c Updated to reflect changes from P0558R1 accepted into C++17.
1. Expose value_type and difference_type (where present) to user's code.

2. Prohibit arithmetic operations on pointers to non-object types. In
   particular, arithmetic operations such as fetch_add/fetch_sub will no longer
   compile for pointers to cv void, pointers to functions and pointers to
   non-static class members.

Also, use C++11 <type_traits> when possible instead of Boost.TypeTraits to
reduce dependencies. Cleaned up value_arg_type internal type usage for more
efficient argument passing.
2017-04-01 18:29:26 +03:00
Andrey Semashev
ff91811c1a Fixes #10994. Fixed compilation with gcc 4.4 when cmpxchg16b is used. 2015-08-17 23:27:37 +03:00
Andrey Semashev
b1bb36c5b3 Only use intptr_t when available. Only test integer overflows/underflows for unsigned integers (the behavior is undefined for signed ints anyway). This should silence compiler warnings as well. 2015-08-17 22:25:19 +03:00
Andrey Semashev
7b1d722d94 Ported tests to core/lightweight_test.hpp.
Boost.Test was dropped due to instability and long-standing differences between develop and master branches. We don't use most of its features anyway.
2015-01-25 18:50:58 +03:00
Andrey Semashev
4dee330229 Added support for types with non-trivial default constructors. 2014-07-07 22:40:41 +04:00
Andrey Semashev
625c3c3a2e Compilation fixes. Added public headers for atomic_flag and atomic. 2014-04-20 17:26:42 +04:00
Andrey Semashev
55e8b16a12 Fixed compilation with gcc 4.4. Optimized code for gcc older than 4.7 and also added support for 128-bit atomic ops. Completed transition to defaulted and deleted functions.
[SVN r84801]
2013-06-16 13:40:11 +00:00
Tim Blechmann
96b44933f0 atomic: provide additive functionality for atomic<void*>
fixes #8501

[SVN r84190]
2013-05-08 04:45:38 +00:00
Tim Blechmann
764db51b6d atomic: adapt for constexpr and noexcept
Signed-off-by: Tim Blechmann <tim@klingt.org>

[SVN r82870]
2013-02-14 12:32:41 +00:00
Helge Bahmann
131b70c1fa atomic: initial import
[SVN r79348]
2012-07-08 11:21:45 +00:00