diff options
author | Jonathan Wakely <jwakely@redhat.com> | 2019-02-14 14:10:25 +0000 |
---|---|---|
committer | Jonathan Wakely <redi@gcc.gnu.org> | 2019-02-14 14:10:25 +0000 |
commit | a61ae535c3e79a446d525fd7205049f407e0464c (patch) | |
tree | fc093c17dad61380775eff93003a6f62f3442861 | |
parent | 1f4dcbf7cd8c60457ab9b156017db6e39293657b (diff) | |
download | gcc-a61ae535c3e79a446d525fd7205049f407e0464c.zip gcc-a61ae535c3e79a446d525fd7205049f407e0464c.tar.gz gcc-a61ae535c3e79a446d525fd7205049f407e0464c.tar.bz2 |
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
-rw-r--r-- | libstdc++-v3/ChangeLog | 8 | ||||
-rw-r--r-- | libstdc++-v3/config.h.in | 3 | ||||
-rwxr-xr-x | libstdc++-v3/configure | 46 | ||||
-rw-r--r-- | libstdc++-v3/configure.ac | 3 | ||||
-rw-r--r-- | libstdc++-v3/crossconfig.m4 | 3 | ||||
-rw-r--r-- | libstdc++-v3/include/c_global/ctime | 9 |
6 files changed, 72 insertions, 0 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 8186974..932b807 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,5 +1,13 @@ 2019-02-14 Jonathan Wakely <jwakely@redhat.com> + * 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. + * doc/xml/manual/intro.xml: Document LWG 2537 status. * include/bits/stl_queue.h (priority_queue(const Compare&, const Container&, const Alloc&)) diff --git a/libstdc++-v3/config.h.in b/libstdc++-v3/config.h.in index 225ef1b..034d91b 100644 --- a/libstdc++-v3/config.h.in +++ b/libstdc++-v3/config.h.in @@ -508,6 +508,9 @@ /* Define to 1 if you have the <tgmath.h> header file. */ #undef HAVE_TGMATH_H +/* Define to 1 if you have the `timespec_get' function. */ +#undef HAVE_TIMESPEC_GET + /* Define to 1 if the target supports thread-local storage. */ #undef HAVE_TLS diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure index 15848e3..857f886 100755 --- a/libstdc++-v3/configure +++ b/libstdc++-v3/configure @@ -28432,6 +28432,19 @@ fi done + # C11 functions for C++17 library + for ac_func in timespec_get +do : + ac_fn_c_check_func "$LINENO" "timespec_get" "ac_cv_func_timespec_get" +if test "x$ac_cv_func_timespec_get" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_TIMESPEC_GET 1 +_ACEOF + +fi +done + + # For iconv support. if test "X$prefix" = "XNONE"; then @@ -53616,6 +53629,17 @@ _ACEOF fi done + for ac_func in timespec_get +do : + ac_fn_c_check_func "$LINENO" "timespec_get" "ac_cv_func_timespec_get" +if test "x$ac_cv_func_timespec_get" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_TIMESPEC_GET 1 +_ACEOF + +fi +done + ;; *-fuchsia*) @@ -60232,6 +60256,17 @@ _ACEOF fi done + for ac_func in timespec_get +do : + ac_fn_c_check_func "$LINENO" "timespec_get" "ac_cv_func_timespec_get" +if test "x$ac_cv_func_timespec_get" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_TIMESPEC_GET 1 +_ACEOF + +fi +done + @@ -66545,6 +66580,17 @@ _ACEOF fi done + for ac_func in timespec_get +do : + ac_fn_c_check_func "$LINENO" "timespec_get" "ac_cv_func_timespec_get" +if test "x$ac_cv_func_timespec_get" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_TIMESPEC_GET 1 +_ACEOF + +fi +done + ;; *-qnx6.1* | *-qnx6.2*) SECTION_FLAGS='-ffunction-sections -fdata-sections' diff --git a/libstdc++-v3/configure.ac b/libstdc++-v3/configure.ac index ad5b411..6c98f27 100644 --- a/libstdc++-v3/configure.ac +++ b/libstdc++-v3/configure.ac @@ -265,6 +265,9 @@ if $GLIBCXX_IS_NATIVE; then AC_CHECK_FUNCS(aligned_alloc posix_memalign memalign _aligned_malloc) AC_CHECK_FUNCS(_wfopen) + # C11 functions for C++17 library + AC_CHECK_FUNCS(timespec_get) + # For iconv support. AM_ICONV diff --git a/libstdc++-v3/crossconfig.m4 b/libstdc++-v3/crossconfig.m4 index 3de40dc..4a30300 100644 --- a/libstdc++-v3/crossconfig.m4 +++ b/libstdc++-v3/crossconfig.m4 @@ -135,6 +135,7 @@ case "${host}" in fi AC_CHECK_FUNCS(__cxa_thread_atexit) AC_CHECK_FUNCS(aligned_alloc posix_memalign memalign _aligned_malloc) + AC_CHECK_FUNCS(timespec_get) ;; *-fuchsia*) @@ -194,6 +195,7 @@ case "${host}" in GCC_CHECK_TLS AC_CHECK_FUNCS(__cxa_thread_atexit_impl) AC_CHECK_FUNCS(aligned_alloc posix_memalign memalign _aligned_malloc) + AC_CHECK_FUNCS(timespec_get) AM_ICONV ;; *-mingw32*) @@ -221,6 +223,7 @@ case "${host}" in AC_DEFINE(HAVE_ISNANL) fi AC_CHECK_FUNCS(aligned_alloc posix_memalign memalign _aligned_malloc) + AC_CHECK_FUNCS(timespec_get) ;; *-qnx6.1* | *-qnx6.2*) SECTION_FLAGS='-ffunction-sections -fdata-sections' diff --git a/libstdc++-v3/include/c_global/ctime b/libstdc++-v3/include/c_global/ctime index cdd3d8d..685c821 100644 --- a/libstdc++-v3/include/c_global/ctime +++ b/libstdc++-v3/include/c_global/ctime @@ -72,4 +72,13 @@ namespace std using ::strftime; } // namespace +#if __cplusplus >= 201703L && defined(_GLIBCXX_HAVE_TIMESPEC_GET) +#undef timespec_get +namespace std +{ + using ::timespec; + using ::timespec_get; +} // namespace std +#endif + #endif |