aboutsummaryrefslogtreecommitdiff
path: root/libstdc++-v3/testsuite/17_intro
AgeCommit message (Collapse)AuthorFilesLines
3 dayslibstdc++/testsuite: Unpoison 'u' on s390x in names.cc testPatrick Palka1-0/+2
This is the s390 counterpart to r11-7364-gd0453cf5c68b6a, and fixes the following names.cc failure caused by a use of a poisoned identifier. If we look at the corresponding upstream header[1] it's clear that the problematic identifier is 'u'. In file included from /usr/include/linux/types.h:5, from /usr/include/linux/sched/types.h:5, from /usr/include/bits/sched.h:61, from /usr/include/sched.h:43, from /usr/include/pthread.h:22, from /usr/include/c++/14/s390x-redhat-linux/bits/gthr-default.h:35, from /usr/include/c++/14/s390x-redhat-linux/bits/gthr.h:157, from /usr/include/c++/14/ext/atomicity.h:35, from /usr/include/c++/14/bits/ios_base.h:39, from /usr/include/c++/14/streambuf:43, from /usr/include/c++/14/bits/streambuf_iterator.h:35, from /usr/include/c++/14/iterator:66, from /usr/include/c++/14/s390x-redhat-linux/bits/stdc++.h:54, from /root/rpmbuild/BUILD/gcc-14.3.1-20250617/libstdc++-v3/testsuite/17_intro/names.cc:384: /usr/include/asm/types.h:24: error: expected unqualified-id before '[' token /usr/include/asm/types.h:24: error: expected ')' before '[' token /root/rpmbuild/BUILD/gcc-14.3.1-20250617/libstdc++-v3/testsuite/17_intro/names.cc:101: note: to match this '(' compiler exited with status 1 FAIL: 17_intro/names.cc -std=gnu++98 (test for excess errors) Excess errors: /usr/include/asm/types.h:24: error: expected unqualified-id before '[' token /usr/include/asm/types.h:24: error: expected ')' before '[' token [1]: https://github.com/torvalds/linux/blob/master/arch/s390/include/uapi/asm/types.h libstdc++-v3/ChangeLog: * testsuite/17_intro/names.cc: Undefine 'u' on s390*-linux. Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
2025-06-12libstdc++: do not use an unreserved name in _Temporary_buffer [PR119496]Giuseppe D'Angelo1-0/+4
As the PR observes, _Temporary_buffer was using an unreserved name for a member function that can therefore clash with macros defined by the user. Avoid that by renaming the member function. PR libstdc++/119496 libstdc++-v3/ChangeLog: * include/bits/stl_algo.h: Adjust calls to requested_size. * include/bits/stl_tempbuf.h (requested_size): Rename with an _M_ prefix. * testsuite/17_intro/names.cc: Add a #define for requested_size. Signed-off-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2025-05-30libstdc++: Move atomic wait/notify entry points into the libraryJonathan Wakely1-2/+0
This moves the implementation details of atomic wait/notify functions into the library, so that only a small API surface is exposed to users. This also fixes some race conditions present in the design for proxied waits: - The stores to _M_ver in __notify_impl must be protected by the mutex, and the loads from _M_ver in __wait_impl and __wait_until_impl to check for changes must also be protected by the mutex. This ensures that checking _M_ver for updates and waiting on the condition_variable happens atomically. Otherwise it's possible to have: _M_ver == old happens-before {++_M_ver; cv.notify;} which happens-before cv.wait. That scenario results in a missed notification, and so the waiting function never wakes. This wasn't a problem for Linux, because the futex wait call re-checks the _M_ver value before sleeping, so the increment cannot interleave between the check and the wait. - The initial load from _M_ver that reads the 'old' value used for the _M_ver == old checks must be done before loading and checking the value of the atomic variable. Otherwise it's possible to have: var.load() == val happens-before {++_M_ver; _M_cv.notify_all();} happens-before {old = _M_ver; lock mutex; if (_M_ver == old) cv.wait}. This results in the waiting thread seeing the already-incremented value of _M_ver and then waiting for it to change again, which doesn't happen. This race was present even for Linux, because using a futex instead of mutex+condvar doesn't prevent the increment from happening before the waiting threads checks for the increment. The first race can be solved locally in the waiting and notifying functions, by acquiring the mutex lock earlier in the function. The second race cannot be fixed locally, because the load of the atomic variable and the check for updates to _M_ver happen in different functions (one in a function template in the headers and one in the library). We do have an _M_old data member in the __wait_args_base struct which was previously only used for non-proxy waits using a futex. We can add a new entry point into the library to look up the waitable state for the address and then load its _M_ver into the _M_old member. This allows the inline function template to ensure that loading _M_ver happens-before testing whether the atomic variable has been changed, so that we can reliably tell if _M_ver changes after we've already tested the atomic variable. This isn't 100% reliable, because _M_ver could be incremented 2^32 times and wrap back to the same value, but that seems unlikely in practice. If/when we support waiting on user-defined predicates (which could execute long enough for _M_ver to wrap) we might want to always wait with a timeout, so that we get a chance to re-check the predicate even in the rare case that _M_ver wraps. Another change is to make the __wait_until_impl function take a __wait_clock_t::duration instead of a __wait_clock_t::time_point, so that the __wait_until_impl function doesn't depend on the symbol name of chrono::steady_clock. Inside the library it can be converted back to a time_point for the clock. This would potentially allow using a different clock, if we made a different __abi_version in the __wait_args imply waiting with a different clock. This also adds a void* to the __wait_args_base structure, so that __wait_impl can store the __waitable_state* in there the first time it's looked up for a given wait, so that it doesn't need to be retrieved again on each loop. This requires passing the __wait_args_base structure by non-const reference. The __waitable_state::_S_track function can be removed now that it's all internal to the library, and namespace-scope RAII types added for locking and tracking contention. libstdc++-v3/ChangeLog: * config/abi/pre/gnu.ver: Add new symbol version and exports. * include/bits/atomic_timed_wait.h (__platform_wait_until): Move to atomic.cc. (__cond_wait_until, __spin_until_impl): Likewise. (__wait_until_impl): Likewise. Change __wait_args_base parameter to non-const reference and change third parameter to __wait_clock_t::duration. (__wait_until): Change __wait_args_base parameter to non-const reference. Change Call time_since_epoch() to get duration from time_point. (__wait_for): Change __wait_args_base parameter to non-const reference. (__atomic_wait_address_until): Call _M_prep_for_wait_on on args. (__atomic_wait_address_for): Likewise. (__atomic_wait_address_until_v): Qualify call to avoid ADL. Do not forward __vfn. * include/bits/atomic_wait.h (__platform_wait_uses_type): Use alignof(T) not alignof(T*). (__futex_wait_flags, __platform_wait, __platform_notify) (__waitable_state, __spin_impl, __notify_impl): Move to atomic.cc. (__wait_impl): Likewise. Change __wait_args_base parameter to non-const reference. (__wait_args_base::_M_wait_state): New data member. (__wait_args_base::_M_prep_for_wait_on): New member function. (__wait_args_base::_M_load_proxy_wait_val): New member function. (__wait_args_base::_S_memory_order_for): Remove member function. (__atomic_wait_address): Call _M_prep_for_wait_on on args. (__atomic_wait_address_v): Qualify call to avoid ADL. * src/c++20/Makefile.am: Add new file. * src/c++20/Makefile.in: Regenerate. * src/c++20/atomic.cc: New file. * testsuite/17_intro/headers/c++1998/49745.cc: Remove XFAIL for C++20 and later. * testsuite/29_atomics/atomic/wait_notify/100334.cc: Remove use of internal implementation details. * testsuite/util/testsuite_abi.cc: Add GLIBCXX_3.4.35 version.
2025-05-29libstdc++: Fix another 17_intro/names.cc failure on AIXJonathan Wakely1-0/+2
FAIL: 17_intro/names.cc -std=gnu++98 (test for excess errors) Also fix typo in experimental/names.cc where I did #undef for the wrong name in r16-901-gd1ced2a5ea6b09. libstdc++-v3/ChangeLog: * testsuite/17_intro/names.cc [_AIX] (a): Undefine. * testsuite/experimental/names.cc [_AIX] (ptr): Undefine.
2025-05-27libstdc++: Fix some names.cc test failures on AIXJonathan Wakely1-0/+2
libstdc++-v3/ChangeLog: * testsuite/17_intro/names.cc [_AIX] (n): Undefine. * testsuite/experimental/names.cc [_AIX] (ptr): Undefine.
2025-05-23libstdc++: Fix 17_intro/names.cc failure on Solaris 11.3Jonathan Wakely1-1/+5
There are some names in Solaris libc headers which cause: FAIL: 17_intro/names.cc -std=gnu++98 (test for excess errors) FAIL: 17_intro/names.cc -std=gnu++11 (test for excess errors) libstdc++-v3/ChangeLog: * testsuite/17_intro/names.cc [__sun__] (a, i, n): Undefine.
2025-04-15libstdc++: Do not declare namespace ranges in <numeric> unconditionallyJonathan Wakely1-0/+4
Move namespace ranges inside the feature test macro guard, because 'ranges' is not a reserved name before C++20. libstdc++-v3/ChangeLog: * include/std/numeric (ranges): Only declare namespace for C++23 and later. (ranges::iota_result): Fix indentation. * testsuite/17_intro/names.cc: Check ranges is not used as an identifier before C++20.
2025-03-27libstdc++-v3 testsuite: fix malformed dg-require-static-libstdcxx directivesDavid Malcolm2-2/+2
I believe these don't get detected by DejaGnu's regexp. Found by dg-lint. libstdc++-v3/ChangeLog: * testsuite/17_intro/shared_with_static_deps.cc: Fix malformed dg-require-static-libstdcxx directive. * testsuite/17_intro/static.cc: Likewise. * testsuite/18_support/type_info/110572.cc: Likewise. * testsuite/20_util/to_chars/4.cc: Likewise. * testsuite/std/time/tzdb_list/pr118811.cc: Likewise. Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2025-01-02Update copyright years.Jakub Jelinek31-31/+31
2024-11-08libstdc++: Do not define _Insert_base::try_emplace before C++17Jonathan Wakely1-0/+2
This is not a reserved name in C++11 and C++14, so must not be defined. Also use the appropriate feature test macros for the try_emplace members of the Debug Mode maps. libstdc++-v3/ChangeLog: * include/bits/hashtable_policy.h (_Insert_base::try_emplace): Do not define for C++11 and C++14. * include/debug/map.h (try_emplace): Use feature test macro. * include/debug/unordered_map (try_emplace): Likewise. * testsuite/17_intro/names.cc: Define try_emplace before C++17.
2024-10-13libstdc++: testsuite: adjust name_fortify test for pre-defined _FORTIFY_SOURCESam James1-0/+1
Otherwise we get failures with toolchains that have _FORTIFY_SOURCE defined already to a different value like 3. libstdc++-v3/ChangeLog: * testsuite/17_intro/names_fortify.cc: Undefine _FORTIFY_SOURCE.
2024-10-09libstdc++: Test 17_intro/names.cc with -D_FORTIFY_SOURCE=2 [PR116210]Jonathan Wakely2-0/+13
Add a new testcase that repeats 17_intro/names.cc but with _FORTIFY_SOURCE defined, to find problems in Glibc fortify wrappers like https://sourceware.org/bugzilla/show_bug.cgi?id=32052 (which is fixed now). libstdc++-v3/ChangeLog: PR libstdc++/116210 * testsuite/17_intro/names.cc (sz): Undef for versions of Glibc that use it in the fortify wrappers. * testsuite/17_intro/names_fortify.cc: New test.
2024-10-09libstdc++: Workaround glibc headers on ia64-linuxFrank Scheiner1-0/+6
We see: ``` FAIL: 17_intro/names.cc -std=gnu++17 (test for excess errors) FAIL: 17_intro/names_pstl.cc -std=gnu++17 (test for excess errors) FAIL: experimental/names.cc -std=gnu++17 (test for excess errors) ``` ...on ia64-linux. This is due to: * /usr/include/bits/sigcontext.h:32-38: ``` 32 struct __ia64_fpreg 33 { 34 union 35 { 36 unsigned long bits[2]; 37 } u; 38 } __attribute__ ((__aligned__ (16))); ``` * /usr/include/sys/ucontext.h:39-45: ``` 39 struct __ia64_fpreg_mcontext 40 { 41 union 42 { 43 unsigned long __ctx(bits)[2]; 44 } __ctx(u); 45 } __attribute__ ((__aligned__ (16))); ``` ...from glibc 2.39 (w/ia64 support re-added). See the discussion starting on [1]. [1]: https://gcc.gnu.org/pipermail/gcc-patches/2024-June/654487.html Signed-off-by: Frank Scheiner <frank.scheiner@web.de> libstdc++-v3/ChangeLog: * testsuite/17_intro/names.cc [__linux__ && __ia64__]: Undefine 'u' as used in glibc headers.
2024-10-04libstdc++: Fix some Parallel Mode testsuite failuresJonathan Wakely1-2/+4
Some of these are due to no longer using #pragma GCC system_header in libstdc++ headers, some have been failing for longer and weren't noticed. libstdc++-v3/ChangeLog: * include/parallel/algobase.h (search): Use sequential algorithm for constant evaluation. * include/parallel/algorithmfwd.h (search): Add _GLIBCXX20_CONSTEXPR. * include/parallel/multiway_merge.h: Remove stray semi-colon. * include/parallel/multiseq_selection.h: Add diagnostic pragmas for -Wlong-long warning. * include/parallel/quicksort.h: Likewise. * include/parallel/random_number.h: Likewise. * include/parallel/settings.h: Likewise. * include/parallel/workstealing.h: Replace ++ and -- on volatile variables. * testsuite/17_intro/names.cc: Skip names defined by <tr1/random>. * testsuite/20_util/pair/dangling_ref.cc: Skip test if Parallel Mode is enabled. * testsuite/20_util/tuple/dangling_ref.cc: Likewise.
2024-07-06libstdc++: Remove redundant 17_intro/headers testsJonathan Wakely35-1278/+26
We have several nearly identical tests under 17_intro/headers which only differ in a -std option set using dg-options. Since the testsuite now supports running tests with multiple -std options (and I test that regularly) we don't need these duplicated tests. We can remove most of them and let the testsuite decide which -std option to use. In the all_attributes.cc case the content of the tests is slightly different, but they can be combined into one test that defines macros conditionally based on __cplusplus checks. The stdc++.cc tests could also be combined this way, but for now I've just kept one version for c++98 and one for all later standards. For stdc++_multiple_inclusion.cc we can remove the body of the files and just include stdc++.cc twice. This means we don't need to add includes to both stdc++.cc and stdc++_multiple_inclusion.cc, we only need to update one place. libstdc++-v3/ChangeLog: * testsuite/17_intro/headers/c++1998/all_attributes.cc: Add attribute names from later standards and remove dg-options. * testsuite/17_intro/headers/c++1998/stdc++.cc: Add c++98_only target selector. * testsuite/17_intro/headers/c++1998/stdc++_multiple_inclusion.cc: Remove content and include stdc++.cc twice instead. * testsuite/17_intro/headers/c++2011/stdc++.cc: Replace dg-options with c++11 target selector. * testsuite/17_intro/headers/c++2011/stdc++_multiple_inclusion.cc: Remove content and include stdc++.cc twice instead. * testsuite/17_intro/headers/c++2011/all_attributes.cc: Removed. * testsuite/17_intro/headers/c++2011/all_no_exceptions.cc: Removed. * testsuite/17_intro/headers/c++2011/all_no_rtti.cc: Removed. * testsuite/17_intro/headers/c++2011/all_pedantic_errors.cc: Removed. * testsuite/17_intro/headers/c++2011/charset.cc: Removed. * testsuite/17_intro/headers/c++2011/operator_names.cc: Removed. * testsuite/17_intro/headers/c++2014/all_attributes.cc: Removed. * testsuite/17_intro/headers/c++2014/all_no_exceptions.cc: Removed. * testsuite/17_intro/headers/c++2014/all_no_rtti.cc: Removed. * testsuite/17_intro/headers/c++2014/all_pedantic_errors.cc: Removed. * testsuite/17_intro/headers/c++2014/charset.cc: Removed. * testsuite/17_intro/headers/c++2014/operator_names.cc: Removed. * testsuite/17_intro/headers/c++2014/stdc++.cc: Removed. * testsuite/17_intro/headers/c++2014/stdc++_multiple_inclusion.cc: Removed. * testsuite/17_intro/headers/c++2017/all_attributes.cc: Removed. * testsuite/17_intro/headers/c++2017/all_no_exceptions.cc: Removed. * testsuite/17_intro/headers/c++2017/all_no_rtti.cc: Removed. * testsuite/17_intro/headers/c++2017/all_pedantic_errors.cc: Removed. * testsuite/17_intro/headers/c++2017/charset.cc: Removed. * testsuite/17_intro/headers/c++2017/operator_names.cc: Removed. * testsuite/17_intro/headers/c++2017/stdc++.cc: Removed. * testsuite/17_intro/headers/c++2017/stdc++_multiple_inclusion.cc: Removed. * testsuite/17_intro/headers/c++2020/all_attributes.cc: Removed. * testsuite/17_intro/headers/c++2020/all_no_exceptions.cc: Removed. * testsuite/17_intro/headers/c++2020/all_no_rtti.cc: Removed. * testsuite/17_intro/headers/c++2020/all_pedantic_errors.cc: Removed. * testsuite/17_intro/headers/c++2020/charset.cc: Removed. * testsuite/17_intro/headers/c++2020/operator_names.cc: Removed. * testsuite/17_intro/headers/c++2020/stdc++.cc: Removed. * testsuite/17_intro/headers/c++2020/stdc++_multiple_inclusion.cc: Removed.
2024-07-06libstdc++: Restore support for including <name.h> in extern "C" [PR115797]Jonathan Wakely1-2/+1
The r15-1857 change means that <type_traits> is included by <cmath> for C++17 and up, which breaks code including <math.h> inside an extern "C" block. Although doing that is not allowed by the C++ standard, there's lots of existing code which incorrectly thinks it's a good idea and so we try to support it. libstdc++-v3/ChangeLog: PR libstdc++/115797 * include/std/type_traits: Ensure "C++" language linkage. * testsuite/17_intro/headers/c++2011/linkage.cc: Replace dg-options with c++11 target selector.
2024-04-22libstdc++: Workaround kernel-headers on s390x-linuxJakub Jelinek6-0/+26
We see FAIL: 17_intro/headers/c++1998/all_attributes.cc (test for excess errors) FAIL: 17_intro/headers/c++2011/all_attributes.cc (test for excess errors) FAIL: 17_intro/headers/c++2014/all_attributes.cc (test for excess errors) FAIL: 17_intro/headers/c++2017/all_attributes.cc (test for excess errors) FAIL: 17_intro/headers/c++2020/all_attributes.cc (test for excess errors) FAIL: 17_intro/names.cc -std=gnu++17 (test for excess errors) on s390x-linux. The first 5 are due to kernel-headers not using uglified attribute names, where <asm/types.h> contains __attribute__((packed, aligned(4))) I've filed a downstream bugreport for this in https://bugzilla.redhat.com/show_bug.cgi?id=2276084 (not really sure where to report kernel-headers issues upstream), while the last one is due to <sys/ucontext.h> from glibc containing: #ifdef __USE_MISC # define __ctx(fld) fld #else # define __ctx(fld) __ ## fld #endif ... typedef union { double __ctx(d); float __ctx(f); } fpreg_t; and g++ predefining -D_GNU_SOURCE which implies define __USE_MISC. The following patch adds a workaround for this on the libstdc++ testsuite side. 2024-04-22 Jakub Jelinek <jakub@redhat.com> * testsuite/17_intro/names.cc (d, f): Undefine on s390*-linux*. * testsuite/17_intro/headers/c++1998/all_attributes.cc (packed): Don't define on s390. * testsuite/17_intro/headers/c++2011/all_attributes.cc (packed): Likewise. * testsuite/17_intro/headers/c++2014/all_attributes.cc (packed): Likewise. * testsuite/17_intro/headers/c++2017/all_attributes.cc (packed): Likewise. * testsuite/17_intro/headers/c++2020/all_attributes.cc (packed): Likewise.
2024-02-02libstdc++: Fix experimental/names.cc failure on AIXJonathan Wakely1-0/+2
This fails due to "u" being used in a system header. FAIL: experimental/names.cc -std=gnu++17 (test for excess errors) Excess errors: /usr/include/sys/poll.h:77: error: expected unqualified-id before ';' token /usr/include/sys/poll.h:77: error: expected ')' before ';' token FAIL: experimental/names.cc -std=gnu++17 (test for excess errors) Excess errors: /usr/include/sys/poll.h:102: error: expected unqualified-id before ';' token /usr/include/sys/poll.h:102: error: expected ')' before ';' token libstdc++-v3/ChangeLog: * testsuite/17_intro/names.cc [_AIX]: Undefine "u".
2024-01-08libstdc++: Remove std::__unicode::__null_sentinelJonathan Wakely1-0/+1
The name __null_sentinel is defined as a macro by newlib, so we can't use it as an identifier. That variable is not actually used by libstdc++, it was added because P2728R6 proposes std::uc::null_sentinel. Since we don't need it and it breaks bootstrap for newlib targets, just remove it. A null sentinel can still be used by constructing a _Null_sentinel_t object as needed, rather than having a named object of that type predefined. libstdc++-v3/ChangeLog: * include/bits/unicode.h (__null_sentinel): Remove. * testsuite/17_intro/names.cc: Add __null_sentinel.
2024-01-03Update copyright years.Jakub Jelinek57-57/+57
2023-08-23libstdc++: Fix tests relying on operator new/delete overloadFrançois Dumont1-0/+8
Fix tests that are checking for an expected allocation plan. They are failing if an allocation is taking place outside the test main. libstdc++-v3/ChangeLog * testsuite/util/replacement_memory_operators.h (counter::scope): New, capture and reset counter count at construction and restore it at destruction. (counter::check_new): Add scope instantiation. * testsuite/23_containers/unordered_map/96088.cc (main): Add counter::scope instantiation. * testsuite/23_containers/unordered_multimap/96088.cc (main): Likewise. * testsuite/23_containers/unordered_multiset/96088.cc (main): Likewise. * testsuite/23_containers/unordered_set/96088.cc (main): Likewise. * testsuite/ext/malloc_allocator/deallocate_local.cc (main): Likewise. * testsuite/ext/new_allocator/deallocate_local.cc (main): Likewise. * testsuite/ext/throw_allocator/deallocate_local.cc (main): Likewise. * testsuite/ext/pool_allocator/allocate_chunk.cc (started): New global. (operator new(size_t)): Check started. (main): Set/Unset started. * testsuite/17_intro/no_library_allocation.cc: New test case.
2023-04-12libstdc++: Fix some AIX test failuresJonathan Wakely1-0/+2
AIX <sys/thread.h> defines struct tstate with non-reserved names, so adjust the 17_intro/names.cc test. It also defines struct user, which conflicts with namespace user in some tests. Replacing the global operator new doesn't work on AIX the same way as it does for ELF, so skip some tests that depend on replacing it. Add missing DG directives to synchronized_value test so it doesn't run for the single-threaded AIX multilib. libstdc++-v3/ChangeLog: * testsuite/17_intro/names.cc [_AIX]: Do not define policy. * testsuite/19_diagnostics/error_code/cons/lwg3629.cc: Rename namespace to avoid clashing with libc struct. * testsuite/19_diagnostics/error_condition/cons/lwg3629.cc: Likewise. * testsuite/23_containers/unordered_map/96088.cc: Skip on AIX. * testsuite/23_containers/unordered_multimap/96088.cc: Likewise. * testsuite/23_containers/unordered_multiset/96088.cc: Likewise. * testsuite/23_containers/unordered_set/96088.cc: Likewise. * testsuite/experimental/synchronized_value.cc: Require gthreads and add missing option for pthreads targets.
2023-04-05libstdc++: Add a test for <version> FTM redefinitionsArsen Arsenović1-0/+7
This test detects redefinitions by compiling stdc++.h and <version>, by disabling the system_header pragma on the latter, to allow warnings in it. Thanks Patrick Palka for the suggestion. libstdc++-v3/ChangeLog: * testsuite/17_intro/versionconflict.cc: New test. * include/std/version: Allow disabling the system_header pragma via _GLIBCXX_TESTING_SYSHDR.
2023-02-22[libstdc++] [testsuite] intro/names.cc: undef func on vxw7krnAlexandre Oliva1-0/+2
The '#define func' added in 2021, to test that system headers don't violate the user namespace, exposes such a bug in the vxworks sysLib.h header, so add yet another such annotated workaround. for libstdc++-v3/ChangeLog * testsuite/17_intro/names.cc: Undef func on vxworks >= 7 in kernel mode.
2023-02-16libstdc++: Make names_pstl.cc require et tbb_backendJonathan Wakely1-1/+3
The https://github.com/oneapi-src/oneTBB/pull/833 fix is needed for TBB headers to avoid an error with GCC 13. The new names_pstl.cc test needs to check effective target tbb_backend so that it's UNSUPPORTED on systems without fixed headers. libstdc++-v3/ChangeLog: * testsuite/17_intro/names_pstl.cc: Require et tbb_backend.
2023-02-16libstdc++: Add missing space after effective-target name in testJonathan Wakely1-1/+1
libstdc++-v3/ChangeLog: * testsuite/17_intro/names_pstl.cc: Add space after effective target name.
2023-02-16libstdc++: Fix non-reserved names in PSTL headersJonathan Wakely1-0/+16
libstdc++-v3/ChangeLog: * include/pstl/algorithm_fwd.h (__pattern_search_n) (__brick_unique_copy, __brick_adjacent_find) (__brick_generate_n, __pattern_generate_n): Use reserved names for parameters. * include/pstl/algorithm_impl.h (__brick_unique_copy) (__pattern_reverse, __brick_generate_n): Likewise. * include/pstl/execution_impl.h (__prefer_unsequenced_tag) (__prefer_parallel_tag): Likewise. * include/pstl/glue_algorithm_impl.h (transform): Likewise. * include/pstl/glue_numeric_defs.h (adjacent_difference): Likewise. * include/pstl/numeric_impl.h (__brick_adjacent_difference): Likewise. * include/pstl/parallel_backend_tbb.h (__merge_func): Likewise. * include/pstl/unseq_backend_simd.h (_Combiner) (__simd_min_element, __simd_minmax_element): Likewise. * testsuite/17_intro/names_pstl.cc: New test.
2023-02-16libstdc++: Fix uses of non-reserved names in headersJonathan Wakely1-2/+19
The non-reserved names 'val' and 'dest' were being used in our headers but haven't been added to the 17_intro/names.cc test. That's because they are used by <asm-generic/posix_types.h> and <netinet/tcp.h> respecitvely on glibc-based systems. libstdc++-v3/ChangeLog: * include/bits/fs_ops.h (create_directory): Use reserved name for parameter. * include/bits/ranges_algo.h (__contains_subrange_fn): Likewise. * include/bits/regex_automaton.h (_State_base::_M_print): Likewise. * include/bits/regex_automaton.tcc(_State_base::_M_print): Likewise. * include/bits/regex_scanner.tcc(_Scanner::_M_print): Likewise. * include/experimental/bits/fs_ops.h (create_directory): Likewise. * include/std/mutex (timed_mutex::_M_clocklock): Likewise. (recursive_timed_mutex:_M_clocklock): Likewise. * include/std/tuple (basic_common_reference): Likewise. * libsupc++/cxxabi_init_exception.h (__cxa_init_primary_exception): Likewise. * testsuite/17_intro/names.cc: Add checks.
2023-01-27libstdc++: Fix up FAIL in 17_intro/names.cc on glibc < 2.19 [PR108568]Jakub Jelinek1-2/+5
On gcc112 which has glibc 2.17 I've noticed FAIL: 17_intro/names.cc (test for excess errors) FAIL: experimental/names.cc (test for excess errors) These are because glibc < 2.19 used __unused as field member of various structs, including mcontext_t in sys/ucontext.h on ppc64le. This was changed in glibc with https://gcc.gnu.org/pipermail/libc-alpha/2013-November/045766.html names.cc even has #ifdef __GLIBC_PREREQ #if ! __GLIBC_PREREQ(2, 19) // Glibc defines this prior to 2.19 #undef __unused #endif #endif for it, but it doesn't work. The reason is that __GLIBC_PREREQ is defined in <features.h> but nothing included that header before this spot (it is included later from bits/stdc++.h). The following patch on Linux/Hurd conditionally includes features.h to get the needed macros before deciding if __unused should be undefined or not. If needed, I could use __GLIBC_PREREQ then but would need to check if it is defined and between 1996 and 1999 it wasn't. 2023-01-27 Jakub Jelinek <jakub@redhat.com> PR libstdc++/108568 * testsuite/17_intro/names.cc (__unused): For linux or GNU hurd include features.h if present and then check __GLIBC__ and __GLIBC_MINOR__ macros for glibc prior to 2.19, instead of testing __GLIBC_PREREQ which isn't defined yet.
2023-01-16Update copyright years.Jakub Jelinek57-57/+57
2022-12-12libstdc++: Change names that clash with Win32 or ClangJonathan Wakely1-0/+11
Clang now defines an __is_unsigned built-in, and Windows defines an _Out_ macro. Replace uses of those as identifiers. There might also be a problem with __is_signed, which we use in several places. libstdc++-v3/ChangeLog: * include/std/chrono (hh_mm_ss): Rename __is_unsigned member to _S_is_unsigned. * include/std/format (basic_format_context): Rename _Out_ template parameter to _Out2. * testsuite/17_intro/names.cc: Add Windows SAL annotation macros.
2022-12-09libstdc++: Fix some -Wunused warnings in testsJonathan Wakely1-0/+2
libstdc++-v3/ChangeLog: * include/ext/pb_ds/detail/type_utils.hpp (PB_DS_STATIC_ASSERT): Add unused attribute to avoid -Wunused-local-typedef warnings. * testsuite/17_intro/tag_type_explicit_ctor.cc: Add pragma to ignore -Wunused-variable warnings
2022-12-06libstdc++: Fix test that fails due to name clash with old glibc [PR107979]Jonathan Wakely1-0/+7
This test was recently modified to check that the library doesn't use __unused anywhere, because that's a macro in newlib. But it's also a macro in old versions of glibc, so the test now fails for those targets. Disable that check for those targets as well as for newlib. libstdc++-v3/ChangeLog: PR libstdc++/107979 * testsuite/17_intro/names.cc: Do not check __unused on old Glibc versions.
2022-11-29libstdc++: Do not use __used or __packed as identifiersJonathan Wakely2-2/+9
These names (and __unused) are defined as macros by newlib. libstdc++-v3/ChangeLog: * include/std/format: Rename all variables called __used or __packed. * testsuite/17_intro/badnames.cc: Add no_pch options. * testsuite/17_intro/names.cc: Check __packed, __unused and __used.
2022-11-16libstdc++: Fix stream initialization with static library [PR107701]Patrick Palka1-1/+1
When linking with a static library, the linker seems to discard a constituent .o object (including its global initializers) if nothing defined in the object is referenced by the program (unless e.g. --whole-archive is used). This behavior breaks iostream with static libstdc++.a (on systems that support init priorities) because we define the global initializer for the standard stream objects in a separate TU (ios_init.cc) from the stream object definitions (globals_io.cc). This patch fixes this by moving the stream initialization object into the same TU that defines the stream objects, so that any use of the streams prevents the linker from discarding this global initializer. PR libstdc++/107701 libstdc++-v3/ChangeLog: * include/std/iostream (__ioinit): Adjust comment. * src/c++98/globals_io.cc: Include "io_base_init.h" here instead of ... * src/c++98/ios_init.cc: ... here. * src/c++98/ios_base_init.h (__ioinit): More comments. * testsuite/17_intro/static.cc: dg-do run instead of just link.
2022-10-03libstdc++: Disable hosted-only tests [PR103626]Arsen Arsenović1-0/+1
PR libstdc++/103626 - _GLIBCXX_HOSTED should respect -ffreestanding libstdc++-v3/ChangeLog: PR libstdc++/103626 * testsuite/17_intro/headers/c++1998/stdc++_assert_neg.cc: Require ET hosted. * testsuite/18_support/aligned_alloc/aligned_alloc.cc: Likewise. * testsuite/18_support/new_nothrow.cc: Likewise. * testsuite/20_util/allocator/105975.cc: Likewise. * testsuite/20_util/allocator/14176.cc: Likewise. * testsuite/20_util/allocator/64135.cc: Likewise. * testsuite/20_util/allocator/89510.cc: Likewise. * testsuite/20_util/allocator/lwg3190.cc: Likewise. * testsuite/20_util/allocator/overaligned.cc: Likewise. * testsuite/20_util/allocator/rebind_c++20.cc: Likewise. * testsuite/20_util/allocator/requirements/constexpr.cc: Likewise. * testsuite/20_util/allocator/requirements/explicit_instantiation/1.cc: Likewise. * testsuite/20_util/allocator/requirements/typedefs.cc: Likewise. * testsuite/20_util/allocator/requirements/typedefs_c++20.cc: Likewise. * testsuite/20_util/allocator/void.cc: Likewise. * testsuite/20_util/allocator_traits/header-2.cc: Likewise. * testsuite/20_util/allocator_traits/header.cc: Likewise. * testsuite/20_util/allocator_traits/members/92878_92947.cc: Likewise. * testsuite/20_util/allocator_traits/members/pointers.cc: Likewise. * testsuite/20_util/allocator_traits/requirements/typedefs.cc: Likewise. * testsuite/20_util/bad_function_call/cons_virtual_derivation.cc: Likewise. * testsuite/20_util/bind/42593.cc: Likewise. * testsuite/20_util/bitset/access/dr396.cc: Likewise. * testsuite/20_util/bitset/access/to_string.cc: Likewise. * testsuite/20_util/bitset/cons/16020.cc: Likewise. * testsuite/20_util/bitset/cons/dr1325-2.cc: Likewise. * testsuite/20_util/bitset/cons/dr396.cc: Likewise. * testsuite/20_util/bitset/debug/invalidation/1.cc: Likewise. * testsuite/20_util/bitset/ext/15361.cc: Likewise. * testsuite/20_util/bitset/operations/13838.cc: Likewise. * testsuite/20_util/bitset/operations/96303.cc: Likewise. * testsuite/20_util/bitset/version.cc: Likewise. * testsuite/20_util/enable_shared_from_this/56383.cc: Likewise. * testsuite/20_util/enable_shared_from_this/89303.cc: Likewise. * testsuite/20_util/enable_shared_from_this/members/assign.cc: Likewise. * testsuite/20_util/enable_shared_from_this/members/const.cc: Likewise. * testsuite/20_util/enable_shared_from_this/members/reinit.cc: Likewise. * testsuite/20_util/enable_shared_from_this/members/unique_ptr.cc: Likewise. * testsuite/20_util/enable_shared_from_this/members/weak_from_this.cc: Likewise. * testsuite/20_util/enable_shared_from_this/requirements/explicit_instantiation.cc: Likewise. * testsuite/20_util/forward/1.cc: Likewise. * testsuite/20_util/forward/1_neg.cc: Likewise. * testsuite/20_util/function/1.cc: Likewise. * testsuite/20_util/function/10.cc: Likewise. * testsuite/20_util/function/2.cc: Likewise. * testsuite/20_util/function/3.cc: Likewise. * testsuite/20_util/function/4.cc: Likewise. * testsuite/20_util/function/43397.cc: Likewise. * testsuite/20_util/function/48541.cc: Likewise. * testsuite/20_util/function/5.cc: Likewise. * testsuite/20_util/function/58569.cc: Likewise. * testsuite/20_util/function/6.cc: Likewise. * testsuite/20_util/function/60594.cc: Likewise. * testsuite/20_util/function/65760.cc: Likewise. * testsuite/20_util/function/69222.cc: Likewise. * testsuite/20_util/function/7.cc: Likewise. * testsuite/20_util/function/77322.cc: Likewise. * testsuite/20_util/function/8.cc: Likewise. * testsuite/20_util/function/9.cc: Likewise. * testsuite/20_util/function/91456.cc: Likewise. * testsuite/20_util/function/assign/move.cc: Likewise. * testsuite/20_util/function/assign/move_target.cc: Likewise. * testsuite/20_util/function/cmp/cmp_neg.cc: Likewise. * testsuite/20_util/function/cons/55320.cc: Likewise. * testsuite/20_util/function/cons/57465.cc: Likewise. * testsuite/20_util/function/cons/72820.cc: Likewise. * testsuite/20_util/function/cons/addressof.cc: Likewise. * testsuite/20_util/function/cons/callable.cc: Likewise. * testsuite/20_util/function/cons/deduction.cc: Likewise. * testsuite/20_util/function/cons/lwg2774.cc: Likewise. * testsuite/20_util/function/cons/move.cc: Likewise. * testsuite/20_util/function/cons/move_target.cc: Likewise. * testsuite/20_util/function/cons/noexcept.cc: Likewise. * testsuite/20_util/function/cons/non_copyconstructible.cc: Likewise. * testsuite/20_util/function/cons/refqual.cc: Likewise. * testsuite/20_util/function/cons/70692.cc: Likewise. * testsuite/20_util/function/cons/deduction_c++23.cc: Likewise. * testsuite/20_util/function/invoke/forwarding.cc: Likewise. * testsuite/20_util/function/invoke/move_only.cc: Likewise. * testsuite/20_util/function/null_pointer_comparisons.cc: Likewise. * testsuite/20_util/function/requirements/explicit_instantiation.cc: Likewise. * testsuite/20_util/function/target_no_rtti.cc: Likewise. * testsuite/20_util/function_objects/83607.cc: Likewise. * testsuite/20_util/function_objects/mem_fn/adl.cc: Likewise. * testsuite/20_util/headers/cstdlib/functions_std.cc: Likewise. * testsuite/20_util/headers/functional/types_std_c++0x.cc: Likewise. * testsuite/20_util/headers/memory/types_std_c++0x.cc: Likewise. * testsuite/20_util/is_function/35637.cc: Likewise. * testsuite/20_util/move/1.cc: Likewise. * testsuite/20_util/move_only_function/call.cc: Likewise. * testsuite/20_util/move_only_function/cons.cc: Likewise. * testsuite/20_util/move_only_function/move.cc: Likewise. * testsuite/20_util/move_only_function/version.cc: Likewise. * testsuite/20_util/owner_less/cmp.cc: Likewise. * testsuite/20_util/owner_less/noexcept.cc: Likewise. * testsuite/20_util/owner_less/void.cc: Likewise. * testsuite/20_util/pointer_safety/1.cc: Likewise. * testsuite/20_util/scoped_allocator/65279.cc: Likewise. * testsuite/20_util/scoped_allocator/69293_neg.cc: Likewise. * testsuite/20_util/scoped_allocator/construct_pair.cc: Likewise. * testsuite/20_util/scoped_allocator/dr2586.cc: Likewise. * testsuite/20_util/scoped_allocator/requirements/explicit_instantiation.cc: Likewise. * testsuite/20_util/shared_ptr/assign/assign.cc: Likewise. * testsuite/20_util/shared_ptr/assign/auto_ptr.cc: Likewise. * testsuite/20_util/shared_ptr/assign/auto_ptr_neg.cc: Likewise. * testsuite/20_util/shared_ptr/assign/auto_ptr_rvalue.cc: Likewise. * testsuite/20_util/shared_ptr/assign/dr541.cc: Likewise. * testsuite/20_util/shared_ptr/assign/move.cc: Likewise. * testsuite/20_util/shared_ptr/assign/sfinae.cc: Likewise. * testsuite/20_util/shared_ptr/assign/shared_ptr.cc: Likewise. * testsuite/20_util/shared_ptr/assign/shared_ptr_neg.cc: Likewise. * testsuite/20_util/shared_ptr/assign/unique_ptr_lvalue_neg.cc: Likewise. * testsuite/20_util/shared_ptr/assign/unique_ptr_rvalue.cc: Likewise. * testsuite/20_util/shared_ptr/atomic/1.cc: Likewise. * testsuite/20_util/shared_ptr/atomic/2.cc: Likewise. * testsuite/20_util/shared_ptr/casts/1.cc: Likewise. * testsuite/20_util/shared_ptr/casts/reinterpret.cc: Likewise. * testsuite/20_util/shared_ptr/casts/rval.cc: Likewise. * testsuite/20_util/shared_ptr/comparison/42925.cc: Likewise. * testsuite/20_util/shared_ptr/comparison/86537.cc: Likewise. * testsuite/20_util/shared_ptr/comparison/cmp.cc: Likewise. * testsuite/20_util/shared_ptr/comparison/cmp_c++20.cc: Likewise. * testsuite/20_util/shared_ptr/comparison/dr1401.cc: Likewise. * testsuite/20_util/shared_ptr/comparison/less.cc: Likewise. * testsuite/20_util/shared_ptr/cons/39405.cc: Likewise. * testsuite/20_util/shared_ptr/cons/43820_neg.cc: Likewise. * testsuite/20_util/shared_ptr/cons/46910.cc: Likewise. * testsuite/20_util/shared_ptr/cons/51365.cc: Likewise. * testsuite/20_util/shared_ptr/cons/52924.cc: Likewise. * testsuite/20_util/shared_ptr/cons/55123.cc: Likewise. * testsuite/20_util/shared_ptr/cons/58659.cc: Likewise. * testsuite/20_util/shared_ptr/cons/58839.cc: Likewise. * testsuite/20_util/shared_ptr/cons/61036.cc: Likewise. * testsuite/20_util/shared_ptr/cons/79467.cc: Likewise. * testsuite/20_util/shared_ptr/cons/80229.cc: Likewise. * testsuite/20_util/shared_ptr/cons/alias-rval.cc: Likewise. * testsuite/20_util/shared_ptr/cons/alias.cc: Likewise. * testsuite/20_util/shared_ptr/cons/array.cc: Likewise. * testsuite/20_util/shared_ptr/cons/auto_ptr.cc: Likewise. * testsuite/20_util/shared_ptr/cons/auto_ptr_neg.cc: Likewise. * testsuite/20_util/shared_ptr/cons/copy.cc: Likewise. * testsuite/20_util/shared_ptr/cons/deduction.cc: Likewise. * testsuite/20_util/shared_ptr/cons/default.cc: Likewise. * testsuite/20_util/shared_ptr/cons/lwg2802.cc: Likewise. * testsuite/20_util/shared_ptr/cons/lwg3548.cc: Likewise. * testsuite/20_util/shared_ptr/cons/move.cc: Likewise. * testsuite/20_util/shared_ptr/cons/noexcept_move_construct.cc: Likewise. * testsuite/20_util/shared_ptr/cons/nullptr.cc: Likewise. * testsuite/20_util/shared_ptr/cons/pointer.cc: Likewise. * testsuite/20_util/shared_ptr/cons/unique_ptr.cc: Likewise. * testsuite/20_util/shared_ptr/cons/unique_ptr_array.cc: Likewise. * testsuite/20_util/shared_ptr/cons/unique_ptr_deleter.cc: Likewise. * testsuite/20_util/shared_ptr/cons/unique_ptr_deleter_ref_1.cc: Likewise. * testsuite/20_util/shared_ptr/cons/unique_ptr_deleter_ref_2.cc: Likewise. * testsuite/20_util/shared_ptr/cons/void_neg.cc: Likewise. * testsuite/20_util/shared_ptr/cons/weak_ptr.cc: Likewise. * testsuite/20_util/shared_ptr/creation/36949.cc: Likewise. * testsuite/20_util/shared_ptr/creation/58594-no-rtti.cc: Likewise. * testsuite/20_util/shared_ptr/creation/58594.cc: Likewise. * testsuite/20_util/shared_ptr/creation/87278.cc: Likewise. * testsuite/20_util/shared_ptr/creation/92878_92947.cc: Likewise. * testsuite/20_util/shared_ptr/creation/99006.cc: Likewise. * testsuite/20_util/shared_ptr/creation/dr402.cc: Likewise. * testsuite/20_util/shared_ptr/creation/dr925.cc: Likewise. * testsuite/20_util/shared_ptr/creation/make.cc: Likewise. * testsuite/20_util/shared_ptr/creation/no_rtti.cc: Likewise. * testsuite/20_util/shared_ptr/creation/overwrite.cc: Likewise. * testsuite/20_util/shared_ptr/creation/private.cc: Likewise. * testsuite/20_util/shared_ptr/creation/single_allocation.cc: Likewise. * testsuite/20_util/shared_ptr/creation/single_allocation_no_rtti.cc: Likewise. * testsuite/20_util/shared_ptr/creation/version.cc: Likewise. * testsuite/20_util/shared_ptr/dest/dest.cc: Likewise. * testsuite/20_util/shared_ptr/hash/1.cc: Likewise. * testsuite/20_util/shared_ptr/misc/24595.cc: Likewise. * testsuite/20_util/shared_ptr/misc/42019.cc: Likewise. * testsuite/20_util/shared_ptr/misc/get_deleter.cc: Likewise. * testsuite/20_util/shared_ptr/misc/swap.cc: Likewise. * testsuite/20_util/shared_ptr/modifiers/reset.cc: Likewise. * testsuite/20_util/shared_ptr/modifiers/reset_neg.cc: Likewise. * testsuite/20_util/shared_ptr/modifiers/reset_sfinae.cc: Likewise. * testsuite/20_util/shared_ptr/modifiers/swap.cc: Likewise. * testsuite/20_util/shared_ptr/modifiers/swap_neg.cc: Likewise. * testsuite/20_util/shared_ptr/observers/array.cc: Likewise. * testsuite/20_util/shared_ptr/observers/bool_conv.cc: Likewise. * testsuite/20_util/shared_ptr/observers/get.cc: Likewise. * testsuite/20_util/shared_ptr/observers/owner_before.cc: Likewise. * testsuite/20_util/shared_ptr/observers/unique.cc: Likewise. * testsuite/20_util/shared_ptr/observers/use_count.cc: Likewise. * testsuite/20_util/shared_ptr/requirements/explicit_instantiation/1.cc: Likewise. * testsuite/20_util/shared_ptr/requirements/explicit_instantiation/2.cc: Likewise. * testsuite/20_util/shared_ptr/requirements/weak_type.cc: Likewise. * testsuite/20_util/specialized_algorithms/construct_at/95788.cc: Likewise. * testsuite/20_util/temporary_buffer.cc: Likewise. * testsuite/20_util/tuple/48476.cc: Likewise. * testsuite/20_util/tuple/cons/90700.cc: Likewise. * testsuite/20_util/tuple/cons/96803.cc: Likewise. * testsuite/20_util/tuple/cons/allocator_with_any.cc: Likewise. * testsuite/20_util/tuple/cons/allocators.cc: Likewise. * testsuite/20_util/tuple/cons/constexpr_allocator_arg_t.cc: Likewise. * testsuite/20_util/tuple/cons/explicit_construct.cc: Likewise. * testsuite/20_util/tuple/p2321r2.cc: Likewise. * testsuite/20_util/unique_ptr/creation/92878_92947.cc: Likewise. * testsuite/20_util/unique_ptr/creation/array.cc: Likewise. * testsuite/20_util/unique_ptr/creation/array_neg.cc: Likewise. * testsuite/20_util/unique_ptr/creation/constexpr.cc: Likewise. * testsuite/20_util/unique_ptr/creation/for_overwrite.cc: Likewise. * testsuite/20_util/unique_ptr/creation/for_overwrite__neg.cc: Likewise. * testsuite/20_util/unique_ptr/creation/single.cc: Likewise. * testsuite/20_util/uses_allocator/69293_neg.cc: Likewise. * testsuite/20_util/uses_allocator/92878_92947.cc: Likewise. * testsuite/20_util/uses_allocator/uninitialized_construct.cc: Likewise. * testsuite/20_util/weak_ptr/comparison/cmp_neg.cc: Likewise. * testsuite/20_util/weak_ptr/cons/deduction.cc: Likewise. * testsuite/20_util/weak_ptr/cons/noexcept_move_construct.cc: Likewise. * testsuite/20_util/weak_ptr/lock/1.cc: Likewise. * testsuite/20_util/weak_ptr/observers/owner_before.cc: Likewise. * testsuite/20_util/weak_ptr/requirements/explicit_instantiation/1.cc: Likewise. * testsuite/20_util/weak_ptr/requirements/explicit_instantiation/2.cc: Likewise. * testsuite/21_strings/basic_string/version.cc: Likewise. * testsuite/21_strings/basic_string_view/operations/contains/char/2.cc: Likewise. * testsuite/21_strings/c_strings/char/69626.cc: Likewise. * testsuite/21_strings/char_traits/requirements/version.cc: Likewise. * testsuite/23_containers/vector/requirements/version.cc: Likewise. * testsuite/24_iterators/back_insert_iterator/requirements/base_classes.cc: Likewise. * testsuite/24_iterators/front_insert_iterator/requirements/base_classes.cc: Likewise. * testsuite/24_iterators/insert_iterator/requirements/base_classes.cc: Likewise. * testsuite/24_iterators/istream_iterator/requirements/base_classes.cc: Likewise. * testsuite/24_iterators/istreambuf_iterator/92285.cc: Likewise. * testsuite/24_iterators/istreambuf_iterator/cons/sentinel.cc: Likewise. * testsuite/24_iterators/istreambuf_iterator/requirements/base_classes.cc: Likewise. * testsuite/24_iterators/istreambuf_iterator/requirements/dr445.cc: Likewise. * testsuite/24_iterators/ostream_iterator/requirements/base_classes.cc: Likewise. * testsuite/24_iterators/ostreambuf_iterator/requirements/base_classes.cc: Likewise. * testsuite/25_algorithms/constexpr_macro.cc: Likewise. * testsuite/25_algorithms/equal/constrained.cc: Likewise. * testsuite/25_algorithms/headers/cstdlib/functions_std.cc: Likewise. * testsuite/25_algorithms/inplace_merge/1.cc: Likewise. * testsuite/25_algorithms/lexicographical_compare/constrained.cc: Likewise. * testsuite/25_algorithms/make_heap/movable.cc: Likewise. * testsuite/25_algorithms/pstl/feature_test-4.cc: Likewise. * testsuite/25_algorithms/random_shuffle/1.cc: Likewise. * testsuite/25_algorithms/random_shuffle/moveable.cc: Likewise. * testsuite/25_algorithms/random_shuffle/requirements/explicit_instantiation/2.cc: Likewise. * testsuite/25_algorithms/sort/35588.cc: Likewise. * testsuite/25_algorithms/stable_partition/1.cc: Likewise. * testsuite/25_algorithms/stable_partition/constrained.cc: Likewise. * testsuite/25_algorithms/stable_partition/mem_check.cc: Likewise. * testsuite/25_algorithms/stable_partition/moveable.cc: Likewise. * testsuite/25_algorithms/stable_partition/requirements/explicit_instantiation/2.cc: Likewise. * testsuite/25_algorithms/stable_partition/requirements/explicit_instantiation/pod.cc: Likewise. * testsuite/25_algorithms/stable_sort/1.cc: Likewise. * testsuite/26_numerics/complex/2.cc: Likewise. * testsuite/26_numerics/headers/cstdlib/13943.cc: Likewise. * testsuite/26_numerics/headers/cstdlib/2190.cc: Likewise. * testsuite/26_numerics/headers/cstdlib/60401.cc: Likewise. * testsuite/26_numerics/headers/cstdlib/dr2192.cc: Likewise. * testsuite/26_numerics/headers/cstdlib/dr2192_neg.cc: Likewise. * testsuite/26_numerics/headers/cstdlib/dr2735.cc: Likewise. * testsuite/26_numerics/headers/cstdlib/functions_std.cc: Likewise. * testsuite/26_numerics/headers/cstdlib/macros.cc: Likewise. * testsuite/26_numerics/headers/cstdlib/types_std.cc: Likewise. * testsuite/26_numerics/headers/cstdlib/types_std_c++0x.cc: Likewise. * testsuite/26_numerics/lerp/version.cc: Likewise. * testsuite/26_numerics/midpoint/version.cc: Likewise. * testsuite/27_io/basic_syncbuf/2.cc: Likewise. * testsuite/27_io/basic_syncstream/2.cc: Likewise. * testsuite/27_io/fpos/14320-1.cc: Likewise. * testsuite/27_io/fpos/14320-2.cc: Likewise. * testsuite/27_io/fpos/14320-3.cc: Likewise. * testsuite/27_io/fpos/14320-4.cc: Likewise. * testsuite/27_io/spanstream/version.cc: Likewise. * testsuite/29_atomics/atomic/lwg3220.cc: Likewise. * testsuite/29_atomics/atomic/operators/51811.cc: Likewise. * testsuite/29_atomics/atomic/wait_notify/1.cc: Likewise. * testsuite/29_atomics/atomic/wait_notify/102994.cc: Likewise. * testsuite/29_atomics/atomic/wait_notify/2.cc: Likewise. * testsuite/29_atomics/headers/stdatomic.h/version.cc: Likewise. * testsuite/30_threads/barrier/2.cc: Likewise. * testsuite/30_threads/condition_variable_any/stop_token/2.cc: Likewise. * testsuite/30_threads/jthread/version.cc: Likewise. * testsuite/30_threads/latch/2.cc: Likewise. * testsuite/30_threads/semaphore/2.cc: Likewise. * testsuite/30_threads/stop_token/2.cc: Likewise. * testsuite/abi/pr42230.cc: Likewise. * testsuite/ext/shared_ptr/1.cc: Likewise. * testsuite/libstdc++-xmethods/shared_ptr.cc: Likewise. * testsuite/std/ranges/adaptors/lazy_split_neg.cc: Likewise. * testsuite/std/ranges/adaptors/p1739.cc: Likewise. * testsuite/std/ranges/iota/lwg3292_neg.cc: Likewise. * testsuite/std/ranges/p2325.cc: Likewise.
2022-10-03libstdc++: Make some tests work on freestanding [PR103626]Arsen Arsenović4-61/+79
PR libstdc++/103626 - _GLIBCXX_HOSTED should respect -ffreestanding Co-authored-by: Jonathan Wakely <jwakely@redhat.com> libstdc++-v3/ChangeLog: PR libstdc++/103626 * testsuite/17_intro/headers/c++1998/stdc++.cc [!__STDC_HOSTED__]: Do not include C headers that aren't valid for freestanding. * testsuite/17_intro/tag_type_explicit_ctor.cc [!__STDC_HOSTED__]: Do not test tag types that aren't defined for freestanding. * testsuite/18_support/headers/cstdlib/functions_std.cc: Do not check for std::getenv and std::system for freestanding. * testsuite/17_intro/using_namespace_std_exp_neg.cc [!__STDC_HOSTED__]: Do not test hosted parts of the standard library. * testsuite/17_intro/using_namespace_std_tr1_neg.cc [!__STDC_HOSTED__]: Likewise. * testsuite/20_util/allocator_traits/members/rebind_alloc.cc [!__STDC_HOSTED__]: Likewise. * testsuite/20_util/allocator_traits/requirements/explicit_instantiation.cc [!HOSTED]: Likewise. * testsuite/20_util/headers/bitset/synopsis.cc [!__STDC_HOSTED__]: Likewise. * testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc [!__STDC_HOSTED__]: Likewise. * testsuite/20_util/pointer_traits/requirements/typedefs.cc [!__STDC_HOSTED__]: Likewise. * testsuite/20_util/tuple/cons/deduction.cc [!__STDC_HOSTED__]: Likewise. * testsuite/25_algorithms/move/93872.cc [!__STDC_HOSTED__]: Likewise. * testsuite/std/ranges/adaptors/100577.cc [!__STDC_HOSTED__]: Likewise.
2022-09-24libstdc++: Simplify detection idiom using conceptsJonathan Wakely1-0/+1
Add a simpler definition of std::__detected_or using concepts. This also replaces the __detector::value_t member which should have been using a reserved name. Use __detected_or in pointer_traits. libstdc++-v3/ChangeLog: * include/bits/alloc_traits.h (allocator_traits::is_always_equal): Only instantiate is_empty if needed. * include/bits/ptr_traits.h (__ptr_traits_impl::difference_type) (__ptr_traits_impl::rebind): Use __detected_or. * include/experimental/type_traits (is_same_v): Add a partial specialization instead of instantiating the std::is_same class template. (detected_t): Redefine in terms of detected_or_t. (is_detected, is_detected_v): Redefine in terms of detected_t. * include/std/type_traits [__cpp_concepts] (__detected_or): Add new definition using concepts. (__detector::value_t): Rename to __is_detected. * testsuite/17_intro/names.cc: Check value_t isn't used.
2022-09-21libstdc++: Remove main() from some compile-only testsJonathan Wakely5-25/+0
libstdc++-v3/ChangeLog: * testsuite/17_intro/headers/c++1998/all_attributes.cc: Remove unnecessary main function. * testsuite/17_intro/headers/c++2011/all_attributes.cc: Likewise. * testsuite/17_intro/headers/c++2014/all_attributes.cc: Likewise. * testsuite/17_intro/headers/c++2017/all_attributes.cc: Likewise. * testsuite/17_intro/headers/c++2020/all_attributes.cc: Likewise.
2022-09-14libstdc++: Add comment to 17_intro/names.cc testJonathan Wakely1-0/+2
libstdc++-v3/ChangeLog: * testsuite/17_intro/names.cc: Explain why poison pragma can't be used.
2022-09-09libstdc++: Rename parameter to avoid darwin __weak qualifierJonathan Wakely1-0/+4
libstdc++-v3/ChangeLog: * include/bits/atomic_base.h (__atomic_impl::__compare_exchange): Rename __weak to __is_weak. * testsuite/17_intro/names.cc: Add __weak and __strong.
2022-05-05libstdc++: Fixes for tests that fail with -fno-rttiJonathan Wakely1-1/+3
This disables a use of dynamic_cast that is not valid for -fno-rtti and adjusts some tests so they don't FAIL with -fno-rtti. Some tests are skipped completely, and others just make use of typeid conditional on the __cpp_rtti macro. A couple of tests were using typeid to verify typedefs denote the right type, which can be done at compile-time using templates instead. libstdc++-v3/ChangeLog: * include/experimental/memory_resource [!__cpp_rtti] (__resource_adaptor_imp::do_is_equal): Do not use dynamic_cast when RTTI is disabled. * testsuite/17_intro/freestanding.cc: Require RTTI. * testsuite/18_support/exception/38732.cc: Likewise. * testsuite/18_support/exception_ptr/rethrow_exception.cc: Likewise. * testsuite/18_support/nested_exception/68139.cc: Likewise. * testsuite/18_support/nested_exception/rethrow_if_nested.cc: Likewise. * testsuite/18_support/type_info/103240.cc: Likewise. * testsuite/18_support/type_info/fundamental.cc: Likewise. * testsuite/18_support/type_info/hash_code.cc: Likewise. * testsuite/20_util/any/assign/emplace.cc: Likewise. * testsuite/20_util/any/cons/in_place.cc: Likewise. * testsuite/20_util/any/misc/any_cast.cc: Likewise. * testsuite/20_util/any/observers/type.cc: Likewise. * testsuite/20_util/function/1.cc: Likewise. * testsuite/20_util/function/2.cc: Likewise. * testsuite/20_util/function/3.cc: Likewise. * testsuite/20_util/function/4.cc: Likewise. * testsuite/20_util/function/5.cc: Likewise. * testsuite/20_util/function/6.cc: Likewise. * testsuite/20_util/function/7.cc: Likewise. * testsuite/20_util/function/8.cc: Likewise. * testsuite/20_util/polymorphic_allocator/resource.cc: Likewise. * testsuite/20_util/shared_ptr/casts/1.cc: Likewise. * testsuite/20_util/shared_ptr/casts/rval.cc: Likewise. * testsuite/20_util/shared_ptr/cons/unique_ptr_deleter_ref_2.cc: Likewise. * testsuite/20_util/shared_ptr/misc/get_deleter.cc: Likewise. * testsuite/20_util/typeindex/comparison_operators.cc: Likewise. * testsuite/20_util/typeindex/comparison_operators_c++20.cc: Likewise. * testsuite/20_util/typeindex/hash.cc: Likewise. * testsuite/20_util/typeindex/hash_code.cc: Likewise. * testsuite/20_util/typeindex/name.cc: Likewise. * testsuite/22_locale/ctype/is/string/89728_neg.cc: Likewise. * testsuite/22_locale/global_templates/standard_facet_hierarchies.cc: Likewise. * testsuite/22_locale/global_templates/user_facet_hierarchies.cc: Likewise. * testsuite/22_locale/locale/13630.cc: Check type without using RTTI. * testsuite/23_containers/array/requirements/non_default_constructible.cc: Require RTTI. * testsuite/27_io/basic_ostream/emit/1.cc: Likewise. * testsuite/27_io/fpos/14320-1.cc: Check type without using RTTI. * testsuite/27_io/fpos/mbstate_t/12065.cc: Require RTTI. * testsuite/27_io/ios_base/failure/dual_abi.cc: Likewise. * testsuite/experimental/any/misc/any_cast.cc: Likewise. * testsuite/experimental/any/observers/type.cc: Likewise. * testsuite/experimental/memory_resource/resource_adaptor.cc: Likewise. * testsuite/lib/libstdc++.exp (check_effective_target_rtti): Define new proc. * testsuite/tr1/3_function_objects/function/1.cc: Likewise. * testsuite/tr1/3_function_objects/function/2.cc: Likewise. * testsuite/tr1/3_function_objects/function/3.cc: Likewise. * testsuite/tr1/3_function_objects/function/4.cc: Likewise. * testsuite/tr1/3_function_objects/function/5.cc: Likewise. * testsuite/tr1/3_function_objects/function/6.cc: Likewise. * testsuite/tr1/3_function_objects/function/7.cc: Likewise. * testsuite/tr1/3_function_objects/function/8.cc: Likewise. * testsuite/tr2/bases/value.cc: Likewise. * testsuite/tr2/direct_bases/value.cc: Likewise. * testsuite/util/exception/safety.h [!__cpp_rtti]: Don't print types without RTTI.
2022-03-03libstdc++: Fix test failure on AIXJonathan Wakely1-0/+2
This fixes a test failure due to a non-reserved name in an AIX system header (included via <pthread.h>). That name clashes with one of the names we check our own headers for, so skip checking that name on AIX. libstdc++-v3/ChangeLog: * testsuite/17_intro/names.cc (func): Undef on AIX.
2022-01-17libstdc++: Rename non-reserved macros in config header [PR103650]Jonathan Wakely1-0/+13
libstdc++-v3/ChangeLog: PR libstdc++/103650 * include/Makefile.am: Rename LT_OBJDIR and STDC_HEADERS. * include/Makefile.in: Regenerate. * testsuite/17_intro/headers/c++1998/103650.cc: New test.
2022-01-03Update copyright years.Jakub Jelinek57-57/+57
2021-12-14libstdc++: Fix non-reserved name in <regex> headerJonathan Wakely1-0/+1
libstdc++-v3/ChangeLog: * include/bits/regex_compiler.tcc (_Compiler::_M_match_token): Use reserved name for parameter. * testsuite/17_intro/names.cc: Check "token".
2021-11-10libstdc++: Fix test for libstdc++ not including <unistd.h> [PR100117]Jonathan Wakely1-1/+112
The <cxxx> headers for the C library are not under our control, so we can't prevent them from including <unistd.h>. Change the PR 49745 test to only include the C++ library headers, not the <cxxx> ones. To ensure <bits/stdc++.h> isn't included automatically we need to use no_pch to disable PCH. libstdc++-v3/ChangeLog: PR libstdc++/100117 * testsuite/17_intro/headers/c++1998/49745.cc: Explicitly list all C++ headers instead of including <bits/stdc++.h>
2021-10-26libstdc++: Fix 17_intro/names.cc on SolarisRainer Orth1-0/+4
17_intro/names.cc and experimental/names.cc currently FAIL on Solaris FAIL: 17_intro/names.cc (test for excess errors) FAIL: experimental/names.cc (test for excess errors) Excess errors: /usr/include/sys/timespec_util.h:22: error: expected ')' before ';' token /usr/include/stdlib.h:157: error: expected unqualified-id before '[' token /usr/include/stdlib.h:157: error: expected ')' before '[' token <sys/timespec_util.h> has extern int timespeccompare(const struct timespec *l, const struct timespec *r); while <stdlib.h> has typedef struct drand48_data { unsigned int _initialised; unsigned short int x[3]; unsigned short int a[3]; unsigned int c; unsigned short lastx[3]; } drand48_data; both of which are broken by defining r resp. x to ( in the testcase. Fixed by undoing the defines. Tested on i386-pc-solaris2.11, sparc-sun-solaris2.11, and x86_64-pc-linux-gnu. 2021-10-20 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> libstdc++-v3: * testsuite/17_intro/names.cc [__sun__] (r, x): Undef.
2021-08-31libstdc++: Fix 17_intro/names.cc failures on SolarisJonathan Wakely1-0/+6
Signed-off-by: Jonathan Wakely <jwakely@redhat.com> libstdc++-v3/ChangeLog: * testsuite/17_intro/names.cc: Undefine some more names used by Solaris system headers.
2021-08-26libstdc++: Add another non-reserved name to testsJonathan Wakely1-0/+1
Signed-off-by: Jonathan Wakely <jwakely@redhat.com> libstdc++-v3/ChangeLog: * testsuite/17_intro/names.cc: Check 'sz'.