CVS commit: src/tests/lib/libc/sync
Module Name:src Committed By: martin Date: Sat Oct 11 14:52:16 UTC 2014 Modified Files: src/tests/lib/libc/sync: Makefile Added Files: src/tests/lib/libc/sync: cpp_atomic_ops_linkable.cc Log Message: Add a link time test to catch missing symbols in libc, as pointed out in PR toolchain/49074. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/tests/lib/libc/sync/Makefile cvs rdiff -u -r0 -r1.1 src/tests/lib/libc/sync/cpp_atomic_ops_linkable.cc Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/lib/libc/sync/Makefile diff -u src/tests/lib/libc/sync/Makefile:1.1 src/tests/lib/libc/sync/Makefile:1.2 --- src/tests/lib/libc/sync/Makefile:1.1 Mon Feb 17 10:10:41 2014 +++ src/tests/lib/libc/sync/Makefile Sat Oct 11 14:52:15 2014 @@ -1,11 +1,12 @@ -# $NetBSD: Makefile,v 1.1 2014/02/17 10:10:41 martin Exp $ +# $NetBSD: Makefile,v 1.2 2014/10/11 14:52:15 martin Exp $ WARNS=0 NOMAN=1 +CXXFLAGS+= -std=c++11 -PROG=all_sync_ops_linkable +PROG=all_sync_ops_linkable cpp_atomic_ops_linkable -proginstall-all_sync_ops_linkable: - @echo link time only test +proginstall: + @echo This directory features link time only tests. .include Added files: Index: src/tests/lib/libc/sync/cpp_atomic_ops_linkable.cc diff -u /dev/null src/tests/lib/libc/sync/cpp_atomic_ops_linkable.cc:1.1 --- /dev/null Sat Oct 11 14:52:16 2014 +++ src/tests/lib/libc/sync/cpp_atomic_ops_linkable.cc Sat Oct 11 14:52:15 2014 @@ -0,0 +1,98 @@ +/* $NetBSD: cpp_atomic_ops_linkable.cc,v 1.1 2014/10/11 14:52:15 martin Exp $ */ + +/*- + * Copyright (c) 2014 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Martin Husemann . + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + *notice, this list of conditions and the following disclaimer in the + *documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * This is a simple link-time test to verify all builtin atomic sync + * operations for C++ are available. + */ + +#include + +template +class ATest { +public: + ATest() : m_val(0) + { +m_val.exchange(std::atomic(8)); +m_val--; +m_val++; +m_val ^= 0x0f; +m_val &= 0x0f; +m_val |= 2; + +T tval(1), other(42); +m_val.compare_exchange_weak(tval, other, + std::memory_order_release, std::memory_order_relaxed); + } + +private: + volatile std::atomic m_val; +}; + +int main(int argc, char **argv) +{ + ATest(); + ATest(); + ATest(); + ATest(); + ATest(); + ATest(); + ATest(); + ATest(); + ATest(); + ATest(); + ATest(); + ATest(); + ATest(); + ATest(); + ATest(); + ATest(); + ATest(); + ATest(); + ATest(); + ATest(); + ATest(); + ATest(); + ATest(); + ATest(); + ATest(); + ATest(); + ATest(); + ATest(); + ATest(); + ATest(); + ATest(); + ATest(); + ATest(); + ATest(); + ATest(); + ATest(); +}
CVS commit: src/tests/lib/libc/sync
Module Name:src Committed By: martin Date: Sat Oct 11 17:46:58 UTC 2014 Modified Files: src/tests/lib/libc/sync: cpp_atomic_ops_linkable.cc Log Message: If not __HAVE_ATOMIC64_OPS, do not force the test for 64bit types. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/tests/lib/libc/sync/cpp_atomic_ops_linkable.cc Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/lib/libc/sync/cpp_atomic_ops_linkable.cc diff -u src/tests/lib/libc/sync/cpp_atomic_ops_linkable.cc:1.1 src/tests/lib/libc/sync/cpp_atomic_ops_linkable.cc:1.2 --- src/tests/lib/libc/sync/cpp_atomic_ops_linkable.cc:1.1 Sat Oct 11 14:52:15 2014 +++ src/tests/lib/libc/sync/cpp_atomic_ops_linkable.cc Sat Oct 11 17:46:58 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: cpp_atomic_ops_linkable.cc,v 1.1 2014/10/11 14:52:15 martin Exp $ */ +/* $NetBSD: cpp_atomic_ops_linkable.cc,v 1.2 2014/10/11 17:46:58 martin Exp $ */ /*- * Copyright (c) 2014 The NetBSD Foundation, Inc. @@ -35,6 +35,7 @@ */ #include +#include // for __HAVE_ATOMIC64_OPS template class ATest { @@ -79,16 +80,20 @@ int main(int argc, char **argv) ATest(); ATest(); ATest(); +#ifdef __HAVE_ATOMIC64_OPS ATest(); ATest(); +#endif ATest(); ATest(); ATest(); ATest(); ATest(); ATest(); +#ifdef __HAVE_ATOMIC64_OPS ATest(); ATest(); +#endif ATest(); ATest(); ATest();
CVS commit: src/tests/lib/libc/sync
Module Name:src Committed By: martin Date: Sun Oct 12 08:02:35 UTC 2014 Modified Files: src/tests/lib/libc/sync: Makefile Log Message: Disable the C++11 test for now, we are not ready for it. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/tests/lib/libc/sync/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/lib/libc/sync/Makefile diff -u src/tests/lib/libc/sync/Makefile:1.2 src/tests/lib/libc/sync/Makefile:1.3 --- src/tests/lib/libc/sync/Makefile:1.2 Sat Oct 11 14:52:15 2014 +++ src/tests/lib/libc/sync/Makefile Sun Oct 12 08:02:35 2014 @@ -1,10 +1,10 @@ -# $NetBSD: Makefile,v 1.2 2014/10/11 14:52:15 martin Exp $ +# $NetBSD: Makefile,v 1.3 2014/10/12 08:02:35 martin Exp $ WARNS=0 NOMAN=1 CXXFLAGS+= -std=c++11 -PROG=all_sync_ops_linkable cpp_atomic_ops_linkable +PROG=all_sync_ops_linkable # cpp_atomic_ops_linkable proginstall: @echo This directory features link time only tests.
CVS commit: src/tests/lib/libc/sync
Module Name:src Committed By: martin Date: Sun Oct 12 12:26:41 UTC 2014 Modified Files: src/tests/lib/libc/sync: cpp_atomic_ops_linkable.cc Log Message: If we don't have 64 bit atomic ops, also do not test "long long" and intmax_t (and friends). To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/tests/lib/libc/sync/cpp_atomic_ops_linkable.cc Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/lib/libc/sync/cpp_atomic_ops_linkable.cc diff -u src/tests/lib/libc/sync/cpp_atomic_ops_linkable.cc:1.2 src/tests/lib/libc/sync/cpp_atomic_ops_linkable.cc:1.3 --- src/tests/lib/libc/sync/cpp_atomic_ops_linkable.cc:1.2 Sat Oct 11 17:46:58 2014 +++ src/tests/lib/libc/sync/cpp_atomic_ops_linkable.cc Sun Oct 12 12:26:41 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: cpp_atomic_ops_linkable.cc,v 1.2 2014/10/11 17:46:58 martin Exp $ */ +/* $NetBSD: cpp_atomic_ops_linkable.cc,v 1.3 2014/10/12 12:26:41 martin Exp $ */ /*- * Copyright (c) 2014 The NetBSD Foundation, Inc. @@ -69,8 +69,10 @@ int main(int argc, char **argv) ATest(); ATest(); ATest(); +#ifdef __HAVE_ATOMIC64_OPS ATest(); ATest(); +#endif ATest(); ATest(); ATest(); @@ -98,6 +100,8 @@ int main(int argc, char **argv) ATest(); ATest(); ATest(); +#ifdef __HAVE_ATOMIC64_OPS ATest(); ATest(); +#endif }
CVS commit: src/tests/lib/libc/sync
Module Name:src Committed By: martin Date: Mon Oct 13 09:57:35 UTC 2014 Modified Files: src/tests/lib/libc/sync: Makefile Log Message: Do not try the C++ 2011 test with gcc < 4.8 To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/tests/lib/libc/sync/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/lib/libc/sync/Makefile diff -u src/tests/lib/libc/sync/Makefile:1.3 src/tests/lib/libc/sync/Makefile:1.4 --- src/tests/lib/libc/sync/Makefile:1.3 Sun Oct 12 08:02:35 2014 +++ src/tests/lib/libc/sync/Makefile Mon Oct 13 09:57:35 2014 @@ -1,12 +1,20 @@ -# $NetBSD: Makefile,v 1.3 2014/10/12 08:02:35 martin Exp $ +# $NetBSD: Makefile,v 1.4 2014/10/13 09:57:35 martin Exp $ WARNS=0 NOMAN=1 -CXXFLAGS+= -std=c++11 - -PROG=all_sync_ops_linkable # cpp_atomic_ops_linkable proginstall: @echo This directory features link time only tests. .include + +PROG= all_sync_ops_linkable + +.if "${ACTIVE_CC}" == "clang" || \ +("${ACTIVE_CC}" == "gcc" && "${HAVE_GCC}" == "48") + +CXXFLAGS+= -std=c++11 +PROG+= cpp_atomic_ops_linkable + +.endif +
CVS commit: src/tests/lib/libc/sync
Module Name:src Committed By: martin Date: Mon Oct 13 11:07:38 UTC 2014 Modified Files: src/tests/lib/libc/sync: Makefile Log Message: Fix include order, so the makefile actually does something again. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/tests/lib/libc/sync/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/lib/libc/sync/Makefile diff -u src/tests/lib/libc/sync/Makefile:1.4 src/tests/lib/libc/sync/Makefile:1.5 --- src/tests/lib/libc/sync/Makefile:1.4 Mon Oct 13 09:57:35 2014 +++ src/tests/lib/libc/sync/Makefile Mon Oct 13 11:07:38 2014 @@ -1,12 +1,9 @@ -# $NetBSD: Makefile,v 1.4 2014/10/13 09:57:35 martin Exp $ +# $NetBSD: Makefile,v 1.5 2014/10/13 11:07:38 martin Exp $ WARNS=0 NOMAN=1 -proginstall: - @echo This directory features link time only tests. - -.include +.include PROG= all_sync_ops_linkable @@ -18,3 +15,8 @@ PROG+= cpp_atomic_ops_linkable .endif +proginstall: + @echo This directory features link time only tests. + +.include +
CVS commit: src/tests/lib/libc/sync
Module Name:src Committed By: joerg Date: Sat Oct 18 02:22:36 UTC 2014 Modified Files: src/tests/lib/libc/sync: Makefile Log Message: Explicitly link C++ test case with CXX. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/tests/lib/libc/sync/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/lib/libc/sync/Makefile diff -u src/tests/lib/libc/sync/Makefile:1.5 src/tests/lib/libc/sync/Makefile:1.6 --- src/tests/lib/libc/sync/Makefile:1.5 Mon Oct 13 11:07:38 2014 +++ src/tests/lib/libc/sync/Makefile Sat Oct 18 02:22:35 2014 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.5 2014/10/13 11:07:38 martin Exp $ +# $NetBSD: Makefile,v 1.6 2014/10/18 02:22:35 joerg Exp $ WARNS=0 NOMAN=1 @@ -11,7 +11,7 @@ PROG= all_sync_ops_linkable ("${ACTIVE_CC}" == "gcc" && "${HAVE_GCC}" == "48") CXXFLAGS+= -std=c++11 -PROG+= cpp_atomic_ops_linkable +PROG_CXX+= cpp_atomic_ops_linkable .endif
CVS commit: src/tests/lib/libc/sync
Module Name:src Committed By: joerg Date: Mon Feb 17 21:38:04 UTC 2014 Modified Files: src/tests/lib/libc/sync: all_sync_ops_linkable.c Log Message: Since clang doesn't recognize the nand variants of the sync builtins and gcc doesn't support __has_builtin, use a plain #ifndef __clang__ check as workaround. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/tests/lib/libc/sync/all_sync_ops_linkable.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/lib/libc/sync/all_sync_ops_linkable.c diff -u src/tests/lib/libc/sync/all_sync_ops_linkable.c:1.1 src/tests/lib/libc/sync/all_sync_ops_linkable.c:1.2 --- src/tests/lib/libc/sync/all_sync_ops_linkable.c:1.1 Mon Feb 17 10:10:41 2014 +++ src/tests/lib/libc/sync/all_sync_ops_linkable.c Mon Feb 17 21:38:04 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: all_sync_ops_linkable.c,v 1.1 2014/02/17 10:10:41 martin Exp $ */ +/* $NetBSD: all_sync_ops_linkable.c,v 1.2 2014/02/17 21:38:04 joerg Exp $ */ /*- * Copyright (c) 2014 The NetBSD Foundation, Inc. @@ -82,6 +82,7 @@ main(int argc, char **argv) #ifdef __HAVE_ATOMIC64_OPS __sync_fetch_and_and_8(&u64, 0x80); #endif +#ifndef __clang__ __sync_fetch_and_nand(&u8, 0x80); __sync_fetch_and_nand_1(&u8, 0x80); __sync_fetch_and_nand_2(&u16, 0x80); @@ -89,6 +90,7 @@ main(int argc, char **argv) #ifdef __HAVE_ATOMIC64_OPS __sync_fetch_and_nand_8(&u64, 0x80); #endif +#endif __sync_fetch_and_or(&u8, 0x80); __sync_fetch_and_or_1(&u8, 0x80); __sync_fetch_and_or_2(&u16, 0x80); @@ -124,6 +126,7 @@ main(int argc, char **argv) #ifdef __HAVE_ATOMIC64_OPS __sync_lock_test_and_set_8(&u64, 5); #endif +#ifndef __clang__ __sync_nand_and_fetch(&u8, 5); __sync_nand_and_fetch_1(&u8, 5); __sync_nand_and_fetch_2(&u16, 5); @@ -131,6 +134,7 @@ main(int argc, char **argv) #ifdef __HAVE_ATOMIC64_OPS __sync_nand_and_fetch_8(&u64, 5); #endif +#endif __sync_or_and_fetch(&u8, 5); __sync_or_and_fetch_1(&u8, 5); __sync_or_and_fetch_2(&u16, 5);
CVS commit: src/tests/lib/libc/sync
Module Name:src Committed By: martin Date: Tue Feb 18 10:27:46 UTC 2014 Modified Files: src/tests/lib/libc/sync: all_sync_ops_linkable.c Log Message: For now excempt i386 from __sync_lock_test_and_set_8 and point to PR lib/48601. Probably more architectures to follow. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/tests/lib/libc/sync/all_sync_ops_linkable.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/lib/libc/sync/all_sync_ops_linkable.c diff -u src/tests/lib/libc/sync/all_sync_ops_linkable.c:1.2 src/tests/lib/libc/sync/all_sync_ops_linkable.c:1.3 --- src/tests/lib/libc/sync/all_sync_ops_linkable.c:1.2 Mon Feb 17 21:38:04 2014 +++ src/tests/lib/libc/sync/all_sync_ops_linkable.c Tue Feb 18 10:27:46 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: all_sync_ops_linkable.c,v 1.2 2014/02/17 21:38:04 joerg Exp $ */ +/* $NetBSD: all_sync_ops_linkable.c,v 1.3 2014/02/18 10:27:46 martin Exp $ */ /*- * Copyright (c) 2014 The NetBSD Foundation, Inc. @@ -124,8 +124,17 @@ main(int argc, char **argv) __sync_lock_test_and_set_2(&u16, 5); __sync_lock_test_and_set_4(&u32, 5); #ifdef __HAVE_ATOMIC64_OPS + + /* + * See PR lib/48601: + * some architectures do not implement this, allow them to build + * anyway. + */ +#if !defined(__i386__) __sync_lock_test_and_set_8(&u64, 5); #endif + +#endif #ifndef __clang__ __sync_nand_and_fetch(&u8, 5); __sync_nand_and_fetch_1(&u8, 5);
CVS commit: src/tests/lib/libc/sync
Module Name:src Committed By: martin Date: Fri Feb 21 10:26:25 UTC 2014 Modified Files: src/tests/lib/libc/sync: all_sync_ops_linkable.c Log Message: Remove excemption for i386 (PR lib/48601) - missing aliases will be added to the C code. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/tests/lib/libc/sync/all_sync_ops_linkable.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/lib/libc/sync/all_sync_ops_linkable.c diff -u src/tests/lib/libc/sync/all_sync_ops_linkable.c:1.3 src/tests/lib/libc/sync/all_sync_ops_linkable.c:1.4 --- src/tests/lib/libc/sync/all_sync_ops_linkable.c:1.3 Tue Feb 18 10:27:46 2014 +++ src/tests/lib/libc/sync/all_sync_ops_linkable.c Fri Feb 21 10:26:25 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: all_sync_ops_linkable.c,v 1.3 2014/02/18 10:27:46 martin Exp $ */ +/* $NetBSD: all_sync_ops_linkable.c,v 1.4 2014/02/21 10:26:25 martin Exp $ */ /*- * Copyright (c) 2014 The NetBSD Foundation, Inc. @@ -124,17 +124,8 @@ main(int argc, char **argv) __sync_lock_test_and_set_2(&u16, 5); __sync_lock_test_and_set_4(&u32, 5); #ifdef __HAVE_ATOMIC64_OPS - - /* - * See PR lib/48601: - * some architectures do not implement this, allow them to build - * anyway. - */ -#if !defined(__i386__) __sync_lock_test_and_set_8(&u64, 5); #endif - -#endif #ifndef __clang__ __sync_nand_and_fetch(&u8, 5); __sync_nand_and_fetch_1(&u8, 5);