2
0
mirror of https://github.com/boostorg/atomic.git synced 2026-02-01 08:12:07 +00:00
Commit Graph

337 Commits

Author SHA1 Message Date
Andrey Semashev
0e810ea02f Updated license URLs to use https. 2019-01-02 15:32:10 +03:00
Mike Dev
04ddfdeb19 [CMake] Add test for cmake file 2019-01-02 15:29:35 +03:00
Mike Dev
1dd9dd831b [CMake] Add minimal cmake file
Generate cmake target that builds the library and which can
be used by other libraries to express their dependency on
this library and retrieve any configuration information
such as the include directory, binary to link to,
transitive dependencies, necessary compiler options or the
required C++ standards level.
2019-01-02 15:00:46 +03:00
Andrey Semashev
a0869374da Re-added manual checkout of libs/config in CI as Boost.Build depends on it. 2018-12-20 20:43:57 +03:00
Andrey Semashev
b092a25923 Revert "Added an experimental partial CMakeLists.txt for dependency tracking in CMake projects."
This reverts commit 5ad28ffd18.

Apparently, just adding include paths to user's CMake projects is not enough
for the original requester.

https://github.com/boostorg/atomic/pull/20#issuecomment-448345886
2018-12-18 23:05:41 +03:00
Andrey Semashev
a469ac480d Use a separate submodule update step with parallel checkouts to speedup CI job startup. 2018-12-18 22:18:14 +03:00
Andrey Semashev
8852afd550 Added tools/boost_install and libs/headers manual checkout to CI jobs. 2018-12-18 21:51:15 +03:00
Andrey Semashev
5ad28ffd18 Added an experimental partial CMakeLists.txt for dependency tracking in CMake projects. 2018-12-18 19:26:35 +03:00
Andrey Semashev
605cb8b153 Enabled tests on Cygwin, enabled tests with GNU extensions on Cygwin and MinGW. 2018-12-09 11:13:22 +03:00
Andrey Semashev
96e980f260 Updated 32-bit compiler path for MinGW-w64 CI job. 2018-12-09 02:21:43 +03:00
Andrey Semashev
f90bee856d Try using a different base image for 32-bit MinGW-w64 CI job. 2018-12-08 23:47:02 +03:00
Andrey Semashev
a0a3424107 Added MinGW-w64 gcc 7.3 job. Try to enable 32-bit MinGW-w64 job with a different path. 2018-12-08 19:45:19 +03:00
Andrey Semashev
c22cc0812d Increased build job count in Appveyor CI config. boost-1.69.0-beta1 boost-1.69.0 2018-11-14 01:17:56 +03:00
Andrey Semashev
0a6c54747d Upgraded g++ multilib dependencies for clang jobs, enabled one OS X job.
libstdc++ 4.8 has a compatibility problem in C++14 mode since it attempts to
import ::gets into namespace std, and this function is not available.
2018-11-14 01:15:16 +03:00
Andrey Semashev
9c3d4c0c82 Disabled 32-bit tests on the default clang job. Updated multilib gcc dependencies on clang 6 and 7. 2018-11-01 21:30:06 +03:00
Andrey Semashev
b68229180b Aggregated 32 and 64-bit tests into the same CI jobs to speedup testing. 2018-11-01 20:16:54 +03:00
Andrey Semashev
629d84fed7 Changed http to https in URLs. 2018-11-01 19:55:23 +03:00
Andrey Semashev
82fb2dd969 Aggregated multiple C++ versions per CI job to speed up testing. 2018-10-28 19:40:54 +03:00
Andrey Semashev
2b1dff067e Hidden visibility is now used by default in the superproject. 2018-09-30 22:23:11 +03:00
Andrey Semashev
640f1796b0 Use Boost.Build feature to select hidden visibility. 2018-08-20 14:59:57 +03:00
Andrey Semashev
056588ab42 Switched to hidden visibility when building Boost.Atomic library. 2018-08-17 11:17:23 +03:00
Andrey Semashev
19eecf893c Removed unused argument to silence compiler warnings.
Fixes https://github.com/boostorg/atomic/issues/16.
boost-1.68.0
2018-07-30 12:10:48 +03:00
Andrey Semashev
6e14ca24da Removed clang-specific branch for x86 DCAS-based loads.
The storage to load from is const-qualified and DCAS via compiler intrinsics
require an unqualified pointer. Use asm implementation instead, which should be
as efficient as intrinsics, if not better, in this case.

Fixes https://github.com/boostorg/atomic/issues/15.
2018-07-17 12:37:29 +03:00
Andrey Semashev
98adecfbb4 Added cache line sizes for PowerPC and IBM Z.
The cache line sizes were taken from Boost.Lockfree.
2018-04-19 22:10:34 +03:00
Andrey Semashev
e16092f473 Updated copyright year. boost-1.67.0 2018-03-18 01:39:40 +03:00
Andrey Semashev
8d5c592da2 Updated the Limitations section. 2018-02-27 02:20:09 +03:00
Andrey Semashev
406228d493 Made initializing constructor of atomic<> implicit.
This is an attempt to make boost::atomic<> interface closer to the standard. It
makes a difference in C++17 as it mandates copy elision, which makes this code
possible:

  boost::atomic<int> a = 10;

It also makes is_convertible<T, boost::atomic<T>> return true, which has
implications on the standard library components, such as std::pair.

This removes the workaround for gcc 4.7, which complains that
operator=(value_arg_type) is considered ambiguous with operator=(atomic const&)
in assignment expressions, even though conversion to atomic<> is less preferred
than conversion to value_arg_type. We try to work around the problem from the
operator= side.

Added a new compile test to check that the initializing constructor is implicit.
2018-02-20 01:39:52 +03:00
Andrey Semashev
9fd86de20b Silenced gcc warnings about unused parameter. 2018-02-18 14:00:16 +03:00
Andrey Semashev
b990132e85 Added casts to silence MSVC warnings about lost FP precision of constants. 2018-02-18 13:57:32 +03:00
Andrey Semashev
7ce05c8ff0 Extended the workaround for noexcept in defaulted constructors to clang 3.1. 2018-02-15 15:46:31 +03:00
Andrey Semashev
35c87f5f6e Extended the workaround for noexcept in defaulted constructors to gcc 4.6. 2018-02-14 16:50:57 +03:00
Andrey Semashev
095812d84f Make the default constructor trivial if the user's type default constructor is.
This requires the is_trivially_default_constructible type trait, which is not
available in the older libstdc++ versions up to gcc 5.1. Thus the config macro
is updated to reflect the fact that Boost.Atomic now has more advanced needs.

Also, attempt to work around Intel compiler problem, which seems to break
(allegedly) because of the noexcept specifiers in the defaulted default
constructors. This may not be the cause, so this change will need to be tested.

Also, use value_arg_type consistently across different specializations of
basic_atomic.
2018-02-14 15:26:57 +03:00
Andrey Semashev
e7347a7d87 Use __builtin_addressof intrinsic where possible. 2018-02-14 03:34:56 +03:00
Andrey Semashev
e081674ce9 Use FP numbers in FP tests. 2018-02-14 03:19:09 +03:00
Andrey Semashev
92248dd5b8 Unified implementation of bitwise_fp_cast and bitwise_cast.
Also use memset to clear the tail padding of the storage as gcc generates
slightly better code for that.
2018-02-14 02:36:11 +03:00
Andrey Semashev
72309f41f9 Fixed CAS test failures for 80-bit long double.
The CAS implementation did not zero-fill the padding bits for the `expected`
argument, which caused CAS to fail sometimes.
2018-02-13 23:58:44 +03:00
Andrey Semashev
2a6b6ca8a7 Removed unnecessary includes to reduce dependencies. 2018-02-13 19:36:00 +03:00
Andrey Semashev
6dad4f3d21 Removed unused memset intrinsic macro. 2018-02-13 04:45:40 +03:00
Andrey Semashev
b575159f8e Improved the wording of the note re. padding bits in FP types. 2018-02-13 04:09:24 +03:00
Andrey Semashev
edef50f042 Added support for atomic floating point operations.
The support includes:

- The standard fetch_add/fetch_sub operations.
- Extra operations: (fetch_/opaque_)negate, (opaque_)add/sub.
- Extra capability macros: BOOST_ATOMIC_FLOAT/DOUBLE/LONG_DOUBLE_LOCK_FREE.

The atomic operations are currently implemented on top of the integer-based
backends and thus are mostly CAS-based. The CAS operations perform binary
comparisons, and as such have different behavior wrt. special FP values like
NaN and signed zero than normal C++.

The support for floating point types is optional and can be disabled by
defining BOOST_ATOMIC_NO_FLOATING_POINT. This can be useful if on a certain
platform parameters of the floating point types cannot be deduced from the
compiler-defined or system macros (in which case the compilation fails).

http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2017/p0020r6.html
2018-02-13 03:36:35 +03:00
Andrey Semashev
e751e235bc Silenced "unused parameter" warnings. 2018-02-12 17:53:57 +03:00
Andrey Semashev
8d7556f913 Added a specialized implementation of generic extra ops for CAS-based platforms.
This specialized implementation is able to save the result of the operations as
it is calculated in the CAS loop.
2018-02-11 01:57:16 +03:00
Andrey Semashev
92c57ac1e4 Added atomic operations that return the result of the operation.
These operations are useful for two reasons. First, they are needed by
atomic<> interface as the pre-increment/decrement and add/subtract operators
need to perform the corresponding arithmetics and return the actual result while
not exhibiting UB in case of overflow. This means that the operation must be
performed on the unsigned storage type in the backend. Second, the (op)_and_test
operations on ARM and PowerPC can be implemented in a more generic way on top of
the operations that return the result. And since we have those operations
internally, why not expose them to users.

Added tests and docs for the new operations. Also, added docs for the recently
added scoped names of the memory_order enum values.

Also, added a specialized "emulated" backend for the extra operations. This
backend makes better use of the fact that the operations are lock-protected
by avoiding any CAS-based loops.
2018-02-11 00:56:23 +03:00
Andrey Semashev
35497819a6 Microoptimization to reduce the number of branches in 128-bit operator==. 2018-02-10 17:19:03 +03:00
Andrey Semashev
8e7ea418ba Fixed a typo in the comment. 2018-02-04 23:50:10 +03:00
Andrey Semashev
233a2f72ba Switched integer storage type to be always an unsigned integer type.
The standard says that arithmetic operations on atomic types must always produce
a well-defined result in terms of two's complement arithmetic
([atomics.types.int]/7), which means integer owerflows are allowed and no trap
representations are allowed. This requires that all internal arithmetics be done
on unsigned integer types, even when the value type is a signed integer.

The implementation now casts between signed and unsigned integers internally,
performing zero or sign extension if the internal storage size is larger than
the stored value. This should have roughly the same performance as before,
although it mostly depends on the optimizer. The casting implementation
currently relies on that the signed integer representation is two's complement
on all supported platforms; other representations are not supported.
2018-02-04 23:42:50 +03:00
Andrey Semashev
64668130e9 Moved string op macros to a separate header. 2018-02-04 17:55:37 +03:00
Andrey Semashev
2a422ef2a9 Another attempt to work around MinGW gcc < 4.6 compilation failure.
The compiler complains:

error: can't find a register in class 'GENERAL_REGS' while reloading 'asm'

Try to work around it by explicitly specifying all registers to use.
2018-02-04 17:40:02 +03:00
Andrey Semashev
ff1e9747e6 Save/restore ebx for PIE code, just as well as for PIC. 2018-02-04 16:29:17 +03:00
Andrey Semashev
08486a7165 Reverted the previous change that gcc up to 4.6 don't support ax:dx pairs.
That change did not fix the compilers. The issue seems to be a bug specific to
MinGW gcc compilers up to 4.6, inclusively, and the cause of the problem is
yet unknown.
2018-02-04 15:39:05 +03:00