]> granicus.if.org Git - libatomic_ops/log
libatomic_ops
7 years agoTravis CI: Test also with AddressSanitizer (ASan)
Ivan Maidanski [Thu, 16 Feb 2017 07:16:30 +0000 (10:16 +0300)]
Travis CI: Test also with AddressSanitizer (ASan)

7 years agoWorkaround MSan warning about uninitialized data read by generalized store
Ivan Maidanski [Thu, 16 Feb 2017 06:43:25 +0000 (09:43 +0300)]
Workaround MSan warning about uninitialized data read by generalized store

* src/atomic_ops.h [__has_feature(memory_sanitizer)]
(AO_MEMORY_SANITIZER): Define.
* src/atomic_ops.h [AO_MEMORY_SANITIZER] (AO_ATTR_NO_SANITIZE_MEMORY):
Likewise.
* src/atomic_ops/generalize-small.h: Regenerate.
* src/atomic_ops/generalize-small.template
[AO_HAVE_XSIZE_compare_and_swap_write && !AO_HAVE_XSIZE_store_write]
(AO_XSIZE_store_write): Add AO_ATTR_NO_SANITIZE_MEMORY attribute.
* src/atomic_ops/generalize-small.template
[AO_HAVE_XSIZE_compare_and_swap && !AO_HAVE_XSIZE_store]
(AO_XSIZE_store): Likewise.
* src/atomic_ops/generalize-small.template
[AO_HAVE_XSIZE_compare_and_swap_release && !AO_HAVE_XSIZE_store_release]
(AO_XSIZE_store_release): Likewise.
* src/atomic_ops/generalize-small.template
[AO_HAVE_XSIZE_compare_and_swap_full && !AO_HAVE_XSIZE_store_full]
(AO_XSIZE_store_full): Likewise.

7 years ago.gitignore: Ignore *.sancov (generated by ASan)
Ivan Maidanski [Wed, 15 Feb 2017 21:41:00 +0000 (00:41 +0300)]
.gitignore: Ignore *.sancov (generated by ASan)

7 years agoTravis CI: Add source check by cppcheck
Ivan Maidanski [Mon, 13 Feb 2017 21:54:35 +0000 (00:54 +0300)]
Travis CI: Add source check by cppcheck

7 years agoTravis CI: Pass -D DEBUG_RUN_ONE_TEST to CFLAGS during test coverage check
Ivan Maidanski [Mon, 13 Feb 2017 21:39:50 +0000 (00:39 +0300)]
Travis CI: Pass -D DEBUG_RUN_ONE_TEST to CFLAGS during test coverage check

7 years agoTravis CI: Add source check by Clang Static Analyzer
Ivan Maidanski [Mon, 13 Feb 2017 21:34:07 +0000 (00:34 +0300)]
Travis CI: Add source check by Clang Static Analyzer

7 years agoTravis CI: Also test --enable-shared
Ivan Maidanski [Mon, 13 Feb 2017 21:26:19 +0000 (00:26 +0300)]
Travis CI: Also test --enable-shared

7 years agoUpdate ChangeLog file
Ivan Maidanski [Mon, 6 Feb 2017 15:17:39 +0000 (18:17 +0300)]
Update ChangeLog file

7 years agoUpdate ChangeLog file (v7.2 - v7.4 changes only)
Ivan Maidanski [Mon, 6 Feb 2017 14:49:02 +0000 (17:49 +0300)]
Update ChangeLog file (v7.2 - v7.4 changes only)

7 years agoTravis CI: Test the default config without assertions
Ivan Maidanski [Sat, 4 Feb 2017 06:58:06 +0000 (09:58 +0300)]
Travis CI: Test the default config without assertions

7 years agoTest store/CAS emulation explicitly
Ivan Maidanski [Fri, 3 Feb 2017 16:19:32 +0000 (19:19 +0300)]
Test store/CAS emulation explicitly

* tests/Makefile.am (test_atomic_generalized_CPPFLAGS): Add
-D AO_TEST_EMULATION.
* tests/test_atomic.c [(!_MSC_VER && !__MINGW32__ && !__BORLANDC__
|| AO_USE_NO_SIGNALS || AO_USE_WIN32_PTHREADS) && AO_TEST_EMULATION]
(AO_store_full_emulation, AO_fetch_compare_and_swap_emulation): Declare
prototype.
* tests/test_atomic.c [(!_MSC_VER && !__MINGW32__ && !__BORLANDC__
|| AO_USE_NO_SIGNALS || AO_USE_WIN32_PTHREADS) && AO_TEST_EMULATION
&& AO_HAVE_double_t] (AO_compare_double_and_swap_double_emulation):
Likewise.
* tests/test_atomic.c (test_atomic_emulation): New function (or a macro
defined to empty if AO_*_emulation primitives are unavailable).
* tests/test_atomic.c (main): Call test_atomic_emulation().

7 years agoFix 'undefined reference to __atomic_load/store_16' error (clang-3.4/x64)
Ivan Maidanski [Thu, 2 Feb 2017 15:31:53 +0000 (18:31 +0300)]
Fix 'undefined reference to __atomic_load/store_16' error (clang-3.4/x64)

* src/atomic_ops/sysdeps/gcc/x86.h [AO_GCC_ATOMIC_TEST_AND_SET
&& __x86_64__ && !__ILP32__ && __clang_major__==3 && __clang_minor__==4
&& !AO_PREFER_BUILTIN_ATOMICS]
(AO_SKIPATOMIC_double_compare_and_swap_ANY, AO_SKIPATOMIC_double_load,
AO_SKIPATOMIC_double_load_acquire, AO_SKIPATOMIC_double_store,
AO_SKIPATOMIC_double_store_release): Define; update comment.

7 years agoTravis CI: Remove -D AO_TRACE_MALLOC from CFLAGS as the log is too long
Ivan Maidanski [Wed, 1 Feb 2017 20:52:09 +0000 (23:52 +0300)]
Travis CI: Remove -D AO_TRACE_MALLOC from CFLAGS as the log is too long
(fix commit bb94b84)

7 years agoTravis CI: Refactoring (define CFLAGS_EXTRA_M, CONF_* variables)
Ivan Maidanski [Wed, 1 Feb 2017 20:19:37 +0000 (23:19 +0300)]
Travis CI: Refactoring (define CFLAGS_EXTRA_M, CONF_* variables)

7 years ago.gitignore: Ignore coverage.info (generated by lcov)
Ivan Maidanski [Tue, 31 Jan 2017 20:48:32 +0000 (23:48 +0300)]
.gitignore: Ignore coverage.info (generated by lcov)

7 years agoTravis CI: Use also 'tests' folder for coverage reporting
Ivan Maidanski [Tue, 31 Jan 2017 20:43:27 +0000 (23:43 +0300)]
Travis CI: Use also 'tests' folder for coverage reporting
(fix commit 88ee70d)

7 years agoAdd Coveralls (test coverage status) badge to README
Ivan Maidanski [Tue, 31 Jan 2017 20:07:14 +0000 (23:07 +0300)]
Add Coveralls (test coverage status) badge to README

7 years agoTravis CI: Fix output test_atomic*.log content
Ivan Maidanski [Tue, 31 Jan 2017 19:28:44 +0000 (22:28 +0300)]
Travis CI: Fix output test_atomic*.log content
(fix commit 8b287a7)

7 years agoTravis CI: Report test coverage for Linux/x64 (native CPU)
Ivan Maidanski [Tue, 31 Jan 2017 19:13:44 +0000 (22:13 +0300)]
Travis CI: Report test coverage for Linux/x64 (native CPU)

7 years agoTravis CI: Output test_atomic*.log content
Ivan Maidanski [Tue, 31 Jan 2017 18:46:57 +0000 (21:46 +0300)]
Travis CI: Output test_atomic*.log content

7 years agoFix a typo in comment belonging to double_ptr_storage
Ivan Maidanski [Tue, 31 Jan 2017 07:56:23 +0000 (10:56 +0300)]
Fix a typo in comment belonging to double_ptr_storage
(fix commit 7633154)

* src/atomic_ops/sysdeps/standard_ao_double_t.h [!__ILP32__ && !__clang__
&& (__x86_64__ && AO_GCC_ATOMIC_TEST_AND_SET || __aarch64__)]
(double_ptr_storage): Fix typo in comment ("pedantic").

7 years agoFix test_atomic fail caused by AO_double_t misaligned load (Linux/i686)
Ivan Maidanski [Tue, 31 Jan 2017 07:29:44 +0000 (10:29 +0300)]
Fix test_atomic fail caused by AO_double_t misaligned load (Linux/i686)

* src/atomic_ops/sysdeps/standard_ao_double_t.h [__i386__ && __GNUC__]
(double_ptr_storage): Add aligned(8) attribute (so that AO_double_t
global/static variables to have proper (double-word) alignment).

7 years agoTravis CI: Exclude osx/gcc builds
Ivan Maidanski [Fri, 27 Jan 2017 21:36:09 +0000 (00:36 +0300)]
Travis CI: Exclude osx/gcc builds
(gcc is an alias to clang on OS X)

7 years agoTravis CI: Fix CFLAGS_EXTRA value with 2 options
Ivan Maidanski [Fri, 27 Jan 2017 21:29:16 +0000 (00:29 +0300)]
Travis CI: Fix CFLAGS_EXTRA value with 2 options
(fix commit e294a77)

7 years agoTravis CI: compile both for x86 and x64
Ivan Maidanski [Fri, 27 Jan 2017 17:20:31 +0000 (20:20 +0300)]
Travis CI: compile both for x86 and x64

7 years agoUse generalized double-wide load/store if AO_PREFER_GENERALIZED (gcc/x86)
Ivan Maidanski [Fri, 27 Jan 2017 16:46:07 +0000 (19:46 +0300)]
Use generalized double-wide load/store if AO_PREFER_GENERALIZED (gcc/x86)

* src/atomic_ops/sysdeps/gcc/x86.h [!__x86_64__ || __ILP32__]: Do not
include double_atomic_load_store.h if AO_PREFER_GENERALIZED.

7 years agoUse generalized load/store if AO_PREFER_GENERALIZED (gcc/generic)
Ivan Maidanski [Fri, 27 Jan 2017 16:35:20 +0000 (19:35 +0300)]
Use generalized load/store if AO_PREFER_GENERALIZED (gcc/generic)

Note: AO_PREFER_GENERALIZED macro is for testing generalize.h mainly.

* src/atomic_ops/sysdeps/gcc/generic-small.template (AO_XSIZE_load,
AO_XSIZE_load_acquire, AO_XSIZE_store, AO_XSIZE_store_release): Do not
define if AO_GCC_HAVE_XSIZE_SYNC_CAS and AO_PREFER_GENERALIZED.
* src/atomic_ops/sysdeps/gcc/generic-small.h: Regenerate.
* src/atomic_ops/sysdeps/gcc/generic.h [AO_HAVE_DOUBLE_PTR_STORAGE]
(AO_GCC_HAVE_double_SYNC_CAS): Move the definition upper to be before
AO_double_load.
* src/atomic_ops/sysdeps/gcc/generic.h [AO_HAVE_DOUBLE_PTR_STORAGE]
(AO_double_load, AO_double_load_acquire, AO_double_store,
AO_double_store_release): Do not define if AO_GCC_HAVE_double_SYNC_CAS
and AO_PREFER_GENERALIZED.

7 years agoAppveyor CI: Test double-wide CAS in debug builds (x86/x64)
Ivan Maidanski [Fri, 27 Jan 2017 16:11:22 +0000 (19:11 +0300)]
Appveyor CI: Test double-wide CAS in debug builds (x86/x64)

7 years agoSupport CFLAGS_EXTRA to pass extra user-defined compiler flags (MS VC)
Ivan Maidanski [Fri, 27 Jan 2017 16:05:17 +0000 (19:05 +0300)]
Support CFLAGS_EXTRA to pass extra user-defined compiler flags (MS VC)

* src/Makefile.msft: Remove commented out variable assignments.
* src/Makefile.msft (CFLAGS_EXTRA): New variable (empty by default).
* src/Makefile.msft (CFLAGS): Append CFLAGS_EXTRA value.

7 years ago.gitignore: Ignore test_atomic_generalized
Ivan Maidanski [Fri, 27 Jan 2017 06:47:03 +0000 (09:47 +0300)]
.gitignore: Ignore test_atomic_generalized

7 years agoAdd test_atomic_generalized to Makefile and Makefile.msft
Ivan Maidanski [Fri, 27 Jan 2017 06:37:15 +0000 (09:37 +0300)]
Add test_atomic_generalized to Makefile and Makefile.msft

* src/Makefile.msft (test_atomic_generalized): New target (same as
test_atomic but with -D AO_PREFER_GENERALIZED).
* src/Makefile.msft (check): Add dependency on test_atomic_generalized;
run test_atomic_generalized.
* tests/Makefile.am (TESTS): Add test_atomic_generalized.
* tests/Makefile.am [HAVE_PTHREAD_H] (TEST): Add test_atomic_pthreads
instead of specifying all tests.
* tests/Makefile.am (test_atomic_generalized_SOURCES,
test_atomic_generalized_LDADD): Define (same as for test_atomic).
* tests/Makefile.am (test_atomic_generalized_CPPFLAGS): Define
specifying -D AO_PREFER_GENERALIZED.

7 years agoAppveyor CI: run test_malloc/stack
Ivan Maidanski [Thu, 26 Jan 2017 20:10:57 +0000 (23:10 +0300)]
Appveyor CI: run test_malloc/stack

7 years agoEnable limited testing in Makefile.msft without Cygwin
Ivan Maidanski [Thu, 26 Jan 2017 20:07:57 +0000 (23:07 +0300)]
Enable limited testing in Makefile.msft without Cygwin

New target "check-noautogen" is introduced in Makefile.msft to build and
run only test_malloc and test_stack (which do not need test code
auto-generation by sed).

* src/Makefile.msft: Refine comment about tests execution; add comment
about "check-noautogen" target.
* src/Makefile.msft (check): Add dependency on check-noautogen;
move test_malloc and test_stack to check-noautogen.
* src/Makefile.msft (check-noautogen): New target (executes test_malloc
and test_stack only).

7 years agoTravis CI: compile for host CPU (to test double-wide primitives)
Ivan Maidanski [Thu, 26 Jan 2017 07:43:08 +0000 (10:43 +0300)]
Travis CI: compile for host CPU (to test double-wide primitives)

7 years agoImplement AO_CLEAR using C11 atomic intrinsic (GCC)
Ivan Maidanski [Thu, 26 Jan 2017 07:38:21 +0000 (10:38 +0300)]
Implement AO_CLEAR using C11 atomic intrinsic (GCC)

* src/atomic_ops/sysdeps/gcc/generic.h [!AO_PREFER_GENERALIZED]
(AO_CLEAR): Implement using GCC built-in __atomic_clear (thus
overriding the default one based on AO_char_store_release).

7 years agoImplement compiler_barrier using C11 __atomic_signal_fence (GCC)
Hans Boehm [Thu, 26 Jan 2017 07:16:54 +0000 (10:16 +0300)]
Implement compiler_barrier using C11 __atomic_signal_fence (GCC)

Use __atomic_signal_fence(__ATOMIC_SEQ_CST) as AO_compiler_barrier.
That was the intended use of __atomic_signal_fence.  The only
standards-relevant context in which you can tell apart a compiler and
real fence is in the case if signal handlers.

* src/atomic_ops/sysdeps/gcc/generic.h (AO_compiler_barrier): Redefine
using GCC atomic intrinsic (__atomic_signal_fence).

7 years agoFix type of general AO_TS_INITIALIZER
Ivan Maidanski [Thu, 26 Jan 2017 06:46:57 +0000 (09:46 +0300)]
Fix type of general AO_TS_INITIALIZER

* src/atomic_ops.h (AO_TS_INITIALIZER): Change type from AO_t to
AO_TS_t; add outermost parentheses.

7 years agoFix test_atomic failure caused unaligned AO_double_t access on x86
Ivan Maidanski [Tue, 24 Jan 2017 19:46:57 +0000 (22:46 +0300)]
Fix test_atomic failure caused unaligned AO_double_t access on x86

The failure is caused by violation of an assertion that checks
AO_double_t variable is 8-byte aligned on x86.

* doc/README.txt (AO_double_t): Add note about required alignment.
* src/atomic_ops/sysdeps/standard_ao_double_t.h (AO_double_t): Add
comment about alignment.
* src/atomic_ops_stack.h (AO_stack_t): Likewise.
* tests/test_atomic_include.template (test_atomicXX): Define old_w, w
local variables as static (as otherwise, e.g., they could have 4-byte
alignment on x86); add comment.

7 years agoRevert "Fix test_atomic fail caused unaligned AO_double_t access (VC/x86)"
Ivan Maidanski [Tue, 24 Jan 2017 14:49:58 +0000 (17:49 +0300)]
Revert "Fix test_atomic fail caused unaligned AO_double_t access (VC/x86)"

This reverts commit 69c4010c1b3d43e2e179421e27379aaa5aeeb6d8.

The failure is actually caused by the fact that default alignment of
stack on x86 is 4 bytes.
So, another solution should be proposed to fix the issue for other
compilers (and, potentially, other targets).  E.g. do not place
AO_double_t volatile variables on stack.

7 years agoImplement char CAS and char/short add for msftc X86[_64] (VS 2013+)
Ivan Maidanski [Mon, 23 Jan 2017 22:42:06 +0000 (01:42 +0300)]
Implement char CAS and char/short add for msftc X86[_64] (VS 2013+)

* src/atomic_ops/sysdeps/msftc/common32_defs.h [_MSC_VER>=1800]
(_InterlockedCompareExchange8): Declare intrinsic.
* src/atomic_ops/sysdeps/msftc/common32_defs.h [_MSC_VER>=1800
&& !AO_PREFER_GENERALIZED && !_M_ARM] (_InterlockedExchangeAdd16,
_InterlockedExchangeAdd8): Likewise.
* src/atomic_ops/sysdeps/msftc/x86_64.h [_MSC_VER>=1800]
(_InterlockedCompareExchange8): Likewise.
* src/atomic_ops/sysdeps/msftc/x86_64.h [_MSC_VER>=1800
&& !AO_PREFER_GENERALIZED] (_InterlockedExchangeAdd16,
_InterlockedExchangeAdd8): Likewise.
* src/atomic_ops/sysdeps/msftc/common32_defs.h [_MSC_VER>=1800]
(AO_char_fetch_compare_and_swap_full): Implement using intrinsic.
* src/atomic_ops/sysdeps/msftc/common32_defs.h [_MSC_VER>=1800
&& !AO_PREFER_GENERALIZED && !_M_ARM] (AO_char_fetch_and_add_full,
AO_short_fetch_and_add_full): Likewise.
* src/atomic_ops/sysdeps/msftc/x86_64.h [_MSC_VER>=1800]
(AO_char_fetch_compare_and_swap_full): Likewise.
* src/atomic_ops/sysdeps/msftc/x86_64.h [_MSC_VER>=1800
&& !AO_PREFER_GENERALIZED] (AO_char_fetch_and_add_full,
AO_short_fetch_and_add_full): Likewise.
* src/atomic_ops/sysdeps/msftc/x86.h [!AO_NO_ASM_XADD]
(AO_char_fetch_and_add_full, AO_short_fetch_and_add_full): Do not
define if AO_HAVE_char_fetch_and_add_full.
* src/atomic_ops/sysdeps/msftc/x86_64.h [AO_ASM_X64_AVAILABLE]
(AO_char_fetch_and_add_full, AO_short_fetch_and_add_full): Do not use
asm-based implementation if _MSC_VER>=1800.

7 years agoImplement short inc/dec directly for msftc ARM and X86[_64]
Ivan Maidanski [Mon, 23 Jan 2017 22:32:41 +0000 (01:32 +0300)]
Implement short inc/dec directly for msftc ARM and X86[_64]

* src/atomic_ops/sysdeps/msftc/common32_defs.h [_MSC_VER>1400
&& !AO_PREFER_GENERALIZED] (_InterlockedIncrement16,
_InterlockedDecrement16): Declare intrinsic.
* src/atomic_ops/sysdeps/msftc/x86_64.h [_MSC_VER>1400
&& !AO_PREFER_GENERALIZED] (_InterlockedIncrement16,
_InterlockedDecrement16): Likewise.
* src/atomic_ops/sysdeps/msftc/common32_defs.h [_MSC_VER>1400
&& !AO_PREFER_GENERALIZED] (AO_short_fetch_and_add1_full,
AO_short_fetch_and_sub1_full): Implement using intrinsic.
* src/atomic_ops/sysdeps/msftc/x86_64.h [_MSC_VER>=1800
&& !AO_PREFER_GENERALIZED] (AO_char_fetch_and_add_full,
AO_short_fetch_and_add_full): Likewise.

7 years agoReally implement char and/or/xor and short CAS for msftc ARM (VS 2013+)
Ivan Maidanski [Mon, 23 Jan 2017 21:26:23 +0000 (00:26 +0300)]
Really implement char and/or/xor and short CAS for msftc ARM (VS 2013+)
(fix commit 9182c62)

* src/atomic_ops/sysdeps/msftc/common32_defs.h [_M_ARM]
(_InterlockedAnd8, _InterlockedCompareExchange16, _InterlockedOr8,
_InterlockedXor8): Declare intrinsic if _MSC_VER>=1800.
* src/atomic_ops/sysdeps/msftc/common32_defs.h [_M_ARM]
(AO_char_and_full, AO_char_or_full, AO_char_xor_full,
AO_short_fetch_compare_and_swap_full): Implement (using intrinsic) if
_MSC_VER>=1800.

7 years agoImplement char and/or/xor and short CAS for msftc ARM and X86[_64]
Ivan Maidanski [Sat, 21 Jan 2017 06:55:44 +0000 (09:55 +0300)]
Implement char and/or/xor and short CAS for msftc ARM and X86[_64]

* src/atomic_ops/sysdeps/msftc/common32_defs.h [_MSC_VER>1400
&& !_M_ARM] (_InterlockedAnd8, _InterlockedCompareExchange16,
_InterlockedOr8, _InterlockedXor8): Declare intrinsic.
* src/atomic_ops/sysdeps/msftc/x86_64.h [_MSC_VER>1400]
(_InterlockedAnd8, _InterlockedCompareExchange16, _InterlockedOr8,
_InterlockedXor8): Likewise.
* src/atomic_ops/sysdeps/msftc/common32_defs.h [_MSC_VER>1400
&& !_M_ARM] (AO_char_and_full, AO_char_or_full, AO_char_xor_full,
AO_short_fetch_compare_and_swap_full): Implement (using intrinsic).
* src/atomic_ops/sysdeps/msftc/x86_64.h [_MSC_VER>1400]
(AO_char_and_full, AO_char_or_full, AO_char_xor_full,
AO_short_fetch_compare_and_swap_full): Likewise.

7 years agoRemove redundant include windows.h from headers (msftc/x86[_64])
Ivan Maidanski [Fri, 20 Jan 2017 16:23:45 +0000 (19:23 +0300)]
Remove redundant include windows.h from headers (msftc/x86[_64])

* src/atomic_ops/sysdeps/msftc/common32_defs.h: Do not include windows.h
if _MSC_VER > 1400 && AO_USE_INTERLOCKED_INTRINSICS && !_WIN32_WCE.
* src/atomic_ops/sysdeps/msftc/common32_defs.h [!AO_PREFER_GENERALIZED
|| !AO_ASSUME_WINDOWS98] (AO_fetch_and_add_full, AO_fetch_and_add1_full,
AO_fetch_and_sub1_full): Replace LONG to long; remove unnecessary cast
to LONG.
* src/atomic_ops/sysdeps/msftc/common32_defs.h [AO_ASSUME_WINDOWS98]
(AO_fetch_compare_and_swap_full): Likewise.
* src/atomic_ops/sysdeps/msftc/x86_64.h
(AO_int_fetch_compare_and_swap_full): Likewise.
* src/atomic_ops/sysdeps/msftc/x86_64.h [!AO_PREFER_GENERALIZED]
(AO_int_fetch_and_add_full, AO_int_fetch_and_add1_full,
AO_int_fetch_and_sub1_full): Likewise.
* src/atomic_ops/sysdeps/msftc/common32_defs.h [AO_ASSUME_WINDOWS98]
(AO_fetch_compare_and_swap_full): Replace PVOID to void*; remove
unnecessary cast to AO_t.
* src/atomic_ops/sysdeps/msftc/x86_64.h: Remove include windows.h.
* src/atomic_ops/sysdeps/msftc/x86_64.h [!AO_PREFER_GENERALIZED]
(AO_fetch_and_add_full, AO_fetch_and_add1_full, AO_fetch_and_sub1_full):
Replace LONGLONG to __int64; remove unnecessary cast to LONGLONG.
* src/atomic_ops/sysdeps/msftc/x86_64.h
(AO_fetch_compare_and_swap_full): Likewise.

7 years agoAlways define word-wide CAS for x86 (MS VC++ 8 or later)
Ivan Maidanski [Fri, 20 Jan 2017 15:10:05 +0000 (18:10 +0300)]
Always define word-wide CAS for x86 (MS VC++ 8 or later)

Visual Studio 2005 (MS VC++ 8.0) discontinued support of Windows 95.
This patch deprecates AO_ASSUME_WINDOWS98 macro.

* configure.ac (AO_ASSUME_WINDOWS98): Remove AH template.
* doc/README.txt (AO_ASSUME_WINDOWS98): Remove documentation (as
relates only to Win95).
* doc/README_win32.txt (AO_ASSUME_WINDOWS98): Likwise.
* doc/README_win32.txt (AO_ASSUME_VISTA): Update documentation.
* src/Makefile.msft (CFLAGS): Remove "-D AO_ASSUME_WINDOWS98".
* src/Makefile.msft (test_atomic_w95): Remove target.
* src/Makefile.msft (check): Do not call test_atomic_w95; remove the
corresponding printed message.
* src/atomic_ops/sysdeps/msftc/x86.h: Remove AO_ASSUME_WINDOWS98 from
comment.
* src/atomic_ops/sysdeps/msftc/x86.h (AO_ASSUME_WINDOWS98): Define
(implicitly) if _MSC_VER >= 1400.

7 years agoFix test_atomic failure caused unaligned AO_double_t access on x86 (VC++)
Ivan Maidanski [Fri, 20 Jan 2017 08:58:13 +0000 (11:58 +0300)]
Fix test_atomic failure caused unaligned AO_double_t access on x86 (VC++)

Passing an unaligned AO_double_t pointer to AO double-wide primitives
results in an undefined behavior of the latter when running on x86 (or
violation of the corresponding assertion on the alignment).
MS VC++/x86 aligns AO_double_t values on a 4-byte boundary by default.
For the proper alignment, __declspec(align(8)) should be applied to
variables defined in the client code (which uses double-wide AO
primitives).  Unfortunately, the attribute cannot be added to
AO_double_t definition itself because the compiler does not allow the
attribute for function arguments.

This patch introduces AO_DOUBLE_ALIGN attribute for use by clients of
the double-wide AO primitives (and, thus, AO_stack clients).
Matters only Visual Studio compiler for X86.
The inner clients (atomic_ops_malloc, test_atomic, test_stack) are
updated to use this attribute.

* doc/README_win32.txt [x86] (AO_DOUBLE_ALIGN): Document.
* src/atomic_ops/sysdeps/generic_pthread.h (AO_DOUBLE_ALIGN): Define
(as empty).
* src/atomic_ops/sysdeps/standard_ao_double_t.h [!_WIN64 && _WIN32
&& !__GNUC__ && _MSC_VER] (AO_DOUBLE_ALIGN): Define as declspec
align(8); document it.
* src/atomic_ops/sysdeps/standard_ao_double_t.h [!AO_DOUBLE_ALIGN]
(AO_DOUBLE_ALIGN): Define as empty (otherwise).
* src/atomic_ops_stack.h [AO_USE_ALMOST_LOCK_FREE && !AO_DOUBLE_ALIGN]
(AO_DOUBLE_ALIGN): Likewise.
* src/atomic_ops_malloc.c (AO_free_list): Use AO_DOUBLE_ALIGN attribute.
* tests/test_stack.c (the_list): Likewise.
* src/atomic_ops_stack.h [!AO_USE_ALMOST_LOCK_FREE] (AO_stack_t):
Document AO_DOUBLE_ALIGN usage (by clients).
* tests/test_atomic_include.template (test_atomicXX): Use
AO_DOUBLE_ALIGN attribute for old_w and w double-wide local variables
(to avoid alignment assertion violation or AO primitives undefined
behavior on x86 if the test code is compiled by VC++).

7 years agoAdd assertion that double-wide CAS target is aligned (msftc/x86[_64])
Ivan Maidanski [Fri, 20 Jan 2017 00:03:54 +0000 (03:03 +0300)]
Add assertion that double-wide CAS target is aligned (msftc/x86[_64])

* src/atomic_ops/sysdeps/msftc/x86.h [AO_ASSUME_VISTA]
(AO_double_compare_and_swap_full): Add assert() that addr pointer is
aligned according to the size of AO_double_t.
* src/atomic_ops/sysdeps/msftc/x86_64.h [AO_CMPXCHG16B_AVAILABLE
&& _MSC_VER>=1500] (AO_compare_double_and_swap_double_full): Likewise.

7 years agoFix turn off optimization in case of configure --enable-gcov
Ivan Maidanski [Thu, 19 Jan 2017 07:03:59 +0000 (10:03 +0300)]
Fix turn off optimization in case of configure --enable-gcov
(fix commit 0d0a16d)

* configure.ac [enable_gcov] (CFLAGS): Change sed regular expression
to avoid [] (as they are not properly handled during autogen), and to
also filter out -Os and -Ofast (-O0 is ignored).

7 years agoAdd asm-based char/short/int CAS implementation for gcc/x86[_64]
Ivan Maidanski [Mon, 16 Jan 2017 22:48:48 +0000 (01:48 +0300)]
Add asm-based char/short/int CAS implementation for gcc/x86[_64]

* src/atomic_ops/sysdeps/gcc/x86.h [!AO_GCC_ATOMIC_TEST_AND_SET]
(AO_char_and_full, AO_char_or_full, AO_char_xor_full, AO_short_and_full,
AO_short_or_full, AO_short_xor_full): Do not define if
AO_PREFER_GENERALIZED.
* src/atomic_ops/sysdeps/gcc/x86.h [!AO_GCC_ATOMIC_TEST_AND_SET]
(AO_char_fetch_compare_and_swap_full,
AO_short_fetch_compare_and_swap_full): Implement.
* src/atomic_ops/sysdeps/gcc/x86.h [!AO_GCC_ATOMIC_TEST_AND_SET
&& __x86_64__ && !__ILP32__] (AO_int_fetch_compare_and_swap_full):
Likewise.
* src/atomic_ops/sysdeps/gcc/x86.h [!AO_GCC_ATOMIC_TEST_AND_SET
&& __x86_64__ && !__ILP32__] (AO_int_fetch_and_add_full,
AO_int_and_full, AO_int_or_full, AO_int_xor_full): Do not define if
AO_PREFER_GENERALIZED.

7 years agoImplement int CAS/inc/dec for msftc/x86_64
Ivan Maidanski [Mon, 16 Jan 2017 21:34:48 +0000 (00:34 +0300)]
Implement int CAS/inc/dec for msftc/x86_64

* src/atomic_ops/sysdeps/msftc/x86_64.h (_InterlockedExchangeAdd):
Declare (as intrinsic) only unless AO_PREFER_GENERALIZED.
* src/atomic_ops/sysdeps/msftc/x86_64.h (_InterlockedCompareExchange):
Declare intrinsic.
* src/atomic_ops/sysdeps/msftc/x86_64.h [!AO_PREFER_GENERALIZED]
(_InterlockedIncrement, _InterlockedDecrement): Likewise.
* src/atomic_ops/sysdeps/msftc/x86_64.h
(AO_int_fetch_compare_and_swap_full): Define inline function (using
_InterlockedCompareExchange).
* src/atomic_ops/sysdeps/msftc/x86_64.h (AO_int_fetch_and_add_full):
Do not define if AO_PREFER_GENERALIZED.
* src/atomic_ops/sysdeps/msftc/x86_64.h [!AO_PREFER_GENERALIZED]
(AO_int_fetch_and_add1_full, AO_int_fetch_and_sub1_full): Define inline
function _InterlockedIncrement/Decrement).

7 years agoRemove outdated FIXME in msftc/arm.h about _InterlockedOps memory barrier
Ivan Maidanski [Mon, 16 Jan 2017 20:55:01 +0000 (23:55 +0300)]
Remove outdated FIXME in msftc/arm.h about _InterlockedOps memory barrier

* src/atomic_ops/sysdeps/msftc/arm.h: Remove FIXME about memory barrier
of _InterlockedOps (they have the correct one according to the MSDN).

8 years agoAdd configure --enable-gcov option (enable code coverage analysis)
Ivan Maidanski [Fri, 13 Jan 2017 17:47:35 +0000 (20:47 +0300)]
Add configure --enable-gcov option (enable code coverage analysis)

* configure.ac (gcov): New --enable-* option.
* configure.ac [enable_gcov] (CFLAGS): Add "--coverage" option; filter
out "-O" options.

8 years ago.gitignore: Ignore gcov c/h output files
Ivan Maidanski [Fri, 13 Jan 2017 17:31:12 +0000 (20:31 +0300)]
.gitignore: Ignore gcov c/h output files

8 years agoFix 'atomic_load/store symbols undefined' error on OS X 10.8 i386
Ivan Maidanski [Thu, 12 Jan 2017 20:36:18 +0000 (23:36 +0300)]
Fix 'atomic_load/store symbols undefined' error on OS X 10.8 i386

Issue #23 (libatomic_ops).

* src/atomic_ops/sysdeps/gcc/x86.h [AO_GCC_ATOMIC_TEST_AND_SET
&& !__x86_64__ && __APPLE__ && __MACH__]: Include AvailabilityMacros.h
unless MAC_OS_X_VERSION_MIN_REQUIRED already defined.
* src/atomic_ops/sysdeps/gcc/x86.h [AO_GCC_ATOMIC_TEST_AND_SET
&& !__x86_64__ && __APPLE__ && __MACH__
&& MAC_OS_X_VERSION_MIN_REQUIRED < 1090] (AO_SKIPATOMIC_double_load,
AO_SKIPATOMIC_double_load_acquire, AO_SKIPATOMIC_double_store,
AO_SKIPATOMIC_double_store_release): Define.

8 years agoFix AO_stack build failure on OS X 10.7 because of missing CAS (x86)
Ivan Maidanski [Wed, 28 Dec 2016 23:02:27 +0000 (02:02 +0300)]
Fix AO_stack build failure on OS X 10.7 because of missing CAS (x86)
(fix commit 7a6a7cc)

Issue #23 (libatomic_ops).

* src/atomic_ops/sysdeps/gcc/x86.h [AO_GCC_ATOMIC_TEST_AND_SET
&& __APPLE_CC__] (AO_GCC_FORCE_HAVE_CAS): Define also for arch i386;
refine comment.

8 years agoFix AO_stack build failure on OS X 10.7 because of missing CAS (x86_64)
Ivan Maidanski [Wed, 28 Dec 2016 20:43:05 +0000 (23:43 +0300)]
Fix AO_stack build failure on OS X 10.7 because of missing CAS (x86_64)

Issue #23 (libatomic_ops).

* src/atomic_ops/sysdeps/gcc/x86.h [AO_GCC_ATOMIC_TEST_AND_SET
&& __APPLE_CC__ && __x86_64__] (AO_GCC_FORCE_HAVE_CAS): Define (to
workaround missing __GCC_HAVE_SYNC_COMPARE_AND_SWAP_<n> predefined
macro in Apple clang-425/x86_64); add comment.

8 years ago.gitignore: Properly ignore sym-linked folders of code analysis tools
Ivan Maidanski [Wed, 14 Dec 2016 16:29:58 +0000 (19:29 +0300)]
.gitignore: Properly ignore sym-linked folders of code analysis tools
(fix commit fa3ebc3)

8 years ago.gitignore: Ignore folders and files of static code analysis tools
Ivan Maidanski [Mon, 12 Dec 2016 21:46:56 +0000 (00:46 +0300)]
.gitignore: Ignore folders and files of static code analysis tools

8 years agoSupport CFLAGS_EXTRA to pass extra user-defined compiler flags (configure)
Ivan Maidanski [Fri, 9 Dec 2016 21:31:25 +0000 (00:31 +0300)]
Support CFLAGS_EXTRA to pass extra user-defined compiler flags (configure)

* configure.ac: Add AC_SUBST(CFLAGS_EXTRA).
* src/Makefile.am (CFLAGS): Append $(CFLAGS_EXTRA).
* tests/Makefile.am (CFLAGS): Likewise.

8 years agoTravis CI configuration: turn on assertion checking
Ivan Maidanski [Wed, 7 Dec 2016 23:00:12 +0000 (02:00 +0300)]
Travis CI configuration: turn on assertion checking

8 years agoEliminate 'printf format specifies type void*' GCC pedantic warnings
Ivan Maidanski [Wed, 7 Dec 2016 09:35:47 +0000 (12:35 +0300)]
Eliminate 'printf format specifies type void*' GCC pedantic warnings

This commit also eliminates 'cast from pointer to integer' compiler
warnings and '32-bit value shift followed by expansion to 64-bit'
static analysis tool warning.

* src/atomic_ops_malloc.c [AO_TRACE_MALLOC] (AO_malloc, AO_free):
Use %p (instead of %x) format specifier to print pthread_self() value
(and cast pthread_self() to void*).
* src/atomic_ops_malloc.c [AO_TRACE_MALLOC] (AO_malloc): Cast result+1
to void* (to match %p printf format specifier).
* src/atomic_ops_malloc.c [AO_TRACE_MALLOC] (AO_free): Use "UL" suffix
for 1 and remove the cast to unsigned long (instead of performing left
shift of an integer value and extending the result to unsigned long).

8 years agoWorkaround 'uninitialized memory use' MemorySanitizer warning (test_atomic)
Ivan Maidanski [Mon, 5 Dec 2016 17:26:16 +0000 (20:26 +0300)]
Workaround 'uninitialized memory use' MemorySanitizer warning (test_atomic)

* tests/test_atomic_include.template (test_atomicXX): Ensure old_w is
always initialized before AO_double_storeXX; add comment about MSan
false warning.

8 years agoUpdate ChangeLog file
Ivan Maidanski [Sat, 26 Nov 2016 18:58:00 +0000 (21:58 +0300)]
Update ChangeLog file

8 years agoUpdate ChangeLog file (v7.4 changes)
Ivan Maidanski [Sat, 26 Nov 2016 18:49:24 +0000 (21:49 +0300)]
Update ChangeLog file (v7.4 changes)

8 years agoWorkaround a bug in double-wide intrinsics of Clang/x64 with ASan enabled
Ivan Maidanski [Thu, 24 Nov 2016 17:13:06 +0000 (20:13 +0300)]
Workaround a bug in double-wide intrinsics of Clang/x64 with ASan enabled

As of clang-3.8, double-wide arguments are incorrectly passed to
atomic intrinsic operations for x64 target if Address Sanitizer is
enabled.

* src/atomic_ops.h [__has_feature(address_sanitizer)]
(AO_ADDRESS_SANITIZER): New internal macro.
* src/atomic_ops/sysdeps/gcc/x86.h [AO_GCC_ATOMIC_TEST_AND_SET
&& __clang__ && __x86_64__ && !__ILP32__]
(AO_SKIPATOMIC_double_compare_and_swap_ANY, AO_SKIPATOMIC_double_load,
AO_SKIPATOMIC_double_load_acquire, AO_SKIPATOMIC_double_store,
AO_SKIPATOMIC_double_store_release): Define also if AO_ADDRESS_SANITIZER;
update comment.

8 years agoCode refactoring of Clang double-wide intrinsic workarounds (gcc/x86)
Ivan Maidanski [Wed, 23 Nov 2016 10:55:00 +0000 (13:55 +0300)]
Code refactoring of Clang double-wide intrinsic workarounds (gcc/x86)
(fix commits 9803386f6a1b68eb6d4fd)

* src/atomic_ops/sysdeps/gcc/generic.h [AO_HAVE_DOUBLE_PTR_STORAGE
&& !AO_HAVE_double_store] (AO_double_store): Do not define if
AO_SKIPATOMIC_double_store.
* src/atomic_ops/sysdeps/gcc/generic.h [AO_HAVE_DOUBLE_PTR_STORAGE
&& !AO_HAVE_double_store_release] (AO_double_store_release): Do not
define if AO_SKIPATOMIC_double_load.
* src/atomic_ops/sysdeps/gcc/x86.h [AO_GCC_ATOMIC_TEST_AND_SET
&& __clang__ && !__x86_64__ && !__APPLE_CC__ && !__CYGWIN__
&& !AO_PREFER_BUILTIN_ATOMICS] (AO_SKIPATOMIC_double_load,
AO_SKIPATOMIC_double_load_acquire, AO_SKIPATOMIC_double_store,
AO_SKIPATOMIC_double_store_release): Define internal macro (undefined
at the end of file).
* src/atomic_ops/sysdeps/gcc/x86.h [AO_GCC_ATOMIC_TEST_AND_SET
&& (__clang__ && !__x86_64__ && !__APPLE_CC__ && !__CYGWIN__
&& !AO_PREFER_BUILTIN_ATOMICS) || (__APPLE_CC__ && __x86_64__))]
(AO_SKIPATOMIC_double_compare_and_swap_ANY): Move definition here
(remove at other places in this file); undefine at the end of the file.
* src/atomic_ops/sysdeps/gcc/x86.h [AO_GCC_ATOMIC_TEST_AND_SET]: Check
AO_SKIPATOMIC_double_compare_and_swap_ANY instead of checking multiple
macros to detect whether a workaround for the CAS (and others)
double-wide operations is needed.

8 years agoUndefine internal macros that are defined solely for generic.h
Ivan Maidanski [Wed, 23 Nov 2016 17:02:39 +0000 (20:02 +0300)]
Undefine internal macros that are defined solely for generic.h
(fix commits 03a0465f3c52619c66f7a4d3)

* src/atomic_ops/sysdeps/gcc/aarch64.h (AO_SKIPATOMIC_double_load,
AO_SKIPATOMIC_double_load_acquire): Undefine at the end of file.
* src/atomic_ops/sysdeps/gcc/arm.h (AO_SKIPATOMIC_ANY_and_ANY,
AO_SKIPATOMIC_ANY_or_ANY, AO_SKIPATOMIC_ANY_xor_ANY,
AO_SKIPATOMIC_char_store, AO_SKIPATOMIC_char_store_release,
AO_SKIPATOMIC_int_store, AO_SKIPATOMIC_int_store_release,
AO_SKIPATOMIC_short_store, AO_SKIPATOMIC_short_store_release,
AO_SKIPATOMIC_store, AO_SKIPATOMIC_store_release): Likewise.

8 years agoFix GCC -Wpedantic checking in configure
Ivan Maidanski [Tue, 22 Nov 2016 01:48:41 +0000 (04:48 +0300)]
Fix GCC -Wpedantic checking in configure
(fix commit 96a8fd9)

* configure.ac [GCC] (ac_cv_cc_pedantic): Compile code that contains
"extern int quiet" (since the translation unit cannot be empty).

8 years agoReport gcc/clang pedantic warnings (configure)
Ivan Maidanski [Tue, 22 Nov 2016 01:18:08 +0000 (04:18 +0300)]
Report gcc/clang pedantic warnings (configure)

* configure.ac [GCC] (WPEDANTIC): New variable (set to
"-Wpedantic -Wno-long-long" if supported by the compiler).
* configure.ac [GCC] (CFLAGS): Add $WPEDANTIC.

8 years agoRefine AO_nop_write comment for ARM big.LITTLE architecture
Ivan Maidanski [Fri, 18 Nov 2016 15:22:00 +0000 (18:22 +0300)]
Refine AO_nop_write comment for ARM big.LITTLE architecture

* src/atomic_ops/sysdeps/gcc/arm.h [!AO_UNIPROCESSOR && AO_ARM_HAVE_DMB
&& !AO_PREFER_BUILTIN_ATOMICS] (AO_nop_write): Refine comment about
"dmb ishst" for big.LITTLE architecture.

8 years agoFix powerpc detection on AIX (gcc)
Tobias Leich [Thu, 17 Nov 2016 22:05:42 +0000 (01:05 +0300)]
Fix powerpc detection on AIX (gcc)

GCC/powerpc-ibm-aix does not define any of __powerpc__, __ppc__,
__PPC__, __powerpc64__, __ppc64__; but it does define _ARCH_PPC (and
_POWER).

* src/atomic_ops.h [_ARCH_PPC]: Include gcc/powerpc.h.

8 years agoDo not define print_list() unless used (tests)
Ivan Maidanski [Mon, 14 Nov 2016 20:09:57 +0000 (23:09 +0300)]
Do not define print_list() unless used (tests)

* tests/test_malloc.c (print_list): Define only if DEBUG_RUN_ONE_TEST.
* tests/test_stack.c (print_list): Define only if VERBOSE.

8 years agoFix indentation of #endif in s390.h
Ivan Maidanski [Sat, 12 Nov 2016 06:47:57 +0000 (09:47 +0300)]
Fix indentation of #endif in s390.h
(fix commit c2edeab)

* src/atomic_ops/sysdeps/gcc/s390.h (AO_fetch_compare_and_swap_full):
Adjust indentation of #endif.

8 years agoUpdate AUTHORS file (add 'Tobias Leich')
Ivan Maidanski [Thu, 10 Nov 2016 09:28:35 +0000 (12:28 +0300)]
Update AUTHORS file (add 'Tobias Leich')

8 years agoImplement fetch-CAS for s390[x] (gcc)
Tobias Leich [Thu, 10 Nov 2016 08:02:56 +0000 (09:02 +0100)]
Implement fetch-CAS for s390[x] (gcc)

* src/atomic_ops/sysdeps/gcc/s390.h (AO_compare_and_swap_full): Do not
define if AO_GENERALIZE_ASM_BOOL_CAS.
* src/atomic_ops/sysdeps/gcc/s390.h (AO_fetch_compare_and_swap_full):
Implement; remove TODO item.

8 years agoUpdate ChangeLog file
Ivan Maidanski [Tue, 8 Nov 2016 17:24:53 +0000 (20:24 +0300)]
Update ChangeLog file

8 years agoUpdate ChangeLog file (v7.4 changes)
Ivan Maidanski [Tue, 8 Nov 2016 06:04:28 +0000 (09:04 +0300)]
Update ChangeLog file (v7.4 changes)

8 years agoUpdate ChangeLog file (v7.2 - v7.4 changes only)
Ivan Maidanski [Fri, 4 Nov 2016 21:34:00 +0000 (00:34 +0300)]
Update ChangeLog file (v7.2 - v7.4 changes only)
(Cherry-pick commit 03a1704 from 'release-7_4' branch.)

8 years agoRemove spaces at EOLn in asm code
Ivan Maidanski [Tue, 8 Nov 2016 05:31:21 +0000 (08:31 +0300)]
Remove spaces at EOLn in asm code

* src/atomic_ops/sysdeps/gcc/hexagon.h (AO_test_and_set,
AO_compare_and_swap, AO_fetch_compare_and_swap): Remove spaces
preceding "\n".
* src/atomic_ops/sysdeps/gcc/mips.h (AO_nop_full, AO_fetch_and_add,
AO_test_and_set, AO_compare_and_swap): Likewise.
* src/atomic_ops/sysdeps/gcc/hexagon.h (AO_fetch_and_add,
AO_test_and_set, AO_fetch_compare_and_swap): Align comments.

8 years agoFix (improve) AO_REQUIRE_CAS description in README
Ivan Maidanski [Wed, 2 Nov 2016 08:15:15 +0000 (11:15 +0300)]
Fix (improve) AO_REQUIRE_CAS description in README

* doc/README.txt: Document AO_REQUIRE_CAS better (replace
"compare-and-swap" with "AO_compare_and_swap*").

8 years agoAdd *_and/or/xor* and *_[fetch_]compare_and_swap* tests to test_atomic
Ivan Maidanski [Tue, 1 Nov 2016 09:18:33 +0000 (12:18 +0300)]
Add *_and/or/xor* and *_[fetch_]compare_and_swap* tests to test_atomic

Previously, only AO_and/or/xor and AO_[fetch]_CAS tests (for AO_t)
existed in test_atomic.

* tests/test_atomic_include.template (test_atomicXX): Add minimal
testing of AO_short_compare_and_swapXX, AO_short_orXX, AO_short_xorXX,
AO_short_andXX, AO_short_fetch_compare_and_swapXX,
AO_char_compare_and_swapXX, AO_char_orXX, AO_char_xorXX, AO_char_andXX,
AO_char_fetch_compare_and_swapXX, AO_int_compare_and_swapXX,
AO_int_orXX, AO_int_xorXX, AO_int_andXX,
AO_int_fetch_compare_and_swapXX.

8 years agoFix reporting about missing and/or/xor_dd_acquire_read (test_atomic)
Ivan Maidanski [Tue, 1 Nov 2016 08:25:39 +0000 (11:25 +0300)]
Fix reporting about missing and/or/xor_dd_acquire_read (test_atomic)

AO_XSIZE_and/or/xor_dd_acquire_read are meaningless and not implemented,
thus their absence is not reported in the tests.

* tests/test_atomic_include.template [!AO_HAVE_orXX] (test_atomicXX):
Do not call MISSING(AO_or) if all AO_HAVE_or* excluding
AO_HAVE_or_dd_acquire_read are not defined.
* tests/test_atomic_include.template [!AO_HAVE_xorXX] (test_atomicXX):
Do not call MISSING(AO_xor) if all AO_HAVE_xor* excluding
AO_HAVE_xor_dd_acquire_read are not defined.
* tests/test_atomic_include.template [!AO_HAVE_andXX] (test_atomicXX):
Do not call MISSING(AO_and) if all AO_HAVE_and* excluding
AO_HAVE_and_dd_acquire_read are not defined.

8 years agoFix missing double_compare_and_swap_dd_acquire_read
Ivan Maidanski [Tue, 1 Nov 2016 08:12:21 +0000 (11:12 +0300)]
Fix missing double_compare_and_swap_dd_acquire_read

This matters only if AO_double_compare_and_swap[_acquire_read] actually
defined in generalize.h too.

* src/atomic_ops/generalize.h
[!AO_HAVE_double_compare_and_swap_dd_acquire_read]
(AO_double_compare_and_swap_dd_acquire_read): Define (same as definition
as auto-generated in generalize-small.h).

8 years agoWorkaround 'value of MAP_ANON unknown' cppcheck info message
Ivan Maidanski [Wed, 26 Oct 2016 08:57:13 +0000 (11:57 +0300)]
Workaround 'value of MAP_ANON unknown' cppcheck info message
(fix commit 4c303bc)

* src/atomic_ops_malloc.c [USE_MMAP_ANON && CPPCHECK] (OPT_MAP_ANON):
Define to immediate non-zero value (taken from Linux libc) instead of
MAP_ANON (because the latter is used in ifdef).

8 years agoSuppress 'ISO C does not support __int128 type' GCC/Clang pedantic warning
Ivan Maidanski [Tue, 25 Oct 2016 08:13:05 +0000 (11:13 +0300)]
Suppress 'ISO C does not support __int128 type' GCC/Clang pedantic warning

* src/atomic_ops/sysdeps/standard_ao_double_t.h [!__ILP32__
&& (__GNUC__ >= 4.7 ||  __clang__ >= 3.6)] (double_ptr_storage): Turn
off pedantic warnings reporting (for this typedef only).

8 years agoFix test_malloc failure if CPPCHECK is defined
Ivan Maidanski [Tue, 25 Oct 2016 07:31:29 +0000 (10:31 +0300)]
Fix test_malloc failure if CPPCHECK is defined
(fix commit c1a7aad)

* src/atomic_ops_malloc.c [USE_MMAP_ANON && MAP_ANONYMOUS]
(OPT_MAP_ANON): Define to MAP_ANON (instead of 0) if CPPCHECK.

8 years agoWorkaround 'function is never used' cppcheck style warnings
Ivan Maidanski [Tue, 25 Oct 2016 07:13:35 +0000 (10:13 +0300)]
Workaround 'function is never used' cppcheck style warnings

* src/atomic_ops.h [AO_CAN_EMUL_CAS]: Include emul_cas.h also if
CPPCHECK (to define AO_store_full as AO_store_full_emulation).
* tests/test_atomic_include.template [CPPCHECK] (list_atomicXX,
char_list_atomicXX, short_list_atomicXX, int_list_atomicXX,
double_list_atomicXX): Declare function.
* tests/test_atomic_include.template test_atomicXX (test_atomicXX):
Call list_atomicXX, char_list_atomicXX, short_list_atomicXX,
int_list_atomicXX and double_list_atomicXX if CPPCHECK.

8 years agoAdd dd_acquire_read case to test_atomic
Ivan Maidanski [Mon, 24 Oct 2016 22:07:49 +0000 (01:07 +0300)]
Add dd_acquire_read case to test_atomic

* tests/Makefile.am (test_atomic_include.h): Add "_dd_acquire_read"
test generation.
* tests/test_atomic.c [!AO_NO_PTHREADS || !AO_USE_PTHREAD_DEFS] (main):
Call test_atomic_dd_acquire_read().

8 years agoHide AO_locks symbol
Ivan Maidanski [Mon, 24 Oct 2016 21:53:20 +0000 (00:53 +0300)]
Hide AO_locks symbol

* src/atomic_ops.c [!_MSC_VER && !__MINGW32__] (AO_locks): Define as
static.

8 years agoWorkaround 'value of macro is unknown' cppcheck information messages
Ivan Maidanski [Tue, 18 Oct 2016 07:44:10 +0000 (10:44 +0300)]
Workaround 'value of macro is unknown' cppcheck information messages

* src/atomic_ops_malloc.c [USE_MMAP_ANON] (OPT_MAP_ANON): Define to 0
(do not use MAP_ANONYMOUS value) if CPPCHECK.
* src/atomic_ops_malloc.c [SIZE_MAX] (AO_SIZE_MAX): Do not use SIZE_MAX
value if CPPCHECK.

8 years agoMerge branch 'ppc-aix'
Ivan Maidanski [Mon, 17 Oct 2016 05:35:43 +0000 (08:35 +0300)]
Merge branch 'ppc-aix'

8 years agoFix 'variable new value is never used' cppcheck style warning
Ivan Maidanski [Mon, 17 Oct 2016 05:22:53 +0000 (08:22 +0300)]
Fix 'variable new value is never used' cppcheck style warning

Assertion for v value after fetch_and_sub1(&v) is added.

* tests/test_atomic_include.template (test_atomicXX): Call TA_assert
for s, b, zz values after they are decremented (use volatile pointer to
avoid "condition is always true" compiler warning).

8 years agoWorkaround 'overflow in pointer subtraction' cppcheck warning
Ivan Maidanski [Mon, 17 Oct 2016 05:08:18 +0000 (08:08 +0300)]
Workaround 'overflow in pointer subtraction' cppcheck warning

* src/atomic_ops_malloc.c (AO_free): Do not perform subtraction from
"p" argument if its value is null; change type of "base" local variable
from char* to AO_t*.

8 years agoEliminate 'ISO C90 does not support long long' compiler pedantic warning
Ivan Maidanski [Tue, 11 Oct 2016 14:52:54 +0000 (17:52 +0300)]
Eliminate 'ISO C90 does not support long long' compiler pedantic warning

Long (32-bit) type is sufficient to represent time delta (duration)
in test_stack.

* tests/test_stack.c (get_msecs): Change return type from long long
to unsigned long (use lowest 32 bits of time value).
* tests/test_stack.c (main): Change type of start_time local variable
to unsigned long; remove redundant type cast.

8 years agoEliminate 'cast to long from void*' compiler warning in test_atomic
Ivan Maidanski [Wed, 12 Oct 2016 06:17:01 +0000 (09:17 +0300)]
Eliminate 'cast to long from void*' compiler warning in test_atomic

* tests/run_parallel.h (AO_PTRDIFF_T): Define to ptrdiff_t for all
targets.

8 years agoFix missing printed value names (test_stack)
Ivan Maidanski [Tue, 11 Oct 2016 14:45:01 +0000 (17:45 +0300)]
Fix missing printed value names (test_stack)

* tests/test_stack.c [VERBOSE] (main): Print value name along with the
value itself; print "ms" for time value; remove extra get_msecs() call.

8 years agoEliminate 'scope of variable can be reduced' cppcheck warning in AO_stack
Ivan Maidanski [Tue, 11 Oct 2016 07:01:35 +0000 (10:01 +0300)]
Eliminate 'scope of variable can be reduced' cppcheck warning in AO_stack

* src/atomic_ops_stack.c [AO_HAVE_compare_and_swap_double]
(AO_stack_push_release): Move local variable declaration to the inner
scope where the variable is actually used.

8 years agoUpdate AUTHORS file
Ivan Maidanski [Mon, 10 Oct 2016 20:15:06 +0000 (23:15 +0300)]
Update AUTHORS file

8 years agoSupport AIX/ppc (gcc)
Jean Girardet [Mon, 10 Oct 2016 08:04:24 +0000 (11:04 +0300)]
Support AIX/ppc (gcc)

* src/atomic_ops/sysdeps/gcc/powerpc.h (AO_PPC_L, AO_PPC_BR_A): New
internal macros (undefined at the end of file); definition depends on
_AIX macro presence.
* src/atomic_ops/sysdeps/gcc/powerpc.h (AO_load_acquire,
AO_test_and_set, AO_compare_and_swap, AO_fetch_compare_and_swap,
AO_fetch_and_add): Use AO_PPC_L for label definitions; use AO_PPC_BR_A
to specify jump target.

8 years agoCode refactoring of gcc/powerpc.h to avoid code duplication
Ivan Maidanski [Fri, 7 Oct 2016 16:27:09 +0000 (19:27 +0300)]
Code refactoring of gcc/powerpc.h to avoid code duplication

* src/atomic_ops/sysdeps/gcc/powerpc.h (AO_PPC_LD, AO_PPC_LxARX,
AO_PPC_CMPx, AO_PPC_STxCXd, AO_PPC_LOAD_CLOBBER): New internal macros
(undefined at the end of the file).
* src/atomic_ops/sysdeps/gcc/powerpc.h (AO_T_IS_INT): Move definition
upper (to have single check of __ppc64__).
* src/atomic_ops/sysdeps/gcc/powerpc.h (AO_load_acquire): Use AO_PPC_LD,
AO_PPC_LOAD_CLOBBER (and eliminate code duplication).
* src/atomic_ops/sysdeps/gcc/powerpc.h (AO_test_and_set,
AO_compare_and_swap, AO_fetch_compare_and_swap, AO_fetch_and_add): Use
AO_PPC_LxARX, AO_PPC_CMPx, AO_PPC_STxCXd (and eliminate code
duplication).