mirror of
https://gcc.gnu.org/git/gcc.git
synced 2024-11-24 11:24:05 +08:00
8df3ee8f7d
234 Commits
Author | SHA1 | Message | Date | |
---|---|---|---|---|
Jonathan Wakely
|
ad0a3be4df |
libstdc++: Remove _GLIBCXX_USE_INT128 autoconf macro
We don't need to decide whether to use __int128 when running configure, we can do so at compilation time by seeing if __SIZEOF_INT128__ is defined and if it's greater than __SIZEOF_LONG_LONG__. This removes another unnecessary architecture-specific config macro in <bits/c++config.h>, so the same header can work for 32-bit or 64-bit compilation on AIX. libstdc++-v3/ChangeLog: * acinclude.m4 (GLIBCXX_ENABLE_INT128_FLOAT128): Remove checks for __int128 and rename to GLIBCXX_ENABLE_FLOAT128. * config.h.in: Regenerate. * configure: Regenerate. * configure.ac: Adjust to use GLIBCXX_ENABLE_FLOAT128. * include/bits/random.h (_Select_uint_least_t<s, 1>): Use __SIZEOF_INT128__ to decide whether to use __int128. * include/std/charconv (__to_chars_unsigned_type): Likewise. |
||
Jonathan Wakely
|
7ddcd26ebb |
libstdc++: Remove GLIBCXX_CHECK_INT64_T checks
This simplifies the definition of std::streamoff by using the predefined __INT64_TYPE__ macro, instead of the _GLIBCXX_HAVE_INT64_T_LONG, _GLIBCXX_HAVE_INT64_T_LONG_LONG and _GLIBCXX_HAVE_INT64_T macros defined by configure. By using the __INT64_TYPE__ macro (which all of GCC, Clang and Intel define) we do not need to determine the type of int64_t in configure, we can just use that type directly. The background for the change was explained by David Edelsohn: Currently the type of streamoff is determined at libstdc++ configure time, chosen by the definitions of _GLIBCXX_HAVE_INT64_T_LONG and _GLIBCXX_HAVE_INT64_T_LONG_LONG. For a multilib configuration, the difference is encoded in the different multilib header file paths. For "FAT" library targets that package 32 bit and 64 bit libraries together, G++ also expects a single header file directory hierarchy, causing an incorrect value for streamoff in some situations. And in a subsequent mail: Most of the libstdc++ headers are architecture-neutral, OS neutral and ABI neutral. The differences are localized in bits/c++config.h. And most of c++config.h is identical for 32 bit AIX and 64 bit AIX. The only differences that matter are __int128 and __int64_t. This change removes some of those differences. With the only uses of the INT64_T configure macros removed, the configure checks themselves can also be removed. Co-authored-by: David Edelsohn <dje.gcc@gmail.com> libstdc++-v3/ChangeLog: * acinclude.m4 (GLIBCXX_CHECK_INT64_T): Delete. * config.h.in: Regenerate. * configure: Regenerate. * configure.ac: Do not use GLIBCXX_CHECK_INT64_T. * include/bits/postypes.h: Remove include of <stdint.h> and definition/undefinition of the __STDC_LIMIT_MACROS and __STDC_CONSTANT_MACROS macros. (streamoff): Use __INT64_TYPE__ if defined. |
||
Jakub Jelinek
|
2d4c3af94f |
Fix AIX libstdc++ semaphore support [PR100164]
> > The #error would not be hit if _GLIBCXX_HAVE_POSIX_SEMAPHORE were defined, > > but it shows up in your error report. > You now have pinpointed the problem. > It's not that AIX doesn't have semaphore, but that the code previously > had a fallback that hid a bug in the macros: // Use futex if available and didn't force use of POSIX using __fast_semaphore = __atomic_semaphore<__detail::__platform_wait_t>; using __fast_semaphore = __platform_semaphore; using __fast_semaphore = __atomic_semaphore<ptrdiff_t>; > The problem is that libstdc++ configure defines > _GLIBCXX_HAVE_POSIX_SEMAPHORE in config.h. libstdc++ uses sed to > rewrite config.h to c++config.h and prepends _GLIBCXX_, so c++config.h > contains > And bits/semaphore_base.h is not testing that corrupted macro. Either > semaphore_base.h needs to test for the corrupted macro, or libtsdc++ > configure needs to define HAVE_POSIX_SEMAPHORE without itself > prepending _GLIBCXX_ so that the c++config.h rewriting works > correctly and defines the correct macro for semaphore_base.h. The include/Makefile.am sed is: sed -e 's/HAVE_/_GLIBCXX_HAVE_/g' \ -e 's/PACKAGE/_GLIBCXX_PACKAGE/g' \ -e 's/VERSION/_GLIBCXX_VERSION/g' \ -e 's/WORDS_/_GLIBCXX_WORDS_/g' \ -e 's/_DARWIN_USE_64_BIT_INODE/_GLIBCXX_DARWIN_USE_64_BIT_INODE/g' \ -e 's/_FILE_OFFSET_BITS/_GLIBCXX_FILE_OFFSET_BITS/g' \ -e 's/_LARGE_FILES/_GLIBCXX_LARGE_FILES/g' \ -e 's/ICONV_CONST/_GLIBCXX_ICONV_CONST/g' \ -e '/[ ]_GLIBCXX_LONG_DOUBLE_COMPAT[ ]/d' \ -e '/[ ]_GLIBCXX_LONG_DOUBLE_ALT128_COMPAT[ ]/d' \ < ${CONFIG_HEADER} >> $@ ;\ so for many macros one needs _GLIBCXX_ prefixes already in configure, as can be seen in grep AC_DEFINE.*_GLIBCXX configure.ac acinclude.m4 But _GLIBCXX_HAVE_POSIX_SEMAPHORE is the only one that shouldn't have that prefix because the sed is adding that. E.g. on i686-linux, I see grep _GLIBCXX__GLIBCXX c++config.h that proves it is the only broken one. So this change fixes the acinclude.m4 side. 2021-04-21 Jakub Jelinek <jakub@redhat.com> PR libstdc++/100164 * acinclude.m4: For POSIX semaphores AC_DEFINE HAVE_POSIX_SEMAPHORE rather than _GLIBCXX_HAVE_POSIX_SEMAPHORE. * configure: Regenerated. * config.h.in: Regenerated. |
||
Jonathan Wakely
|
f5feee6adc |
libstdc++: Regenerate autoconf files
I forgot to regenerate these files in r11-6137. libstdc++-v3/ChangeLog: * config.h.in: Regenerate. * configure: Regenerate. |
||
Jonathan Wakely
|
7c1e7eed89 |
libstdc++: Add C++ runtime support for new 128-bit long double format
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. |
||
Keith Packard
|
75aee07269 |
libstdc++: Support libc with stdio-only I/O in libstdc++
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. |
||
Jonathan Wakely
|
0aa1786d34 |
libstdc++: Fix build failure for target with no way to sleep
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. |
||
Jonathan Wakely
|
92b47a321e |
libstdc++: Add configure checks for semaphores
This moves the checks for POSIX semaphores to configure time. As well as requiring <semaphore.h> and SEM_VALUE_MAX, we also require the sem_timedwait function. That was only optional in POSIX 2001 (and is absent on Darwin). libstdc++-v3/ChangeLog: * acinclude.m4 (GLIBCXX_CHECK_GTHREADS): Check for * config.h.in: Regenerate. * configure: Regenerate. * include/bits/semaphore_base.h (_GLIBCXX_HAVE_POSIX_SEMAPHORE): Check autoconf macro instead of defining it here. |
||
Jonathan Wakely
|
932fbc868a |
libstdc++: Add std::from_chars for floating-point types
This adds the missing std::from_chars overloads for floating-point types, as required for C++17 conformance. The implementation is a hack and not intended to be used in the long term. Rather than parsing the string directly, this determines the initial portion of the string that matches the pattern determined by the chars_format parameter, then creates a NTBS to be parsed by strtod (or strtold or strtof). Because creating a NTBS requires allocating memory, but std::from_chars is noexcept, we need to be careful to minimise allocation. Even after being careful, allocation failure is still possible, and so a non-conforming std::no_more_memory error code might be returned. Because strtod et al depend on the current locale, but std::from_chars does not, we change the current thread's locale to "C" using newlocale and uselocale before calling strtod, and restore it afterwards. Because strtod doesn't have the equivalent of a std::chars_format parameter, it has to examine the input to determine the format in use, even though the std::from_chars code has already parsed it once (or twice for large input strings!) By replacing the use of strtod we could avoid allocation, avoid changing locale, and use optimised code paths specific to each std::chars_format case. We would also get more portable behaviour, rather than depending on the presence of uselocale, and on any bugs or quirks of the target libc's strtod. Replacing strtod is a project for a later date. libstdc++-v3/ChangeLog: * acinclude.m4 (libtool_VERSION): Bump version. * config.h.in: Regenerate. * config/abi/pre/gnu.ver: Add GLIBCXX_3.4.29 version and new exports. * config/os/gnu-linux/ldbl-extra.ver: Add _GLIBCXX_LDBL_3.4.29 version and new export. * configure: Regenerate. * configure.ac: Check for <xlocale.h> and uselocale. * crossconfig.m4: Add macro or checks for uselocale. * include/std/charconv (from_chars): Declare overloads for float, double, and long double. * src/c++17/Makefile.am: Add new file. * src/c++17/Makefile.in: Regenerate. * src/c++17/floating_from_chars.cc: New file. (from_chars): Define for float, double, and long double. * testsuite/20_util/from_chars/1_c++20_neg.cc: Prune extra diagnostics caused by new overloads. * testsuite/20_util/from_chars/1_neg.cc: Likewise. * testsuite/20_util/from_chars/2.cc: Check leading '+'. * testsuite/20_util/from_chars/4.cc: New test. * testsuite/20_util/from_chars/5.cc: New test. * testsuite/util/testsuite_abi.cc: Add new symbol versions. |
||
Mike Crowe
|
ab40695a46 |
libstdc++: Add full steady_clock support to shared_timed_mutex
The pthread_rwlock_clockrdlock and pthread_rwlock_clockwrlock functions were added to glibc in v2.30. They have also been added to Android Bionic. If these functions are available in the C library then they can be used to implement shared_timed_mutex::try_lock_until, shared_timed_mutex::try_lock_for, shared_timed_mutex::try_lock_shared_until and shared_timed_mutex::try_lock_shared_for so that they are no longer unaffected by the system clock being warped. (This is the shared_mutex equivalent of PR libstdc++/78237 for mutex.) If the new functions are available then steady_clock is deemed to be the "best" clock available which means that it is used for the relative try_lock_for calls and absolute try_lock_until calls using steady_clock and user-defined clocks. It's not possible to have _GLIBCXX_USE_PTHREAD_RWLOCK_CLOCKLOCK defined without _GLIBCXX_USE_PTHREAD_RWLOCK_T, so the requirement that the clock be the same as condition_variable is maintained. Calls explicitly using system_clock (aka high_resolution_clock) continue to use CLOCK_REALTIME via the old pthread_rwlock_timedrdlock and pthread_rwlock_timedwrlock functions. If the new functions are not available then system_clock is deemed to be the "best" clock available which means that the previous suboptimal behaviour remains. Additionally, the user-defined clock used with shared_timed_mutex::try_lock_for and shared_mutex::try_lock_shared_for may have higher precision than __clock_t. We may need to round the duration up to ensure that the timeout is long enough. (See __timed_mutex_impl::_M_try_lock_for) 2019-12-02 Mike Crowe <mac@mcrowe.com> Add full steady_clock support to shared_timed_mutex * acinclude.m4 (GLIBCXX_CHECK_PTHREAD_RWLOCK_CLOCKLOCK): Define to check for the presence of both pthread_rwlock_clockrdlock and pthread_rwlock_clockwrlock. * config.h.in: Regenerate. * configure.ac: Call GLIBCXX_USE_PTHREAD_RWLOCK_CLOCKLOCK. * configure: Regenerate. * include/std/shared_mutex (shared_timed_mutex): Define __clock_t as the best clock to use for relative waits. (shared_timed_mutex::try_lock_for) Round up wait duration if necessary. (shared_timed_mutex::try_lock_shared_for): Likewise. (shared_timed_mutex::try_lock_until): Use existing try_lock_until implementation for system_clock (which matches __clock_t when _GLIBCCXX_USE_PTHREAD_RWLOCK_CLOCKLOCK is not defined). Add new overload for steady_clock that uses pthread_rwlock_clockwrlock if it is available. Simplify overload for non-standard clock to just call try_lock_for with a relative timeout. (shared_timed_mutex::try_lock_shared_until): Likewise. From-SVN: r278903 |
||
Mike Crowe
|
3b2fb54353 |
libstdc++: PR 78237 Add full steady_clock support to timed_mutex
The pthread_mutex_clocklock function is available in glibc since the 2.30 release. If this function is available in the C library it can be used to fix PR libstdc++/78237 by supporting steady_clock properly with timed_mutex. This means that code using timed_mutex::try_lock_for or timed_mutex::wait_until with steady_clock is no longer subject to timing out early or potentially waiting for much longer if the system clock is warped at an inopportune moment. If pthread_mutex_clocklock is available then steady_clock is deemed to be the "best" clock available which means that it is used for the relative try_lock_for calls and absolute try_lock_until calls using steady_clock and user-defined clocks. Calls explicitly using system_clock (aka high_resolution_clock) continue to use CLOCK_REALTIME via __gthread_cond_timedwait. If pthread_mutex_clocklock is not available then system_clock is deemed to be the "best" clock available which means that the previous suboptimal behaviour remains. 2019-12-02 Mike Crowe <mac@mcrowe.com> PR libstdc++/78237 Add full steady_clock support to timed_mutex * acinclude.m4 (GLIBCXX_CHECK_PTHREAD_MUTEX_CLOCKLOCK): Define to detect presence of pthread_mutex_clocklock function. * config.h.in: Regenerate. * configure: Regenerate. * configure.ac: Call GLIBCXX_CHECK_PTHREAD_MUTEX_CLOCKLOCK. * include/std/mutex (__timed_mutex_impl): Remove unnecessary __clock_t. (__timed_mutex_impl::_M_try_lock_for): Use best clock to turn relative timeout into absolute timeout. (__timed_mutex_impl::_M_try_lock_until): Keep existing implementation for system_clock. Add new implementation for steady_clock that calls _M_clocklock. Modify overload for user-defined clock to use a relative wait so that it automatically uses the best clock. [_GLIBCXX_USE_PTHREAD_MUTEX_CLOCKLOCK] (timed_mutex::_M_clocklock): New member function. (recursive_timed_mutex::_M_clocklock): Likewise. From-SVN: r278901 |
||
Jonathan Wakely
|
2fc115875e |
Build filesystem library with large file support
Enable AC_SYS_LARGEFILE to set the macros needed for large file APIs to be used by default. We do not want to define those macros in the public headers that users include. The values of the macros are copied to a separate file that is only included by the filesystem sources during the build, and then the macros in <bits/c++config.h> are renamed so that they don't have any effect in user code including our headers. Also use larger type for result of filesystem::file_size to avoid truncation of large values on 32-bit systems (PR 91947). PR libstdc++/81091 PR libstdc++/91947 * configure.ac: Use AC_SYS_LARGEFILE to enable 64-bit file APIs. * config.h.in: Regenerate: * configure: Regenerate: * include/Makefile.am (${host_builddir}/largefile-config.h): New target to generate config header for filesystem library. (${host_builddir}/c++config.h): Rename macros for large file support. * include/Makefile.in: Regenerate. * src/c++17/fs_dir.cc: Include new config header. * src/c++17/fs_ops.cc: Likewise. (filesystem::file_size): Use uintmax_t for size. * src/filesystem/dir.cc: Include new config header. * src/filesystem/ops.cc: Likewise. (experimental::filesystem::file_size): Use uintmax_t for size. From-SVN: r276585 |
||
Mike Crowe
|
ad4d1d21ad |
PR libstdc++/41861 Add full steady_clock support to condition_variable
The pthread_cond_clockwait function is available in glibc since the 2.30 release. If this function is available in the C library it can be used to fix PR libstdc++/41861 by supporting std::chrono::steady_clock properly with std::condition_variable. This means that code using std::condition_variable::wait_for or std::condition_variable::wait_until with std::chrono::steady_clock is no longer subject to timing out early or potentially waiting for much longer if the system clock is warped at an inopportune moment. If pthread_cond_clockwait is available then std::chrono::steady_clock is deemed to be the "best" clock available which means that it is used for the relative wait_for calls and absolute wait_until calls using user-defined clocks. Calls explicitly using std::chrono::system_clock continue to use CLOCK_REALTIME via __gthread_cond_timedwait. If pthread_cond_clockwait is not available then std::chrono::system_clock is deemed to be the "best" clock available which means that the previous suboptimal behaviour remains. 2019-09-04 Mike Crowe <mac@mcrowe.com> PR libstdc++/41861 * acinclude.m4 (GLIBCXX_CHECK_PTHREAD_COND_CLOCKWAIT): Check for new pthread_cond_clockwait function. * configure.ac: Use GLIBCXX_CHECK_PTHREAD_COND_CLOCKWAIT. * configure: Regenerate. * config.h.in: Regenerate. * include/std/condition_variable: (condition_variable): Rename __steady_clock_t typedef and add system_clock. Change __clock_t to be a typedef for the preferred clock to convert arbitrary other clocks to. [_GLIBCXX_USE_PTHREAD_COND_CLOCKWAIT] (wait_until): Add a steady_clock overload. (wait_until): Change __clock_t overload to use system_clock. [_GLIBCXX_USE_PTHREAD_COND_CLOCKWAIT] (__wait_until_impl): Add steady_clock overload that calls pthread_cond_clockwait. (__wait_until_impl): Change __clock_t overload to use system_clock. (condition_variable_any) [_GLIBCXX_USE_PTHREAD_COND_CLOCKWAIT]: Use steady_clock for __clock_t if pthread_cond_clockwait is available. From-SVN: r275390 |
||
Jonathan Wakely
|
b0c0d878a8 |
PR libstdc++/85494 use rdseed and rand_s in std::random_device
Add support for additional sources of randomness to std::random_device, to allow using RDSEED for Intel CPUs and rand_s for Windows. When supported these can be selected using the tokens "rdseed" and "rand_s". For *-w64-mingw32 targets the "default" token will now use rand_s, and for other i?86-*-* and x86_64-*-* targets it will try to use "rdseed" first, then "rdrand", and finally "/dev/urandom". To simplify the declaration of std::random_device in <bits/random.h> the constructors now unconditionally call _M_init instead of _M_init_pretr1, and the function call operator now unconditionally calls _M_getval. The library code now decides whether _M_init and _M_getval should use a real source of randomness or the mt19937 engine. Existing code compiled against old libstdc++ headers will still call _M_init_pretr1 and _M_getval_pretr1, but those functions now forward to _M_init and _M_getval if a real source of randomness is available. This means existing code compiled for mingw-w64 will start to use rand_s just by linking to a new libstdc++.dll. * acinclude.m4 (GLIBCXX_CHECK_X86_RDSEED): Define macro to check if the assembler supports rdseed. * config.h.in: Regenerate. * configure: Regenerate. * configure.ac: Use GLIBCXX_CHECK_X86_RDSEED. * config/os/mingw32-w64/os_defines.h (_GLIBCXX_USE_CRT_RAND_S): Define. * doc/html/*: Regenerate. * doc/xml/manual/status_cxx2011.xml: Document new tokens. * include/bits/random.h (random_device::random_device()): Always call _M_init rather than _M_init_pretr1. (random_device::random_device(const string&)): Likewise. (random_device::operator()()): Always call _M_getval(). (random_device::_M_file): Replace first member of union with an anonymous struct, with _M_file as its first member. * src/c++11/random.cc [_GLIBCXX_X86_RDRAND] (USE_RDRAND): Define. [_GLIBCXX_X86_RDSEED] (USE_RDSEED): Define. (USE_MT19937): Define if none of the above are defined. (USE_POSIX_FILE_IO): Define. (_M_strtoul): Remove. [USE_RDSEED] (__x86_rdseed): Define new function. [_GLIBCXX_USE_CRT_RAND_S] (__winxp_rand_s): Define new function. (random_device::_M_init(const string&)): Initialize new union members. Add support for "rdseed" and "rand_s" tokens. Decide what the "default" token does according to which USE_* macros are defined. [USE_POSIX_FILE_IO]: Store a file descriptor. [USE_MT19937]: Forward to _M_init_pretr1 instead. (random_device::_M_init_pretr1(const string&)) [USE_MT19937]: Inline code from _M_strtoul. [!USE_MT19937]: Call _M_init, transforming the old default token or numeric tokens to "default". (random_device::_M_fini()) [USE_POSIX_FILE_IO]: Use close not fclose. (random_device::_M_getval()): Use new union members to obtain a random number from the stored function pointer or file descriptor. [USE_MT19937]: Obtain a value from the mt19937 engine. (random_device::_M_getval_pretr1()): Call _M_getval(). (random_device::_M_getentropy()) [USE_POSIX_FILE_IO]: Use _M_fd instead of fileno. [!USE_MT19937] (mersenne_twister): Do not instantiate when not needed. * testsuite/26_numerics/random/random_device/85494.cc: New test. From-SVN: r271740 |
||
Jonathan Wakely
|
187fdaea67 |
PR libstdc++/89460 Fix Networking TS test failures on HP-UX
Check for availability of POSIX sockatmark before using it. Rename _S_ntoh overloads that are ambiguous when passed an integral type that is neither uint16_t nor uint32_t. PR libstdc++/89460 * configure.ac: Check for sockatmark. * crossconfig.m4: Check for sockatmark. * config.h.in: Regenerate. * configure: Regenerate. * include/experimental/internet (address_v4::_S_hton): Rename overloaded functions to _S_hton_16 and _S_ntoh_16. (address_v4::_S_ntoh): Rename to _S_ntoh_16 and _S_ntoh_32. (basic_endpoint): Adjust calls to _S_hton and _S_ntoh. * include/experimental/socket (basic_socket::at_mark): Check _GLIBCXX_HAVE_SOCKATMARK. From-SVN: r269588 |
||
Jonathan Wakely
|
a61ae535c3 |
Add std::timespec and std::timespec_get for C++17
* configure.ac: Check for C11 timespec_get function. * crossconfig.m4 (freebsd, linux, gnu, cygwin, solaris, netbsd) (openbsd): Likewise * config.h.in: Regenerate. * configure: Regenerate. * include/c_global/ctime (timespec, timespec_get): Add to namespace std for C++17 and up. From-SVN: r268879 |
||
Jonathan Wakely
|
cf4b581f2e |
Fix build for systems without POSIX truncate
Older versions of newlib do not provide truncate so add a configure check for it, and provide a fallback definition. There were also some missing exports in the linker script, which went unnoticed because there are no tests for some functions. A new link-only test checks that every filesystem operation function is defined by the library. * acinclude.m4 (GLIBCXX_CHECK_FILESYSTEM_DEPS): Check for truncate. * config.h.in: Regenerate. * config/abi/pre/gnu.ver: Order patterns for filesystem operations alphabetically and add missing entries for copy_symlink, hard_link_count, rename, and resize_file. * configure: Regenerate. * src/c++17/fs_ops.cc (resize_file): Remove #if so posix::truncate is used unconditionally. * src/filesystem/ops-common.h (__gnu_posix::truncate) [!_GLIBCXX_HAVE_TRUNCATE]: Provide fallback definition that only supports truncating to zero length. * testsuite/27_io/filesystem/operations/all.cc: New test. * testsuite/27_io/filesystem/operations/resize_file.cc: New test. From-SVN: r267647 |
||
Jonathan Wakely
|
de4db54fd9 |
PR libstdc++/86756 Move rest of std::filesystem to libstdc++.so
Move std::filesystem directory iterators and operations from libstdc++fs.a to main libstdc++ library. These components have many dependencies on OS support, which is not available on all targets. Some additional autoconf checks and conditional compilation is needed to ensure the files will build for all targets. Previously this code was not compiled without --enable-libstdcxx-filesystem-ts but the C++17 components should be available for all hosted builds. The tests for these components no longer need to link to libstdc++fs.a, but are not expected to pass on all targets. To avoid numerous failures on targets which are not expected to pass the tests (due to missing OS functionality) leave the dg-require-filesystem-ts directives in place for now. This will ensure the tests only run for builds where the filesystem-ts library is built, which presumably means some level of OS support is present. PR libstdc++/86756 * acinclude.m4 (GLIBCXX_CHECK_FILESYSTEM_DEPS): Check for utime and lstat and define _GLIBCXX_USE_UTIME and _GLIBCXX_USE_LSTAT. * config.h.in: Regenerate. * config/abi/pre/gnu.ver (GLIBCXX_3.4.26): Export symbols for remaining std::filesystem types and functions. * configure: Regenerate. * src/c++17/Makefile.am: Add C++17 filesystem sources. * src/c++17/Makefile.in: Regenerate. * src/c++17/cow-fs_dir.cc: Move src/filesystem/cow-std-dir.cc to here, and change name of included file. * src/c++17/cow-fs_ops.cc: Move src/filesystem/cow-std-ops.cc to here, and change name of included file. * src/c++17/fs_dir.cc: Move src/filesystem/std-dir.cc to here. Change path to dir-common.h. * src/c++17/fs_ops.cc: Move src/filesystem/std-ops.cc to here. Change path to ops-common.h. Disable -Wunused-parameter warnings. (internal_file_clock): Define unconditionally. [!_GLIBCXX_HAVE_SYS_STAT_H] (internal_file_clock::from_stat): Do not define. (do_copy_file, do_space): Move definitions to ops.common.h. (copy, file_size, hard_link_count, last_write_time, space): Only perform operation when _GLIBCXX_HAVE_SYS_STAT_H is defined, otherwise report an error. (last_write_time, read_symlink): Remove unused attributes from parameters. * src/filesystem/Makefile.am: Remove C++17 filesystem sources. * src/filesystem/Makefile.in: Regenerate. * src/filesystem/cow-std-dir.cc: Move to src/c++17/cow-fs_dir.cc. * src/filesystem/cow-std-ops.cc: Move to src/c++17/cow-fs_ops.cc. * src/filesystem/std-dir.cc: Move to src/c++17/fs_dir.cc. * src/filesystem/std-ops.cc: Move to src/c++17/fs_ops.cc. * src/filesystem/dir-common.h [!_GLIBCXX_HAVE_DIRENT_H]: Define dummy types and functions instead of using #error. * src/filesystem/dir.cc [!_GLIBCXX_HAVE_DIRENT_H]: Use #error. * src/filesystem/ops-common.h [!_GLIBCXX_USE_LSTAT] (lstat): Define in terms of stat. [!_GLIBCXX_HAVE_UNISTD_H]: Define dummy types and functions. (do_copy_file, do_space): Move definitions here from std-ops.cc. * src/filesystem/ops.cc: Adjust calls to do_copy_file and do_space to account for new namespace. * testsuite/27_io/filesystem/directory_entry/86597.cc: Remove -lstdc++fs from dg-options. * testsuite/27_io/filesystem/directory_entry/lwg3171.cc: Likewise. * testsuite/27_io/filesystem/file_status/1.cc: Likewise. * testsuite/27_io/filesystem/filesystem_error/cons.cc: Likewise. * testsuite/27_io/filesystem/filesystem_error/copy.cc: Likewise. * testsuite/27_io/filesystem/iterators/directory_iterator.cc: Likewise. * testsuite/27_io/filesystem/iterators/pop.cc: Likewise. * testsuite/27_io/filesystem/iterators/recursive_directory_iterator.cc: Likewise. * testsuite/27_io/filesystem/operations/absolute.cc: Likewise. * testsuite/27_io/filesystem/operations/canonical.cc: Likewise. * testsuite/27_io/filesystem/operations/copy.cc: Likewise. * testsuite/27_io/filesystem/operations/copy_file.cc: Likewise. * testsuite/27_io/filesystem/operations/create_directories.cc: Likewise. * testsuite/27_io/filesystem/operations/create_directory.cc: Likewise. * testsuite/27_io/filesystem/operations/create_symlink.cc: Likewise. * testsuite/27_io/filesystem/operations/current_path.cc: Likewise. * testsuite/27_io/filesystem/operations/equivalent.cc: Likewise. * testsuite/27_io/filesystem/operations/exists.cc: Likewise. * testsuite/27_io/filesystem/operations/file_size.cc: Likewise. * testsuite/27_io/filesystem/operations/is_empty.cc: Likewise. * testsuite/27_io/filesystem/operations/last_write_time.cc: Likewise. * testsuite/27_io/filesystem/operations/permissions.cc: Likewise. * testsuite/27_io/filesystem/operations/proximate.cc: Likewise. * testsuite/27_io/filesystem/operations/read_symlink.cc: Likewise. * testsuite/27_io/filesystem/operations/relative.cc: Likewise. * testsuite/27_io/filesystem/operations/remove.cc: Likewise. * testsuite/27_io/filesystem/operations/remove_all.cc: Likewise. * testsuite/27_io/filesystem/operations/space.cc: Likewise. * testsuite/27_io/filesystem/operations/status.cc: Likewise. * testsuite/27_io/filesystem/operations/symlink_status.cc: Likewise. * testsuite/27_io/filesystem/operations/temp_directory_path.cc: Likewise. * testsuite/27_io/filesystem/operations/weakly_canonical.cc: Likewise. From-SVN: r267616 |
||
Jonathan Wakely
|
da29d2a36e |
PR libstdc++/67843 set shared_ptr lock policy at build-time
This resolves a longstanding issue where the lock policy for shared_ptr reference counting depends on compilation options when the header is included, so that different -march options can cause ABI changes. For example, objects compiled with -march=armv7 will use atomics to synchronize reference counts, and objects compiled with -march=armv5t will use a mutex. That means the shared_ptr control block will have a different layout in different objects, causing ODR violations and undefined behaviour. This was the root cause of PR libstdc++/42734 as well as PR libstdc++/67843. The solution is to decide on the lock policy at build time, when libstdc++ is configured. The configure script checks for the availability of the necessary atomic built-ins for the target and fixes that choice permanently. Different -march flags used to compile user code will not cause changes to the lock policy. This results in an ABI change for certain compilations, but only where there was already an ABI incompatibility between the libstdc++.so library and objects built with an incompatible -march option. In general, this means a more stable ABI that isn't silently altered when -march flags make addition atomic ops available. To force a target to use "atomic" or "mutex" the new configure option --with-libstdcxx-lock-policy can be used. In order to turn ODR violations into linker errors, the uses of shared_ptr in filesystem directory iterators have been replaced with __shared_ptr, and explicit instantiations are declared. This ensures that object files using those types cannot link to libstdc++ libs unless they use the same lock policy. PR libstdc++/67843 * acinclude.m4 (GLIBCXX_ENABLE_LOCK_POLICY): Add new macro that defines _GLIBCXX_HAVE_ATOMIC_LOCK_POLICY. * config.h.in: Regenerate. * configure: Regenerate. * configure.ac: Use GLIBCXX_ENABLE_LOCK_POLICY. * doc/xml/manual/configure.xml: Document new configure option. * include/bits/fs_dir.h (directory_iterator): Use __shared_ptr instead of shared_ptr. (recursive_directory_iterator): Likewise. (__shared_ptr<_Dir>): Add explicit instantiation declaration. (__shared_ptr<recursive_directory_iterator::_Dir_stack>): Likewise. * include/bits/shared_ptr_base.h (__allocate_shared, __make_shared): Add default template argument for _Lock_policy template parameter. * include/ext/concurrence.h (__default_lock_policy): Check macro _GLIBCXX_HAVE_ATOMIC_LOCK_POLICY instead of checking if the current target supports the builtins for compare-and-swap. * src/filesystem/std-dir.cc (__shared_ptr<_Dir>): Add explicit instantiation definition. (__shared_ptr<recursive_directory_iterator::_Dir_stack>): Likewise. (directory_iterator, recursive_directory_iterator): Use __make_shared instead of make_shared. From-SVN: r266533 |
||
Jonathan Wakely
|
82a0f2fd10 |
Use autoconf to check for features needed by Networking TS
* config.h.in: Regenerate. * configure: Regenerate. * configure.ac: Check for headers used by Networking TS. * include/experimental/executor: Include <condition_variable> instead of <mutex>. * include/experimental/internet: Use autoconf macros for available headers. Include <sys/socket.h> for. Remove <cstring> and use __builtin_memcpy and __builtin_strchr. (resolver_errc) [!_GLIBCXX_HAVE_NETDB_H]: Do not define. (address_v4::to_string, address_v6::to_string) [!_GLIBCXX_HAVE_ARPA_INET_H]: Likewise. (basic_resolver_results) [!_GLIBCXX_HAVE_NETDB_H]: Make private constructors report errors. [!_GLIBCXX_HAVE_NETINET_TCP_H] (tcp::no_delay): Do not define. * include/experimental/io_context: Likewise. * include/experimental/socket: Likewise. [!_GLIBCXX_HAVE_SYS_SOCKET_H, !_GLIBCXX_HAVE_POLL_H] (socket_base): Do not define nested types when relevant header not available. (__socket_impl::native_non_blocking) [!_GLIBCXX_HAVE_FCNTL_H]: Report an error. (__basic_socket_impl::open, __basic_socket_impl::local_endpoint) (__basic_socket_impl::bind) [!_GLIBCXX_HAVE_SYS_SOCKET_H]: Likewise. (__basic_socket_impl::io_control) [!_GLIBCXX_HAVE_SYS_IOCTL_H]: Likewise. (basic_socket::at_mark, basic_socket::shutdown) (basic_socket::remote_endpoint, basic_socket::connect) (basic_socket::async_connect) [!_GLIBCXX_HAVE_SYS_SOCKET_H]: Likewise. (basic_socket::available) [_GLIBCXX_HAVE_SYS_IOCTL_H]: Check macro for <sys/ioctl.h> availability. (basic_socket::wait) [!_GLIBCXX_HAVE_POLL_H]: Likewise. (basic_datagram_socket::receive, basic_datagram_socket::async_receive) (basic_datagram_socket::receive_from) (basic_datagram_socket::async_receive_from) (basic_datagram_socket::send, basic_datagram_socket::async_send) (basic_datagram_socket::send_to, basic_datagram_socket::async_send_to) [!_GLIBCXX_HAVE_SYS_SOCKET_H]: Likewise. (basic_stream_socket::receive, basic_stream_socket::async_receive) (basic_stream_socket::send, basic_stream_socket::async_send) [!_GLIBCXX_HAVE_SYS_SOCKET_H]: Likewise. (basic_socket_acceptor::listen, basic_socket_acceptor::accept) (basic_socket_acceptor::async_accept) [!_GLIBCXX_HAVE_SYS_SOCKET_H]: Likewise. (basic_socket_acceptor::wait) [!_GLIBCXX_HAVE_POLL_H]: Likewise. From-SVN: r265203 |
||
Jonathan Wakely
|
5ae2c32a8a |
Define _GLIBCXX_USE_DEV_RANDOM as replacement for _GLIBCXX_USE_RANDOM_TR1
Define and use a new macro with a more descriptive name. Only use the old macro in <tr1/random.h>. * acinclude.m4 (GLIBCXX_CHECK_RANDOM_TR1): Replace with ... (GLIBCXX_CHECK_DEV_RANDOM): New macro with more descriptive name. Define _GLIBCXX_USE_DEV_RANDOM as well as _GLIBCXX_USE_RANDOM_TR1. * config.h.in: Regenerate. * configure: Regenerate. * configure.ac: Use GLIBCXX_CHECK_DEV_RANDOM instead of GLIBCXX_CHECK_RANDOM_TR1. crossconfig.m4: Likewise. * include/bits/random.h (random_device): Use _GLIBCXX_USE_DEV_RANDOM instead of _GLIBCXX_USE_RANDOM_TR1. * testsuite/26_numerics/random/random_device/cons/token.cc: Likewise. From-SVN: r265197 |
||
Jonathan Wakely
|
7314856c61 |
Fix bootstrap failure for bare metal due to autoconf link tests
The AC_CHECK_FUNCS tests cause the build to fail for bare metal cross compilers, where link tests are not allowed. Replace them with GCC_TRY_COMPILE_OR_LINK tests instead. Skip all the Filesystem dependency checks if not building the filesystem library. * acinclude.m4 (GLIBCXX_CHECK_FILESYSTEM_DEPS): Only check when enable_libstdcxx_filesystem_ts = yes. Check for link, readlink and symlink. * config.h.in: Regenerate. * configure: Regenerate. * configure.ac: Remove AC_CHECK_FUNCS for link, readlink and symlink. From-SVN: r261704 |
||
Jonathan Wakely
|
9534a5e62d |
PR libstdc++/78870 support std::filesystem on Windows
PR libstdc++/78870 support std::filesystem on Windows * config.h.in: Regenerate. * configure: Regenerate. * configure.ac: Check for link, readlink and symlink. * include/bits/fs_path.h (path::operator/=(const path&)): Move definition out of class body. (path::is_absolute(), path::_M_append(path)): Likewise. (operator<<(basic_ostream, const path&)): Use std::quoted directly. (operator>>(basic_istream, path&)): Likewise. (u8path): Reorder definitions and fix Windows implementation. (path::is_absolute()): Define inline and fix for Windows. [!_GLIBCXX_FILESYSTEM_IS_WINDOWS] (path::operator/=(const path&)): Define POSIX version inline. (path::_M_append(path)): Define inline. * include/experimental/bits/fs_path.h (path::is_absolute()): Move definition out of class body. (operator<<(basic_ostream, const path&)): Fix type of delimiter and escape characters. (operator>>(basic_istream, path&)): Likewise. (path::is_absolute()): Define inline and fix for Windows. * src/filesystem/dir-common.h (__gnu_posix): New namespace. (__gnu_posix::char_type, __gnu_posix::DIR, __gnu_posix::dirent) (__gnu_posix::opendir, __gnu_posix::readdir, __gnu_posix::closedir): Define as adaptors for Windows functions/types or as using-declarations for POSIX functions/types. (_Dir_base, get_file_type): Qualify names to use declarations from __gnu_posix namespace. (_Dir_base::is_dor_or_dotdot): New helper functions. * src/filesystem/dir.cc (_Dir, recursive_directory_iterator): Qualify names to use declarations from __gnu_posix namespace. * src/filesystem/ops-common.h (__gnu_posix): New nested namespace. (__gnu_posix::open, __gnu_posix::close, __gnu_posix::stat_type) (__gnu_posix::stat, __gnu_posix::lstat, __gnu_posix::mode_t) (__gnu_posix::chmod, __gnu_posix::mkdir, __gnu_posix::getcwd) (__gnu_posix::chdir, __gnu_posix::utimbuf, __gnu_posix::utime) (__gnu_posix::rename, __gnu_posix::truncate, __gnu_posix::char_type): Define as adaptors for Windows functions/types or as using-declarations for POSIX functions/types. (stat_type, do_copy_file): Qualify names to use declarations from __gnu_posix namespace. (do_space): Declare new function. (make_file_type): Only use S_ISLNK if defined. * src/filesystem/ops.cc (char_ptr, filesystem::canonical): Use path::value_type not char. (filesystem::copy, create_dir, filesystem::create_directory): Qualify names to use declarations from __gnu_posix namespace. (filesystem::create_hard_link): Check HAVE_LINK autoconf macro and add implementation for Windows. (filesystem::create_symlink): Check HAVE_SYMLINK autoconf macro. (filesystem::current_path(error_code&)): Use __gnu_posix::getcwd. [!_PC_PATH_MAX]: Don't use pathconf. [PATH_MAX]: Use if defined. (filesystem::current_path(const path&, error_code&)) (filesystem::equivalent, do_stat, filesystem::hard_link_count) (filesystem::last_write_time, filesystem::permissions): Use names from __gnu_posix. (filesystem::read_symlink): Check HAVE_READLINK autoconf macro. (filesystem::remove) [_GLIBCXX_FILESYSTEM_IS_WINDOWS]: Add implementation for Windows. (filesystem::rename, filesystem::resize_file): Use names from __gnu_posix. (filesystem::space): Use do_space. [_GLIBCXX_FILESYSTEM_IS_WINDOWS]: Get absolute path to directory. (filesystem::status, filesystem::symlink_status): Use names from __gnu_posix. (filesystem::temp_directory_path): Add implementation for Windows. * src/filesystem/path.cc (dot): Define constant. (path::replace_extension): Use dot. (path::_M_find_extension): Likewise. Use path::string_type not std::string. (path::_M_split_cmpts): Use dot. (filesystem_error::_M_get_what): Use u8string() not native(). * src/filesystem/std-dir.cc (_Dir, recursive_directory_iterator): Qualify names to use declarations from __gnu_posix namespace. * src/filesystem/std-ops.cc (filesystem::absolute(const path&)): Use correct error_code. (filesystem::absolute(const path&, error_code&)): Add implementation for Windows. (char_ptr, filesystem::canonical): Use path::value_type not char. (do_copy_file): Use names from __gnu_posix. [_GLIBCXX_FILESYSTEM_IS_WINDOWS]: Do not use fchmod, fchmodat or sendfile. (filesystem::copy, create_dir, filesystem::create_directory): Qualify names to use declarations from __gnu_posix namespace. (filesystem::create_hard_link): Check HAVE_LINK autoconf macro and add implementation for Windows. (filesystem::create_symlink): Check HAVE_SYMLINK autoconf macro. (filesystem::current_path(error_code&)): Use __gnu_posix::getcwd. [!_PC_PATH_MAX]: Don't use pathconf. [PATH_MAX]: Use if defined. (filesystem::current_path(const path&, error_code&)) (filesystem::equivalent, do_stat, filesystem::hard_link_count) (filesystem::last_write_time, filesystem::permissions): Use names from __gnu_posix. (filesystem::read_symlink): Check HAVE_READLINK autoconf macro. (filesystem::remove) [_GLIBCXX_FILESYSTEM_IS_WINDOWS]: Add implementation for Windows. (filesystem::rename, filesystem::resize_file): Use names from __gnu_posix. (do_space): Define. (filesystem::space): Use do_space. (filesystem::status, filesystem::symlink_status): Use names from __gnu_posix. (filesystem::temp_directory_path): Add implementation for Windows. * src/filesystem/std-path.cc [_GLIBCXX_FILESYSTEM_IS_WINDOWS] (path::operator/=(const path&)): Define for Windows. (dot): Define constant. (path::replace_extension, is_dot): Use dot. (path::lexically_normal): Check _M_type instead of calling non-existent function. (path::_M_find_extension): Use dot. Use path::string_type not std::string. (path::_M_split_cmpts): Use dot. (filesystem_error::_M_get_what): Use u8string() not native(). * testsuite/27_io/filesystem/iterators/directory_iterator.cc: Do not use symlinks. * testsuite/27_io/filesystem/iterators/recursive_directory_iterator.cc: Likewise. * testsuite/27_io/filesystem/operations/absolute.cc: Use __gnu_test::root_path() instead of "/" and add Windows-specific tests. * testsuite/27_io/filesystem/operations/canonical.cc: Use path::string() to get narrow string, not path::native(). * testsuite/27_io/filesystem/operations/copy.cc: Construct fstreams with std::filesystem::path not std::basic_string. * testsuite/27_io/filesystem/operations/copy_file.cc: Likewise. * testsuite/27_io/filesystem/operations/exists.cc: Use __gnu_test::root_path() instead of "/". * testsuite/27_io/filesystem/operations/is_empty.cc: Construct fstreams with std::filesystem::path not std::basic_string. * testsuite/27_io/filesystem/operations/last_write_time.cc: Use path::string() to get narrow string. * testsuite/27_io/filesystem/operations/space.cc: Check results for errors, expect sensible values otherwise. * testsuite/27_io/filesystem/operations/temp_directory_path.cc: Add helpers for adjusting the environment on Windows. * testsuite/27_io/filesystem/path/append/path.cc: Test Windows-specific behaviour. * testsuite/27_io/filesystem/path/construct/format.cc: Fix creation of path::string_type objects. * testsuite/27_io/filesystem/path/construct/locale.cc: Compare native string to wide string on Windows. * testsuite/27_io/filesystem/path/decompose/root_directory.cc: Allow for backslash as root-directory. * testsuite/27_io/filesystem/path/decompose/stem.cc: Use path::string() to get narrow string. * testsuite/27_io/filesystem/path/itr/traversal.cc: Test Windows-style paths. * testsuite/27_io/filesystem/path/native/string.cc: Use string_type not std::string. * testsuite/27_io/filesystem/path/query/is_absolute.cc: Adjust for different definintion of absolute paths on Windows. * testsuite/experimental/filesystem/iterators/directory_iterator.cc: Do not use symlinks. * testsuite/experimental/filesystem/operations/absolute.cc: Test Windows behaviour. * testsuite/experimental/filesystem/operations/copy.cc: Construct fstreams with NTCTS not std::basic_string. * testsuite/experimental/filesystem/operations/copy_file.cc: Likewise. * testsuite/experimental/filesystem/operations/exists.cc: Use __gnu_test::root_path() instead of "/". * testsuite/experimental/filesystem/operations/is_empty.cc: Construct fstreams with NTCTS not std::basic_string. * testsuite/experimental/filesystem/operations/last_write_time.cc: Use path::string() to get narrow string. * testsuite/experimental/filesystem/operations/space.cc: Use __gnu_test::root_path() instead of "/". * testsuite/experimental/filesystem/operations/temp_directory_path.cc: Add helpers for adjusting the environment on Windows. * testsuite/experimental/filesystem/path/append/path.cc: Use path::string() to get narrow strings for comparisons. * testsuite/experimental/filesystem/path/concat/path.cc: Likewise. * testsuite/experimental/filesystem/path/decompose/root_directory.cc: Likewise. * testsuite/experimental/filesystem/path/decompose/stem.cc: Likewise. * testsuite/experimental/filesystem/path/native/string.cc: Use string_type not std::string. * testsuite/experimental/filesystem/path/query/is_absolute.cc: Adjust for different definintion of absolute paths on Windows. * testsuite/util/testsuite_fs.h (__gnu_test::root_path()): New function. (__gnu_test::scoped_file): Construct fstreams with NTCTS not std::basic_string. From-SVN: r261034 |
||
Jonathan Wakely
|
b02923592a |
Add support for opening file streams from wide character strings
C++17 added new overloads to <fstream> class templates to support opening files from wide character strings "on systems where filesystem::path::value_type is not char". This patch adds those overloads conditional on _wfopen being available, and enables them for pre-C++17 modes as well. Add support for opening file streams from wide character strings. * config/io/basic_file_stdio.cc [_GLIBCXX_HAVE__WFOPEN] (__basic_file<char>::open(const wchar_t*, ios_base::openmode)): Define new overload. * config/io/basic_file_stdio.h [_GLIBCXX_HAVE__WFOPEN] (__basic_file<char>::open(const wchar_t*, ios_base::openmode)): Declare new overload. * configure.ac: Check for _wfopen. * crossconfig.m4: Likewise. * configure: Regenerate. * config.h.in: Regenerate. * include/bits/fstream.tcc [_GLIBCXX_HAVE__WFOPEN] (basic_filebuf<C,T>::open(const wchar_t*, ios_base::openmode)): Define new overload. * include/std/fstream [_GLIBCXX_HAVE__WFOPEN] (basic_filebuf<C,T>::open(const wchar_t*, ios_base::openmode)): Declare new overload. [_GLIBCXX_HAVE__WFOPEN] (basic_ifstream<C,T>::basic_ifstream(const wchar_t*, openmode)) (basic_ifstream<C,T>::basic_open(const wchar_t*, openmode)) (basic_ofstream<C,T>::basic_ifstream(const wchar_t*, openmode)) (basic_ofstream<C,T>::basic_open(const wchar_t*, openmode)) (basic_fstream<C,T>::basic_ifstream(const wchar_t*, openmode)) (basic_fstream<C,T>::basic_open(const wchar_t*, openmode)): Define new overloads. * testsuite/27_io/basic_filebuf/open/wchar_t/1.cc: New. * testsuite/27_io/basic_ifstream/cons/wchar_t/1.cc: New. * testsuite/27_io/basic_ifstream/open/wchar_t/1.cc: New. * testsuite/27_io/basic_ofstream/cons/wchar_t/1.cc: New. * testsuite/27_io/basic_ofstream/open/wchar_t/1.cc: New. * testsuite/27_io/basic_fstream/cons/wchar_t/1.cc: New. * testsuite/27_io/basic_fstream/open/wchar_t/1.cc: New. From-SVN: r260479 |
||
Tulio Magno Quites Machado Filho
|
f421e442c6 |
PR libstdc++/84654 Disable __float128 specializations for -mno-float128
2018-05-01 Tulio Magno Quites Machado Filho <tuliom@linux.vnet.ibm.com> PR libstdc++/84654 * acinclude.m4: Set ENABLE_FLOAT128 instead of _GLIBCXX_USE_FLOAT128. * config.h.in: Remove references to _GLIBCXX_USE_FLOAT128. * configure: Regenerate. * include/Makefile.am: Replace the value of _GLIBCXX_USE_FLOAT128 based on ENABLE_FLOAT128. * include/Makefile.in: Regenerate. * include/bits/c++config: Define _GLIBCXX_USE_FLOAT128. [!defined(__FLOAT128__) && !defined(__SIZEOF_FLOAT128__)]: Undefine _GLIBCXX_USE_FLOAT128. From-SVN: r259813 |
||
Uros Bizjak
|
dac867c90a |
configure.ac (AC_CHECK_HEADERS): Add linux/types.h.
* configure.ac (AC_CHECK_HEADERS): Add linux/types.h. Conditionally include linux/types.h when checking linux/random.h header. * config.h.in: Regenerate. * configure: Ditto. * src/c++11/random.cc: Conditionally include linux/types.h. From-SVN: r256859 |
||
Xi Ruoyao
|
78aa76df40 |
PR libstdc++/67578 Implement non-trivial std::random_device::entropy
2017-05-23 Xi Ruoyao <ryxi@stu.xidian.edu.cn> Jonathan Wakely <jwakely@redhat.com> PR libstdc++/67578 * acinclude.m4: Bump libtool_VERSION. * config/abi/pre/gnu.ver: Create GLIBCXX_3.4.24 with new symbol. * config.h.in: Regenerate. * configure: Regenerate. * configure.ac: Add test for <linux/random.h>. * doc/xml/manual/abi.xml: Document new library version. * include/bits/random.h (random_device::entropy) [_GLIBCXX_USE_RANDOM_TR1]: Add call to new _M_getentropy member. (random_device::_M_getentropy): Declare. * src/c++11/random.cc (random_device::_M_getentropy): Define. * testsuite/util/testsuite_abi.cc: Add GLIBCXX_3.4.24 to known versions, and make it the latest version. Co-Authored-By: Jonathan Wakely <jwakely@redhat.com> From-SVN: r248374 |
||
Jonathan Wakely
|
64e1a55de1 |
Fix typo in config.h.in comment
* acinclude.m4 (GLIBCXX_CHECK_S_ISREG_OR_S_IFREG): Fix typo in comment. * config.h.in: Regenerate. * configure: Regenerate. * doc/Makefile.in: Regenerate. From-SVN: r246165 |
||
Jonathan Wakely
|
a7765de8ef |
PR79017 workaround incomplete C99 math on darwin
PR libstdc++/79017 * acinclude.m4 (GLIBCXX_CHECK_C99_TR1): Check for llrint and llround functions separately on darwin and if they're missing define _GLIBCXX_NO_C99_ROUNDING_FUNCS. * config.h.in: Regenerate. * configure: Regenerate. * include/c_global/cmath [_GLIBCXX_NO_C99_ROUNDING_FUNCS] (llrint) (llrintf, llrintl, llround, llroundf, llroundl): Do not define. From-SVN: r244231 |
||
Jonathan Wakely
|
2a792efe7f |
PR78968 add configure check for __cxa_thread_atexit in libc
PR libstdc++/78968 * config.h.in: Regenerate. * configure: Likewise. * configure.ac: Check for __cxa_thread_atexit. * libsupc++/atexit_thread.cc [_GLIBCXX_HAVE___CXA_THREAD_ATEXIT]: Don't define __cxa_thread_atexit if libc provides it. From-SVN: r244057 |
||
Pauli Nieminen
|
ed3cb49703 |
Support exception propagation without lock-free atomic int
2017-01-04 Pauli Nieminen <suokkos@gmail.com> Jonathan Wakely <jwakely@redhat.com> PR libstdc++/64735 * acinclude.m4 (GLIBCXX_CHECK_EXCEPTION_PTR_SYMVER): Define. * config.h.in: Regenerate. * config/abi/pre/gnu.ver [HAVE_EXCEPTION_PTR_SINCE_GCC46] (GLIBCXX_3.4.15, GLIBCXX_3.4.21, CXXABI_1.3.3, CXXABI_1.3.5): Make exports for exception_ptr, nested_exception, and future conditional. [HAVE_EXCEPTION_PTR_SINCE_GCC46] (GLIBCXX_3.4.23, CXXABI_1.3.11): Add exports for exception_ptr, nested_exception, and future conditional. * configure: Regenerate. * configure.ac: Use GLIBCXX_CHECK_EXCEPTION_PTR_SYMVER. * include/std/future: Remove check for ATOMIC_INT_LOCK_FREE * libsupc++/eh_atomics.h: New file for internal use only. (__eh_atomic_inc, __eh_atomic_dec): New. * libsupc++/eh_ptr.cc (exception_ptr::_M_addref) (exception_ptr::_M_release) (__gxx_dependent_exception_cleanup) (rethrow_exception): Use eh_atomics.h reference counting helpers. * libsupc++/eh_throw.cc (__gxx_exception_cleanup): Likewise. * libsupc++/eh_tm.cc (free_any_cxa_exception): Likewise. * libsupc++/exception: Remove check for ATOMIC_INT_LOCK_FREE. * libsupc++/exception_ptr.h: Likewise. * libsupc++/guard.cc: Include header for ATOMIC_INT_LOCK_FREE macro. * libsupc++/nested_exception.cc: Remove check for ATOMIC_INT_LOCK_FREE. * libsupc++/nested_exception.h: Likewise. * src/c++11/future.cc: Likewise. * testsuite/18_support/exception_ptr/*: Remove atomic builtins checks. * testsuite/18_support/nested_exception/*: Likewise. * testsuite/30_threads/async/*: Likewise. * testsuite/30_threads/future/*: Likewise. * testsuite/30_threads/headers/future/types_std_c++0x.cc: Likewise. * testsuite/30_threads/packaged_task/*: Likewise. * testsuite/30_threads/promise/*: Likewise. * testsuite/30_threads/shared_future/*: Likewise. Co-Authored-By: Jonathan Wakely <jwakely@redhat.com> From-SVN: r244051 |
||
Rainer Orth
|
3115f94f7f |
Don't define libstdc++-internal macros in Solaris 10+ <math.h>
libstdc++-v3: * acinclude.m4 (GLIBCXX_CHECK_MATH11_PROTO): Update comments. (__CORRECT_ISO_CPP11_MATH_H_PROTO): Rename to ... (__CORRECT_ISO_CPP11_MATH_H_PROTO_FP): ... this. Add test for C++11 <math.h> integral overloads. * configure: Regenerate. * config.h.in: Regenerate. * include/c_global/cmath [__cplusplus >= 201103L]: Reflect __CORRECT_ISO_CPP11_MATH_H_PROTO to __CORRECT_ISO_CPP11_MATH_H_PROTO_FP rename. * include/c_global/cmath [_GLIBCXX_USE_C99_MATH && !_GLIBCXX_USE_C99_FP_MACROS_DYNAMIC && __cplusplus >= 201103L] (std::fpclassify): Wrap in !__CORRECT_ISO_CPP11_MATH_H_PROTO_INT. (std::isfinite): Likewise. (std::isinf): Likewise. (std::isnan): Likewise. (std::isnormal): Likewise. (std::signbit): Likewise. (std::isgreater): Likewise. (std::isgreaterequal): Likewise. (std::isless): Likewise. (std::islessequal): Likewise. (std::islessgreater): Likewise. (std::isunordered): Likewise. [__cplusplus >= 201103L && _GLIBCXX_USE_C99_MATH_TR1] (std::acosh): Likewise. (std::asinh): Likewise. (std::atanh): Likewise. (std::cbrt): Likewise. (std::copysign): Likewise. (std::erf): Likewise. (std::erfc): Likewise. (std::exp2): Likewise. (std::expm1): Likewise. (std::fdim): Likewise. (std::fma): Likewise. (std::fmax): Likewise. (std::fmin): Likewise. (std::hypot): Likewise. (std::ilogb): Likewise. (std::lgamma): Likewise. (std::llrint): Likewise. (std::llround): Likewise. (std::log1p): Likewise. (std::log2): Likewise. (std::logb): Likewise. (std::lrint): Likewise. (std::lround): Likewise. (std::nearbyint): Likewise. (std::nextafter): Likewise. (std::nexttoward): Likewise. (std::remainder): Likewise. (std::remquo): Likewise. (std::rint): Likewise. (std::round): Likewise. (std::scalbln): Likewise. (std::scalbn): Likewise. (std::tgamma): Likewise. (std::trunc): Likewise. * include/tr1/cmath [_GLIBCXX_USE_C99_MATH_TR1 && __cplusplus >= 201103L]: Reflect __CORRECT_ISO_CPP11_MATH_H_PROTO to __CORRECT_ISO_CPP11_MATH_H_PROTO_FP rename. fixincludes: * inclhack.def (solaris_math_12): New fix. (hpux11_fabsf): Replace bypass by *-hp-hpux11* mach selector. * fixincl.x: Regenerate. * tests/base/math.h [SOLARIS_MATH_12_CHECK]: New test. From-SVN: r242671 |
||
Jonathan Wakely
|
36105dbdab |
libstdc++/77795 Only declare ::gets for C++98 and C++11
PR libstdc++/77795 * acinclude.m4 (GLIBCXX_CHECK_STDIO_PROTO): Use -std=gnu++11 to check for gets. * config.h.in: Regenerate. * configure: Regenerate. * include/c_global/cstdio [!_GLIBCXX_HAVE_GETS] (gets): Only declare for C++98 and C++11. * include/c_std/cstdio [!_GLIBCXX_HAVE_GETS] (gets): Likewise. * testsuite/27_io/headers/cstdio/functions_neg.cc: New test. From-SVN: r240672 |
||
Jason Merrill
|
af63ba4b30 |
Implement P0035R4, C++17 new of over-aligned types.
gcc/cp/ * cp-tree.h (enum cp_tree_index): Add CPTI_ALIGN_TYPE. (align_type_node): New macro. * call.c (build_operator_new_call): Handle C++17 aligned new. (second_parm_is_size_t, build_op_delete_call): Likewise. (non_placement_deallocation_fn_p): Likewise. Rename to usual_deallocation_fn_p. (aligned_allocation_fn_p, aligned_deallocation_fn_p): New. * decl.c (cxx_init_decl_processing): Add aligned new support. * init.c (type_has_new_extended_alignment): New. (build_new_1): Handle aligned new. * tree.c (vec_copy_and_insert): New. gcc/c-family/ * c.opt: Add -faligned-new and -Waligned-new. * c-common.c (max_align_t_align): Split out from... (cxx_fundamental_alignment_p): ...here. * c-common.h: Declare it. * c-cppbuiltin.c (c_cpp_builtins): Handle aligned new. libstdc++-v3/ * libsupc++/new: Declare aligned new/delete operators. * config/abi/pre/gnu.ver: Export them. * configure.ac: Check for aligned_alloc, posix_memalign, memalign, _aligned_malloc. * libsupc++/new_opa.cc: New. * libsupc++/new_opant.cc: New. * libsupc++/new_opva.cc: New. * libsupc++/new_opva.cc: New. * libsupc++/del_opa.cc: New. * libsupc++/del_opant.cc: New. * libsupc++/del_opsa.cc: New. * libsupc++/del_opva.cc: New. * libsupc++/del_opvant.cc: New. * libsupc++/del_opvsa.cc: New. * libsupc++/Makefile.am: Build them. From-SVN: r240056 |
||
Jonathan Wakely
|
c42d228806 |
Fix configure test for sendfile()
* acinclude.m4 (GLIBCXX_CHECK_FILESYSTEM_DEPS): Fix test for sendfile. * configure: Regenerate. * config.h.in: Regenerate. From-SVN: r236730 |
||
Jonathan Wakely
|
3555173fb9 |
Test for C99 stdlib.h functions with -std=c++98
PR libstdc++/69626 * acinclude.m4 (GLIBCXX_ENABLE_C99): Check C99 stdlib.h functions with -std=c++98 and define _GLIBCXX98_USE_C99_STDLIB. * config.h.in: Regenerate. * configure: Regenerate. * testsuite/21_strings/c_strings/char/69626.cc: New. From-SVN: r233161 |
||
John David Anglin
|
69b0daeb4a |
re PR libstdc++/69450 (libstdc++-v3/include/math.h:66:1 2: error: 'constexpr bool std::isnan(double)' conflicts with a previous declaration)
PR libstdc++/69450 * acinclude.m4 (GLIBCXX_CHECK_MATH11_PROTO): Split check for obsolete isinf and isnan functions into two independent checks. Check on hpux. * config.h.in: Regenerate. * configure: Regenerate. * include/c_global/cmath (isinf(double), isnan(double)): Use _GLIBCXX_HAVE_OBSOLETE_ISINF and _GLIBCXX_HAVE_OBSOLETE_ISNAN, respectively. From-SVN: r232925 |
||
Torvald Riegel
|
a04d5fc95d |
libstdc++: Make certain exceptions transaction_safe.
From-SVN: r232454 |
||
Jonathan Wakely
|
39a1d8c894 |
Use ::isinf and ::isnan if libc defines them
PR libstdc++/48891 * acinclude.m4 (GLIBCXX_CHECK_MATH11_PROTO): Check for obsolete isinf and isnan functions. * config.h.in: Regenerate. * configure: Regenerate. * include/c_global/cmath (isinf(double), isnan(double)) [_GLIBCXX_HAVE_OBSOLETE_ISINF_ISNAN]: Import via using-directive. * testsuite/26_numerics/headers/cmath/48891.cc: New. From-SVN: r232327 |
||
Rainer Orth
|
ef3a75060e |
Handle C++11 <math.h> overloads on Solaris 12
* acinclude.m4 (GLIBCXX_CHECK_MATH11_PROTO): New test. * configure.ac: Use it. * configure: Regenerate. * config.h.in: Regenerate. * include/c_global/cmath [__cplusplus >= 201103L] (std::fpclassify): Wrap in !__CORRECT_ISO_CPP11_MATH_H_PROTO. (std::isfinite): Likewise. (std::isinf): Likewise. (std::isnan): Likewise. (std::isnormal): Likewise. (std::signbit): Likewise. (std::isgreater): Likewise. (std::isgreaterequal): Likewise. (std::isless): Likewise. (std::islessequal): Likewise. (std::islessgreater): Likewise. (std::isunordered): Likewise. (std::acosh): Likewise. (std::asinh): Likewise. (std::atanh): Likewise. (std::cbrt): Likewise. (std::copysign): Likewise. (std::erf): Likewise. (std::erfc): Likewise. (std::exp2): Likewise. (std::expm1): Likewise. (std::fdim): Likewise. (std::fma): Likewise. (std::fmax): Likewise. (std::fmin): Likewise. (std::hypot): Likewise. (std::ilogb): Likewise. (std::lgamma): Likewise. (std::llrint): Likewise. (std::llround): Likewise. (std::log1p): Likewise. (std::log2): Likewise. (std::logb): Likewise. (std::lrint): Likewise. (std::lround): Likewise. (std::nearbyint): Likewise. (std::nextafter): Likewise. (std::nexttoward): Likewise. (std::remainder): Likewise. (std::remquo): Likewise. (std::rint): Likewise. (std::round): Likewise. (std::scalbln): Likewise. (std::scalbn): Likewise. (std::tgamma): Likewise. (std::trunc): Likewise. * include/tr1/cmath [_GLIBCXX_USE_C99_MATH_TR1] (std::tr1::acosh): Wrap in !__CORRECT_ISO_CPP11_MATH_H_PROTO. (std::tr1::asinh): Likewise. (std::tr1::atanh): Likewise. (std::tr1::cbrt): Likewise. (std::tr1::copysign): Likewise. (std::tr1::erf): Likewise. (std::tr1::erfc): Likewise. (std::tr1::exp2): Likewise. (std::tr1::expm1): Likewise. (std::tr1::fabs): Likewise. (std::tr1::fdim): Likewise. (std::tr1::fma): Likewise. (std::tr1::fmax): Likewise. (std::tr1::fmin): Likewise. (std::tr1::hypot): Likewise. (std::tr1::ilogb): Likewise. (std::tr1::lgamma): Likewise. (std::tr1::llrint): Likewise. (std::tr1::llround): Likewise. (std::tr1::log1p): Likewise. (std::tr1::log2): Likewise. (std::tr1::logb): Likewise. (std::tr1::lrint): Likewise. (std::tr1::lround): Likewise. (std::tr1::nearbyint): Likewise. (std::tr1::nextafter): Likewise. (std::tr1::nexttoward): Likewise. (std::tr1::remainder): Likewise. (std::tr1::remquo): Likewise. (std::tr1::rint): Likewise. (std::tr1::scalbln): Likewise. (std::tr1::scalbn): Likewise. (std::tr1::tgamma): Likewise. (std::tr1::trunc): Likewise. (std::tr1::pow): Likewise. * testsuite/26_numerics/headers/cmath/c99_classification_macros_c.cc: Restrict dg-xfail-if, dg-excess-errors to *-*-solaris2.1[01]*. From-SVN: r230807 |
||
Jennifer Yao
|
23c64853c8 |
More fine-grained autoconf checks for C99 library
2015-11-13 Jennifer Yao <jenny.hyphen.fa@gmail.com> Jonathan Wakely <jwakely@redhat.com> PR libstdc++/58393 PR libstdc++/61580 * acinclude.m4 (GLIBCXX_ENABLE_C99): Perform tests twice, with -std=c++11 as well as -std=c++98, and define separate macros for each. Cache the results of checking for complex math and wide character functions. Reformat for readability. * config.h.in: Regenerate. * include/bits/c++config: Define _GLIBCXX_USE_C99_XXX macros to either _GLIBCXX98_USE_C99_XXX or _GLIBCXX11_USE_C99_XXX according to language standard in use. * config/locale/dragonfly/c_locale.h (std::__convert_from_v): Replace _GLIBCXX_USE_C99 with _GLIBCXX_USE_C99_STDIO. * config/locale/generic/c_locale.h (std::__convert_from_v): Likewise. * config/locale/gnu/c_locale.h (std::__convert_from_v): Likewise. * config/os/bsd/dragonfly/os_defines.h: Define _GLIBCXX_USE_C99_STDIO, _GLIBCXX_USE_C99_STDLIB, and _GLIBCXX_USE_C99_WCHAR. * configure: Regenerate. * include/bits/basic_string.h: Make numeric conversion functions depend on _GLIBCXX_USE_C99_STDIO, _GLIBCXX_USE_C99_STDLIB, or _GLIBCXX_USE_C99_WCHAR, instead of _GLIBCXX_USE_C99. * include/ext/vstring.h: Likewise. * include/bits/locale_facets.tcc (std::num_put::_M_insert_float): Replace _GLIBCXX_USE_C99 with _GLIBCXX_USE_C99_STDIO. * include/bits/locale_facets_nonio.tcc (std::money_put::do_put): Likewise. * include/c_compatibility/math.h: Replace _GLIBCXX_USE_C99 with _GLIBCXX_USE_C99_MATH. * include/c_compatibility/wchar.h: Replace _GLIBCXX_USE_C99 with _GLIBCXX_USE_C99_WCHAR. * include/c_global/cstdio: Replace _GLIBCXX_USE_C99 with _GLIBCXX_USE_C99_STDIO. * include/c_global/cstdlib: Replace _GLIBCXX_USE_C99 with _GLIBCXX_USE_C99_STDLIB. * include/c_global/cwchar: Replace _GLIBCXX_USE_C99 with _GLIBCXX_USE_C99_WCHAR. * include/c_std/cstdio: Replace _GLIBCXX_USE_C99 with _GLIBCXX_USE_C99_STDIO. * include/c_std/cstdlib: Replace _GLIBCXX_USE_C99 with _GLIBCXX_USE_C99_STDLIB. * include/c_std/cwchar: Replace _GLIBCXX_USE_C99 with _GLIBCXX_USE_C99_WCHAR. * include/tr1/cstdio: Replace _GLIBCXX_USE_C99 with _GLIBCXX_USE_C99_STDIO. * include/tr1/cstdlib: Replace _GLIBCXX_USE_C99 with _GLIBCXX_USE_C99_STDLIB. * include/tr1/cwchar: Replace _GLIBCXX_USE_C99 with _GLIBCXX_USE_C99_WCHAR. * include/tr1/stdlib.h: Replace _GLIBCXX_USE_C99 with _GLIBCXX_USE_C99_STDLIB. * src/c++98/locale_facets.cc (std::__num_base::_S_format_float): Replace _GLIBCXX_USE_C99 with _GLIBCXX_USE_C99_STDIO. * testsuite/18_support/exception_ptr/60612-terminate.cc: Replace _GLIBCXX_USE_C99 with _GLIBCXX_USE_C99_STDLIB. * testsuite/18_support/exception_ptr/60612-unexpected.cc: Likewise. * testsuite/21_strings/basic_string/numeric_conversions/wchar_t/stod.cc (test01): Replace _GLIBCXX_USE_C99 with _GLIBCXX_USE_C99_WCHAR. * testsuite/21_strings/basic_string/numeric_conversions/wchar_t/ stof.cc: Likewise. * testsuite/21_strings/basic_string/numeric_conversions/wchar_t/ stoi.cc: Likewise. * testsuite/21_strings/basic_string/numeric_conversions/wchar_t/ stol.cc: Likewise. * testsuite/21_strings/basic_string/numeric_conversions/wchar_t/ stold.cc: Likewise. * testsuite/21_strings/basic_string/numeric_conversions/wchar_t/ stoll.cc: Likewise. * testsuite/21_strings/basic_string/numeric_conversions/wchar_t/ stoul.cc: Likewise. * testsuite/21_strings/basic_string/numeric_conversions/wchar_t/ stoull.cc: Likewise. * testsuite/21_strings/basic_string/numeric_conversions/wchar_t/ to_wstring.cc: Likewise. * testsuite/26_numerics/headers/cstdlib/13943.cc: Replace _GLIBCXX_USE_C99 with _GLIBCXX_USE_C99_STDLIB. * testsuite/26_numerics/headers/cstdlib/types_std_c++0x.cc: Likewise. * testsuite/lib/libstdc++.exp (check_v3_target_string_conversions): Change preprocessor #if conditional so that it uses _GLIBCXX_USE_C99_STDIO, _GLIBCXX_USE_C99_STDLIB, and _GLIBCXX_USE_C99_WCHAR, instead of _GLIBCXX_USE_C99. * testsuite/tr1/8_c_compatibility/cmath/templates.cc: Replace _GLIBCXX_USE_C99 with _GLIBCXX_USE_C99_MATH. * testsuite/tr1/8_c_compatibility/cstdio/functions.cc: Replace _GLIBCXX_USE_C99 with _GLIBCXX_USE_C99_STDIO. * testsuite/tr1/8_c_compatibility/cstdlib/functions.cc: Replace _GLIBCXX_USE_C99 with _GLIBCXX_USE_C99_STDLIB. * testsuite/tr1/8_c_compatibility/cstdlib/types_std_tr1.cc: Likewise. * testsuite/tr1/8_c_compatibility/cwchar/functions.cc: Replace _GLIBCXX_USE_C99 with _GLIBCXX_USE_C99_WCHAR. * testsuite/util/testsuite_fs.h: Replace _GLIBCXX_USE_C99 with _GLIBCXX_USE_C99_STDIO. Co-Authored-By: Jonathan Wakely <jwakely@redhat.com> From-SVN: r230324 |
||
Jonathan Wakely
|
429ee11aa3 |
Fix semantics of Filesystem TS directory iterators
[class.directory_iterator] p4 and [directory_iterator.members] p4 require that only the default constructor and ignored permission denied errors can create the end iterator. * acinclude.m4 (GLIBCXX_CHECK_FILESYSTEM_DEPS): Remove _GLIBCXX_ prefix from HAVE_STRUCT_DIRENT_D_TYPE. * config.h.in: Regenerate. * configure: Regenerate. * include/experimental/fs_dir.h (operator==, operator==): Use owner_before instead of pointer equality. (directory_iterator(std::shared_ptr<_Dir>, error_code*)): Remove. * src/filesystem/dir.cc (ErrorCode): Remove. (_Dir::advance): Change ErrorCode parameter to error_code*, add directory_options parameter and check it on error. (opendir): Rename to open_dir to avoid clashing with macro. Change ErrorCode parameter to error_code*. (make_shared_dir): Remove. (native_readdir) [_GLIBCXX_FILESYSTEM_IS_WINDOWS]: Don't set errno. (directory_iterator(std::shared_ptr<_Dir>, error_code*)): Remove. (directory_iterator(const path&, directory_options, error_code*)): Pass options to _Dir::advance and create non-end iterator on error. (recursive_directory_iterator(const path&, directory_options, error_code*)): Clear error_code on ignored error, create non-end iterator otherwise. (recursive_directory_iterator::increment): Pass _M_options to _Dir::advance. (recursive_directory_iterator::pop): Likewise. * testsuite/experimental/filesystem/iterators/directory_iterator.cc: New. * testsuite/experimental/filesystem/iterators/ recursive_directory_iterator.cc: New. From-SVN: r228042 |
||
Jonathan Wakely
|
3036299861 |
Implement filesystem::canonical() without realpath
PR libstdc++/67173 * acinclude.m4 (GLIBCXX_CHECK_FILESYSTEM_DEPS): Check _XOPEN_VERSION and PATH_MAX for _GLIBCXX_USE_REALPATH. * config.h.in: Regenerate. * configure: Regenerate. * src/filesystem/ops.cc: (canonical) [!_GLIBCXX_USE_REALPATH]: Add alternative implementation. * testsuite/experimental/filesystem/operations/canonical.cc: New. * testsuite/experimental/filesystem/operations/exists.cc: Add more tests. * testsuite/experimental/filesystem/operations/absolute.cc: Add test variables. * testsuite/experimental/filesystem/operations/copy.cc: Likewise. * testsuite/experimental/filesystem/operations/current_path.cc: Likewise. * testsuite/experimental/filesystem/operations/file_size.cc: Likewise. * testsuite/experimental/filesystem/operations/status.cc: Likewise. * testsuite/experimental/filesystem/operations/temp_directory_path.cc: Likewise. From-SVN: r227836 |
||
Edward Smith-Rowland
|
20b5f0b3e6 |
Add C++11 header <cuchar>.
2015-09-04 Edward Smith-Rowland <3dw4rd@verizon.net> Jonathan Wakely <jwakely@redhat.com> * acinclude.m4 (GLIBCXX_CHECK_UCHAR_H): Define. * config.h.in: Regenerate. * configure: Regenerate. * configure.ac: Check for <uchar.h>. * include/Makefile.am: Add new headers. * include/Makefile.in: Regenerate. * include/c/cuchar: New. * include/c_compatibility/uchar.h: New. * include/c_global/cuchar: New. * include/c_std/cuchar: New. * include/precompiled/stdc++.h: Include <cuchar>. * testsuite/17_intro/headers/c++200x/stdc++.cc: Include <uchar.h>. * testsuite/17_intro/headers/c++200x/stdc++_multiple_inclusion.cc: Include <uchar.h>. Co-Authored-By: Jonathan Wakely <jwakely@redhat.com> From-SVN: r227488 |
||
Jonathan Wakely
|
a0c4531ccf |
re PR libstdc++/66011 (call to '__open_missing_mode' declared with attribute error)
PR libstdc++/66011 * acinclude.m4 (GLIBCXX_CHECK_FILESYSTEM_DEPS): Check for fchmod and sendfile. * config.h.in: Regenerate. * configure: Regenerate. * src/filesystem/ops.cc (do_copy_file): Fix arguments to open(). Do not return after copying contents. Use fchmod, fchmodat, and sendfile when available. (current_path, permissions, space): Use errno not return value. From-SVN: r223196 |
||
Jonathan Wakely
|
0b9fc9fee8 |
re PR libstdc++/66018 (opendir configure test not working when GCC_NO_EXECUTABLES)
PR libstdc++/66018 * acinclude.m4 (GLIBCXX_CHECK_FILESYSTEM_DEPS): Check for struct dirent.d_type. * config.h.in: Regenerate. * configure: Regenerate. * configure.ac (AC_STRUCT_DIRENT_D_TYPE): Remove. From-SVN: r223194 |
||
Eric Botcazou
|
9b92a9f3b6 |
sjlj.m4: New file.
config/ * sjlj.m4: New file. libgcc/ * configure.ac: Include config/sjlj.m4. Remove manual SJLJ check, add GCC_CHECK_SJLJ_EXCEPTIONS and adjust. * config.in: Regenerate. * configure: Likewise. * config.host: Replace enable_sjlj_exceptions by ac_cv_sjlj_exceptions. libjava/ * configure.ac: Include config/sjlj.m4. Remove manual SJLJ check, add GCC_CHECK_SJLJ_EXCEPTIONS and adjust. * include/config.h.in: Regenerate. * configure: Likewise. * exception.cc: Replace SJLJ_EXCEPTIONS by __USING_SJLJ_EXCEPTIONS__. * stacktrace.cc: Likewise. * include/default-signal.h: Likewise. * sysdep/i386/backtrace.h: Likewise. libobjc/ * configure.ac: Remove manual SJLJ check. * config.h.in: Regenerate. * configure: Likewise. * exception.c: Replace SJLJ_EXCEPTIONS by __USING_SJLJ_EXCEPTIONS__. libstdc++-v3/ * acinclude.m4 (GLIBCXX_ENABLE_SJLJ_EXCEPTIONS): Delete. * configure.ac: Remove GLIBCXX_ENABLE_SJLJ_EXCEPTIONS. * config.h.in: Regenerate. * configure: Likewise. * libsupc++/eh_personality.cc: Replace _GLIBCXX_SJLJ_EXCEPTIONS by __USING_SJLJ_EXCEPTIONS__. * libsupc++/eh_throw.cc: Likewise. * libsupc++/eh_ptr.cc: Likewise. * doc/html/manual/appendix_porting.html: Remove GLIBCXX_ENABLE_SJLJ_EXCEPTIONS * doc/xml/manual/build_hacking.xml: Likewise. * doc/html/manual/configure.html: Remove --enable-sjlj-exceptions. * doc/xml/manual/configure.xml: Likewise. From-SVN: r223181 |
||
Jonathan Wakely
|
bf53e6a9dd |
acinclude.m4 (GLIBCXX_ENABLE_FILESYSTEM_TS): Disable when <dirent.h> is not available.
* acinclude.m4 (GLIBCXX_ENABLE_FILESYSTEM_TS): Disable when <dirent.h> is not available. (GLIBCXX_CHECK_FILESYSTEM_DEPS): Check for fchmodat. * configure: Regenerate. * config.h.in: Regenerate. * configure.ac: Check for utime.h * include/experimental/fs_path.h (path::string<>) [_GLIBCXX_FILESYSTEM_IS_WINDOWS]: Remove stray typename keyword. * src/filesystem/dir.cc [!_GLIBCXX_HAVE_DIRENT_H] (DIR, opendir, closedir, dirent, readdir_r): Replace dummy functions with #error. (native_readdir, _Dir::advance): Use readdir when readdir_r is missing. * src/filesystem/ops.cc (do_stat, is_set): Make inline. (last_write_time) [!_GLIBCXX_USE_UTIMENSAT]: Use utime. (permissions) [!_GLIBCXX_USE_FCHMODAT]: Use chmod. (space, temp_directory_path) [_GLIBCXX_FILESYSTEM_IS_WINDOWS]: Set error_code. From-SVN: r222703 |
||
Jonathan Wakely
|
0ca7ba9aa6 |
Implement N4100 File System TS
* acinclude.m4 (GLIBCXX_ENABLE_FILESYSTEM_TS): Define. (GLIBCXX_CHECK_FILESYSTEM_DEPS): Define. * config.h.in: Regenerate. * configure: Regenerate. * configure.ac: Enable filesystem TS and check its dependencies. * include/Makefile.am: Add new headers. * include/Makefile.in: Regenerate. * include/bits/locale_conv.h (__do_str_code_cvt, __str_codecvt_in, __str_codecvt_out): Move code conversion logic from wstring_convert into new global functions. (wstring_convert::to_bytes, wstring_convert::from_bytes): Use new functions. (wstring_convert::_M_conv): Remove. * include/bits/quoted_string.h (_Quoted_string): Split out of iomanip. * include/experimental/filesystem: New. * include/experimental/fs_dir.h: New. * include/experimental/fs_fwd.h: New. * include/experimental/fs_ops.h: New. * include/experimental/fs_path.h: New. * include/std/iomanip (_Quoted_string): Move to bits/quoted_string.h. * python/libstdcxx/v6/printers.py (StdExpPathPrinter): Add. * src/Makefile.am (SUBDIRS): Add filesystem. * src/Makefile.in: Regenerate. * src/filesystem/Makefile.am: New. * src/filesystem/Makefile.in: New. * src/filesystem/dir.cc: New. * src/filesystem/ops.cc: New. * src/filesystem/path.cc: New. * testsuite/experimental/filesystem/operations/absolute.cc: New. * testsuite/experimental/filesystem/operations/copy.cc: New. * testsuite/experimental/filesystem/operations/current_path.cc: New. * testsuite/experimental/filesystem/path/append/path.cc: New. * testsuite/experimental/filesystem/path/assign/assign.cc: New. * testsuite/experimental/filesystem/path/assign/copy.cc: New. * testsuite/experimental/filesystem/path/compare/compare.cc: New. * testsuite/experimental/filesystem/path/compare/path.cc: New. * testsuite/experimental/filesystem/path/compare/strings.cc: New. * testsuite/experimental/filesystem/path/concat/path.cc: New. * testsuite/experimental/filesystem/path/concat/strings.cc: New. * testsuite/experimental/filesystem/path/construct/copy.cc: New. * testsuite/experimental/filesystem/path/construct/default.cc: New. * testsuite/experimental/filesystem/path/construct/locale.cc: New. * testsuite/experimental/filesystem/path/construct/range.cc: New. * testsuite/experimental/filesystem/path/decompose/extension.cc: New. * testsuite/experimental/filesystem/path/decompose/filename.cc: New. * testsuite/experimental/filesystem/path/decompose/parent_path.cc: New. * testsuite/experimental/filesystem/path/decompose/relative_path.cc: New. * testsuite/experimental/filesystem/path/decompose/root_directory.cc: New. * testsuite/experimental/filesystem/path/decompose/root_name.cc: New. * testsuite/experimental/filesystem/path/decompose/root_path.cc: New. * testsuite/experimental/filesystem/path/decompose/stem.cc: New. * testsuite/experimental/filesystem/path/generic/generic_string.cc: New. * testsuite/experimental/filesystem/path/itr/traversal.cc: New. * testsuite/experimental/filesystem/path/modifiers/clear.cc: New. * testsuite/experimental/filesystem/path/modifiers/make_preferred.cc: New. * testsuite/experimental/filesystem/path/modifiers/remove_filename.cc: New. * testsuite/experimental/filesystem/path/modifiers/replace_extension.cc: New. * testsuite/experimental/filesystem/path/modifiers/replace_filename.cc: New. * testsuite/experimental/filesystem/path/modifiers/swap.cc: New. * testsuite/experimental/filesystem/path/nonmember/hash_value.cc: New. * testsuite/experimental/filesystem/path/query/empty.cc: New. * testsuite/experimental/filesystem/path/query/has_extension.cc: New. * testsuite/experimental/filesystem/path/query/has_filename.cc: New. * testsuite/experimental/filesystem/path/query/has_parent_path.cc: New. * testsuite/experimental/filesystem/path/query/has_relative_path.cc: New. * testsuite/experimental/filesystem/path/query/has_root_directory.cc: New. * testsuite/experimental/filesystem/path/query/has_root_name.cc: New. * testsuite/experimental/filesystem/path/query/has_root_path.cc: New. * testsuite/experimental/filesystem/path/query/has_stem.cc: New. * testsuite/experimental/filesystem/path/query/is_relative.cc: New. * testsuite/util/testsuite_fs.h: New. From-SVN: r222654 |
||
Jonathan Wakely
|
5e0216f173 |
acinclude.m4 (GLIBCXX_CHECK_GTHREADS): Check for pthread_rwlock_t.
2015-03-18 Jonathan Wakely <jwakely@redhat.com> Torvald Riegel <triegel@redhat.com> * acinclude.m4 (GLIBCXX_CHECK_GTHREADS): Check for pthread_rwlock_t. * config.h.in: Regenerate. * configure: Regenerate. * include/std/shared_mutex: Check _GLIBCXX_USE_PTHREAD_RWLOCK_T. (shared_timed_mutex::_M_rwlock): Use PTHREAD_RWLOCK_INITIALIZER. (shared_timed_mutex::lock_shared()): Retry on EAGAIN. (shared_timed_mutex::try_lock_shared_until()): Retry on EAGAIN and EDEADLK. Co-Authored-By: Torvald Riegel <triegel@redhat.com> From-SVN: r221484 |