platform/upstream/libatomic_ops.git
7 years agoTravis CI: Test also Intel x32 builds (Linux)
Ivan Maidanski [Thu, 23 Mar 2017 18:08:18 +0000 (21:08 +0300)]
Travis CI: Test also Intel x32 builds (Linux)

7 years agoTravis CI: Test also 32-bit, 64-bit builds with clang-4.0, gcc-5 (Linux)
Ivan Maidanski [Thu, 23 Mar 2017 18:02:46 +0000 (21:02 +0300)]
Travis CI: Test also 32-bit, 64-bit builds with clang-4.0, gcc-5 (Linux)

7 years agoTravis CI: Use inline format for 'packages' and 'sources'
Ivan Maidanski [Thu, 23 Mar 2017 17:57:48 +0000 (20:57 +0300)]
Travis CI: Use inline format for 'packages' and 'sources'
(refactoring of commit 6098194)

7 years agoTravis CI: Test also with -D _FORTIFY_SOURCE, -std=c11, -std=c89
Ivan Maidanski [Thu, 23 Mar 2017 07:37:59 +0000 (10:37 +0300)]
Travis CI: Test also with -D _FORTIFY_SOURCE, -std=c11, -std=c89

7 years agoTravis CI: Use -march=native for MSan/UBSan, musl-gcc, no atomic-intrinsics
Ivan Maidanski [Thu, 23 Mar 2017 07:29:45 +0000 (10:29 +0300)]
Travis CI: Use -march=native for MSan/UBSan, musl-gcc, no atomic-intrinsics

7 years agoTravis CI: Use CSA v4.0 (clang-4.0)
Ivan Maidanski [Thu, 23 Mar 2017 07:27:16 +0000 (10:27 +0300)]
Travis CI: Use CSA v4.0 (clang-4.0)

7 years agoTravis CI: Use inline format of 'addons' and 'env'
Ivan Maidanski [Thu, 23 Mar 2017 07:23:10 +0000 (10:23 +0300)]
Travis CI: Use inline format of 'addons' and 'env'
(code refactoring of commits d808080, 0f3f282)

7 years agoEliminate 'implicit declaration of close' warning in 'strict ANSI' mode
Ivan Maidanski [Thu, 23 Mar 2017 06:52:55 +0000 (09:52 +0300)]
Eliminate 'implicit declaration of close' warning in 'strict ANSI' mode

* src/atomic_ops_malloc.c [HAVE_MMAP && !USE_MMAP_ANON]: Include
unistd.h (to declare "close" function).

7 years agoFix block_all_signals compilation in 'strict ANSI' mode
Ivan Maidanski [Thu, 23 Mar 2017 06:41:37 +0000 (09:41 +0300)]
Fix block_all_signals compilation in 'strict ANSI' mode

* src/atomic_ops.c [(__linux__ || __GLIBC__ || __GNU__)
&& !AO_USE_NO_SIGNALS] (_GNU_SOURCE): Define (before including system
headers).

7 years agoTravis CI: Also test with musl-gcc (Linux)
Ivan Maidanski [Tue, 21 Mar 2017 09:01:26 +0000 (12:01 +0300)]
Travis CI: Also test with musl-gcc (Linux)

7 years agoTravis CI: Do not specify compiler for OS X builds
Ivan Maidanski [Mon, 20 Mar 2017 22:43:09 +0000 (01:43 +0300)]
Travis CI: Do not specify compiler for OS X builds

7 years agoTravis CI: Run CSA in a standalone test configuration
Ivan Maidanski [Mon, 20 Mar 2017 22:29:34 +0000 (01:29 +0300)]
Travis CI: Run CSA in a standalone test configuration

7 years agoTravis CI: Specify test configurations using 'matrix:include'
Ivan Maidanski [Mon, 20 Mar 2017 22:22:20 +0000 (01:22 +0300)]
Travis CI: Specify test configurations using 'matrix:include'
(code refactoring)

Also, require "sudo" only where needed.

7 years agoFix AO_SIZE_MAX definition (Linux/musl-gcc)
Ivan Maidanski [Wed, 15 Mar 2017 08:27:48 +0000 (11:27 +0300)]
Fix AO_SIZE_MAX definition (Linux/musl-gcc)
(fix commit b1365bd)

* src/atomic_ops_malloc.c [SIZE_MAX && !CPPCHECK] (AO_SIZE_MAX): Cast
SIZE_MAX to size_t explicitly (to workaround incorrect definition
of SIZE_MAX - e.g. it is defined as ~0ULL in musl-tools which is not
correct for a 32-bit target).

7 years agoRefine configure messages when checking for compiler options
Ivan Maidanski [Wed, 15 Mar 2017 08:22:26 +0000 (11:22 +0300)]
Refine configure messages when checking for compiler options

* configure.ac (AC_MSG_CHECKING, AC_MSG_RESULT): Refine message when
checking for a compiler option support (replace "gcc" with "compiler"),
and when reporting PIC option required; put string in [].
* configure.ac (AC_MSG_RESULT): Do not put string in quotes.

7 years agoTravis CI: Put a space after '-D', '-U' for cppcheck, clang, gcc
Ivan Maidanski [Fri, 10 Mar 2017 08:22:09 +0000 (11:22 +0300)]
Travis CI: Put a space after '-D', '-U' for cppcheck, clang, gcc
(refactoring of commits 4393a96, 797e428, ff3885c, 76825c7, 106bab9)

7 years agoWorkaround 'obsolescent ftime called' cppcheck style warning (POSIX)
Ivan Maidanski [Thu, 9 Mar 2017 04:53:32 +0000 (07:53 +0300)]
Workaround 'obsolescent ftime called' cppcheck style warning (POSIX)

* tests/test_stack.c [!NO_TIMES && (USE_WINTHREADS
|| AO_USE_WIN32_PTHREADS)] (get_msecs): Use gettimeofday-based
implementation if CPPCHECK.

7 years agoWorkaround 'shifting 32-bit value by 32 bits undefined' cppcheck warning
Ivan Maidanski [Thu, 9 Mar 2017 04:30:35 +0000 (07:30 +0300)]
Workaround 'shifting 32-bit value by 32 bits undefined' cppcheck warning

* src/atomic_ops_malloc.c [__SIZEOF_SIZE_T__==8] (msb): Ignore by
CPPCHECK.

7 years agoDefine CLANG/GNUC_PREREQ macros to check gcc/clang minimum version
Ivan Maidanski [Mon, 6 Mar 2017 04:32:19 +0000 (07:32 +0300)]
Define CLANG/GNUC_PREREQ macros to check gcc/clang minimum version
(code refactoring)

* src/atomic_ops.h (AO_GNUC_PREREQ, AO_CLANG_PREREQ): New internal
macro.
* src/atomic_ops.h (AO_EXPECT_FALSE): Use AO_GNUC_PREREQ() instead of
direct use of __GNUC[_MINOR]__.
* src/atomic_ops.h [__x86_64__] (AO_USE_SYNC_CAS_BUILTIN): Likewise.
* src/atomic_ops/sysdeps/gcc/arm.h (AO_GCC_ATOMIC_TEST_AND_SET):
Likewise.
* src/atomic_ops/sysdeps/gcc/mips.h: Likewise.
* src/atomic_ops/sysdeps/gcc/tile.h: Likewise.
* src/atomic_ops/sysdeps/gcc/x86.h (AO_GCC_ATOMIC_TEST_AND_SET):
Likewise.
* src/atomic_ops/sysdeps/standard_ao_double_t.h (pragma GCC,
double_ptr_storage): Likewise.
* src/atomic_ops.h [!AO_ATTR_NO_SANITIZE_MEMORY]
(AO_ATTR_NO_SANITIZE_MEMORY): Use AO_CLANG_PREREQ() instead of direct
use __clang_major__ and __clang_minor__.
* src/atomic_ops/sysdeps/gcc/arm.h (AO_GCC_ATOMIC_TEST_AND_SET,
AO_ARM_HAVE_LDREXD): Likewise.
* src/atomic_ops/sysdeps/gcc/mips.h: Likewise.
* src/atomic_ops/sysdeps/gcc/tile.h: Likewise.
* src/atomic_ops/sysdeps/gcc/x86.h (AO_GCC_ATOMIC_TEST_AND_SET,
AO_SKIPATOMIC_double_load): Likewise.
* src/atomic_ops/sysdeps/standard_ao_double_t.h (pragma GCC): Likewise.

7 years agoFix missing .exe for test filenames in Makefile (MinGW)
Ivan Maidanski [Wed, 1 Mar 2017 22:50:24 +0000 (01:50 +0300)]
Fix missing .exe for test filenames in Makefile (MinGW)
(fix commits ad82960, 13a17dd, ecd43ca)

* tests/Makefile.am (TESTS, check-without-test-driver): Add $(EXEEXT)
suffix to each item (test).
* tests/Makefile.am (TEST_OBJS): Reorder items (to match the that of
TESTS).
* tests/Makefile.am (check_PROGRAMS): Specify all items explicitly (so
that to have all items without the suffix as before this change).

7 years agoTravis CI: Test also with kernel.org gcc-4.2, gcc-4.6 cross-compilers
Ivan Maidanski [Mon, 27 Feb 2017 18:17:42 +0000 (21:17 +0300)]
Travis CI: Test also with  gcc-4.2, gcc-4.6 cross-compilers
(avr32, cris, sh4, tilegx)

7 years agoAllow alternate CC (CROSS_CC) for AC_TRY_COMPILE (configure)
Ivan Maidanski [Mon, 27 Feb 2017 17:58:28 +0000 (20:58 +0300)]
Allow alternate CC (CROSS_CC) for AC_TRY_COMPILE (configure)

* configure.ac [GCC && CROSS_CC] (CC): Assign to CROSS_CC temporarily
(for AC_TRY_COMPILE); restore original value after last AC_TRY_COMPILE.

7 years agoTravis CI: Test also with other kernel.org gcc-4.9 cross-compilers
Ivan Maidanski [Wed, 22 Feb 2017 21:44:46 +0000 (00:44 +0300)]
Travis CI: Test also with other  gcc-4.9 cross-compilers
(aarch64, alpha, hppa, ia64, m68k, mips[64], powerpc[64], s390x, sparc[64])

7 years agoTravis CI: Move CROSS_ prefix from NOLIBC_ARCH_ABI to GCC_VER variable
Ivan Maidanski [Wed, 22 Feb 2017 20:53:05 +0000 (23:53 +0300)]
Travis CI: Move CROSS_ prefix from NOLIBC_ARCH_ABI to GCC_VER variable
(code refactoring of commit a596be3)

7 years agoTravis CI: Reformat 'env' section (describe each configuration in a line)
Ivan Maidanski [Wed, 22 Feb 2017 15:37:50 +0000 (18:37 +0300)]
Travis CI: Reformat 'env' section (describe each configuration in a line)
(fix commits 641030c, ff3885c)

7 years agoTravis CI: Also test with ARM cross-compiler
Ivan Maidanski [Wed, 22 Feb 2017 06:55:09 +0000 (09:55 +0300)]
Travis CI: Also test with ARM cross-compiler

7 years agoTravis CI: Move cppcheck to parent (home) folder
Ivan Maidanski [Wed, 22 Feb 2017 06:45:48 +0000 (09:45 +0300)]
Travis CI: Move cppcheck to parent (home) folder
(fix commit ff3885c)

7 years agoFix 'Cannot implement CAS_full on this architecture' build error (cris)
Ivan Maidanski [Tue, 21 Feb 2017 21:05:11 +0000 (00:05 +0300)]
Fix 'Cannot implement CAS_full on this architecture' build error (cris)

* src/atomic_ops.h [__cris__ || CRIS] (AO_CAN_EMUL_CAS): Define.
* src/atomic_ops/sysdeps/gcc/cris.h: Add TODO to implement CAS.

7 years agoEliminate 'missing braces around initializer' gcc warning (hppa)
Ivan Maidanski [Tue, 21 Feb 2017 20:38:47 +0000 (23:38 +0300)]
Eliminate 'missing braces around initializer' gcc warning (hppa)

* src/atomic_ops/sysdeps/gcc/hppa.h (AO_TS_INITIALIZER): Add extra
outermost {} braces.

7 years agoUpdate shared libraries version info to differentiate against v7.4.x
Ivan Maidanski [Tue, 21 Feb 2017 08:43:42 +0000 (11:43 +0300)]
Update shared libraries version info to differentiate against v7.4.x

Version info "current" and "age" numbers are incremented, "revision"
number is reset to zero (indicating that programs using the previous
libraries version may use the new version as drop-in replacement).
Thus, version info is 2:0:1 now (both for libatomic_ops.so and
libatomic_ops_gpl.so).

* src/Makefile.am (LIBATOMIC_OPS_VER_INFO, LIBATOMIC_OPS_GPL_VER_INFO):
Change version info from 1:3:0 (used for libatomic_ops v7.4.x releases)
to 2:0:1.

7 years agoFix 'unknown attribute no_sanitize' compiler warning (clang prior to v3.8)
Ivan Maidanski [Mon, 20 Feb 2017 20:30:55 +0000 (23:30 +0300)]
Fix 'unknown attribute no_sanitize' compiler warning (clang prior to v3.8)

* src/atomic_ops.h [!AO_ATTR_NO_SANITIZE_MEMORY && AO_MEMORY_SANITIZER]
(AO_ATTR_NO_SANITIZE_MEMORY): Do not define to no_sanitize attribute
unless clang-3.8+ (or not clang).
* tests/test_atomic_include.template [AO_HAVE_storeXX
&& AO_MEMORY_SANITIZER && AO_PREFER_GENERALIZED] (test_atomicXX):
Initialize x local variable (before AO_storeXX which can be defined
using CAS); add comment.
* tests/test_atomic_include.template [AO_HAVE_short_storeXX
&& AO_MEMORY_SANITIZER && AO_PREFER_GENERALIZED] (test_atomicXX):
Initialize s local variable.
* tests/test_atomic_include.template [AO_HAVE_char_storeXX
&& AO_MEMORY_SANITIZER && AO_PREFER_GENERALIZED] (test_atomicXX):
Initialize b local variable.
* tests/test_atomic_include.template [AO_HAVE_int_storeXX
&& AO_MEMORY_SANITIZER && AO_PREFER_GENERALIZED] (test_atomicXX):
Initialize zz local variable.

7 years agoEliminate 'condition sizeof(long)>4 is always true' cppcheck style warning
Ivan Maidanski [Mon, 20 Feb 2017 19:16:54 +0000 (22:16 +0300)]
Eliminate 'condition sizeof(long)>4 is always true' cppcheck style warning

* src/atomic_ops_malloc.c (msb): Cast (s >> 32) to unsigned int type
before assigning the result to v; check __SIZEOF_SIZE_T__ value (if
defined) to decide whether (s >> 32) is needed; move condition
(sizeof(size_t) > 4) to SIZEOF_SIZE_T_GT_4 macro (to eliminate cppcheck
false report that the condition is always true).

7 years agoFix typo in comments in gcc/arm.h
Ivan Maidanski [Mon, 20 Feb 2017 08:19:54 +0000 (11:19 +0300)]
Fix typo in comments in gcc/arm.h

* src/atomic_ops/sysdeps/gcc/arm.h [!AO_GENERALIZE_ASM_BOOL_CAS]
(AO_compare_and_swap): Fix typo ("succeeded") and add "then" in comment.
* src/atomic_ops/sysdeps/gcc/arm.h [AO_ARM_HAVE_LDREXD]
(AO_double_compare_and_swap): Likewise.

7 years agoWorkaround 'AM_EXTRA_RECURSIVE_TARGETS not found in library' autoconf error
Ivan Maidanski [Mon, 20 Feb 2017 08:10:07 +0000 (11:10 +0300)]
Workaround 'AM_EXTRA_RECURSIVE_TARGETS not found in library' autoconf error
(fix commit 3b7e732)

* Makefile.am (.PHONY): Add check-nolink, check-nolink-local targets.
* Makefile.am (check-nolink): New target (which invokes existing
check-nolink-local in this Makefile and in tests/Makefile).
* configure.ac (AM_EXTRA_RECURSIVE_TARGETS): Remove (this directive
is not supported by autoconf-1.12 and earlier).

7 years agoTravis CI: Run 'make check-without-test-driver' for build with MSan/UBsan
Ivan Maidanski [Sat, 18 Feb 2017 14:46:17 +0000 (17:46 +0300)]
Travis CI: Run 'make check-without-test-driver' for build with MSan/UBsan
(fix commit 8277cbf)

7 years agoTravis CI: Use 'make all' to generate list_atomic.c, test_atomic_include.h
Ivan Maidanski [Sat, 18 Feb 2017 14:35:28 +0000 (17:35 +0300)]
Travis CI: Use 'make all' to generate list_atomic.c, test_atomic_include.h
(fix commits 4393a96, ff3885c)

7 years agoTravis CI: Do not output config.h if CSA_CHECK or CPPCHECK
Ivan Maidanski [Sat, 18 Feb 2017 14:20:05 +0000 (17:20 +0300)]
Travis CI: Do not output config.h if CSA_CHECK or CPPCHECK
(fix commit e6249bb)

7 years agoAdd Makefile target to run all tests without test-driver
Ivan Maidanski [Sat, 18 Feb 2017 07:23:33 +0000 (10:23 +0300)]
Add Makefile target to run all tests without test-driver

This could be used to catch errors reported by MemorySanitizer
(the traditional "make check" shows the tests with MSan errors as
skipped, so it does not lead to a non-zero exit code of make itself).

* tests/Makefile.am (check-without-test-driver): New phony target (to
compile, link and execute all tests not using test-driver).

7 years agoAdd Makefile target (check-nolink) to compile all source without linking
Ivan Maidanski [Sat, 18 Feb 2017 06:21:58 +0000 (09:21 +0300)]
Add Makefile target (check-nolink) to compile all source without linking

Note: it is assumed --enable-shared is not passed to configure.

* Makefile.am (check-nolink-local): New Makefile phony target (just
redirects to "all").
* configure.ac: Define check-nolink by AM_EXTRA_RECURSIVE_TARGETS.
* tests/Makefile.am (TEST_OBJS): New variable (with a list of the test
.o files).
* tests/Makefile.am (check-nolink-local): New Makefile phony target
(forces all tests to be compiled but not linked).

7 years agoRefine documentation in Makefile.msft how to run all tests (MS VC)
Ivan Maidanski [Fri, 17 Feb 2017 20:48:23 +0000 (23:48 +0300)]
Refine documentation in Makefile.msft how to run all tests (MS VC)

* src/Makefile.msft: Refine comment about all tests execution
("make check" is redundant, it is enough to run only "make" to
auto-generate list_atomic.c and test_atomic_include.h).

7 years agoMove libraries version info to the beginning of Makefile.am
Ivan Maidanski [Fri, 17 Feb 2017 20:27:19 +0000 (23:27 +0300)]
Move libraries version info to the beginning of Makefile.am
(code refactoring)

* src/Makefile.am (LIBATOMIC_OPS_VER_INFO, LIBATOMIC_OPS_GPL_VER_INFO):
New variable; add comment about the version update rule.
* src/Makefile.am (libatomic_ops_la_LDFLAGS,
libatomic_ops_gpl_la_LDFLAGS): Use LIBATOMIC_OPS_[GPL_]VER_INFO
instead direct hard-coding of version info.

7 years agoTravis CI: Also test with Memory and Unexpected Behavior sanitizers
Ivan Maidanski [Fri, 17 Feb 2017 08:51:30 +0000 (11:51 +0300)]
Travis CI: Also test with Memory and Unexpected Behavior sanitizers

Note: Currently an error found by MSan/UBSan does not cause Travis build
to fail, the log should be examined manually for the absence of
"MemorySanitizer" and "runtime error" character sequences (the error
messages are shown in red).

7 years agoTravis CI: Fix indent of CFLAGS_EXTRA assignment if SANITIZE set
Ivan Maidanski [Thu, 16 Feb 2017 21:44:14 +0000 (00:44 +0300)]
Travis CI: Fix indent of CFLAGS_EXTRA assignment if SANITIZE set
(fix commit fc43ce4)

7 years agoTravis CI: Output config.h content
Ivan Maidanski [Thu, 16 Feb 2017 21:36:33 +0000 (00:36 +0300)]
Travis CI: Output config.h content

7 years agoTravis CI: Also test --disable-atomic-intrinsics
Ivan Maidanski [Thu, 16 Feb 2017 18:34:45 +0000 (21:34 +0300)]
Travis CI: Also test --disable-atomic-intrinsics

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).

7 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.

7 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

7 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.

7 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.