aboutsummaryrefslogtreecommitdiff
path: root/libstdc++-v3
AgeCommit message (Collapse)AuthorFilesLines
2020-12-17libstdc++: Test errno macros directly for all targets [PR 93151]Jonathan Wakely3-39/+39
This applies the same changes to the djgpp and mingw versions of error_constants.h as r11-6137 did for the generic version. All of these constants are defined as macros by <errno.h> on these targets, so we can just test the macro directly instead of checking for it at configure time. libstdc++-v3/ChangeLog: * config/os/djgpp/error_constants.h: Test POSIX errno macros directly, instead of corresponding _GLIBCXX_HAVE_EXXX macros. * config/os/mingw32-w64/error_constants.h: Likewise. * config/os/mingw32/error_constants.h: Likewise.
2020-12-17libstdc++: Fix condition for gthreads-timed effective-targetJonathan Wakely1-1/+1
The refactoring in r11-5500 altered the condition for the gthreads-timed test from #if to #ifdef. For some reason that macro is always defined, rather than being defined to 1 or undefined like most of our autoconf macros. That means the test always passes now, even for targets where the macro is defined to 0 (specifically, Darwin). That causes some tests to FAIL when they should have been UNSUPPORTED. This restores the previous behaviour. libstdc++-v3/ChangeLog: * testsuite/lib/libstdc++.exp (check_v3_target_gthreads_timed): Fix condition for _GTHREAD_USE_MUTEX_TIMEDLOCK test.
2020-12-17libstdc++: Fix -Wunused warningJonathan Wakely1-1/+2
As noted in PR 66146 comment 35, there is a new warning in the new std::call_once implementation. libstdc++-v3/ChangeLog: * src/c++11/mutex.cc (std::once_flag::_M_finish): Add maybe_unused attribute to variable used in assertion.
2020-12-17libstdc++: Fix preprocessor condition [PR 98344]Jonathan Wakely1-1/+1
libstdc++-v3/ChangeLog: PR libstdc++/98344 * include/bits/semaphore_base.h: Fix preprocessor condition.
2020-12-17libstdc++: Move std::hash<std::thread::id> to <bits/std_thread.h>Jonathan Wakely2-12/+12
This makes the hash function available without including the whole of <thread>, which is needed for <barrier>. libstdc++-v3/ChangeLog: * include/bits/std_thread.h (hash<thread::id>): Move here, from ... * include/std/thread (hash<thread::id>): ... here.
2020-12-17libstdc++: Regenerate autoconf filesJonathan Wakely2-688/+0
I forgot to regenerate these files in r11-6137. libstdc++-v3/ChangeLog: * config.h.in: Regenerate. * configure: Regenerate.
2020-12-17Daily bump.GCC Administrator1-0/+134
2020-12-16libstdc++: Add C++ runtime support for new 128-bit long double formatJonathan Wakely44-311/+1380
This adds support for the new __ieee128 long double format on powerpc64le targets. Most of the complexity comes from wanting a single libstdc++.so library that contains the symbols needed by code compiled with both -mabi=ibmlongdouble and -mabi=ieeelongdouble (and not forgetting -mlong-double-64 as well!) In a few places this just requires an extra overload, for example std::from_chars has to be overloaded for both forms of long double. That can be done in a single translation unit that defines overloads for 'long double' and also '__ieee128', so that user code including <charconv> will be able to link to a definition for either type of long double. Those are the easy cases. The difficult parts are (as for the std::string ABI transition) the I/O and locale facets. In order to be able to write either form of long double to an ostream such as std::cout we need the locale to contain a std::num_put facet that can handle both forms. The same approach is taken as was already done for supporting 64-bit long double and 128-bit long double: adding extra overloads of do_put to the facet class. On targets where the new long double code is enabled, the facets that are registered in the locale at program startup have additional overloads so that they can work with any long double type. Where this fails to work is if user code installs its own facet, which will probably not have the additional overloads and so will only be able to output one or the other type. In practice the number of users expecting to be able to use their own locale facets in code using a mix of -mabi=ibmlongdouble and -mabi=ieeelongdouble is probably close to zero. libstdc++-v3/ChangeLog: * Makefile.in: Regenerate. * config.h.in: Regenerate. * config/abi/pre/gnu.ver: Make patterns less greedy. * config/os/gnu-linux/ldbl-ieee128-extra.ver: New file with patterns for IEEE128 long double symbols. * configure: Regenerate. * configure.ac: Enable alternative 128-bit long double format on powerpc64*-*-linux*. * doc/Makefile.in: Regenerate. * fragment.am: Regenerate. * include/Makefile.am: Set _GLIBCXX_LONG_DOUBLE_ALT128_COMPAT. * include/Makefile.in: Regenerate. * include/bits/c++config: Define inline namespace for new long double symbols. Don't define _GLIBCXX_USE_FLOAT128 when it's the same type as long double. * include/bits/locale_classes.h [_GLIBCXX_LONG_DOUBLE_ALT128_COMPAT] (locale::_Impl::_M_init_extra_ldbl128): Declare new member function. * include/bits/locale_facets.h (_GLIBCXX_NUM_FACETS): Simplify by only counting narrow character facets. (_GLIBCXX_NUM_CXX11_FACETS): Likewise. (_GLIBCXX_NUM_LBDL_ALT128_FACETS): New. [_GLIBCXX_LONG_DOUBLE_ALT128_COMPAT] (num_get::__do_get): Define vtable placeholder for __ibm128 long double type. [_GLIBCXX_LONG_DOUBLE_ALT128_COMPAT && __LONG_DOUBLE_IEEE128__] (num_get::__do_get): Declare vtable placeholder for __ibm128 long double type. [_GLIBCXX_LONG_DOUBLE_ALT128_COMPAT && __LONG_DOUBLE_IEEE128__] (num_put::__do_put): Likewise. * include/bits/locale_facets.tcc [_GLIBCXX_LONG_DOUBLE_ALT128_COMPAT && __LONG_DOUBLE_IEEE128__] (num_get::__do_get, num_put::__do_put): Define. * include/bits/locale_facets_nonio.h [_GLIBCXX_LONG_DOUBLE_ALT128_COMPAT && __LONG_DOUBLE_IEEE128__] (money_get::__do_get): Declare vtable placeholder for __ibm128 long double type. [_GLIBCXX_LONG_DOUBLE_ALT128_COMPAT && __LONG_DOUBLE_IEEE128__] (money_put::__do_put): Likewise. * include/bits/locale_facets_nonio.tcc [_GLIBCXX_LONG_DOUBLE_ALT128_COMPAT && __LONG_DOUBLE_IEEE128__] (money_get::__do_get, money_put::__do_put): Define. * include/ext/numeric_traits.h [_GLIBCXX_LONG_DOUBLE_ALT128_COMPAT] (__numeric_traits<__ibm128>, __numeric_traits<__ieee128>): Define. * libsupc++/Makefile.in: Regenerate. * po/Makefile.in: Regenerate. * python/Makefile.in: Regenerate. * src/Makefile.am: Add compatibility-ldbl-alt128.cc and compatibility-ldbl-alt128-cxx11.cc sources and recipes for objects. * src/Makefile.in: Regenerate. * src/c++11/Makefile.in: Regenerate. * src/c++11/compatibility-ldbl-alt128-cxx11.cc: New file defining symbols using the old 128-bit long double format, for the cxx11 ABI. * src/c++11/compatibility-ldbl-alt128.cc: Likewise, for the gcc4-compatible ABI. * src/c++11/compatibility-ldbl-facets-aliases.h: New header for long double compat aliases. * src/c++11/cow-locale_init.cc: Add comment. * src/c++11/cxx11-locale-inst.cc: Define C and C_is_char unconditionally. * src/c++11/cxx11-wlocale-inst.cc: Add sanity check. Include locale-inst.cc directly, not via cxx11-locale-inst.cc. * src/c++11/locale-inst-monetary.h: New header for monetary category instantiations. * src/c++11/locale-inst-numeric.h: New header for numeric category instantiations. * src/c++11/locale-inst.cc: Include new headers for monetary, numeric, and long double definitions. * src/c++11/wlocale-inst.cc: Remove long double compat aliases that are defined in new header now. * src/c++17/Makefile.am: Use -mabi=ibmlongdouble for floating_from_chars.cc. * src/c++17/Makefile.in: Regenerate. * src/c++17/floating_from_chars.cc (from_chars_impl): Add if-constexpr branch for __ieee128. (from_chars): Overload for __ieee128. * src/c++20/Makefile.in: Regenerate. * src/c++98/Makefile.in: Regenerate. * src/c++98/locale_init.cc (num_facets): Adjust calculation. (locale::_Impl::_Impl(size_t)): Call _M_init_extra_ldbl128. * src/c++98/localename.cc (num_facets): Adjust calculation. (locale::_Impl::_Impl(const char*, size_t)): Call _M_init_extra_ldbl128. * src/filesystem/Makefile.in: Regenerate. * testsuite/Makefile.in: Regenerate. * testsuite/util/testsuite_abi.cc: Add new symbol versions. Allow new symbols to be added to GLIBCXX_IEEE128_3.4.29 and CXXABI_IEEE128_1.3.13 too. * testsuite/26_numerics/complex/abi_tag.cc: Add u9__ieee128 to regex matching expected symbols.
2020-12-16libstdc++: Simplify built-in detection in <utility>Jonathan Wakely1-11/+5
Now that GCC supports __has_builtin there is no need to test whether it's defined, we can just use it unconditionally. libstdc++-v3/ChangeLog: * include/std/utility: Use __has_builtin without checking if it's defined.
2020-12-16libstdc++: Warn if __STRICT_ANSI has been undefinedJonathan Wakely1-0/+9
Recent changes to use __int128 as an integer-like type in <ranges> and to optimize std::uniform_int_distribution mean that the library relies on __int128 more heavily than in the past. The library expects that if __int128 is supported then either __GLIBCXX_TYPE_INT_N_0 is defined (and we treat is like the standard integer types), or __STRICT_ANSI__ is defined (and we need to add special handling for __int128 as a non-standard integer type). If users compile with -std=c++NN -U__STRICT_ANSI__ then it puts the library into a broken and inconsistent state, where the compiler doesn't define the __GLIBCXX_TYPE_INT_N_0 macro, but the library thinks it doesn't need special handling for __int128. What the user should do is compile with -std=gnu++NN instead. This adds a warning if it appears that __int128 is supported but neither __GLIBCXX_TYPE_INT_N_0 nor __STRICT_ANSI__ is defined. libstdc++-v3/ChangeLog: * include/bits/c++config: Warn if __STRICT_ANSI__ state is inconsistent with __GLIBCXX_TYPE_INT_N_0.
2020-12-16libstdc++: Only use __builtin_sprintf if supported [PR 96083]Jonathan Wakely1-0/+16
Clang doesn't support __builtin_sprintf, so use std::sprintf instead. libstdc++-v3/ChangeLog: PR libstdc++/96083 * include/ext/throw_allocator.h: Use __has_builtin to check for __builtin_sprintf support, and use std::sprtinf if necessary.
2020-12-16libstdc++: Fix errors from Library Fundamentals TS headers in C++11 [PR 98319]Jonathan Wakely4-60/+45
Currently the <experimental/random>, <experimental/source_location> and <experimental/utility> headers can be included in C++98 and C++11 modes, but gives errors. With this change they can be included, but define nothing. libstdc++-v3/ChangeLog: PR libstdc++/98319 * include/experimental/random: Only define contents for C++14 and later. * include/experimental/source_location: Likewise. * include/experimental/utility: Likewise. * testsuite/experimental/feat-lib-fund.cc: Include all LFTS headers that are present. Allow test to run for all modes.
2020-12-16libstdc++: Add performance test for atomic_flag [PR 46447]Jonathan Wakely1-0/+71
This adds a test to compare the performance of std::atomic_flag with similar operations on std::atomic_uchar and std::atomic_int. libstdc++-v3/ChangeLog: PR libstdc++/46447 * testsuite/performance/29_atomics/atomic_flag.cc: New test.
2020-12-16libstdc++: Test errno macros directly, not via autoconf [PR 93151]Jonathan Wakely5-60/+53
This fixes a bug caused by a mismatch between the macros defined by <errno.h> when GCC is built and the macros defined by <errno.h> when users include <system_error>. If the user code is compiled with _XOPEN_SOURCE defined to 500 or 600, Darwin suppresses the ENOTRECOVERABLE and EOWNERDEAD macros, which are not defined by SUSv3 (aka POSIX.1-2001). Since POSIX requires the errno macros to be macros (and not variables or enumerators) we can just test for them directly using the preprocessor. That means that <system_error> will match what is actuallydefined when it's included, not what was defined when GCC was built. With that change there is no need for the GLIBCXX_CHECK_SYSTEM_ERROR configure checks and they can be removed. libstdc++-v3/ChangeLog: PR libstdc++/93151 * acinclude.m4 (GLIBCXX_CHECK_SYSTEM_ERROR): Remove. * configure.ac: Regenerate. * config/os/generic/error_constants.h: Test POSIX errno macros directly, instead of corresponding _GLIBCXX_HAVE_EXXX macros. * testsuite/19_diagnostics/headers/system_error/errc_std_c++0x.cc: Likewise. * testsuite/19_diagnostics/headers/system_error/93151.cc: New test.
2020-12-16Daily bump.GCC Administrator1-0/+65
2020-12-15libstdc++: Remove init_priority attribute for Init object [PR 98108]Jonathan Wakely1-9/+1
This reverts commit cf4ed3b41594b6935a337fe0aaf8149eadf88751. libstdc++-v3/ChangeLog: PR libstdc++/98108 * include/std/iostream (__ioinit): Remove init_priority attribute.
2020-12-15libstdc++: Support libc with stdio-only I/O in libstdc++Keith Packard4-17/+69
The current libstdc++ basic_file_stdio.cc code assumes a POSIX API underneath the stdio implementation provided by the host libc. This means that the host must provide a fairly broad POSIX file API, including read, write, open, close, lseek and ioctl. This patch changes basic_file_stdio.cc to only use basic ANSI-C stdio functions, allowing it to be used with libc implementations like picolibc which may not have a POSIX operating system underneath. This is enabled by a new --enable-cstdio=stdio_pure configure option. Aided-by: Jonathan Wakely <jwakely@redhat.com> Signed-off-by: Keith Packard <keithp@keithp.com> libstdc++-v3/ChangeLog: * acinclude.m4 (GLIBCXX_ENABLE_CSTDIO): Allow "stdio_pure" option and define _GLIBCXX_USE_PURE_STDIO when it is used. Also add "stdio_posix" option as an alias for "stdio". * config/io/basic_file_stdio.cc [_GLIBCXX_USE_PURE_STDIO]: Only use defined stdio entry points for all I/O operations, without direct calls to underlying POSIX functions. * config.h.in: Regenerate. * configure: Regenerate.
2020-12-15libstdc++: Fix the test for rvalue stream extractionVille Voutilainen1-0/+2
libstdc++-v3/ChangeLog: * testsuite/27_io/rvalue_streams.cc: Run the extraction to a char* for C++17 and lower only.
2020-12-15libstdc++: Increase timeout for tests in debug modeJonathan Wakely4-2/+9
These tests FAIL when testing debug mode with a small tool_timeout value. Give them a longer relative timeout. libstdc++-v3/ChangeLog: * testsuite/25_algorithms/lexicographical_compare/deque_iterators/1.cc: Add dg-timeout-factor directive. * testsuite/ext/pb_ds/regression/tree_map_rand_debug.cc: Increase timeout factor from 2.0 to 3.0. * testsuite/ext/pb_ds/regression/tree_set_rand_debug.cc: Likewise. * testsuite/lib/libstdc++.exp (check_effective_target_debug-mode): Define "debug-mode" as an effective-target keyword.
2020-12-15libstdc++: Do not define constexpr assertions for C++11Jonathan Wakely1-1/+1
There's no point even checking is_constant_evaluated() in C++11 mode, because the 'if' statement used for the assertion wouldn't be valid in a C++11 constexpr function anyway. libstdc++-v3/ChangeLog: * include/bits/c++config (__glibcxx_assert_1): Define as empty for C++11.
2020-12-15libstdc++: Fix required locales of a testcaseMarius Hillenbrand1-1/+3
The testsuite for libstdc++ aims to skips test cases for which not all required locales are installed. This patch adds missing directives about required locales to one test case to avoid false positive test failures on systems that have a partial set of locales installed. Verified by test suite runs that this patch changes the test case from FAIL to UNSUPPORTED when not all required locales are available and that the test case will run and PASS when the necessary locales have been added. libstdc++-v3/ChangeLog: * testsuite/22_locale/locale/cons/5.cc: Add missing directives for required locales.
2020-12-15libstdc++: Remove workaround for PR c++/78173Jonathan Wakely1-4/+1
Now that the G++ bug is fixed we no longer need to protect this partial specialization from complaining about subtracting void pointers. libstdc++-v3/ChangeLog: * include/bits/iterator_concepts.h (incrementable_traits<Tp>): Remove workaround for PR c++/78173.
2020-12-15libstdc++: Disabling AC_LIBTOOL_DLOPEN check if building with avr-libcVladimir Vishnevsky2-2/+2
The AC_LIBTOOL_DLOPEN checks were previously disabled for newlib targets. The patch applies similar logic to avr-libc based builds. libstdc++-v3/ChangeLog: * configure.ac: Skip AC_LIBTOOL_DLOPEN check if avr-libc is used. * configure: Regenerate.
2020-12-15libstdc++: Use init_priority attribute for Init object [PR 98108]Jonathan Wakely1-1/+9
This causes the global objects that run the <iostream> initialization code to be constructed earlier, which avoids some bugs in user code due to incorrectly relying on static initialization order. libstdc++-v3/ChangeLog: PR libstdc++/98108 * include/std/iostream (__ioinit): Add init_priority attribute.
2020-12-15libstdc++: Update link to Unicode-HOWTOGerald Pfeifer2-2/+2
libstdc++-v3/ChangeLog: 2020-12-15 Gerald Pfeifer <gerald@pfeifer.com> * doc/xml/manual/codecvt.xml: Update link to Unicode-HOWTO. * doc/html/manual/facets.html: Regenerate.
2020-12-15Daily bump.GCC Administrator1-0/+23
2020-12-14libstdc++: Make tests with Undefined Behavior in C++11 UNSUPPORTEDFrançois Dumont3-3/+3
libstdc++-v3/ChangeLog: * testsuite/23_containers/array/debug/back1_neg.cc: Target c++14 because assertion is disabled in C++11. * testsuite/23_containers/array/debug/front1_neg.cc: Likewise. * testsuite/23_containers/array/debug/square_brackets_operator1_neg.cc: Likewise.
2020-12-14Correct/improve maybe_emit_free_warning (PR middle-end/98166, PR c++/57111, ↵Martin Sebor2-0/+8
PR middle-end/98160). Resolves: PR middle-end/98166 - bogus -Wmismatched-dealloc on user-defined allocator and inlining PR c++/57111 - 57111 - Generalize -Wfree-nonheap-object to delete PR middle-end/98160 - ICE in default_tree_printer at gcc/tree-diagnostic.c:270 gcc/ChangeLog: PR middle-end/98166 PR c++/57111 PR middle-end/98160 * builtins.c (check_access): Call tree_inlined_location fndecl_alloc_p): Handle BUILT_IN_ALIGNED_ALLOC and BUILT_IN_GOMP_ALLOC. call_dealloc_p): Remove unused function. (new_delete_mismatch_p): Call valid_new_delete_pair_p and rework. (matching_alloc_calls_p): Handle built-in deallocation functions. (warn_dealloc_offset): Corrct the handling of user-defined operators delete. (maybe_emit_free_warning): Avoid assuming expression is a decl. Simplify. * doc/extend.texi (attribute malloc): Update. * tree-ssa-dce.c (valid_new_delete_pair_p): Factor code out into valid_new_delete_pair_p in tree.c. * tree.c (tree_inlined_location): Define new function. (valid_new_delete_pair_p): Define. * tree.h (tree_inlined_location): Declare. (valid_new_delete_pair_p): Declare. gcc/c-family/ChangeLog: PR middle-end/98166 PR c++/57111 PR middle-end/98160 * c-attribs.c (maybe_add_noinline): New function. (handle_malloc_attribute): Call it. Use ATTR_FLAG_INTERNAL. Implicitly add attribute noinline to functions not declared inline and warn on those. libstdc++-v3/ChangeLog: * testsuite/ext/vstring/requirements/exception/basic.cc: Suppress a false positive warning. * testsuite/ext/vstring/requirements/exception/propagation_consistent.cc: Same. gcc/testsuite/ChangeLog: PR middle-end/98166 PR c++/57111 PR middle-end/98160 * g++.dg/warn/Wmismatched-dealloc-2.C: Adjust test of expected warning. * g++.dg/warn/Wmismatched-new-delete.C: Same. * gcc.dg/Wmismatched-dealloc.c: Same. * c-c++-common/Wfree-nonheap-object-2.c: New test. * c-c++-common/Wfree-nonheap-object-3.c: New test. * c-c++-common/Wfree-nonheap-object.c: New test. * c-c++-common/Wmismatched-dealloc.c: New test. * g++.dg/warn/Wfree-nonheap-object-3.C: New test. * g++.dg/warn/Wfree-nonheap-object-4.C: New test. * g++.dg/warn/Wmismatched-dealloc-2.C: New test. * g++.dg/warn/Wmismatched-new-delete-2.C: New test. * g++.dg/warn/Wmismatched-new-delete.C: New test. * gcc.dg/Wmismatched-dealloc-2.c: New test. * gcc.dg/Wmismatched-dealloc-3.c: New test. * gcc.dg/Wmismatched-dealloc.c: New test.
2020-12-14libstdc++: Fix several _GLIBCXX_DEBUG testsFrançois Dumont4-3/+4
libstdc++-v3/ChangeLog: * testsuite/23_containers/array/debug/back2_neg.cc: target c++14 because assertion for constexpr is disabled in C++11. * testsuite/23_containers/array/debug/front2_neg.cc: Likewise. * testsuite/23_containers/array/debug/square_brackets_operator2_neg.cc: Likewise. * testsuite/23_containers/vector/debug/multithreaded_swap.cc: Include <memory> for shared_ptr.
2020-12-13Daily bump.GCC Administrator1-0/+11
2020-12-12libstdc++: Fix _GLIBCXX_DEBUG mode constexpr compatibilityFrançois Dumont6-4/+210
The __glibcxx_check_can_[increment|decrement]_range macros are using the _GLIBCXX_DEBUG_VERIFY_COND_AT macro which is not constexpr compliant and will produce nasty diagnostics rather than the std::__failed_assertion dedicated to constexpr. Replace it with correct _GLIBCXX_DEBUG_VERIFY_AT_F. libstdc++-v3/ChangeLog: * include/debug/macros.h (__glibcxx_check_can_increment_range): Replace _GLIBCXX_DEBUG_VERIFY_COND_AT usage with _GLIBCXX_DEBUG_VERIFY_AT_F. (__glibcxx_check_can_decrement_range): Likewise. * testsuite/25_algorithms/copy_backward/constexpr.cc (test03): New. * testsuite/25_algorithms/copy/debug/constexpr_neg.cc: New test. * testsuite/25_algorithms/copy_backward/debug/constexpr_neg.cc: New test. * testsuite/25_algorithms/equal/constexpr_neg.cc: New test. * testsuite/25_algorithms/equal/debug/constexpr_neg.cc: New test.
2020-12-11Daily bump.GCC Administrator1-0/+6
2020-12-10libstdc++: Remove redundant branches in countl_one and countr_one [PR 98226]Jonathan Wakely1-4/+0
There's no need to explicitly check for the maximum value, because the function we call handles it correctly anyway. libstdc++-v3/ChangeLog: PR libstdc++/98226 * include/std/bit (__countl_one, __countr_one): Remove redundant branches.
2020-12-10Daily bump.GCC Administrator1-0/+13
2020-12-09libstdc++: Fix build failure for target with no way to sleepJonathan Wakely5-2/+27
In previous releases the std::this_thread::sleep_for function was only declared if the target supports multiple threads. I changed that recently in r11-2649-g5bbb1f3000c57fd4d95969b30fa0e35be6d54ffb so that sleep_for could be used single-threaded. But that means that targets using --disable-threads are now required to provide some way to sleep. This breaks the build for (at least) AVR when trying to build a hosted library. This patch adds a new autoconf macro that is defined when no way to sleep is available, and uses that to suppress the sleeping functions in std::this_thread. The #error in src/c++11/thread.cc is retained for the case where there is no sleep function available but multiple threads are supported. This is consistent with previous releases, but that #error could probably be removed without any consequences. libstdc++-v3/ChangeLog: * acinclude.m4 (GLIBCXX_ENABLE_LIBSTDCXX_TIME): Define NO_SLEEP if none of nanosleep, sleep and Sleep is available. * config.h.in: Regenerate. * configure: Regenerate. * include/std/thread [_GLIBCXX_NO_SLEEP] (__sleep_for): Do not declare. [_GLIBCXX_NO_SLEEP] (sleep_for, sleep_until): Do not define. * src/c++11/thread.cc [_GLIBCXX_NO_SLEEP] (__sleep_for): Do not define.
2020-12-09Daily bump.GCC Administrator1-0/+12
2020-12-08c++: Fix defaulted <=> fallback to < and == [PR96299]Jason Merrill1-2/+2
I thought I had implemented P1186R3, but apparently I didn't read it closely enough to understand the point of the paper, namely that for a defaulted operator<=>, if a member type doesn't have a viable operator<=>, we will use its operator< and operator== if the defaulted operator has an specific comparison category as its return type; the compiler can't guess if it should be strong_ordering or something else, but the user can make that choice explicit. The libstdc++ test change was necessary because of the change in genericize_spaceship from op0 > op1 to op1 < op0; this should be equivalent, but isn't because of PR88173. gcc/cp/ChangeLog: PR c++/96299 * cp-tree.h (build_new_op): Add overload that omits some parms. (genericize_spaceship): Add location_t parm. * constexpr.c (cxx_eval_binary_expression): Pass it. * cp-gimplify.c (genericize_spaceship): Pass it. * method.c (genericize_spaceship): Handle class-type arguments. (build_comparison_op): Fall back to op</== when appropriate. gcc/testsuite/ChangeLog: PR c++/96299 * g++.dg/cpp2a/spaceship-synth-neg2.C: Move error. * g++.dg/cpp2a/spaceship-p1186.C: New test. libstdc++-v3/ChangeLog: PR c++/96299 * testsuite/18_support/comparisons/algorithms/partial_order.cc: One more line needs to use VERIFY instead of static_assert.
2020-12-08libstdc++: Adjust whitespace in documentationJonathan Wakely2-2/+2
libstdc++-v3/ChangeLog: * doc/xml/manual/appendix_contributing.xml: Use consistent indentation. * doc/html/manual/source_code_style.html: Regenerate.
2020-12-06Daily bump.GCC Administrator1-0/+5
2020-12-05Darwin : Update libtool and dependencies for Darwin20 [PR97865]Iain Sandoe1-23/+25
The change in major version (and the increment from Darwin19 to 20) caused libtool tests to fail which resulted in incorrect build settings for shared libraries. We take this opportunity to sort out the shared undefined symbols state rather than propagating the current unsound behaviour into a new rev. This change means that we default to the case that missing symbols are considered an error, and if one wants to allow this intentionally, the confiuration for that case should be set appropriately. Three existing cases need undefined dynamic lookup: libitm, where there is already a configuration mechanism to add the flags. libcc1, where we add simple configuration to add the flags for Darwin. libsanitizer, where we can add to the existing extra flags. libcc1/ChangeLog: PR target/97865 * Makefile.am: Add dynamic_lookup to LD flags for Darwin. * configure.ac: Test for Darwin host and set a flag. * Makefile.in: Regenerate. * configure: Regenerate. libitm/ChangeLog: PR target/97865 * configure.tgt: Add dynamic_lookup to XLDFLAGS for Darwin. * configure: Regenerate. libsanitizer/ChangeLog: PR target/97865 * configure.tgt: Add dynamic_lookup to EXTRA_CXXFLAGS for Darwin. * configure: Regenerate. ChangeLog: PR target/97865 * libtool.m4: Update handling of Darwin platform link flags for Darwin20. gcc/ChangeLog: PR target/97865 * configure: Regenerate. libatomic/ChangeLog: PR target/97865 * configure: Regenerate. libbacktrace/ChangeLog: PR target/97865 * configure: Regenerate. libffi/ChangeLog: PR target/97865 * configure: Regenerate. libgfortran/ChangeLog: PR target/97865 * configure: Regenerate. libgomp/ChangeLog: PR target/97865 * configure: Regenerate. libhsail-rt/ChangeLog: PR target/97865 * configure: Regenerate. libobjc/ChangeLog: PR target/97865 * configure: Regenerate. libphobos/ChangeLog: PR target/97865 * configure: Regenerate. libquadmath/ChangeLog: PR target/97865 * configure: Regenerate. libssp/ChangeLog: PR target/97865 * configure: Regenerate. libstdc++-v3/ChangeLog: PR target/97865 * configure: Regenerate. libvtv/ChangeLog: PR target/97865 * configure: Regenerate. zlib/ChangeLog: PR target/97865 * configure: Regenerate.
2020-12-05Daily bump.GCC Administrator1-0/+8
2020-12-04c++: Change __builtin_source_location to use __PRETTY_FUNCTION__ instead of ↵Jakub Jelinek2-18/+14
__FUNCTION__ [PR80780] On Tue, Dec 01, 2020 at 01:03:52PM +0000, Jonathan Wakely via Gcc-patches wrote: > I mentioned in PR 80780 that a __builtin__PRETTY_FUNCTION would have > been nice, because __FUNCTION__ isn't very useful for C++, because of > overloading and namespace/class scopes. There are an unlimited number > of functions that have __FUNCTION__ == "s", e.g. "ns::s(int)" and > "ns::s()" and "another_scope::s::s<T...>(T...)" etc. > > Since __builtin_source_location() can do whatever it wants (without > needing to add __builtin__PRETTY_FUNCTION) it might be nice to use the > __PRETTY_FUNCTION__ string. JeanHeyd's tests would still need changes, > because the name would be "s::s(void*)" not "s::s" but that still > seems better for users. When I've added template tests for the previous patch, I have noticed that the current __builtin_source_location behavior is not really __FUNCTION__, just close, because e.g. in function template __FUNCTION__ is still "bar" but __builtin_source_location gave "bar<0>". Anyway, this patch implements above request to follow __PRETTY_FUNCTION__ (on top of the earlier posted patch). 2020-12-04 Jakub Jelinek <jakub@redhat.com> PR c++/80780 * cp-gimplify.c (fold_builtin_source_location): Use 2 instead of 0 as last argument to cxx_printable_name. * g++.dg/cpp2a/srcloc1.C (quux): Use __PRETTY_FUNCTION__ instead of function. * g++.dg/cpp2a/srcloc2.C (quux): Likewise. * g++.dg/cpp2a/srcloc15.C (S::S): Likewise. (bar): Likewise. Adjust expected column. * g++.dg/cpp2a/srcloc17.C (S::S): Likewise. (bar): Likewise. Adjust expected column. * testsuite/18_support/source_location/1.cc (main): Adjust for __builtin_source_location using __PRETTY_FUNCTION__-like names instead __FUNCTION__-like. * testsuite/18_support/source_location/consteval.cc (main): Likewise.
2020-12-04Daily bump.GCC Administrator1-0/+54
2020-12-03Add support for detecting mismatched allocation/deallocation calls.Martin Sebor1-2/+6
PR c++/90629 - Support for -Wmismatched-new-delete PR middle-end/94527 - Add an __attribute__ that marks a function as freeing an object gcc/ChangeLog: PR c++/90629 PR middle-end/94527 * builtins.c (access_ref::access_ref): Initialize new member. (compute_objsize): Use access_ref::deref. Handle simple pointer assignment. (expand_builtin): Remove handling of the free built-in. (call_dealloc_argno): Same. (find_assignment_location): New function. (fndecl_alloc_p): Same. (gimple_call_alloc_p): Same. (call_dealloc_p): Same. (matching_alloc_calls_p): Same. (warn_dealloc_offset): Same. (maybe_emit_free_warning): Same. * builtins.h (struct access_ref): Declare new member. (maybe_emit_free_warning): Make extern. Make use of access_ref. Handle -Wmismatched-new-delete. * calls.c (initialize_argument_information): Call maybe_emit_free_warning. * doc/extend.texi (attribute malloc): Update. * doc/invoke.texi (-Wfree-nonheap-object): Expand documentation. (-Wmismatched-new-delete): Document new option. (-Wmismatched-dealloc): Document new option. gcc/c-family/ChangeLog: PR c++/90629 PR middle-end/94527 * c-attribs.c (handle_dealloc_attribute): New function. (handle_malloc_attribute): Handle argument forms of attribute. * c.opt (-Wmismatched-dealloc): New option. (-Wmismatched-new-delete): New option. gcc/testsuite/ChangeLog: PR c++/90629 PR middle-end/94527 * g++.dg/asan/asan_test.cc: Fix a bug. * g++.dg/warn/delete-array-1.C: Add expected warning. * g++.old-deja/g++.other/delete2.C: Add expected warning. * g++.dg/warn/Wfree-nonheap-object-2.C: New test. * g++.dg/warn/Wfree-nonheap-object.C: New test. * g++.dg/warn/Wmismatched-new-delete.C: New test. * g++.dg/warn/Wmismatched-dealloc-2.C: New test. * g++.dg/warn/Wmismatched-dealloc.C: New test. * gcc.dg/Wmismatched-dealloc.c: New test. * gcc.dg/analyzer/malloc-1.c: Prune out expected warning. * gcc.dg/attr-malloc.c: New test. * gcc.dg/free-1.c: Adjust text of expected warning. * gcc.dg/free-2.c: Same. * gcc.dg/torture/pr71816.c: Prune out expected warning. * gcc.dg/tree-ssa/pr19831-2.c: Add an expected warning. * gcc.dg/Wfree-nonheap-object-2.c: New test. * gcc.dg/Wfree-nonheap-object-3.c: New test. * gcc.dg/Wfree-nonheap-object.c: New test. libstdc++-v3/ChangeLog: * testsuite/ext/vstring/modifiers/clear/56166.cc: Suppress a false positive warning.
2020-12-03libstdc++: Fix typos in #error stringsJonathan Wakely2-4/+4
libstdc++-v3/ChangeLog: * testsuite/26_numerics/bit/bit.cast/bit_cast.cc: Remove stray word from copy&paste. * testsuite/26_numerics/bit/bit.cast/version.cc: Likewise.
2020-12-03libstdc++: Update C++20 library implementation statusJonathan Wakely3-21/+15
libstdc++-v3/ChangeLog: * doc/xml/manual/status_cxx2020.xml: Update C++20 status. * doc/html/*: Regenerate.
2020-12-03libtdc++: Define std::source_location for C++20JeanHeyd Meneide9-0/+454
This doesn't define a new _GLIBCXX_HAVE_BUILTIN_SOURCE_LOCATION macro. because using __has_builtin(__builtin_source_location) is sufficient. Currently only GCC supports it, but if/when Clang and Intel add it the __has_builtin check should for them too. Co-authored-by: Jonathan Wakely <jwakely@redhat.com> libstdc++-v3/ChangeLog: * doc/doxygen/user.cfg.in (INPUT): Add <source_location>. * include/Makefile.am: Add <source_location>. * include/Makefile.in: Regenerate. * include/std/version (__cpp_lib_source_location): Define. * include/std/source_location: New file. * testsuite/18_support/source_location/1.cc: New test. * testsuite/18_support/source_location/consteval.cc: New test. * testsuite/18_support/source_location/srcloc.h: New test. * testsuite/18_support/source_location/version.cc: New test.
2020-12-03libstdc++: Add std::bit_cast for C++20 [PR 93121]Jonathan Wakely4-0/+123
Thanks to Jakub's addition of the built-in, we can add this to the library now. The compiler tests for the built-in are quite extensive, including verifying the constraints, so this only adds minimal tests to the library testsuite. This doesn't add a new _GLIBCXX_HAVE_BUILTIN_BIT_CAST because using __has_builtin(__builtin_bit_cast) works for GCC and versions of Clang that provide the built-in. libstdc++-v3/ChangeLog: PR libstdc++/93121 * include/std/bit (__cpp_lib_bit_cast, bit_cast): Define. * include/std/version (__cpp_lib_bit_cast): Define. * testsuite/26_numerics/bit/bit.cast/bit_cast.cc: New test. * testsuite/26_numerics/bit/bit.cast/version.cc: New test.
2020-12-03libstdc++: Update powerpc-linux baselines for GCC 10.1Jonathan Wakely2-0/+34
This should have been done before the GCC 10.1 release. libstdc++-v3/ChangeLog: * config/abi/post/powerpc-linux-gnu/baseline_symbols.txt: Update. * config/abi/post/powerpc64-linux-gnu/32/baseline_symbols.txt: Update.
2020-12-03libstdc++: Disable std::array assertions for C++11 constexprJonathan Wakely4-11/+48
The recent changes to add assertions to std::array broke the functions that need to be constexpr in C++11, because of the restrictive rules for constexpr functions in C++11. This simply disables the assertions for C++11 mode, so the functions can be constexpr again. libstdc++-v3/ChangeLog: * include/std/array (array::operator[](size_t) const, array::front() const) (array::back() const) [__cplusplus == 201103]: Disable assertions. * testsuite/23_containers/array/element_access/constexpr_element_access.cc: Check for correct values. * testsuite/23_containers/array/tuple_interface/get_neg.cc: Adjust dg-error line numbers. * testsuite/23_containers/array/debug/constexpr_c++11.cc: New test.