# DP: updates from the 5 branch upto 20150903 (r227431). last_update() { cat > ${dir}LAST_UPDATED next; + start = __atomic_load_n (&ws->next, MEMMODEL_RELAXED); while (1) { long left = end - start; @@ -301,7 +301,7 @@ long start, end, nend, incr; unsigned long chunk_size; - start = ws->next; + start = __atomic_load_n (&ws->next, MEMMODEL_RELAXED); end = ws->end; incr = ws->incr; chunk_size = ws->chunk_size; Index: libgomp/iter_ull.c =================================================================== --- a/src/libgomp/iter_ull.c (.../tags/gcc_5_2_0_release) +++ b/src/libgomp/iter_ull.c (.../branches/gcc-5-branch) @@ -219,7 +219,7 @@ } } - start = ws->next_ull; + start = __atomic_load_n (&ws->next_ull, MEMMODEL_RELAXED); while (1) { gomp_ull left = end - start; @@ -305,7 +305,7 @@ gomp_ull start, end, nend, incr; gomp_ull chunk_size; - start = ws->next_ull; + start = __atomic_load_n (&ws->next_ull, MEMMODEL_RELAXED); end = ws->end_ull; incr = ws->incr_ull; chunk_size = ws->chunk_size_ull; Index: libgomp/ChangeLog =================================================================== --- a/src/libgomp/ChangeLog (.../tags/gcc_5_2_0_release) +++ b/src/libgomp/ChangeLog (.../branches/gcc-5-branch) @@ -1,3 +1,13 @@ +2015-08-24 Joost VandeVondele + + PR libgomp/66761 + PR libgomp/67303 + * iter.c (gomp_iter_dynamic_next): Employ an atomic load. + (gomp_iter_guided_next): Idem. + * iter_ull.c (gomp_iter_ull_dynamic_next): Idem. + (gomp_iter_ull_guided_next): Idem. + * config/linux/wait.h (do_spin): Idem. + 2015-07-16 Release Manager * GCC 5.2.0 released. Index: libgomp/config/linux/wait.h =================================================================== --- a/src/libgomp/config/linux/wait.h (.../tags/gcc_5_2_0_release) +++ b/src/libgomp/config/linux/wait.h (.../branches/gcc-5-branch) @@ -49,7 +49,9 @@ { unsigned long long i, count = gomp_spin_count_var; - if (__builtin_expect (gomp_managed_threads > gomp_available_cpus, 0)) + if (__builtin_expect (__atomic_load_n (&gomp_managed_threads, + MEMMODEL_RELAXED) + > gomp_available_cpus, 0)) count = gomp_throttled_spin_count_var; for (i = 0; i < count; i++) if (__builtin_expect (__atomic_load_n (addr, MEMMODEL_RELAXED) != val, 0)) Index: libstdc++-v3/configure =================================================================== --- a/src/libstdc++-v3/configure (.../tags/gcc_5_2_0_release) +++ b/src/libstdc++-v3/configure (.../branches/gcc-5-branch) @@ -638,6 +638,8 @@ DOXYGEN BUILD_INFO_FALSE BUILD_INFO_TRUE +ENABLE_FILESYSTEM_TS_FALSE +ENABLE_FILESYSTEM_TS_TRUE baseline_subdir_switch baseline_dir HWCAP_FLAGS @@ -890,6 +892,7 @@ enable_libstdcxx_dual_abi with_default_libstdcxx_abi enable_libstdcxx_threads +enable_libstdcxx_filesystem_ts with_gxx_include_dir enable_version_specific_runtime_libs ' @@ -1588,6 +1591,8 @@ support two versions of std::string [default=yes] --enable-libstdcxx-threads enable C++11 threads support [default=auto] + --enable-libstdcxx-filesystem-ts + turns on ISO/IEC TS 18822 support [default=auto] --enable-version-specific-runtime-libs Specify that runtime libraries should be installed in a compiler-specific directory @@ -3604,11 +3609,12 @@ # We need awk for the "check" target. The system "awk" is bad on # some platforms. -# Always define AMTAR for backward compatibility. +# Always define AMTAR for backward compatibility. Yes, it's still used +# in the wild :-( We should find a proper way to deprecate it ... +AMTAR='$${TAR-tar}' -AMTAR=${AMTAR-"${am_missing_run}tar"} +am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -' -am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -' @@ -3616,7 +3622,6 @@ - # -fno-builtin must be present here so that a non-conflicting form of # std::exit can be guessed by AC_PROG_CXX, and used in later tests. @@ -4951,7 +4956,7 @@ # expandable list at autoconf time; the second provides an expandable list # (i.e., shell variable) at configure time. - SUBDIRS='include libsupc++ python src src/c++98 src/c++11 doc po testsuite' + SUBDIRS='include libsupc++ src src/c++98 src/c++11 src/filesystem doc po testsuite python' # These need to be absolute paths, yet at the same time need to # canonicalize only relative paths, because then amd will not unmount @@ -11593,7 +11598,7 @@ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11596 "configure" +#line 11601 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -11699,7 +11704,7 @@ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11702 "configure" +#line 11707 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -15119,7 +15124,7 @@ # # Fake what AC_TRY_COMPILE does. XXX Look at redoing this new-style. cat > conftest.$ac_ext << EOF -#line 15122 "configure" +#line 15127 "configure" struct S { ~S(); }; void bar(); void foo() @@ -15471,7 +15476,7 @@ # Fake what AC_TRY_COMPILE does. cat > conftest.$ac_ext << EOF -#line 15474 "configure" +#line 15479 "configure" int main() { typedef bool atomic_type; @@ -15506,7 +15511,7 @@ rm -f conftest* cat > conftest.$ac_ext << EOF -#line 15509 "configure" +#line 15514 "configure" int main() { typedef short atomic_type; @@ -15541,7 +15546,7 @@ rm -f conftest* cat > conftest.$ac_ext << EOF -#line 15544 "configure" +#line 15549 "configure" int main() { // NB: _Atomic_word not necessarily int. @@ -15577,7 +15582,7 @@ rm -f conftest* cat > conftest.$ac_ext << EOF -#line 15580 "configure" +#line 15585 "configure" int main() { typedef long long atomic_type; @@ -15656,7 +15661,7 @@ # unnecessary for this test. cat > conftest.$ac_ext << EOF -#line 15659 "configure" +#line 15664 "configure" int main() { _Decimal32 d1; @@ -15698,7 +15703,7 @@ # unnecessary for this test. cat > conftest.$ac_ext << EOF -#line 15701 "configure" +#line 15706 "configure" template struct same { typedef T2 type; }; @@ -15732,7 +15737,7 @@ rm -f conftest* cat > conftest.$ac_ext << EOF -#line 15735 "configure" +#line 15740 "configure" template struct same { typedef T2 type; }; @@ -78867,6 +78872,508 @@ +# For Filesystem TS. +for ac_header in fcntl.h dirent.h sys/statvfs.h utime.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" +eval as_val=\$$as_ac_Header + if test "x$as_val" = x""yes; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + + # Check whether --enable-libstdcxx-filesystem-ts was given. +if test "${enable_libstdcxx_filesystem_ts+set}" = set; then : + enableval=$enable_libstdcxx_filesystem_ts; + case "$enableval" in + yes|no|auto) ;; + *) as_fn_error "Unknown argument to enable/disable libstdcxx-filesystem-ts" "$LINENO" 5 ;; + esac + +else + enable_libstdcxx_filesystem_ts=auto +fi + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build Filesystem TS support" >&5 +$as_echo_n "checking whether to build Filesystem TS support... " >&6; } + if test x"$ac_cv_header_dirent_h" != x"yes"; then + enable_libstdcxx_filesystem_ts=no + fi + if test x"$enable_libstdcxx_filesystem_ts" = x"auto"; then + case "${target_os}" in + freebsd*|netbsd*|openbsd*|dragonfly*|darwin*) + enable_libstdcxx_filesystem_ts=yes + ;; + gnu* | linux* | kfreebsd*-gnu | knetbsd*-gnu) + enable_libstdcxx_filesystem_ts=yes + ;; + solaris*) + enable_libstdcxx_filesystem_ts=yes + ;; + *) + enable_libstdcxx_filesystem_ts=no + ;; + esac + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_libstdcxx_filesystem_ts" >&5 +$as_echo "$enable_libstdcxx_filesystem_ts" >&6; } + + + + ac_ext=cpp +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu + + ac_save_CXXFLAGS="$CXXFLAGS" + CXXFLAGS="$CXXFLAGS -fno-exceptions" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for struct dirent.d_type" >&5 +$as_echo_n "checking for struct dirent.d_type... " >&6; } + if test "${glibcxx_cv_dirent_d_type+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test x$gcc_no_link = xyes; then + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main () +{ + + struct dirent d; + if (sizeof d.d_type) return 0; + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + glibcxx_cv_dirent_d_type=yes +else + glibcxx_cv_dirent_d_type=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +else + if test x$gcc_no_link = xyes; then + as_fn_error "Link tests are not allowed after GCC_NO_EXECUTABLES." "$LINENO" 5 +fi +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main () +{ + + struct dirent d; + if (sizeof d.d_type) return 0; + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_link "$LINENO"; then : + glibcxx_cv_dirent_d_type=yes +else + glibcxx_cv_dirent_d_type=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi + +fi + + if test $glibcxx_cv_dirent_d_type = yes; then + +$as_echo "#define _GLIBCXX_HAVE_STRUCT_DIRENT_D_TYPE 1" >>confdefs.h + + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $glibcxx_cv_dirent_d_type" >&5 +$as_echo "$glibcxx_cv_dirent_d_type" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for realpath" >&5 +$as_echo_n "checking for realpath... " >&6; } + if test "${glibcxx_cv_realpath+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test x$gcc_no_link = xyes; then + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main () +{ +char *tmp = realpath((const char*)NULL, (char*)NULL); + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + glibcxx_cv_realpath=yes +else + glibcxx_cv_realpath=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +else + if test x$gcc_no_link = xyes; then + as_fn_error "Link tests are not allowed after GCC_NO_EXECUTABLES." "$LINENO" 5 +fi +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main () +{ +char *tmp = realpath((const char*)NULL, (char*)NULL); + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_link "$LINENO"; then : + glibcxx_cv_realpath=yes +else + glibcxx_cv_realpath=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi + +fi + + if test $glibcxx_cv_realpath = yes; then + +$as_echo "#define _GLIBCXX_USE_REALPATH 1" >>confdefs.h + + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $glibcxx_cv_realpath" >&5 +$as_echo "$glibcxx_cv_realpath" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for utimensat" >&5 +$as_echo_n "checking for utimensat... " >&6; } + if test "${glibcxx_cv_utimensat+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test x$gcc_no_link = xyes; then + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + #include + #include + +int +main () +{ + + struct timespec ts[2] = { { 0, UTIME_OMIT }, { 1, 1 } }; + int i = utimensat(AT_FDCWD, "path", ts, 0); + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + glibcxx_cv_utimensat=yes +else + glibcxx_cv_utimensat=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +else + if test x$gcc_no_link = xyes; then + as_fn_error "Link tests are not allowed after GCC_NO_EXECUTABLES." "$LINENO" 5 +fi +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + #include + #include + +int +main () +{ + + struct timespec ts[2] = { { 0, UTIME_OMIT }, { 1, 1 } }; + int i = utimensat(AT_FDCWD, "path", ts, 0); + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_link "$LINENO"; then : + glibcxx_cv_utimensat=yes +else + glibcxx_cv_utimensat=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi + +fi + + if test $glibcxx_cv_utimensat = yes; then + +$as_echo "#define _GLIBCXX_USE_UTIMENSAT 1" >>confdefs.h + + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $glibcxx_cv_utimensat" >&5 +$as_echo "$glibcxx_cv_utimensat" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for struct stat.st_mtim.tv_nsec" >&5 +$as_echo_n "checking for struct stat.st_mtim.tv_nsec... " >&6; } + if test "${glibcxx_cv_st_mtim+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test x$gcc_no_link = xyes; then + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + #include +int +main () +{ + + struct stat st; + return st.st_mtim.tv_nsec; + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + glibcxx_cv_st_mtim=yes +else + glibcxx_cv_st_mtim=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +else + if test x$gcc_no_link = xyes; then + as_fn_error "Link tests are not allowed after GCC_NO_EXECUTABLES." "$LINENO" 5 +fi +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + #include +int +main () +{ + + struct stat st; + return st.st_mtim.tv_nsec; + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_link "$LINENO"; then : + glibcxx_cv_st_mtim=yes +else + glibcxx_cv_st_mtim=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi + +fi + + if test $glibcxx_cv_st_mtim = yes; then + +$as_echo "#define _GLIBCXX_USE_ST_MTIM 1" >>confdefs.h + + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $glibcxx_cv_st_mtim" >&5 +$as_echo "$glibcxx_cv_st_mtim" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for fchmod" >&5 +$as_echo_n "checking for fchmod... " >&6; } + if test "${glibcxx_cv_fchmod+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test x$gcc_no_link = xyes; then + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main () +{ +fchmod(1, S_IWUSR); + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + glibcxx_cv_fchmod=yes +else + glibcxx_cv_fchmod=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +else + if test x$gcc_no_link = xyes; then + as_fn_error "Link tests are not allowed after GCC_NO_EXECUTABLES." "$LINENO" 5 +fi +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main () +{ +fchmod(1, S_IWUSR); + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_link "$LINENO"; then : + glibcxx_cv_fchmod=yes +else + glibcxx_cv_fchmod=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi + +fi + + if test $glibcxx_cv_fchmod = yes; then + +$as_echo "#define _GLIBCXX_USE_FCHMOD 1" >>confdefs.h + + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $glibcxx_cv_fchmod" >&5 +$as_echo "$glibcxx_cv_fchmod" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for fchmodat" >&5 +$as_echo_n "checking for fchmodat... " >&6; } + if test "${glibcxx_cv_fchmodat+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test x$gcc_no_link = xyes; then + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + #include + #include + +int +main () +{ +fchmodat(AT_FDCWD, "", 0, AT_SYMLINK_NOFOLLOW); + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + glibcxx_cv_fchmodat=yes +else + glibcxx_cv_fchmodat=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +else + if test x$gcc_no_link = xyes; then + as_fn_error "Link tests are not allowed after GCC_NO_EXECUTABLES." "$LINENO" 5 +fi +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + #include + #include + +int +main () +{ +fchmodat(AT_FDCWD, "", 0, AT_SYMLINK_NOFOLLOW); + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_link "$LINENO"; then : + glibcxx_cv_fchmodat=yes +else + glibcxx_cv_fchmodat=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi + +fi + + if test $glibcxx_cv_fchmodat = yes; then + +$as_echo "#define _GLIBCXX_USE_FCHMODAT 1" >>confdefs.h + + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $glibcxx_cv_fchmodat" >&5 +$as_echo "$glibcxx_cv_fchmodat" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sendfile that can copy files" >&5 +$as_echo_n "checking for sendfile that can copy files... " >&6; } + if test "${glibcxx_cv_sendfile+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + case "${target_os}" in + gnu* | linux* | solaris*) + if test x$gcc_no_link = xyes; then + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main () +{ +sendfile(1, 2, (off_t*)NULL, sizeof 1); + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + glibcxx_cv_sendfile=yes +else + glibcxx_cv_sendfile=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +else + if test x$gcc_no_link = xyes; then + as_fn_error "Link tests are not allowed after GCC_NO_EXECUTABLES." "$LINENO" 5 +fi +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main () +{ +sendfile(1, 2, (off_t*)NULL, sizeof 1); + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_link "$LINENO"; then : + glibcxx_cv_sendfile=yes +else + glibcxx_cv_sendfile=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi + ;; + *) + glibcxx_cv_sendfile=no + ;; + esac + +fi + + if test $glibcxx_cv_sendfile = yes; then + +$as_echo "#define _GLIBCXX_USE_SENDFILE 1" >>confdefs.h + + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $glibcxx_cv_sendfile" >&5 +$as_echo "$glibcxx_cv_sendfile" >&6; } + CXXFLAGS="$ac_save_CXXFLAGS" + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + # Define documentation rules conditionally. # See if makeinfo has been installed and is modern enough @@ -79490,8 +79997,17 @@ fi + if test $enable_libstdcxx_filesystem_ts = yes; then + ENABLE_FILESYSTEM_TS_TRUE= + ENABLE_FILESYSTEM_TS_FALSE='#' +else + ENABLE_FILESYSTEM_TS_TRUE='#' + ENABLE_FILESYSTEM_TS_FALSE= +fi + + cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure @@ -79715,7 +80231,7 @@ # append it here. Only modify Makefiles that have just been created. # # Also, get rid of this simulated-VPATH thing that automake does. -ac_config_files="$ac_config_files include/Makefile libsupc++/Makefile python/Makefile src/Makefile src/c++98/Makefile src/c++11/Makefile doc/Makefile po/Makefile testsuite/Makefile" +ac_config_files="$ac_config_files include/Makefile libsupc++/Makefile src/Makefile src/c++98/Makefile src/c++11/Makefile src/filesystem/Makefile doc/Makefile po/Makefile testsuite/Makefile python/Makefile" ac_config_commands="$ac_config_commands generate-headers" @@ -79914,6 +80430,10 @@ as_fn_error "conditional \"GLIBCXX_LDBL_COMPAT\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi +if test -z "${ENABLE_FILESYSTEM_TS_TRUE}" && test -z "${ENABLE_FILESYSTEM_TS_FALSE}"; then + as_fn_error "conditional \"ENABLE_FILESYSTEM_TS\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi if test -z "${BUILD_INFO_TRUE}" && test -z "${BUILD_INFO_FALSE}"; then as_fn_error "conditional \"BUILD_INFO\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 @@ -80932,13 +81452,14 @@ "doc/xsl/customization.xsl") CONFIG_FILES="$CONFIG_FILES doc/xsl/customization.xsl" ;; "include/Makefile") CONFIG_FILES="$CONFIG_FILES include/Makefile" ;; "libsupc++/Makefile") CONFIG_FILES="$CONFIG_FILES libsupc++/Makefile" ;; - "python/Makefile") CONFIG_FILES="$CONFIG_FILES python/Makefile" ;; "src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;; "src/c++98/Makefile") CONFIG_FILES="$CONFIG_FILES src/c++98/Makefile" ;; "src/c++11/Makefile") CONFIG_FILES="$CONFIG_FILES src/c++11/Makefile" ;; + "src/filesystem/Makefile") CONFIG_FILES="$CONFIG_FILES src/filesystem/Makefile" ;; "doc/Makefile") CONFIG_FILES="$CONFIG_FILES doc/Makefile" ;; "po/Makefile") CONFIG_FILES="$CONFIG_FILES po/Makefile" ;; "testsuite/Makefile") CONFIG_FILES="$CONFIG_FILES testsuite/Makefile" ;; + "python/Makefile") CONFIG_FILES="$CONFIG_FILES python/Makefile" ;; "generate-headers") CONFIG_COMMANDS="$CONFIG_COMMANDS generate-headers" ;; *) as_fn_error "invalid argument: \`$ac_config_target'" "$LINENO" 5;; @@ -82738,7 +83259,7 @@ . ${multi_basedir}/config-ml.in { ml_norecursion=; unset ml_norecursion;} ;; - "python/Makefile":F) cat > vpsed$$ << \_EOF + "src/Makefile":F) cat > vpsed$$ << \_EOF s!`test -f '$<' || echo '$(srcdir)/'`!! _EOF sed -f vpsed$$ $ac_file > tmp$$ @@ -82749,7 +83270,7 @@ . ${multi_basedir}/config-ml.in { ml_norecursion=; unset ml_norecursion;} ;; - "src/Makefile":F) cat > vpsed$$ << \_EOF + "src/c++98/Makefile":F) cat > vpsed$$ << \_EOF s!`test -f '$<' || echo '$(srcdir)/'`!! _EOF sed -f vpsed$$ $ac_file > tmp$$ @@ -82760,7 +83281,7 @@ . ${multi_basedir}/config-ml.in { ml_norecursion=; unset ml_norecursion;} ;; - "src/c++98/Makefile":F) cat > vpsed$$ << \_EOF + "src/c++11/Makefile":F) cat > vpsed$$ << \_EOF s!`test -f '$<' || echo '$(srcdir)/'`!! _EOF sed -f vpsed$$ $ac_file > tmp$$ @@ -82771,7 +83292,7 @@ . ${multi_basedir}/config-ml.in { ml_norecursion=; unset ml_norecursion;} ;; - "src/c++11/Makefile":F) cat > vpsed$$ << \_EOF + "src/filesystem/Makefile":F) cat > vpsed$$ << \_EOF s!`test -f '$<' || echo '$(srcdir)/'`!! _EOF sed -f vpsed$$ $ac_file > tmp$$ @@ -82815,6 +83336,17 @@ . ${multi_basedir}/config-ml.in { ml_norecursion=; unset ml_norecursion;} ;; + "python/Makefile":F) cat > vpsed$$ << \_EOF +s!`test -f '$<' || echo '$(srcdir)/'`!! +_EOF + sed -f vpsed$$ $ac_file > tmp$$ + mv tmp$$ $ac_file + rm vpsed$$ + echo 'MULTISUBDIR =' >> $ac_file + ml_norecursion=yes + . ${multi_basedir}/config-ml.in + { ml_norecursion=; unset ml_norecursion;} + ;; "generate-headers":C) (cd include && ${MAKE-make} pch_build= ) ;; esac Index: libstdc++-v3/python/Makefile.in =================================================================== --- a/src/libstdc++-v3/python/Makefile.in (.../tags/gcc_5_2_0_release) +++ b/src/libstdc++-v3/python/Makefile.in (.../branches/gcc-5-branch) @@ -1,9 +1,9 @@ -# Makefile.in generated by automake 1.11.1 from Makefile.am. +# Makefile.in generated by automake 1.11.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, -# Inc. +# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software +# Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -16,6 +16,23 @@ @SET_MAKE@ VPATH = @srcdir@ +am__make_dryrun = \ + { \ + am__dry=no; \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ + | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ + *) \ + for am__flg in $$MAKEFLAGS; do \ + case $$am__flg in \ + *=*|--*) ;; \ + *n*) am__dry=yes; break;; \ + esac; \ + done;; \ + esac; \ + test $$am__dry = yes; \ + } pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ @@ -68,6 +85,11 @@ depcomp = am__depfiles_maybe = SOURCES = +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ @@ -89,6 +111,12 @@ am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } am__installdirs = "$(DESTDIR)$(pythondir)" DATA = $(nobase_python_DATA) ABI_TWEAKS_SRCDIR = @ABI_TWEAKS_SRCDIR@ @@ -345,6 +373,7 @@ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; +$(top_srcdir)/fragment.am: $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh @@ -362,8 +391,11 @@ -rm -rf .libs _libs install-nobase_pythonDATA: $(nobase_python_DATA) @$(NORMAL_INSTALL) - test -z "$(pythondir)" || $(MKDIR_P) "$(DESTDIR)$(pythondir)" @list='$(nobase_python_DATA)'; test -n "$(pythondir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(pythondir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(pythondir)" || exit 1; \ + fi; \ $(am__nobase_list) | while read dir files; do \ xfiles=; for file in $$files; do \ if test -f "$$file"; then xfiles="$$xfiles $$file"; \ @@ -370,7 +402,7 @@ else xfiles="$$xfiles $(srcdir)/$$file"; fi; done; \ test -z "$$xfiles" || { \ test "x$$dir" = x. || { \ - echo "$(MKDIR_P) '$(DESTDIR)$(pythondir)/$$dir'"; \ + echo " $(MKDIR_P) '$(DESTDIR)$(pythondir)/$$dir'"; \ $(MKDIR_P) "$(DESTDIR)$(pythondir)/$$dir"; }; \ echo " $(INSTALL_DATA) $$xfiles '$(DESTDIR)$(pythondir)/$$dir'"; \ $(INSTALL_DATA) $$xfiles "$(DESTDIR)$(pythondir)/$$dir" || exit $$?; }; \ @@ -380,9 +412,7 @@ @$(NORMAL_UNINSTALL) @list='$(nobase_python_DATA)'; test -n "$(pythondir)" || list=; \ $(am__nobase_strip_setup); files=`$(am__nobase_strip)`; \ - test -n "$$files" || exit 0; \ - echo " ( cd '$(DESTDIR)$(pythondir)' && rm -f" $$files ")"; \ - cd "$(DESTDIR)$(pythondir)" && rm -f $$files + dir='$(DESTDIR)$(pythondir)'; $(am__uninstall_files_from_dir) tags: TAGS TAGS: @@ -406,10 +436,15 @@ installcheck: installcheck-am install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi mostlyclean-generic: clean-generic: @@ -512,7 +547,7 @@ install-data-local: gdb.py @$(mkdir_p) $(DESTDIR)$(toolexeclibdir) @here=`pwd`; cd $(DESTDIR)$(toolexeclibdir); \ - for file in libstdc++*; do \ + for file in libstdc++.*; do \ case $$file in \ *-gdb.py) ;; \ *.la) ;; \ Index: libstdc++-v3/python/libstdcxx/v6/printers.py =================================================================== --- a/src/libstdc++-v3/python/libstdcxx/v6/printers.py (.../tags/gcc_5_2_0_release) +++ b/src/libstdc++-v3/python/libstdcxx/v6/printers.py (.../branches/gcc-5-branch) @@ -980,6 +980,57 @@ def display_hint (self): return 'string' +class StdExpPathPrinter: + "Print a std::experimental::filesystem::path" + + def __init__ (self, typename, val): + self.val = val + start = self.val['_M_cmpts']['_M_impl']['_M_start'] + finish = self.val['_M_cmpts']['_M_impl']['_M_finish'] + self.num_cmpts = int (finish - start) + + def _path_type(self): + t = str(self.val['_M_type']) + if t[-9:] == '_Root_dir': + return "root-directory" + if t[-10:] == '_Root_name': + return "root-name" + return None + + def to_string (self): + path = "%s" % self.val ['_M_pathname'] + if self.num_cmpts == 0: + t = self._path_type() + if t: + path = '%s [%s]' % (path, t) + return "filesystem::path %s" % path + + class _iterator(Iterator): + def __init__(self, cmpts): + self.item = cmpts['_M_impl']['_M_start'] + self.finish = cmpts['_M_impl']['_M_finish'] + self.count = 0 + + def __iter__(self): + return self + + def __next__(self): + if self.item == self.finish: + raise StopIteration + item = self.item.dereference() + count = self.count + self.count = self.count + 1 + self.item = self.item + 1 + path = item['_M_pathname'] + t = StdExpPathPrinter(item.type.name, item)._path_type() + if not t: + t = count + return ('[%s]' % t, path) + + def children(self): + return self._iterator(self.val['_M_cmpts']) + + # A "regular expression" printer which conforms to the # "SubPrettyPrinter" protocol from gdb.printing. class RxPrinter(object): @@ -1365,6 +1416,11 @@ 'optional', StdExpOptionalPrinter) libstdcxx_printer.add_version('std::experimental::fundamentals_v1::', 'basic_string_view', StdExpStringViewPrinter) + # Filesystem TS components + libstdcxx_printer.add_version('std::experimental::filesystem::v1::', + 'path', StdExpPathPrinter) + libstdcxx_printer.add_version('std::experimental::filesystem::v1::__cxx11::', + 'path', StdExpPathPrinter) # Extensions. libstdcxx_printer.add_version('__gnu_cxx::', 'slist', StdSlistPrinter) Index: libstdc++-v3/python/Makefile.am =================================================================== --- a/src/libstdc++-v3/python/Makefile.am (.../tags/gcc_5_2_0_release) +++ b/src/libstdc++-v3/python/Makefile.am (.../branches/gcc-5-branch) @@ -49,7 +49,7 @@ ## fragile, but there does not seem to be a better option, because ## libtool hides the real names from us. @here=`pwd`; cd $(DESTDIR)$(toolexeclibdir); \ - for file in libstdc++*; do \ + for file in libstdc++.*; do \ case $$file in \ *-gdb.py) ;; \ *.la) ;; \ Index: libstdc++-v3/Makefile.in =================================================================== --- a/src/libstdc++-v3/Makefile.in (.../tags/gcc_5_2_0_release) +++ b/src/libstdc++-v3/Makefile.in (.../branches/gcc-5-branch) @@ -1,9 +1,9 @@ -# Makefile.in generated by automake 1.11.1 from Makefile.am. +# Makefile.in generated by automake 1.11.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, -# Inc. +# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software +# Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -15,6 +15,23 @@ @SET_MAKE@ VPATH = @srcdir@ +am__make_dryrun = \ + { \ + am__dry=no; \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ + | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ + *) \ + for am__flg in $$MAKEFLAGS; do \ + case $$am__flg in \ + *=*|--*) ;; \ + *n*) am__dry=yes; break;; \ + esac; \ + done;; \ + esac; \ + test $$am__dry = yes; \ + } pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ @@ -88,6 +105,11 @@ install-pdf-recursive install-ps-recursive install-recursive \ installcheck-recursive installdirs-recursive pdf-recursive \ ps-recursive uninstall-recursive +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \ @@ -392,7 +414,7 @@ $(MAKE) $(AM_MAKEFLAGS) all-recursive .SUFFIXES: -am--refresh: +am--refresh: Makefile @: $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/fragment.am $(am__configure_deps) @for dep in $?; do \ @@ -417,6 +439,7 @@ echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ esac; +$(top_srcdir)/fragment.am: $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) $(SHELL) ./config.status --recheck @@ -428,10 +451,8 @@ $(am__aclocal_m4_deps): config.h: stamp-h1 - @if test ! -f $@; then \ - rm -f stamp-h1; \ - $(MAKE) $(AM_MAKEFLAGS) stamp-h1; \ - else :; fi + @if test ! -f $@; then rm -f stamp-h1; else :; fi + @if test ! -f $@; then $(MAKE) $(AM_MAKEFLAGS) stamp-h1; else :; fi stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status @rm -f stamp-h1 @@ -590,10 +611,15 @@ installcheck: installcheck-recursive install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi mostlyclean-generic: clean-generic: Index: libstdc++-v3/scripts/testsuite_flags.in =================================================================== --- a/src/libstdc++-v3/scripts/testsuite_flags.in (.../tags/gcc_5_2_0_release) +++ b/src/libstdc++-v3/scripts/testsuite_flags.in (.../branches/gcc-5-branch) @@ -77,7 +77,8 @@ echo ${PCHFLAGS} ;; --cxxldflags) - SECTIONLDFLAGS="@SECTION_LDFLAGS@ @LIBICONV@" + SECTIONLDFLAGS="@SECTION_LDFLAGS@ @LIBICONV@ + -L${BUILD_DIR}/src/filesystem/.libs" echo ${SECTIONLDFLAGS} ;; *) Index: libstdc++-v3/src/Makefile.in =================================================================== --- a/src/libstdc++-v3/src/Makefile.in (.../tags/gcc_5_2_0_release) +++ b/src/libstdc++-v3/src/Makefile.in (.../branches/gcc-5-branch) @@ -1,9 +1,9 @@ -# Makefile.in generated by automake 1.11.1 from Makefile.am. +# Makefile.in generated by automake 1.11.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, -# Inc. +# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software +# Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -16,6 +16,23 @@ @SET_MAKE@ VPATH = @srcdir@ +am__make_dryrun = \ + { \ + am__dry=no; \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ + | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ + *) \ + for am__flg in $$MAKEFLAGS; do \ + case $$am__flg in \ + *=*|--*) ;; \ + *n*) am__dry=yes; break;; \ + esac; \ + done;; \ + esac; \ + test $$am__dry = yes; \ + } pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ @@ -86,6 +103,12 @@ am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } am__installdirs = "$(DESTDIR)$(toolexeclibdir)" LTLIBRARIES = $(toolexeclib_LTLIBRARIES) am__DEPENDENCIES_1 = @@ -117,6 +140,11 @@ install-pdf-recursive install-ps-recursive install-recursive \ installcheck-recursive installdirs-recursive pdf-recursive \ ps-recursive uninstall-recursive +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \ @@ -123,7 +151,7 @@ $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS ETAGS = etags CTAGS = ctags -DIST_SUBDIRS = $(SUBDIRS) +DIST_SUBDIRS = c++98 c++11 filesystem ABI_TWEAKS_SRCDIR = @ABI_TWEAKS_SRCDIR@ ACLOCAL = @ACLOCAL@ ALLOCATOR_H = @ALLOCATOR_H@ @@ -346,7 +374,9 @@ # -I/-D flags to pass when compiling. AM_CPPFLAGS = $(GLIBCXX_INCLUDES) -SUBDIRS = c++98 c++11 +@ENABLE_FILESYSTEM_TS_FALSE@filesystem_dir = +@ENABLE_FILESYSTEM_TS_TRUE@filesystem_dir = filesystem +SUBDIRS = c++98 c++11 $(filesystem_dir) @VTV_CYGMIN_FALSE@toolexeclib_LTLIBRARIES = libstdc++.la # Cross compiler support. @@ -529,6 +559,7 @@ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; +$(top_srcdir)/fragment.am: $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh @@ -540,7 +571,6 @@ $(am__aclocal_m4_deps): install-toolexeclibLTLIBRARIES: $(toolexeclib_LTLIBRARIES) @$(NORMAL_INSTALL) - test -z "$(toolexeclibdir)" || $(MKDIR_P) "$(DESTDIR)$(toolexeclibdir)" @list='$(toolexeclib_LTLIBRARIES)'; test -n "$(toolexeclibdir)" || list=; \ list2=; for p in $$list; do \ if test -f $$p; then \ @@ -548,6 +578,8 @@ else :; fi; \ done; \ test -z "$$list2" || { \ + echo " $(MKDIR_P) '$(DESTDIR)$(toolexeclibdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(toolexeclibdir)" || exit 1; \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(toolexeclibdir)'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(toolexeclibdir)"; \ } @@ -569,9 +601,9 @@ echo "rm -f \"$${dir}/so_locations\""; \ rm -f "$${dir}/so_locations"; \ done -libstdc++.la: $(libstdc___la_OBJECTS) $(libstdc___la_DEPENDENCIES) +libstdc++.la: $(libstdc___la_OBJECTS) $(libstdc___la_DEPENDENCIES) $(EXTRA_libstdc___la_DEPENDENCIES) $(libstdc___la_LINK) $(am_libstdc___la_rpath) $(libstdc___la_OBJECTS) $(libstdc___la_LIBADD) $(LIBS) -libvtv.la: $(libvtv_la_OBJECTS) $(libvtv_la_DEPENDENCIES) +libvtv.la: $(libvtv_la_OBJECTS) $(libvtv_la_DEPENDENCIES) $(EXTRA_libvtv_la_DEPENDENCIES) $(libvtv_la_LINK) $(am_libvtv_la_rpath) $(libvtv_la_OBJECTS) $(libvtv_la_LIBADD) $(LIBS) mostlyclean-compile: @@ -747,10 +779,15 @@ installcheck: installcheck-recursive install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi mostlyclean-generic: clean-generic: @@ -859,6 +896,7 @@ vpath % $(top_srcdir)/src/c++98 vpath % $(top_srcdir)/src/c++11 +@ENABLE_FILESYSTEM_TS_TRUE@vpath % $(top_srcdir)/src/filesystem # Use special rules for compatibility-ldbl.cc compilation, as we need to # pass -mlong-double-64. Index: libstdc++-v3/src/filesystem/path.cc =================================================================== --- a/src/libstdc++-v3/src/filesystem/path.cc (.../tags/gcc_5_2_0_release) +++ b/src/libstdc++-v3/src/filesystem/path.cc (.../branches/gcc-5-branch) @@ -0,0 +1,471 @@ +// Class filesystem::path -*- C++ -*- + +// Copyright (C) 2014-2015 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +#include + +using std::experimental::filesystem::path; + +std::experimental::filesystem::filesystem_error::~filesystem_error() = default; + +constexpr path::value_type path::preferred_separator; + +path& +path::remove_filename() +{ + if (_M_type == _Type::_Multi) + { + if (!_M_cmpts.empty()) + { + auto cmpt = std::prev(_M_cmpts.end()); + _M_pathname.erase(cmpt->_M_pos); + _M_cmpts.erase(cmpt); + _M_trim(); + } + } + else + clear(); + return *this; +} + +path& +path::replace_filename(const path& replacement) +{ + remove_filename(); + operator/=(replacement); + return *this; +} + +path& +path::replace_extension(const path& replacement) +{ + auto ext = _M_find_extension(); + if (ext.first && ext.second != string_type::npos) + { + if (ext.first == &_M_pathname) + _M_pathname.erase(ext.second); + else + { + const auto& back = _M_cmpts.back(); + if (ext.first != &back._M_pathname) + _GLIBCXX_THROW_OR_ABORT( + std::logic_error("path::replace_extension failed")); + _M_pathname.erase(back._M_pos + ext.second); + } + } + if (!replacement.empty() && replacement.native()[0] != '.') + _M_pathname += '.'; + _M_pathname += replacement.native(); + _M_split_cmpts(); + return *this; +} + +namespace +{ + template + int do_compare(Iter1 begin1, Iter1 end1, Iter2 begin2, Iter2 end2) + { + int cmpt = 1; + while (begin1 != end1 && begin2 != end2) + { + if (begin1->native() < begin2->native()) + return -cmpt; + if (begin1->native() > begin2->native()) + return +cmpt; + ++begin1; + ++begin2; + ++cmpt; + } + if (begin1 == end1) + { + if (begin2 == end2) + return 0; + return -cmpt; + } + return +cmpt; + } +} + +int +path::compare(const path& p) const noexcept +{ + struct CmptRef + { + const path* ptr; + const string_type& native() const noexcept { return ptr->native(); } + }; + + if (_M_type == _Type::_Multi && p._M_type == _Type::_Multi) + return do_compare(_M_cmpts.begin(), _M_cmpts.end(), + p._M_cmpts.begin(), p._M_cmpts.end()); + else if (_M_type == _Type::_Multi) + { + CmptRef c[1] = { { &p } }; + return do_compare(_M_cmpts.begin(), _M_cmpts.end(), c, c+1); + } + else if (p._M_type == _Type::_Multi) + { + CmptRef c[1] = { { this } }; + return do_compare(c, c+1, p._M_cmpts.begin(), p._M_cmpts.end()); + } + else + return _M_pathname.compare(p._M_pathname); +} + +path +path::root_name() const +{ + path __ret; + if (_M_type == _Type::_Root_name) + __ret = *this; + else if (_M_cmpts.size() && _M_cmpts.begin()->_M_type == _Type::_Root_name) + __ret = *_M_cmpts.begin(); + return __ret; +} + +path +path::root_directory() const +{ + path __ret; + if (_M_type == _Type::_Root_dir) + __ret = *this; + else if (!_M_cmpts.empty()) + { + auto __it = _M_cmpts.begin(); + if (__it->_M_type == _Type::_Root_name) + ++__it; + if (__it != _M_cmpts.end() && __it->_M_type == _Type::_Root_dir) + __ret = *__it; + } + return __ret; +} + + +path +path::root_path() const +{ + path __ret; + if (_M_type == _Type::_Root_name || _M_type == _Type::_Root_dir) + __ret = *this; + else if (!_M_cmpts.empty()) + { + auto __it = _M_cmpts.begin(); + if (__it->_M_type == _Type::_Root_name) + { + __ret = *__it++; + if (__it != _M_cmpts.end() && __it->_M_type == _Type::_Root_dir) + { + __ret._M_pathname += preferred_separator; + __ret._M_split_cmpts(); + } + } + else if (__it->_M_type == _Type::_Root_dir) + __ret = *__it; + } + return __ret; +} + +path +path::relative_path() const +{ + path __ret; + if (_M_type == _Type::_Filename) + __ret = *this; + else if (!_M_cmpts.empty()) + { + auto __it = _M_cmpts.begin(); + if (__it->_M_type == _Type::_Root_name) + ++__it; + if (__it != _M_cmpts.end() && __it->_M_type == _Type::_Root_dir) + ++__it; + if (__it != _M_cmpts.end()) + __ret.assign(_M_pathname.substr(__it->_M_pos)); + } + return __ret; +} + +path +path::parent_path() const +{ + path __ret; + if (_M_cmpts.size() < 2) + return __ret; + for (auto __it = _M_cmpts.begin(), __end = std::prev(_M_cmpts.end()); + __it != __end; ++__it) + { + __ret /= *__it; + } + return __ret; +} + +bool +path::has_root_name() const +{ + if (_M_type == _Type::_Root_name) + return true; + if (!_M_cmpts.empty() && _M_cmpts.begin()->_M_type == _Type::_Root_name) + return true; + return false; +} + +bool +path::has_root_directory() const +{ + if (_M_type == _Type::_Root_dir) + return true; + if (!_M_cmpts.empty()) + { + auto __it = _M_cmpts.begin(); + if (__it->_M_type == _Type::_Root_name) + ++__it; + if (__it != _M_cmpts.end() && __it->_M_type == _Type::_Root_dir) + return true; + } + return false; +} + +bool +path::has_root_path() const +{ + if (_M_type == _Type::_Root_name || _M_type == _Type::_Root_dir) + return true; + if (!_M_cmpts.empty()) + { + auto __type = _M_cmpts.front()._M_type; + if (__type == _Type::_Root_name || __type == _Type::_Root_dir) + return true; + } + return false; +} + +bool +path::has_relative_path() const +{ + if (_M_type == _Type::_Filename) + return true; + if (!_M_cmpts.empty()) + { + auto __it = _M_cmpts.begin(); + if (__it->_M_type == _Type::_Root_name) + ++__it; + if (__it != _M_cmpts.end() && __it->_M_type == _Type::_Root_dir) + ++__it; + if (__it != _M_cmpts.end()) + return true; + } + return false; +} + + +bool +path::has_parent_path() const +{ + return _M_cmpts.size() > 1; +} + +bool +path::has_filename() const +{ + return !empty(); +} + +std::pair +path::_M_find_extension() const +{ + const std::string* s = nullptr; + + if (_M_type != _Type::_Multi) + s = &_M_pathname; + else if (!_M_cmpts.empty()) + { + const auto& c = _M_cmpts.back(); + if (c._M_type == _Type::_Filename) + s = &c._M_pathname; + } + + if (s) + { + if (auto sz = s->size()) + { + if (sz <= 2 && (*s)[0] == '.') + { + if (sz == 1 || (*s)[1] == '.') // filename is "." or ".." + return { s, string_type::npos }; + else + return { s, 0 }; // filename is like ".?" + } + return { s, s->rfind('.') }; + } + } + return {}; +} + +void +path::_M_split_cmpts() +{ + _M_type = _Type::_Multi; + _M_cmpts.clear(); + + if (_M_pathname.empty()) + return; + + size_t pos = 0; + const size_t len = _M_pathname.size(); + + // look for root name or root directory + if (_S_is_dir_sep(_M_pathname[0])) + { + // look for root name, such as "//" or "//foo" + if (len > 1 && _M_pathname[1] == _M_pathname[0]) + { + if (len == 2) + { + // entire path is just "//" + _M_type = _Type::_Root_name; + return; + } + + if (!_S_is_dir_sep(_M_pathname[2])) + { + // got root name, find its end + pos = 3; + while (pos < len && !_S_is_dir_sep(_M_pathname[pos])) + ++pos; + _M_add_root_name(pos); + if (pos < len) // also got root directory + _M_add_root_dir(pos); + } + else + { + // got something like "///foo" which is just a root directory + // composed of multiple redundant directory separators + _M_add_root_dir(0); + } + } + else // got root directory + _M_add_root_dir(0); + ++pos; + } +#ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS + else if (len > 1 && _M_pathname[1] == L':') + { + // got disk designator + _M_add_root_name(2); + if (len > 2 && _S_is_dir_sep(_M_pathname[2])) + _M_add_root_dir(2); + pos = 2; + } +#endif + + size_t back = pos; + while (pos < len) + { + if (_S_is_dir_sep(_M_pathname[pos])) + { + if (back != pos) + _M_add_filename(back, pos - back); + back = ++pos; + } + else + ++pos; + } + + if (back != pos) + _M_add_filename(back, pos - back); + else if (_S_is_dir_sep(_M_pathname.back())) + { + // [path.itr]/8 + // "Dot, if one or more trailing non-root slash characters are present." + if (_M_cmpts.back()._M_type == _Type::_Filename) + { + const auto& last = _M_cmpts.back(); + pos = last._M_pos + last._M_pathname.size(); + _M_cmpts.emplace_back(string_type(1, '.'), _Type::_Filename, pos); + } + } + + _M_trim(); +} + +void +path::_M_add_root_name(size_t n) +{ + _M_cmpts.emplace_back(_M_pathname.substr(0, n), _Type::_Root_name, 0); +} + +void +path::_M_add_root_dir(size_t pos) +{ + _M_cmpts.emplace_back(_M_pathname.substr(pos, 1), _Type::_Root_dir, pos); +} + +void +path::_M_add_filename(size_t pos, size_t n) +{ + _M_cmpts.emplace_back(_M_pathname.substr(pos, n), _Type::_Filename, pos); +} + +void +path::_M_trim() +{ + if (_M_cmpts.size() == 1) + { + _M_type = _M_cmpts.front()._M_type; + _M_cmpts.clear(); + } +} + +path::string_type +path::_S_convert_loc(const char* __first, const char* __last, + const std::locale& __loc) +{ + auto& __cvt = std::use_facet>(__loc); + basic_string __ws; + if (!__str_codecvt_in(__first, __last, __ws, __cvt)) + _GLIBCXX_THROW_OR_ABORT(filesystem_error( + "Cannot convert character sequence", + std::make_error_code(errc::illegal_byte_sequence))); +#ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS + return __ws; +#else + return _Cvt::_S_convert(__ws.data(), __ws.data() + __ws.size()); +#endif +} + +std::size_t +std::experimental::filesystem::hash_value(const path& p) noexcept +{ + // [path.non-member] + // "If for two paths, p1 == p2 then hash_value(p1) == hash_value(p2)." + // Equality works as if by traversing the range [begin(), end()), meaning + // e.g. path("a//b") == path("a/b"), so we cannot simply hash _M_pathname + // but need to iterate over individual elements. Use the hash_combine from + // http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n3876.pdf + size_t seed = 0; + for (const auto& x : p) + { + seed ^= std::hash()(x.native()) + 0x9e3779b9 + + (seed<<6) + (seed>>2); + } + return seed; +} Index: libstdc++-v3/src/filesystem/Makefile.in =================================================================== --- a/src/libstdc++-v3/src/filesystem/Makefile.in (.../tags/gcc_5_2_0_release) +++ b/src/libstdc++-v3/src/filesystem/Makefile.in (.../branches/gcc-5-branch) @@ -0,0 +1,696 @@ +# Makefile.in generated by automake 1.11.6 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software +# Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +VPATH = @srcdir@ +am__make_dryrun = \ + { \ + am__dry=no; \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ + | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ + *) \ + for am__flg in $$MAKEFLAGS; do \ + case $$am__flg in \ + *=*|--*) ;; \ + *n*) am__dry=yes; break;; \ + esac; \ + done;; \ + esac; \ + test $$am__dry = yes; \ + } +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +target_triplet = @target@ +DIST_COMMON = $(top_srcdir)/fragment.am $(srcdir)/Makefile.in \ + $(srcdir)/Makefile.am +subdir = src/filesystem +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \ + $(top_srcdir)/../config/enable.m4 \ + $(top_srcdir)/../config/futex.m4 \ + $(top_srcdir)/../config/iconv.m4 \ + $(top_srcdir)/../config/lead-dot.m4 \ + $(top_srcdir)/../config/lib-ld.m4 \ + $(top_srcdir)/../config/lib-link.m4 \ + $(top_srcdir)/../config/lib-prefix.m4 \ + $(top_srcdir)/../config/lthostflags.m4 \ + $(top_srcdir)/../config/multi.m4 \ + $(top_srcdir)/../config/no-executables.m4 \ + $(top_srcdir)/../config/override.m4 \ + $(top_srcdir)/../config/stdint.m4 \ + $(top_srcdir)/../config/unwind_ipinfo.m4 \ + $(top_srcdir)/../libtool.m4 $(top_srcdir)/../ltoptions.m4 \ + $(top_srcdir)/../ltsugar.m4 $(top_srcdir)/../ltversion.m4 \ + $(top_srcdir)/../lt~obsolete.m4 $(top_srcdir)/crossconfig.m4 \ + $(top_srcdir)/linkage.m4 $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/../config/gc++filt.m4 \ + $(top_srcdir)/../config/tls.m4 $(top_srcdir)/../config/gthr.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +am__installdirs = "$(DESTDIR)$(toolexeclibdir)" +LTLIBRARIES = $(toolexeclib_LTLIBRARIES) +libstdc__fs_la_LIBADD = +am__objects_1 = dir.lo ops.lo path.lo +am_libstdc__fs_la_OBJECTS = $(am__objects_1) +libstdc__fs_la_OBJECTS = $(am_libstdc__fs_la_OBJECTS) +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = +am__depfiles_maybe = +CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) +CXXLD = $(CXX) +SOURCES = $(libstdc__fs_la_SOURCES) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +ETAGS = etags +CTAGS = ctags +ABI_TWEAKS_SRCDIR = @ABI_TWEAKS_SRCDIR@ +ACLOCAL = @ACLOCAL@ +ALLOCATOR_H = @ALLOCATOR_H@ +ALLOCATOR_NAME = @ALLOCATOR_NAME@ +AMTAR = @AMTAR@ +AR = @AR@ +AS = @AS@ +ATOMICITY_SRCDIR = @ATOMICITY_SRCDIR@ +ATOMIC_FLAGS = @ATOMIC_FLAGS@ +ATOMIC_WORD_SRCDIR = @ATOMIC_WORD_SRCDIR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BASIC_FILE_CC = @BASIC_FILE_CC@ +BASIC_FILE_H = @BASIC_FILE_H@ +CC = @CC@ +CCODECVT_CC = @CCODECVT_CC@ +CCOLLATE_CC = @CCOLLATE_CC@ +CCTYPE_CC = @CCTYPE_CC@ +CFLAGS = @CFLAGS@ +CLOCALE_CC = @CLOCALE_CC@ +CLOCALE_H = @CLOCALE_H@ +CLOCALE_INTERNAL_H = @CLOCALE_INTERNAL_H@ +CMESSAGES_CC = @CMESSAGES_CC@ +CMESSAGES_H = @CMESSAGES_H@ +CMONEY_CC = @CMONEY_CC@ +CNUMERIC_CC = @CNUMERIC_CC@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CPU_DEFINES_SRCDIR = @CPU_DEFINES_SRCDIR@ +CPU_OPT_BITS_RANDOM = @CPU_OPT_BITS_RANDOM@ +CPU_OPT_EXT_RANDOM = @CPU_OPT_EXT_RANDOM@ +CSTDIO_H = @CSTDIO_H@ +CTIME_CC = @CTIME_CC@ +CTIME_H = @CTIME_H@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXFILT = @CXXFILT@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +C_INCLUDE_DIR = @C_INCLUDE_DIR@ +DBLATEX = @DBLATEX@ +DEBUG_FLAGS = @DEBUG_FLAGS@ +DEFS = @DEFS@ +DOT = @DOT@ +DOXYGEN = @DOXYGEN@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +ERROR_CONSTANTS_SRCDIR = @ERROR_CONSTANTS_SRCDIR@ +EXEEXT = @EXEEXT@ +EXTRA_CXX_FLAGS = @EXTRA_CXX_FLAGS@ +FGREP = @FGREP@ +GLIBCXX_INCLUDES = @GLIBCXX_INCLUDES@ +GLIBCXX_LIBS = @GLIBCXX_LIBS@ +GREP = @GREP@ +HWCAP_FLAGS = @HWCAP_FLAGS@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBICONV = @LIBICONV@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBICONV = @LTLIBICONV@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OPTIMIZE_CXXFLAGS = @OPTIMIZE_CXXFLAGS@ +OPT_LDFLAGS = @OPT_LDFLAGS@ +OS_INC_SRCDIR = @OS_INC_SRCDIR@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PDFLATEX = @PDFLATEX@ +RANLIB = @RANLIB@ +SECTION_FLAGS = @SECTION_FLAGS@ +SECTION_LDFLAGS = @SECTION_LDFLAGS@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +SYMVER_FILE = @SYMVER_FILE@ +TOPLEVEL_INCLUDES = @TOPLEVEL_INCLUDES@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +VTV_CXXFLAGS = @VTV_CXXFLAGS@ +VTV_CXXLINKFLAGS = @VTV_CXXLINKFLAGS@ +VTV_PCH_CXXFLAGS = @VTV_PCH_CXXFLAGS@ +WARN_FLAGS = @WARN_FLAGS@ +WERROR = @WERROR@ +XMLLINT = @XMLLINT@ +XSLTPROC = @XSLTPROC@ +XSL_STYLE_DIR = @XSL_STYLE_DIR@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__leading_dot = @am__leading_dot@ +am__tar = @am__tar@ +am__untar = @am__untar@ +baseline_dir = @baseline_dir@ +baseline_subdir_switch = @baseline_subdir_switch@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +check_msgfmt = @check_msgfmt@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +enable_shared = @enable_shared@ +enable_static = @enable_static@ +exec_prefix = @exec_prefix@ +glibcxx_MOFILES = @glibcxx_MOFILES@ +glibcxx_PCHFLAGS = @glibcxx_PCHFLAGS@ +glibcxx_POFILES = @glibcxx_POFILES@ +glibcxx_builddir = @glibcxx_builddir@ +glibcxx_compiler_pic_flag = @glibcxx_compiler_pic_flag@ +glibcxx_compiler_shared_flag = @glibcxx_compiler_shared_flag@ +glibcxx_cxx98_abi = @glibcxx_cxx98_abi@ +glibcxx_localedir = @glibcxx_localedir@ +glibcxx_lt_pic_flag = @glibcxx_lt_pic_flag@ +glibcxx_prefixdir = @glibcxx_prefixdir@ +glibcxx_srcdir = @glibcxx_srcdir@ +glibcxx_toolexecdir = @glibcxx_toolexecdir@ +glibcxx_toolexeclibdir = @glibcxx_toolexeclibdir@ +gxx_include_dir = @gxx_include_dir@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +libtool_VERSION = @libtool_VERSION@ +localedir = @localedir@ +localstatedir = @localstatedir@ +lt_host_flags = @lt_host_flags@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +multi_basedir = @multi_basedir@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +port_specific_symbol_files = @port_specific_symbol_files@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +python_mod_dir = @python_mod_dir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target = @target@ +target_alias = @target_alias@ +target_cpu = @target_cpu@ +target_os = @target_os@ +target_vendor = @target_vendor@ +thread_header = @thread_header@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +toplevel_builddir = @toplevel_builddir@ +toplevel_srcdir = @toplevel_srcdir@ + +# May be used by various substitution variables. +gcc_version := $(shell cat $(top_srcdir)/../gcc/BASE-VER) +MAINT_CHARSET = latin1 +mkinstalldirs = $(SHELL) $(toplevel_srcdir)/mkinstalldirs +PWD_COMMAND = $${PWDCMD-pwd} +STAMP = echo timestamp > +toolexecdir = $(glibcxx_toolexecdir) +toolexeclibdir = $(glibcxx_toolexeclibdir) +@ENABLE_WERROR_FALSE@WERROR_FLAG = +@ENABLE_WERROR_TRUE@WERROR_FLAG = $(WERROR) +@ENABLE_EXTERN_TEMPLATE_FALSE@XTEMPLATE_FLAGS = +@ENABLE_EXTERN_TEMPLATE_TRUE@XTEMPLATE_FLAGS = -fno-implicit-templates + +# These bits are all figured out from configure. Look in acinclude.m4 +# or configure.ac to see how they are set. See GLIBCXX_EXPORT_FLAGS. +CONFIG_CXXFLAGS = \ + $(SECTION_FLAGS) $(HWCAP_FLAGS) -frandom-seed=$@ + +WARN_CXXFLAGS = \ + $(WARN_FLAGS) $(WERROR_FLAG) -fdiagnostics-show-location=once + + +# -I/-D flags to pass when compiling. +AM_CPPFLAGS = $(GLIBCXX_INCLUDES) +toolexeclib_LTLIBRARIES = libstdc++fs.la +headers = +sources = \ + dir.cc \ + ops.cc \ + path.cc + + +# vpath % $(top_srcdir)/src/filesystem +libstdc__fs_la_SOURCES = $(sources) + +# AM_CXXFLAGS needs to be in each subdirectory so that it can be +# modified in a per-library or per-sub-library way. Need to manually +# set this option because CONFIG_CXXFLAGS has to be after +# OPTIMIZE_CXXFLAGS on the compile line so that -O2 can be overridden +# as the occasion call for it. +AM_CXXFLAGS = \ + $(glibcxx_lt_pic_flag) $(glibcxx_compiler_shared_flag) \ + -std=gnu++14 \ + $(WARN_CXXFLAGS) $(OPTIMIZE_CXXFLAGS) $(CONFIG_CXXFLAGS) + +AM_MAKEFLAGS = \ + "gxx_include_dir=$(gxx_include_dir)" + + +# Libtool notes + +# 1) In general, libtool expects an argument such as `--tag=CXX' when +# using the C++ compiler, because that will enable the settings +# detected when C++ support was being configured. However, when no +# such flag is given in the command line, libtool attempts to figure +# it out by matching the compiler name in each configuration section +# against a prefix of the command line. The problem is that, if the +# compiler name and its initial flags stored in the libtool +# configuration file don't match those in the command line, libtool +# can't decide which configuration to use, and it gives up. The +# correct solution is to add `--tag CXX' to LTCXXCOMPILE and maybe +# CXXLINK, just after $(LIBTOOL), so that libtool doesn't have to +# attempt to infer which configuration to use. +# +# The second tag argument, `--tag disable-shared` means that libtool +# only compiles each source once, for static objects. In actuality, +# glibcxx_lt_pic_flag and glibcxx_compiler_shared_flag are added to +# the libtool command that is used create the object, which is +# suitable for shared libraries. The `--tag disable-shared` must be +# placed after --tag CXX lest things CXX undo the affect of +# disable-shared. + +# 2) Need to explicitly set LTCXXCOMPILE so that EXTRA_CXX_FLAGS is +# last. (That way, things like -O2 passed down from the toplevel can +# be overridden by --enable-debug.) +LTCXXCOMPILE = \ + $(LIBTOOL) --tag CXX --tag disable-shared \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=compile $(CXX) $(TOPLEVEL_INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) $(EXTRA_CXX_FLAGS) + +LTLDFLAGS = $(shell $(SHELL) $(top_srcdir)/../libtool-ldflags $(LDFLAGS)) + +# 3) We'd have a problem when building the shared libstdc++ object if +# the rules automake generates would be used. We cannot allow g++ to +# be used since this would add -lstdc++ to the link line which of +# course is problematic at this point. So, we get the top-level +# directory to configure libstdc++-v3 to use gcc as the C++ +# compilation driver. +CXXLINK = \ + $(LIBTOOL) --tag CXX --tag disable-shared \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=link $(CXX) \ + $(OPT_LDFLAGS) $(SECTION_LDFLAGS) $(AM_CXXFLAGS) $(LTLDFLAGS) -o $@ + + +# By adding these files here, automake will remove them for 'make clean' +CLEANFILES = stamp-* +all: all-am + +.SUFFIXES: +.SUFFIXES: .cc .lo .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/fragment.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign --ignore-deps src/filesystem/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign --ignore-deps src/filesystem/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; +$(top_srcdir)/fragment.am: + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +install-toolexeclibLTLIBRARIES: $(toolexeclib_LTLIBRARIES) + @$(NORMAL_INSTALL) + @list='$(toolexeclib_LTLIBRARIES)'; test -n "$(toolexeclibdir)" || list=; \ + list2=; for p in $$list; do \ + if test -f $$p; then \ + list2="$$list2 $$p"; \ + else :; fi; \ + done; \ + test -z "$$list2" || { \ + echo " $(MKDIR_P) '$(DESTDIR)$(toolexeclibdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(toolexeclibdir)" || exit 1; \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(toolexeclibdir)'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(toolexeclibdir)"; \ + } + +uninstall-toolexeclibLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(toolexeclib_LTLIBRARIES)'; test -n "$(toolexeclibdir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(toolexeclibdir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(toolexeclibdir)/$$f"; \ + done + +clean-toolexeclibLTLIBRARIES: + -test -z "$(toolexeclib_LTLIBRARIES)" || rm -f $(toolexeclib_LTLIBRARIES) + @list='$(toolexeclib_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" != "$$p" || dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +libstdc++fs.la: $(libstdc__fs_la_OBJECTS) $(libstdc__fs_la_DEPENDENCIES) $(EXTRA_libstdc__fs_la_DEPENDENCIES) + $(CXXLINK) -rpath $(toolexeclibdir) $(libstdc__fs_la_OBJECTS) $(libstdc__fs_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +.cc.o: + $(CXXCOMPILE) -c -o $@ $< + +.cc.obj: + $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.cc.lo: + $(LTCXXCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) +installdirs: + for dir in "$(DESTDIR)$(toolexeclibdir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool clean-toolexeclibLTLIBRARIES \ + mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: install-toolexeclibLTLIBRARIES + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-toolexeclibLTLIBRARIES + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libtool clean-toolexeclibLTLIBRARIES ctags distclean \ + distclean-compile distclean-generic distclean-libtool \ + distclean-tags dvi dvi-am html html-am info info-am install \ + install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-strip install-toolexeclibLTLIBRARIES installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags uninstall uninstall-am uninstall-toolexeclibLTLIBRARIES + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: Index: libstdc++-v3/src/filesystem/dir.cc =================================================================== --- a/src/libstdc++-v3/src/filesystem/dir.cc (.../tags/gcc_5_2_0_release) +++ b/src/libstdc++-v3/src/filesystem/dir.cc (.../branches/gcc-5-branch) @@ -0,0 +1,403 @@ +// Class filesystem::directory_entry etc. -*- C++ -*- + +// Copyright (C) 2014-2015 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +#include +#include +#include +#include +#include +#ifdef _GLIBCXX_HAVE_DIRENT_H +# ifdef _GLIBCXX_HAVE_SYS_TYPES_H +# include +# endif +# include +#else +# error "the header is needed to build the Filesystem TS" +#endif + +#ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS +# undef opendir +# define opendir _wopendir +#endif + +namespace fs = std::experimental::filesystem; + +namespace +{ + struct ErrorCode + { + ErrorCode(std::error_code* p) : ec(p) { } + + ErrorCode(ErrorCode&& e) : ec(std::exchange(e.ec, nullptr)) { } + + ~ErrorCode() { if (ec) ec->clear(); } + + void assign(int err) + { + ec->assign(err, std::generic_category()); + ec = nullptr; + } + + explicit operator bool() { return ec != nullptr; } + + std::error_code* ec; + }; +} + +struct fs::_Dir +{ + _Dir() : dirp(nullptr) { } + + _Dir(DIR* dirp, const fs::path& path) : dirp(dirp), path(path) { } + + _Dir(_Dir&& d) + : dirp(std::exchange(d.dirp, nullptr)), path(std::move(d.path)), + entry(std::move(d.entry)), type(d.type) + { } + + _Dir& operator=(_Dir&&) = delete; + + ~_Dir() { if (dirp) ::closedir(dirp); } + + bool advance(ErrorCode); + + DIR* dirp; + fs::path path; + directory_entry entry; + file_type type = file_type::none; +}; + +namespace +{ + template + inline bool is_set(Bitmask obj, Bitmask bits) + { + return (obj & bits) != Bitmask::none; + } + + fs::_Dir + opendir(const fs::path& p, fs::directory_options options, ErrorCode ec) + { + if (DIR* dirp = ::opendir(p.c_str())) + return {dirp, p}; + + const int err = errno; + if (err == EACCES + && is_set(options, fs::directory_options::skip_permission_denied)) + return {}; + + if (!ec) + _GLIBCXX_THROW_OR_ABORT(fs::filesystem_error( + "directory iterator cannot open directory", p, + std::error_code(err, std::generic_category()))); + + ec.assign(err); + return {}; + } + + inline std::shared_ptr + make_shared_dir(fs::_Dir&& dir) + { + if (dir.dirp) + return std::make_shared(std::move(dir)); + return {}; + } + + inline fs::file_type + get_file_type(const dirent& d __attribute__((__unused__))) + { +#ifdef _GLIBCXX_HAVE_STRUCT_DIRENT_D_TYPE + switch (d.d_type) + { + case DT_BLK: + return fs::file_type::block; + case DT_CHR: + return fs::file_type::character; + case DT_DIR: + return fs::file_type::directory; + case DT_FIFO: + return fs::file_type::fifo; + case DT_LNK: + return fs::file_type::symlink; + case DT_REG: + return fs::file_type::regular; + case DT_SOCK: + return fs::file_type::socket; + case DT_UNKNOWN: + return fs::file_type::unknown; + default: + return fs::file_type::none; + } +#else + return fs::file_type::none; +#endif + } + + int + native_readdir(DIR* dirp, ::dirent*& entryp) + { +#ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS + errno = 0; + if ((entryp = ::readdir(dirp))) + return 0; + return errno; +#else + return ::readdir_r(dirp, entryp, &entryp); +#endif + } +} + +bool +fs::_Dir::advance(ErrorCode ec) +{ + ::dirent ent; + ::dirent* result = &ent; + if (int err = native_readdir(dirp, result)) + { + if (!ec) + _GLIBCXX_THROW_OR_ABORT(filesystem_error( + "directory iterator cannot advance", + std::error_code(err, std::generic_category()))); + ec.assign(err); + return true; + } + else if (result != nullptr) + { + // skip past dot and dot-dot + if (!strcmp(ent.d_name, ".") || !strcmp(ent.d_name, "..")) + return advance(std::move(ec)); + entry = fs::directory_entry{path / ent.d_name}; + type = get_file_type(ent); + return true; + } + else + { + // reached the end + entry = {}; + type = fs::file_type::none; + return false; + } +} + +fs::directory_iterator:: +directory_iterator(const path& p, directory_options options, error_code* ec) +: directory_iterator(make_shared_dir(opendir(p, options, ec)), ec) +{ } + +fs::directory_iterator:: +directory_iterator(std::shared_ptr<_Dir> dir, error_code* ec) +: _M_dir(std::move(dir)) +{ + if (_M_dir && !_M_dir->advance(ec)) + _M_dir.reset(); +} + +const fs::directory_entry& +fs::directory_iterator::operator*() const +{ + if (!_M_dir) + _GLIBCXX_THROW_OR_ABORT(filesystem_error( + "non-dereferenceable directory iterator", + std::make_error_code(errc::invalid_argument))); + return _M_dir->entry; +} + +fs::directory_iterator& +fs::directory_iterator::operator++() +{ + if (!_M_dir) + _GLIBCXX_THROW_OR_ABORT(filesystem_error( + "cannot advance non-dereferenceable directory iterator", + std::make_error_code(errc::invalid_argument))); + if (!_M_dir->advance(nullptr)) + _M_dir.reset(); + return *this; +} + +fs::directory_iterator& +fs::directory_iterator::increment(error_code& ec) noexcept +{ + if (!_M_dir) + { + ec = std::make_error_code(errc::invalid_argument); + return *this; + } + if (!_M_dir->advance(&ec)) + _M_dir.reset(); + return *this; +} + +using Dir_iter_pair = std::pair; + +struct fs::recursive_directory_iterator::_Dir_stack : std::stack<_Dir> +{ + void clear() { c.clear(); } +}; + +fs::recursive_directory_iterator:: +recursive_directory_iterator(const path& p, directory_options options, + error_code* ec) +: _M_options(options), _M_pending(true) +{ + if (DIR* dirp = ::opendir(p.c_str())) + { + _M_dirs = std::make_shared<_Dir_stack>(); + _M_dirs->push(_Dir{ dirp, p }); + if (!_M_dirs->top().advance(ec)) + _M_dirs.reset(); + } + else + { + const int err = errno; + if (err == EACCES + && is_set(options, fs::directory_options::skip_permission_denied)) + return; + + if (!ec) + _GLIBCXX_THROW_OR_ABORT(filesystem_error( + "recursive directory iterator cannot open directory", p, + std::error_code(err, std::generic_category()))); + + ec->assign(err, std::generic_category()); + } +} + +fs::recursive_directory_iterator::~recursive_directory_iterator() = default; + +int +fs::recursive_directory_iterator::depth() const +{ + return int(_M_dirs->size()) - 1; +} + +const fs::directory_entry& +fs::recursive_directory_iterator::operator*() const +{ + return _M_dirs->top().entry; +} + +fs::recursive_directory_iterator& +fs::recursive_directory_iterator:: +operator=(const recursive_directory_iterator& other) noexcept = default; + +fs::recursive_directory_iterator& +fs::recursive_directory_iterator:: +operator=(recursive_directory_iterator&& other) noexcept = default; + +fs::recursive_directory_iterator& +fs::recursive_directory_iterator::operator++() +{ + error_code ec; + increment(ec); + if (ec.value()) + _GLIBCXX_THROW_OR_ABORT(filesystem_error( + "cannot increment recursive directory iterator", ec)); + return *this; +} + +namespace +{ + bool + recurse(const fs::_Dir& d, fs::directory_options options, std::error_code& ec) + { + bool follow_symlink + = is_set(options, fs::directory_options::follow_directory_symlink); +#ifdef _GLIBCXX_HAVE_STRUCT_DIRENT_D_TYPE + if (d.type == fs::file_type::directory) + return true; + if (d.type == fs::file_type::symlink && follow_symlink) + return d.entry.status().type() == fs::file_type::directory; + if (d.type != fs::file_type::none && d.type != fs::file_type::unknown) + return false; +#endif + const fs::path& path = d.entry.path(); + auto type = fs::symlink_status(path, ec).type(); + if (ec.value()) + return false; + if (type == fs::file_type::symlink) + { + if (!follow_symlink) + return false; + type = fs::status(path, ec).type(); + } + return type == fs::file_type::directory; + } +} + +fs::recursive_directory_iterator& +fs::recursive_directory_iterator::increment(error_code& ec) noexcept +{ + if (!_M_dirs) + { + ec = std::make_error_code(errc::invalid_argument); + return *this; + } + + auto& top = _M_dirs->top(); + + if (std::exchange(_M_pending, true) && recurse(top, _M_options, ec)) + { + _Dir dir = opendir(top.entry.path(), _M_options, &ec); + if (ec.value()) + return *this; + if (dir.dirp) + { + _M_dirs->push(std::move(dir)); + if (!_M_dirs->top().advance(&ec)) // dir is empty + pop(); + return *this; + } + // else skip permission denied and continue in parent dir + } + + ec.clear(); + while (!_M_dirs->top().advance(&ec) && !ec.value()) + { + _M_dirs->pop(); + if (_M_dirs->empty()) + { + _M_dirs.reset(); + return *this; + } + } + return *this; +} + +void +fs::recursive_directory_iterator::pop() +{ + if (!_M_dirs) + _GLIBCXX_THROW_OR_ABORT(filesystem_error( + "cannot pop non-dereferenceable recursive directory iterator", + std::make_error_code(errc::invalid_argument))); + + do { + _M_dirs->pop(); + if (_M_dirs->empty()) + { + _M_dirs.reset(); + return; + } + } while (!_M_dirs->top().advance(nullptr)); +} Index: libstdc++-v3/src/filesystem/ops.cc =================================================================== --- a/src/libstdc++-v3/src/filesystem/ops.cc (.../tags/gcc_5_2_0_release) +++ b/src/libstdc++-v3/src/filesystem/ops.cc (.../branches/gcc-5-branch) @@ -0,0 +1,1233 @@ +// Filesystem operations -*- C++ -*- + +// Copyright (C) 2014-2015 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +#include +#include +#include +#include +#include +#include +#ifdef _GLIBCXX_HAVE_UNISTD_H +# include +# if defined(_GLIBCXX_HAVE_SYS_STAT_H) && defined(_GLIBCXX_HAVE_SYS_TYPES_H) +# include +# include +# endif +#endif +#ifdef _GLIBCXX_HAVE_FCNTL_H +# include +#endif +#ifdef _GLIBCXX_HAVE_SYS_STATVFS_H +# include +#endif +#ifdef _GLIBCXX_USE_SENDFILE +# include +#else +# include +# include +#endif +#if _GLIBCXX_HAVE_UTIME_H +# include +#endif + +#ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS +# undef utime +# define utime _wutime +# undef chmod +# define chmod _wchmod +#endif + +namespace fs = std::experimental::filesystem; + +fs::path +fs::absolute(const path& p, const path& base) +{ + const bool has_root_dir = p.has_root_directory(); + const bool has_root_name = p.has_root_name(); + path abs; + if (has_root_dir && has_root_name) + abs = p; + else + { + abs = base.is_absolute() ? base : absolute(base); + if (has_root_dir) + abs = abs.root_name() / p; + else if (has_root_name) + abs = p.root_name() / abs.root_directory() / abs.relative_path() + / p.relative_path(); + else + abs = abs / p; + } + return abs; +} + +namespace +{ + struct free_as_in_malloc + { + void operator()(void* p) const { ::free(p); } + }; + + using char_ptr = std::unique_ptr; +} + +fs::path +fs::canonical(const path& p, const path& base, error_code& ec) +{ + path can; +#ifdef _GLIBCXX_USE_REALPATH + if (char_ptr rp = char_ptr{::realpath(absolute(p, base).c_str(), nullptr)}) + { + can.assign(rp.get()); + ec.clear(); + } + else + ec.assign(errno, std::generic_category()); +#else + ec = std::make_error_code(std::errc::not_supported); +#endif + return can; +} + +fs::path +fs::canonical(const path& p, error_code& ec) +{ + path cur = current_path(ec); + if (ec.value()) + return {}; + return canonical(p, cur, ec); +} + +fs::path +fs::canonical(const path& p, const path& base) +{ + error_code ec; + path can = canonical(p, base, ec); + if (ec.value()) + _GLIBCXX_THROW_OR_ABORT(filesystem_error("cannot canonicalize", p, ec)); + return can; +} + +void +fs::copy(const path& from, const path& to, copy_options options) +{ + error_code ec; + copy(from, to, options, ec); + if (ec.value()) + _GLIBCXX_THROW_OR_ABORT(filesystem_error("cannot copy", from, to, ec)); +} + +namespace +{ + template + inline bool is_set(Bitmask obj, Bitmask bits) + { + return (obj & bits) != Bitmask::none; + } +} + +#ifdef _GLIBCXX_HAVE_SYS_STAT_H +namespace +{ + typedef struct ::stat stat_type; + + inline fs::file_type + make_file_type(const stat_type& st) + { + using fs::file_type; +#ifdef _GLIBCXX_HAVE_S_ISREG + if (S_ISREG(st.st_mode)) + return file_type::regular; + else if (S_ISDIR(st.st_mode)) + return file_type::directory; + else if (S_ISCHR(st.st_mode)) + return file_type::character; + else if (S_ISBLK(st.st_mode)) + return file_type::block; + else if (S_ISFIFO(st.st_mode)) + return file_type::fifo; + else if (S_ISLNK(st.st_mode)) + return file_type::symlink; + else if (S_ISSOCK(st.st_mode)) + return file_type::socket; +#endif + return file_type::unknown; + + } + + inline fs::file_status + make_file_status(const stat_type& st) + { + return fs::file_status{ + make_file_type(st), + static_cast(st.st_mode) & fs::perms::mask + }; + } + + inline bool + is_not_found_errno(int err) + { + return err == ENOENT || err == ENOTDIR; + } + + inline fs::file_time_type + file_time(const stat_type& st) + { + using namespace std::chrono; + return fs::file_time_type{ +#ifdef _GLIBCXX_USE_ST_MTIM + seconds{st.st_mtim.tv_sec} + nanoseconds{st.st_mtim.tv_nsec} +#else + seconds{st.st_mtime} +#endif + }; + } + + bool + do_copy_file(const fs::path& from, const fs::path& to, + fs::copy_options option, + stat_type* from_st, stat_type* to_st, + std::error_code& ec) noexcept + { + stat_type st1, st2; + fs::file_status t, f; + + if (to_st == nullptr) + { + if (::stat(to.c_str(), &st1)) + { + int err = errno; + if (!is_not_found_errno(err)) + { + ec.assign(err, std::generic_category()); + return false; + } + } + else + to_st = &st1; + } + else if (to_st == from_st) + to_st = nullptr; + + if (to_st == nullptr) + t = fs::file_status{fs::file_type::not_found}; + else + t = make_file_status(*to_st); + + if (from_st == nullptr) + { + if (::stat(from.c_str(), &st2)) + { + ec.assign(errno, std::generic_category()); + return false; + } + else + from_st = &st2; + } + f = make_file_status(*from_st); + + using opts = fs::copy_options; + + if (exists(t)) + { + if (!is_other(t) && !is_other(f) + && to_st->st_dev == from_st->st_dev + && to_st->st_ino == from_st->st_ino) + { + ec = std::make_error_code(std::errc::file_exists); + return false; + } + + if (is_set(option, opts::skip_existing)) + { + ec.clear(); + return false; + } + else if (is_set(option, opts::update_existing)) + { + if (file_time(*from_st) <= file_time(*to_st)) + { + ec.clear(); + return false; + } + } + else if (!is_set(option, opts::overwrite_existing)) + { + ec = std::make_error_code(std::errc::file_exists); + return false; + } + } + + struct CloseFD { + ~CloseFD() { if (fd != -1) ::close(fd); } + int fd; + }; + + CloseFD in = { ::open(from.c_str(), O_RDONLY) }; + if (in.fd == -1) + { + ec.assign(errno, std::generic_category()); + return false; + } + int oflag = O_WRONLY|O_CREAT; + if (is_set(option, opts::overwrite_existing|opts::update_existing)) + oflag |= O_TRUNC; + else + oflag |= O_EXCL; + CloseFD out = { ::open(to.c_str(), oflag, S_IWUSR) }; + if (out.fd == -1) + { + if (errno == EEXIST && is_set(option, opts::skip_existing)) + ec.clear(); + else + ec.assign(errno, std::generic_category()); + return false; + } + +#ifdef _GLIBCXX_USE_SENDFILE + auto n = ::sendfile(out.fd, in.fd, nullptr, from_st->st_size); + if (n != from_st->st_size) + { + ec.assign(errno, std::generic_category()); + return false; + } +#else + __gnu_cxx::stdio_filebuf sbin(in.fd, std::ios::in); + __gnu_cxx::stdio_filebuf sbout(out.fd, std::ios::out); + if ( !(std::ostream(&sbout) << &sbin) ) + { + ec = std::make_error_code(std::errc::io_error); + return false; + } +#endif + +#ifdef _GLIBCXX_USE_FCHMOD + if (::fchmod(out.fd, from_st->st_mode)) +#elif _GLIBCXX_USE_FCHMODAT + if (::fchmodat(AT_FDCWD, to.c_str(), from_st->st_mode, 0)) +#else + if (::chmod(to.c_str(), from_st->st_mode)) +#endif + { + ec.assign(errno, std::generic_category()); + return false; + } + ec.clear(); + return true; + } +} +#endif + +void +fs::copy(const path& from, const path& to, copy_options options, + error_code& ec) noexcept +{ + bool skip_symlinks = is_set(options, copy_options::skip_symlinks); + bool create_symlinks = is_set(options, copy_options::create_symlinks); + bool use_lstat = create_symlinks || skip_symlinks; + + file_status f, t; + stat_type from_st, to_st; + if (use_lstat + ? ::lstat(from.c_str(), &from_st) + : ::stat(from.c_str(), &from_st)) + { + ec.assign(errno, std::generic_category()); + return; + } + if (use_lstat + ? ::lstat(to.c_str(), &to_st) + : ::stat(to.c_str(), &to_st)) + { + if (!is_not_found_errno(errno)) + { + ec.assign(errno, std::generic_category()); + return; + } + t = file_status{file_type::not_found}; + } + else + t = make_file_status(to_st); + f = make_file_status(from_st); + + if (exists(t) && !is_other(t) && !is_other(f) + && to_st.st_dev == from_st.st_dev && to_st.st_ino == from_st.st_ino) + { + ec = std::make_error_code(std::errc::file_exists); + return; + } + if (is_other(f) || is_other(t)) + { + ec = std::make_error_code(std::errc::not_supported); + return; + } + if (is_directory(f) && is_regular_file(t)) + { + ec = std::make_error_code(std::errc::is_a_directory); + return; + } + + if (is_symlink(f)) + { + if (skip_symlinks) + ec.clear(); + else if (!exists(t) && is_set(options, copy_options::copy_symlinks)) + copy_symlink(from, to, ec); + else + // Not clear what should be done here. + // "Otherwise report an error as specified in Error reporting (7)." + ec = std::make_error_code(std::errc::invalid_argument); + } + else if (is_regular_file(f)) + { + if (is_set(options, copy_options::directories_only)) + ec.clear(); + else if (create_symlinks) + create_symlink(from, to, ec); + else if (is_set(options, copy_options::create_hard_links)) + create_hard_link(from, to, ec); + else if (is_directory(t)) + do_copy_file(from, to / from.filename(), options, &from_st, 0, ec); + else + { + auto ptr = exists(t) ? &to_st : &from_st; + do_copy_file(from, to, options, &from_st, ptr, ec); + } + } + else if (is_directory(f) && (is_set(options, copy_options::recursive) + || options == copy_options::none)) + { + if (!exists(t)) + if (!create_directory(to, from, ec)) + return; + // set an unused bit in options to disable further recursion + if (!is_set(options, copy_options::recursive)) + options |= static_cast(4096); + for (const directory_entry& x : directory_iterator(from)) + copy(x.path(), to/x.path().filename(), options, ec); + } + // "Otherwise no effects." (should ec.clear() be called?) +} + +bool +fs::copy_file(const path& from, const path& to, copy_options option) +{ + error_code ec; + bool result = copy_file(from, to, option, ec); + if (ec.value()) + _GLIBCXX_THROW_OR_ABORT(filesystem_error("cannot copy file", from, to, + ec)); + return result; +} + +bool +fs::copy_file(const path& from, const path& to, copy_options option, + error_code& ec) noexcept +{ +#ifdef _GLIBCXX_HAVE_SYS_STAT_H + return do_copy_file(from, to, option, nullptr, nullptr, ec); +#else + ec = std::make_error_code(std::errc::not_supported); + return false; +#endif +} + + +void +fs::copy_symlink(const path& existing_symlink, const path& new_symlink) +{ + error_code ec; + copy_symlink(existing_symlink, new_symlink, ec); + if (ec.value()) + _GLIBCXX_THROW_OR_ABORT(filesystem_error("cannot copy symlink", + existing_symlink, new_symlink, ec)); +} + +void +fs::copy_symlink(const path& existing_symlink, const path& new_symlink, + error_code& ec) noexcept +{ + auto p = read_symlink(existing_symlink, ec); + if (ec.value()) + return; +#ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS + if (is_directory(p)) + { + create_directory_symlink(p, new_symlink, ec); + return; + } +#endif + create_symlink(p, new_symlink, ec); +} + + +bool +fs::create_directories(const path& p) +{ + error_code ec; + bool result = create_directories(p, ec); + if (ec.value()) + _GLIBCXX_THROW_OR_ABORT(filesystem_error("cannot create directories", p, + ec)); + return result; +} + +bool +fs::create_directories(const path& p, error_code& ec) noexcept +{ + std::stack missing; + path pp = p; + ec.clear(); + while (!p.empty() && !exists(pp, ec) && !ec.value()) + { + missing.push(pp); + pp = pp.parent_path(); + } + while (!missing.empty() && !ec.value()) + { + create_directory(missing.top(), ec); + missing.pop(); + } + return missing.empty(); +} + +namespace +{ + bool + create_dir(const fs::path& p, fs::perms perm, std::error_code& ec) + { +#ifdef _GLIBCXX_HAVE_SYS_STAT_H + ::mode_t mode = static_cast>(perm); + if (::mkdir(p.c_str(), mode)) + { + ec.assign(errno, std::generic_category()); + return false; + } + else + { + ec.clear(); + return true; + } +#else + ec = std::make_error_code(std::errc::not_supported); + return false; +#endif + } +} // namespace + +bool +fs::create_directory(const path& p) +{ + error_code ec; + bool result = create_directory(p, ec); + if (ec.value()) + _GLIBCXX_THROW_OR_ABORT(filesystem_error("cannot create directory", p, + ec)); + return result; +} + +bool +fs::create_directory(const path& p, error_code& ec) noexcept +{ + return create_dir(p, perms::all, ec); +} + + +bool +fs::create_directory(const path& p, const path& attributes) +{ + error_code ec; + bool result = create_directory(p, attributes, ec); + if (ec.value()) + _GLIBCXX_THROW_OR_ABORT(filesystem_error("cannot create directory", p, + ec)); + return result; +} + +bool +fs::create_directory(const path& p, const path& attributes, + error_code& ec) noexcept +{ +#ifdef _GLIBCXX_HAVE_SYS_STAT_H + stat_type st; + if (::stat(attributes.c_str(), &st)) + { + ec.assign(errno, std::generic_category()); + return false; + } + return create_dir(p, static_cast(st.st_mode), ec); +#else + ec = std::make_error_code(std::errc::not_supported); + return false; +#endif +} + + +void +fs::create_directory_symlink(const path& to, const path& new_symlink) +{ + error_code ec; + create_directory_symlink(to, new_symlink, ec); + if (ec.value()) + _GLIBCXX_THROW_OR_ABORT(filesystem_error("cannot create directory symlink", + to, new_symlink, ec)); +} + +void +fs::create_directory_symlink(const path& to, const path& new_symlink, + error_code& ec) noexcept +{ +#ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS + ec = std::make_error_code(std::errc::not_supported); +#else + create_symlink(to, new_symlink, ec); +#endif +} + + +void +fs::create_hard_link(const path& to, const path& new_hard_link) +{ + error_code ec; + create_hard_link(to, new_hard_link, ec); + if (ec.value()) + _GLIBCXX_THROW_OR_ABORT(filesystem_error("cannot create hard link", + to, new_hard_link, ec)); +} + +void +fs::create_hard_link(const path& to, const path& new_hard_link, + error_code& ec) noexcept +{ +#ifdef _GLIBCXX_HAVE_UNISTD_H + if (::link(to.c_str(), new_hard_link.c_str())) + ec.assign(errno, std::generic_category()); + else + ec.clear(); +#else + ec = std::make_error_code(std::errc::not_supported); +#endif +} + +void +fs::create_symlink(const path& to, const path& new_symlink) +{ + error_code ec; + create_symlink(to, new_symlink, ec); + if (ec.value()) + _GLIBCXX_THROW_OR_ABORT(filesystem_error("cannot create symlink", + to, new_symlink, ec)); +} + +void +fs::create_symlink(const path& to, const path& new_symlink, + error_code& ec) noexcept +{ +#ifdef _GLIBCXX_HAVE_UNISTD_H + if (::symlink(to.c_str(), new_symlink.c_str())) + ec.assign(errno, std::generic_category()); + else + ec.clear(); +#else + ec = std::make_error_code(std::errc::not_supported); +#endif +} + + +fs::path +fs::current_path() +{ + error_code ec; + path p = current_path(ec); + if (ec.value()) + _GLIBCXX_THROW_OR_ABORT(filesystem_error("cannot get current path", ec)); + return p; +} + +fs::path +fs::current_path(error_code& ec) +{ + path p; +#ifdef _GLIBCXX_HAVE_UNISTD_H +#ifdef __GLIBC__ + if (char_ptr cwd = char_ptr{::getcwd(nullptr, 0)}) + { + p.assign(cwd.get()); + ec.clear(); + } + else + ec.assign(errno, std::generic_category()); +#else + long path_max = pathconf(".", _PC_PATH_MAX); + size_t size; + if (path_max == -1) + size = 1024; + else if (path_max > 10240) + size = 10240; + else + size = path_max; + for (char_ptr buf; p.empty(); size *= 2) + { + buf.reset((char*)malloc(size)); + if (buf) + { + if (getcwd(buf.get(), size)) + { + p.assign(buf.get()); + ec.clear(); + } + else if (errno != ERANGE) + { + ec.assign(errno, std::generic_category()); + return {}; + } + } + else + { + ec = std::make_error_code(std::errc::not_enough_memory); + return {}; + } + } +#endif // __GLIBC__ +#else // _GLIBCXX_HAVE_UNISTD_H + ec = std::make_error_code(std::errc::not_supported); +#endif + return p; +} + +void +fs::current_path(const path& p) +{ + error_code ec; + current_path(p, ec); + if (ec.value()) + _GLIBCXX_THROW_OR_ABORT(filesystem_error("cannot set current path", ec)); +} + +void +fs::current_path(const path& p, error_code& ec) noexcept +{ +#ifdef _GLIBCXX_HAVE_UNISTD_H + if (::chdir(p.c_str())) + ec.assign(errno, std::generic_category()); + else + ec.clear(); +#else + ec = std::make_error_code(std::errc::not_supported); +#endif +} + +bool +fs::equivalent(const path& p1, const path& p2) +{ + error_code ec; + auto result = equivalent(p1, p2, ec); + if (ec.value()) + _GLIBCXX_THROW_OR_ABORT(filesystem_error("cannot check file equivalence", + p1, p2, ec)); + return result; +} + +bool +fs::equivalent(const path& p1, const path& p2, error_code& ec) noexcept +{ +#ifdef _GLIBCXX_HAVE_SYS_STAT_H + stat_type st1, st2; + if (::stat(p1.c_str(), &st1) == 0 && ::stat(p2.c_str(), &st2) == 0) + { + file_status s1 = make_file_status(st1); + file_status s2 = make_file_status(st2); + if (is_other(s1) && is_other(s2)) + { + ec = std::make_error_code(std::errc::not_supported); + return false; + } + ec.clear(); + return st1.st_dev == st2.st_dev && st1.st_ino == st2.st_ino; + } + else if (is_not_found_errno(errno)) + { + ec = std::make_error_code(std::errc::no_such_file_or_directory); + return false; + } + ec.assign(errno, std::generic_category()); +#else + ec = std::make_error_code(std::errc::not_supported); +#endif + return false; +} + +std::uintmax_t +fs::file_size(const path& p) +{ + error_code ec; + auto sz = file_size(p, ec); + if (ec.value()) + _GLIBCXX_THROW_OR_ABORT(filesystem_error("cannot get file size", p, ec)); + return sz; +} + +namespace +{ + template + inline T + do_stat(const fs::path& p, std::error_code& ec, Accessor f, T deflt) + { +#ifdef _GLIBCXX_HAVE_SYS_STAT_H + stat_type st; + if (::stat(p.c_str(), &st)) + { + ec.assign(errno, std::generic_category()); + return deflt; + } + ec.clear(); + return f(st); +#else + ec = std::make_error_code(std::errc::not_supported); + return deflt; +#endif + } +} + +std::uintmax_t +fs::file_size(const path& p, error_code& ec) noexcept +{ + struct S + { + S(const stat_type& st) : type(make_file_type(st)), size(st.st_size) { } + S() : type(file_type::not_found) { } + file_type type; + size_t size; + }; + auto s = do_stat(p, ec, [](const auto& st) { return S{st}; }, S{}); + if (s.type == file_type::regular) + return s.size; + if (!ec) + { + if (s.type == file_type::directory) + ec = std::make_error_code(std::errc::is_a_directory); + else + ec = std::make_error_code(std::errc::not_supported); + } + return -1; +} + +std::uintmax_t +fs::hard_link_count(const path& p) +{ + error_code ec; + auto count = hard_link_count(p, ec); + if (ec.value()) + _GLIBCXX_THROW_OR_ABORT(filesystem_error("cannot get link count", p, ec)); + return count; +} + +std::uintmax_t +fs::hard_link_count(const path& p, error_code& ec) noexcept +{ + return do_stat(p, ec, std::mem_fn(&stat::st_nlink), + static_cast(-1)); +} + +bool +fs::is_empty(const path& p) +{ + return fs::is_directory(status(p)) + ? fs::directory_iterator(p) == fs::directory_iterator() + : fs::file_size(p) == 0; +} + +bool +fs::is_empty(const path& p, error_code& ec) noexcept +{ + auto s = status(p, ec); + if (ec.value()) + return false; + return fs::is_directory(s) + ? fs::directory_iterator(p, ec) == fs::directory_iterator() + : fs::file_size(p, ec) == 0; +} + +fs::file_time_type +fs::last_write_time(const path& p) +{ + error_code ec; + auto t = last_write_time(p, ec); + if (ec.value()) + _GLIBCXX_THROW_OR_ABORT(filesystem_error("cannot get file time", p, ec)); + return t; +} + +fs::file_time_type +fs::last_write_time(const path& p, error_code& ec) noexcept +{ + return do_stat(p, ec, [](const auto& st) { return file_time(st); }, + file_time_type::min()); +} + +void +fs::last_write_time(const path& p, file_time_type new_time) +{ + error_code ec; + last_write_time(p, new_time, ec); + if (ec.value()) + _GLIBCXX_THROW_OR_ABORT(filesystem_error("cannot set file time", p, ec)); +} + +void +fs::last_write_time(const path& p __attribute__((__unused__)), + file_time_type new_time, error_code& ec) noexcept +{ + auto d = new_time.time_since_epoch(); + auto s = chrono::duration_cast(d); +#if _GLIBCXX_USE_UTIMENSAT + auto ns = chrono::duration_cast(d - s); + struct ::timespec ts[2]; + ts[0].tv_sec = 0; + ts[0].tv_nsec = UTIME_OMIT; + ts[1].tv_sec = static_cast(s.count()); + ts[1].tv_nsec = static_cast(ns.count()); + if (::utimensat(AT_FDCWD, p.c_str(), ts, 0)) + ec.assign(errno, std::generic_category()); + else + ec.clear(); +#elif _GLIBCXX_HAVE_UTIME_H + ::utimbuf times; + times.modtime = s.count(); + times.actime = do_stat(p, ec, [](const auto& st) { return st.st_atime; }, + times.modtime); + if (::utime(p.c_str(), ×)) + ec.assign(errno, std::generic_category()); + else + ec.clear(); +#else + ec = std::make_error_code(std::errc::not_supported); +#endif +} + +void +fs::permissions(const path& p, perms prms) +{ + error_code ec; + permissions(p, prms, ec); + if (ec.value()) + _GLIBCXX_THROW_OR_ABORT(filesystem_error("cannot set permissions", p, ec)); +} + +void fs::permissions(const path& p, perms prms, error_code& ec) noexcept +{ +#if _GLIBCXX_USE_FCHMODAT + if (::fchmodat(AT_FDCWD, p.c_str(), static_cast(prms), 0)) +#else + if (::chmod(p.c_str(), static_cast(prms))) +#endif + ec.assign(errno, std::generic_category()); + else + ec.clear(); +} + +fs::path +fs::read_symlink(const path& p) +{ + error_code ec; + path tgt = read_symlink(p, ec); + if (ec.value()) + _GLIBCXX_THROW_OR_ABORT(filesystem_error("read_symlink", p, ec)); + return tgt; +} + +fs::path fs::read_symlink(const path& p, error_code& ec) +{ +#ifdef _GLIBCXX_HAVE_SYS_STAT_H + stat_type st; + if (::lstat(p.c_str(), &st)) + { + ec.assign(errno, std::generic_category()); + return {}; + } + std::string buf(st.st_size, '\0'); + ssize_t len = ::readlink(p.c_str(), &buf.front(), buf.size()); + if (len == -1) + { + ec.assign(errno, std::generic_category()); + return {}; + } + return path{buf.data(), buf.data()+len}; +#else + ec = std::make_error_code(std::errc::not_supported); + return {}; +#endif +} + + +bool +fs::remove(const path& p) +{ + error_code ec; + bool result = fs::remove(p, ec); + if (ec.value()) + _GLIBCXX_THROW_OR_ABORT(filesystem_error("cannot remove", p, ec)); + return result; +} + +bool +fs::remove(const path& p, error_code& ec) noexcept +{ + if (exists(symlink_status(p, ec))) + { + if (::remove(p.c_str()) == 0) + { + ec.clear(); + return true; + } + else + ec.assign(errno, std::generic_category()); + } + return false; +} + + +std::uintmax_t +fs::remove_all(const path& p) +{ + error_code ec; + bool result = remove_all(p, ec); + if (ec.value()) + _GLIBCXX_THROW_OR_ABORT(filesystem_error("cannot remove all", p, ec)); + return result; +} + +std::uintmax_t +fs::remove_all(const path& p, error_code& ec) noexcept +{ + auto fs = symlink_status(p, ec); + uintmax_t count = 0; + if (ec.value() == 0 && fs.type() == file_type::directory) + for (directory_iterator d(p, ec), end; ec.value() == 0 && d != end; ++d) + count += fs::remove(d->path(), ec); + if (ec.value()) + return -1; + return fs::remove(p, ec) ? ++count : -1; // fs:remove() calls ec.clear() +} + +void +fs::rename(const path& from, const path& to) +{ + error_code ec; + rename(from, to, ec); + if (ec.value()) + _GLIBCXX_THROW_OR_ABORT(filesystem_error("cannot rename", from, to, ec)); +} + +void +fs::rename(const path& from, const path& to, error_code& ec) noexcept +{ + if (::rename(from.c_str(), to.c_str())) + ec.assign(errno, std::generic_category()); + else + ec.clear(); +} + +void +fs::resize_file(const path& p, uintmax_t size) +{ + error_code ec; + resize_file(p, size, ec); + if (ec.value()) + _GLIBCXX_THROW_OR_ABORT(filesystem_error("cannot resize file", p, ec)); +} + +void +fs::resize_file(const path& p, uintmax_t size, error_code& ec) noexcept +{ +#ifdef _GLIBCXX_HAVE_UNISTD_H + if (size > static_cast(std::numeric_limits::max())) + ec.assign(EINVAL, std::generic_category()); + else if (::truncate(p.c_str(), size)) + ec.assign(errno, std::generic_category()); + else + ec.clear(); +#else + ec = std::make_error_code(std::errc::not_supported); +#endif +} + + +fs::space_info +fs::space(const path& p) +{ + error_code ec; + space_info s = space(p, ec); + if (ec.value()) + _GLIBCXX_THROW_OR_ABORT(filesystem_error("cannot get free space", p, ec)); + return s; +} + +fs::space_info +fs::space(const path& p, error_code& ec) noexcept +{ + space_info info = { + static_cast(-1), + static_cast(-1), + static_cast(-1) + }; +#ifdef _GLIBCXX_HAVE_SYS_STATVFS_H + struct ::statvfs f; + if (::statvfs(p.c_str(), &f)) + ec.assign(errno, std::generic_category()); + else + { + info = space_info{ + f.f_blocks * f.f_frsize, + f.f_bfree * f.f_frsize, + f.f_bavail * f.f_frsize + }; + ec.clear(); + } +#else + ec = std::make_error_code(std::errc::not_supported); +#endif + return info; +} + +#ifdef _GLIBCXX_HAVE_SYS_STAT_H +fs::file_status +fs::status(const fs::path& p, std::error_code& ec) noexcept +{ + file_status status; + stat_type st; + if (::stat(p.c_str(), &st)) + { + int err = errno; + ec.assign(err, std::generic_category()); + if (is_not_found_errno(err)) + status.type(file_type::not_found); + } + else + { + status = make_file_status(st); + ec.clear(); + } + return status; +} + +fs::file_status +fs::symlink_status(const fs::path& p, std::error_code& ec) noexcept +{ + file_status status; + stat_type st; + if (::lstat(p.c_str(), &st)) + { + int err = errno; + ec.assign(err, std::generic_category()); + if (is_not_found_errno(err)) + status.type(file_type::not_found); + } + else + { + status = make_file_status(st); + ec.clear(); + } + return status; +} +#endif + +fs::file_status +fs::status(const fs::path& p) +{ + std::error_code ec; + auto result = status(p, ec); + if (result.type() == file_type::none) + _GLIBCXX_THROW_OR_ABORT(filesystem_error("status", p, ec)); + return result; +} + +fs::file_status +fs::symlink_status(const fs::path& p) +{ + std::error_code ec; + auto result = symlink_status(p, ec); + if (result.type() == file_type::none) + _GLIBCXX_THROW_OR_ABORT(filesystem_error("symlink_status", p, ec)); + return result; +} + +fs::path +fs::system_complete(const path& p) +{ + error_code ec; + path comp = system_complete(p, ec); + if (ec.value()) + _GLIBCXX_THROW_OR_ABORT(filesystem_error("system_complete", p, ec)); + return comp; +} + +fs::path +fs::system_complete(const path& p, error_code& ec) +{ + path base = current_path(ec); +#ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS + if (p.is_absolute() || !p.has_root_name() + || p.root_name() == base.root_name()) + return absolute(p, base); + // else TODO + ec = std::make_error_code(std::errc::not_supported); + return {}; +#else + if (ec.value()) + return {}; + return absolute(p, base); +#endif +} + +fs::path fs::temp_directory_path() +{ + error_code ec; + path tmp = temp_directory_path(ec); + if (ec.value()) + _GLIBCXX_THROW_OR_ABORT(filesystem_error("temp_directory_path", ec)); + return tmp; +} + +fs::path fs::temp_directory_path(error_code& ec) +{ +#ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS + ec = std::make_error_code(std::errc::not_supported); + return {}; // TODO +#else + const char* tmpdir = nullptr; + const char* env[] = { "TMPDIR", "TMP", "TEMP", "TEMPDIR", nullptr }; + for (auto e = env; tmpdir == nullptr && *e != nullptr; ++e) + tmpdir = ::getenv(*e); + path p = tmpdir ? tmpdir : "/tmp"; + if (exists(p) && is_directory(p)) + { + ec.clear(); + return p; + } + ec = std::make_error_code(std::errc::not_a_directory); + return {}; +#endif +} + Index: libstdc++-v3/src/filesystem/Makefile.am =================================================================== --- a/src/libstdc++-v3/src/filesystem/Makefile.am (.../tags/gcc_5_2_0_release) +++ b/src/libstdc++-v3/src/filesystem/Makefile.am (.../branches/gcc-5-branch) @@ -0,0 +1,100 @@ +## Makefile for the GNU C++ Filesystem library. +## +## Copyright (C) 2014-2015 Free Software Foundation, Inc. +## +## Process this file with automake to produce Makefile.in. +## +## This file is part of GCC. +## +## GCC is free software; you can redistribute it and/or modify +## it under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 3, or (at your option) +## any later version. +## +## GCC is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +## GNU General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with GCC; see the file COPYING3. If not see +## . + +include $(top_srcdir)/fragment.am + +toolexeclib_LTLIBRARIES = libstdc++fs.la + +headers = + +sources = \ + dir.cc \ + ops.cc \ + path.cc + +# vpath % $(top_srcdir)/src/filesystem + +libstdc__fs_la_SOURCES = $(sources) + +# AM_CXXFLAGS needs to be in each subdirectory so that it can be +# modified in a per-library or per-sub-library way. Need to manually +# set this option because CONFIG_CXXFLAGS has to be after +# OPTIMIZE_CXXFLAGS on the compile line so that -O2 can be overridden +# as the occasion call for it. +AM_CXXFLAGS = \ + $(glibcxx_lt_pic_flag) $(glibcxx_compiler_shared_flag) \ + -std=gnu++14 \ + $(WARN_CXXFLAGS) $(OPTIMIZE_CXXFLAGS) $(CONFIG_CXXFLAGS) + +AM_MAKEFLAGS = \ + "gxx_include_dir=$(gxx_include_dir)" + + +# Libtool notes + +# 1) In general, libtool expects an argument such as `--tag=CXX' when +# using the C++ compiler, because that will enable the settings +# detected when C++ support was being configured. However, when no +# such flag is given in the command line, libtool attempts to figure +# it out by matching the compiler name in each configuration section +# against a prefix of the command line. The problem is that, if the +# compiler name and its initial flags stored in the libtool +# configuration file don't match those in the command line, libtool +# can't decide which configuration to use, and it gives up. The +# correct solution is to add `--tag CXX' to LTCXXCOMPILE and maybe +# CXXLINK, just after $(LIBTOOL), so that libtool doesn't have to +# attempt to infer which configuration to use. +# +# The second tag argument, `--tag disable-shared` means that libtool +# only compiles each source once, for static objects. In actuality, +# glibcxx_lt_pic_flag and glibcxx_compiler_shared_flag are added to +# the libtool command that is used create the object, which is +# suitable for shared libraries. The `--tag disable-shared` must be +# placed after --tag CXX lest things CXX undo the affect of +# disable-shared. + +# 2) Need to explicitly set LTCXXCOMPILE so that EXTRA_CXX_FLAGS is +# last. (That way, things like -O2 passed down from the toplevel can +# be overridden by --enable-debug.) +LTCXXCOMPILE = \ + $(LIBTOOL) --tag CXX --tag disable-shared \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=compile $(CXX) $(TOPLEVEL_INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) $(EXTRA_CXX_FLAGS) + +LTLDFLAGS = $(shell $(SHELL) $(top_srcdir)/../libtool-ldflags $(LDFLAGS)) + +# 3) We'd have a problem when building the shared libstdc++ object if +# the rules automake generates would be used. We cannot allow g++ to +# be used since this would add -lstdc++ to the link line which of +# course is problematic at this point. So, we get the top-level +# directory to configure libstdc++-v3 to use gcc as the C++ +# compilation driver. +CXXLINK = \ + $(LIBTOOL) --tag CXX --tag disable-shared \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=link $(CXX) \ + $(OPT_LDFLAGS) $(SECTION_LDFLAGS) $(AM_CXXFLAGS) $(LTLDFLAGS) -o $@ + +# By adding these files here, automake will remove them for 'make clean' +CLEANFILES = stamp-* + Index: libstdc++-v3/src/Makefile.am =================================================================== --- a/src/libstdc++-v3/src/Makefile.am (.../tags/gcc_5_2_0_release) +++ b/src/libstdc++-v3/src/Makefile.am (.../branches/gcc-5-branch) @@ -22,8 +22,14 @@ include $(top_srcdir)/fragment.am -SUBDIRS = c++98 c++11 +if ENABLE_FILESYSTEM_TS +filesystem_dir = filesystem +else +filesystem_dir = +endif +SUBDIRS = c++98 c++11 $(filesystem_dir) + # Cross compiler support. if VTV_CYGMIN toolexeclib_LTLIBRARIES = libvtv.la libstdc++.la @@ -52,6 +58,9 @@ vpath % $(top_srcdir)/src/c++98 vpath % $(top_srcdir)/src/c++11 +if ENABLE_FILESYSTEM_TS +vpath % $(top_srcdir)/src/filesystem +endif if GLIBCXX_LDBL_COMPAT ldbl_compat_sources = compatibility-ldbl.cc Index: libstdc++-v3/src/c++98/Makefile.in =================================================================== --- a/src/libstdc++-v3/src/c++98/Makefile.in (.../tags/gcc_5_2_0_release) +++ b/src/libstdc++-v3/src/c++98/Makefile.in (.../branches/gcc-5-branch) @@ -1,9 +1,9 @@ -# Makefile.in generated by automake 1.11.1 from Makefile.am. +# Makefile.in generated by automake 1.11.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, -# Inc. +# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software +# Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -16,6 +16,23 @@ @SET_MAKE@ VPATH = @srcdir@ +am__make_dryrun = \ + { \ + am__dry=no; \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ + | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ + *) \ + for am__flg in $$MAKEFLAGS; do \ + case $$am__flg in \ + *=*|--*) ;; \ + *n*) am__dry=yes; break;; \ + esac; \ + done;; \ + esac; \ + test $$am__dry = yes; \ + } pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ @@ -99,6 +116,11 @@ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) CXXLD = $(CXX) SOURCES = $(libc__98convenience_la_SOURCES) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac ETAGS = etags CTAGS = ctags ABI_TWEAKS_SRCDIR = @ABI_TWEAKS_SRCDIR@ @@ -501,6 +523,7 @@ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; +$(top_srcdir)/fragment.am: $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh @@ -519,7 +542,7 @@ echo "rm -f \"$${dir}/so_locations\""; \ rm -f "$${dir}/so_locations"; \ done -libc++98convenience.la: $(libc__98convenience_la_OBJECTS) $(libc__98convenience_la_DEPENDENCIES) +libc++98convenience.la: $(libc__98convenience_la_OBJECTS) $(libc__98convenience_la_DEPENDENCIES) $(EXTRA_libc__98convenience_la_DEPENDENCIES) $(CXXLINK) $(libc__98convenience_la_OBJECTS) $(libc__98convenience_la_LIBADD) $(LIBS) mostlyclean-compile: @@ -608,10 +631,15 @@ installcheck: installcheck-am install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi mostlyclean-generic: clean-generic: Index: libstdc++-v3/src/c++11/Makefile.in =================================================================== --- a/src/libstdc++-v3/src/c++11/Makefile.in (.../tags/gcc_5_2_0_release) +++ b/src/libstdc++-v3/src/c++11/Makefile.in (.../branches/gcc-5-branch) @@ -1,9 +1,9 @@ -# Makefile.in generated by automake 1.11.1 from Makefile.am. +# Makefile.in generated by automake 1.11.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, -# Inc. +# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software +# Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -16,6 +16,23 @@ @SET_MAKE@ VPATH = @srcdir@ +am__make_dryrun = \ + { \ + am__dry=no; \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ + | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ + *) \ + for am__flg in $$MAKEFLAGS; do \ + case $$am__flg in \ + *=*|--*) ;; \ + *n*) am__dry=yes; break;; \ + esac; \ + done;; \ + esac; \ + test $$am__dry = yes; \ + } pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ @@ -98,6 +115,11 @@ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) CXXLD = $(CXX) SOURCES = $(libc__11convenience_la_SOURCES) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac ETAGS = etags CTAGS = ctags ABI_TWEAKS_SRCDIR = @ABI_TWEAKS_SRCDIR@ @@ -485,6 +507,7 @@ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; +$(top_srcdir)/fragment.am: $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh @@ -503,7 +526,7 @@ echo "rm -f \"$${dir}/so_locations\""; \ rm -f "$${dir}/so_locations"; \ done -libc++11convenience.la: $(libc__11convenience_la_OBJECTS) $(libc__11convenience_la_DEPENDENCIES) +libc++11convenience.la: $(libc__11convenience_la_OBJECTS) $(libc__11convenience_la_DEPENDENCIES) $(EXTRA_libc__11convenience_la_DEPENDENCIES) $(CXXLINK) $(libc__11convenience_la_OBJECTS) $(libc__11convenience_la_LIBADD) $(LIBS) mostlyclean-compile: @@ -592,10 +615,15 @@ installcheck: installcheck-am install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi mostlyclean-generic: clean-generic: Index: libstdc++-v3/configure.ac =================================================================== --- a/src/libstdc++-v3/configure.ac (.../tags/gcc_5_2_0_release) +++ b/src/libstdc++-v3/configure.ac (.../branches/gcc-5-branch) @@ -402,6 +402,11 @@ # For gthread support. Depends on GLIBCXX_ENABLE_SYMVERS. GLIBCXX_CHECK_GTHREADS +# For Filesystem TS. +AC_CHECK_HEADERS([fcntl.h dirent.h sys/statvfs.h utime.h]) +GLIBCXX_ENABLE_FILESYSTEM_TS +GLIBCXX_CHECK_FILESYSTEM_DEPS + # Define documentation rules conditionally. # See if makeinfo has been installed and is modern enough Index: libstdc++-v3/doc/Makefile.in =================================================================== --- a/src/libstdc++-v3/doc/Makefile.in (.../tags/gcc_5_2_0_release) +++ b/src/libstdc++-v3/doc/Makefile.in (.../branches/gcc-5-branch) @@ -1,9 +1,9 @@ -# Makefile.in generated by automake 1.11.1 from Makefile.am. +# Makefile.in generated by automake 1.11.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, -# Inc. +# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software +# Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -15,6 +15,23 @@ @SET_MAKE@ VPATH = @srcdir@ +am__make_dryrun = \ + { \ + am__dry=no; \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ + | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ + *) \ + for am__flg in $$MAKEFLAGS; do \ + case $$am__flg in \ + *=*|--*) ;; \ + *n*) am__dry=yes; break;; \ + esac; \ + done;; \ + esac; \ + test $$am__dry = yes; \ + } pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ @@ -67,6 +84,11 @@ depcomp = am__depfiles_maybe = SOURCES = +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac ABI_TWEAKS_SRCDIR = @ABI_TWEAKS_SRCDIR@ ACLOCAL = @ACLOCAL@ ALLOCATOR_H = @ALLOCATOR_H@ @@ -604,6 +626,7 @@ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; +$(top_srcdir)/fragment.am: $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh @@ -639,10 +662,15 @@ installcheck: installcheck-am install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi mostlyclean-generic: clean-generic: Index: libstdc++-v3/po/Makefile.in =================================================================== --- a/src/libstdc++-v3/po/Makefile.in (.../tags/gcc_5_2_0_release) +++ b/src/libstdc++-v3/po/Makefile.in (.../branches/gcc-5-branch) @@ -1,9 +1,9 @@ -# Makefile.in generated by automake 1.11.1 from Makefile.am. +# Makefile.in generated by automake 1.11.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, -# Inc. +# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software +# Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -15,6 +15,23 @@ @SET_MAKE@ VPATH = @srcdir@ +am__make_dryrun = \ + { \ + am__dry=no; \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ + | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ + *) \ + for am__flg in $$MAKEFLAGS; do \ + case $$am__flg in \ + *=*|--*) ;; \ + *n*) am__dry=yes; break;; \ + esac; \ + done;; \ + esac; \ + test $$am__dry = yes; \ + } pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ @@ -67,6 +84,11 @@ depcomp = am__depfiles_maybe = SOURCES = +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac ABI_TWEAKS_SRCDIR = @ABI_TWEAKS_SRCDIR@ ACLOCAL = @ACLOCAL@ ALLOCATOR_H = @ALLOCATOR_H@ @@ -330,6 +352,7 @@ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; +$(top_srcdir)/fragment.am: $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh @@ -365,10 +388,15 @@ installcheck: installcheck-am install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi mostlyclean-generic: clean-generic: Index: libstdc++-v3/include/Makefile.in =================================================================== --- a/src/libstdc++-v3/include/Makefile.in (.../tags/gcc_5_2_0_release) +++ b/src/libstdc++-v3/include/Makefile.in (.../branches/gcc-5-branch) @@ -1,9 +1,9 @@ -# Makefile.in generated by automake 1.11.1 from Makefile.am. +# Makefile.in generated by automake 1.11.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, -# Inc. +# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software +# Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -15,6 +15,23 @@ @SET_MAKE@ VPATH = @srcdir@ +am__make_dryrun = \ + { \ + am__dry=no; \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ + | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ + *) \ + for am__flg in $$MAKEFLAGS; do \ + case $$am__flg in \ + *=*|--*) ;; \ + *n*) am__dry=yes; break;; \ + esac; \ + done;; \ + esac; \ + test $$am__dry = yes; \ + } pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ @@ -67,6 +84,11 @@ depcomp = am__depfiles_maybe = SOURCES = +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac ABI_TWEAKS_SRCDIR = @ABI_TWEAKS_SRCDIR@ ACLOCAL = @ACLOCAL@ ALLOCATOR_H = @ALLOCATOR_H@ @@ -396,6 +418,7 @@ ${bits_srcdir}/postypes.h \ ${bits_srcdir}/predefined_ops.h \ ${bits_srcdir}/ptr_traits.h \ + ${bits_srcdir}/quoted_string.h \ ${bits_srcdir}/random.h \ ${bits_srcdir}/random.tcc \ ${bits_srcdir}/range_access.h \ @@ -917,12 +940,21 @@ ${experimental_srcdir}/optional \ ${experimental_srcdir}/ratio \ ${experimental_srcdir}/string_view \ + ${experimental_srcdir}/string_view.tcc \ ${experimental_srcdir}/system_error \ - ${experimental_srcdir}/string_view.tcc \ ${experimental_srcdir}/tuple \ - ${experimental_srcdir}/type_traits + ${experimental_srcdir}/type_traits \ + ${experimental_filesystem_headers} +@ENABLE_FILESYSTEM_TS_FALSE@experimental_filesystem_headers = +@ENABLE_FILESYSTEM_TS_TRUE@experimental_filesystem_headers = \ +@ENABLE_FILESYSTEM_TS_TRUE@ ${experimental_srcdir}/filesystem \ +@ENABLE_FILESYSTEM_TS_TRUE@ ${experimental_srcdir}/fs_dir.h \ +@ENABLE_FILESYSTEM_TS_TRUE@ ${experimental_srcdir}/fs_fwd.h \ +@ENABLE_FILESYSTEM_TS_TRUE@ ${experimental_srcdir}/fs_ops.h \ +@ENABLE_FILESYSTEM_TS_TRUE@ ${experimental_srcdir}/fs_path.h + # This is the common subset of C++ files that all three "C" header models use. c_base_srcdir = $(C_INCLUDE_DIR) c_base_builddir = . @@ -1232,6 +1264,7 @@ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; +$(top_srcdir)/fragment.am: $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh @@ -1267,10 +1300,15 @@ installcheck: installcheck-am install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi mostlyclean-generic: clean-generic: Index: libstdc++-v3/include/std/iomanip =================================================================== --- a/src/libstdc++-v3/include/std/iomanip (.../tags/gcc_5_2_0_release) +++ b/src/libstdc++-v3/include/std/iomanip (.../branches/gcc-5-branch) @@ -42,7 +42,7 @@ #if __cplusplus >= 201103L #include #if __cplusplus > 201103L -#include // used in quoted. +#include #endif #endif @@ -450,127 +450,6 @@ #define __cpp_lib_quoted_string_io 201304 -_GLIBCXX_END_NAMESPACE_VERSION - namespace __detail { - _GLIBCXX_BEGIN_NAMESPACE_VERSION - - /** - * @brief Struct for delimited strings. - */ - template - struct _Quoted_string - { - static_assert(is_reference<_String>::value - || is_pointer<_String>::value, - "String type must be pointer or reference"); - - _Quoted_string(_String __str, _CharT __del, _CharT __esc) - : _M_string(__str), _M_delim{__del}, _M_escape{__esc} - { } - - _Quoted_string& - operator=(_Quoted_string&) = delete; - - _String _M_string; - _CharT _M_delim; - _CharT _M_escape; - }; - - /** - * @brief Inserter for quoted strings. - * - * _GLIBCXX_RESOLVE_LIB_DEFECTS - * DR 2344 quoted()'s interaction with padding is unclear - */ - template - auto& - operator<<(std::basic_ostream<_CharT, _Traits>& __os, - const _Quoted_string& __str) - { - std::basic_ostringstream<_CharT, _Traits> __ostr; - __ostr << __str._M_delim; - for (const _CharT* __c = __str._M_string; *__c; ++__c) - { - if (*__c == __str._M_delim || *__c == __str._M_escape) - __ostr << __str._M_escape; - __ostr << *__c; - } - __ostr << __str._M_delim; - - return __os << __ostr.str(); - } - - /** - * @brief Inserter for quoted strings. - * - * _GLIBCXX_RESOLVE_LIB_DEFECTS - * DR 2344 quoted()'s interaction with padding is unclear - */ - template - auto& - operator<<(std::basic_ostream<_CharT, _Traits>& __os, - const _Quoted_string<_String, _CharT>& __str) - { - std::basic_ostringstream<_CharT, _Traits> __ostr; - __ostr << __str._M_delim; - for (auto& __c : __str._M_string) - { - if (__c == __str._M_delim || __c == __str._M_escape) - __ostr << __str._M_escape; - __ostr << __c; - } - __ostr << __str._M_delim; - - return __os << __ostr.str(); - } - - /** - * @brief Extractor for delimited strings. - * The left and right delimiters can be different. - */ - template - auto& - operator>>(std::basic_istream<_CharT, _Traits>& __is, - const _Quoted_string&, - _CharT>& __str) - { - _CharT __c; - __is >> __c; - if (!__is.good()) - return __is; - if (__c != __str._M_delim) - { - __is.unget(); - __is >> __str._M_string; - return __is; - } - __str._M_string.clear(); - std::ios_base::fmtflags __flags - = __is.flags(__is.flags() & ~std::ios_base::skipws); - do - { - __is >> __c; - if (!__is.good()) - break; - if (__c == __str._M_escape) - { - __is >> __c; - if (!__is.good()) - break; - } - else if (__c == __str._M_delim) - break; - __str._M_string += __c; - } - while (true); - __is.setf(__flags); - - return __is; - } - _GLIBCXX_END_NAMESPACE_VERSION - } // namespace __detail -_GLIBCXX_BEGIN_NAMESPACE_VERSION - /** * @brief Manipulator for quoted strings. * @param __string String to quote. Index: libstdc++-v3/include/experimental/fs_ops.h =================================================================== --- a/src/libstdc++-v3/include/experimental/fs_ops.h (.../tags/gcc_5_2_0_release) +++ b/src/libstdc++-v3/include/experimental/fs_ops.h (.../branches/gcc-5-branch) @@ -0,0 +1,291 @@ +// Filesystem operational functions -*- C++ -*- + +// Copyright (C) 2014-2015 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your __option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file experimental/filesystem + * This is a TS C++ Library header. + */ + +#ifndef _GLIBCXX_EXPERIMENTAL_FS_OPS_H +#define _GLIBCXX_EXPERIMENTAL_FS_OPS_H 1 + +#if __cplusplus < 201103L +# include +#else + +#include + +namespace std _GLIBCXX_VISIBILITY(default) +{ +namespace experimental +{ +namespace filesystem +{ +inline namespace v1 +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + /** + * @ingroup filesystem + * @{ + */ + + path absolute(const path& __p, const path& __base = current_path()); + + path canonical(const path& __p, const path& __base = current_path()); + path canonical(const path& __p, error_code& __ec); + path canonical(const path& __p, const path& __base, error_code& __ec); + + inline void + copy(const path& __from, const path& __to) + { copy(__from, __to, copy_options::none); } + + inline void + copy(const path& __from, const path& __to, error_code& __ec) noexcept + { copy(__from, __to, copy_options::none, __ec); } + + void copy(const path& __from, const path& __to, copy_options __options); + void copy(const path& __from, const path& __to, copy_options __options, + error_code& __ec) noexcept; + + inline bool + copy_file(const path& __from, const path& __to) + { return copy_file(__from, __to, copy_options::none); } + + inline bool + copy_file(const path& __from, const path& __to, error_code& __ec) noexcept + { return copy_file(__from, __to, copy_options::none, __ec); } + + bool copy_file(const path& __from, const path& __to, copy_options __option); + bool copy_file(const path& __from, const path& __to, copy_options __option, + error_code& __ec) noexcept; + + void copy_symlink(const path& __existing_symlink, const path& __new_symlink); + void copy_symlink(const path& __existing_symlink, const path& __new_symlink, + error_code& __ec) noexcept; + + bool create_directories(const path& __p); + bool create_directories(const path& __p, error_code& __ec) noexcept; + + bool create_directory(const path& __p); + bool create_directory(const path& __p, error_code& __ec) noexcept; + + bool create_directory(const path& __p, const path& attributes); + bool create_directory(const path& __p, const path& attributes, + error_code& __ec) noexcept; + + void create_directory_symlink(const path& __to, const path& __new_symlink); + void create_directory_symlink(const path& __to, const path& __new_symlink, + error_code& __ec) noexcept; + + void create_hard_link(const path& __to, const path& __new_hard_link); + void create_hard_link(const path& __to, const path& __new_hard_link, + error_code& __ec) noexcept; + + void create_symlink(const path& __to, const path& __new_symlink); + void create_symlink(const path& __to, const path& __new_symlink, + error_code& __ec) noexcept; + + path current_path(); + path current_path(error_code& __ec); + void current_path(const path& __p); + void current_path(const path& __p, error_code& __ec) noexcept; + + inline bool + exists(file_status __s) noexcept + { return status_known(__s) && __s.type() != file_type::not_found; } + + inline bool + exists(const path& __p) + { return exists(status(__p)); } + + inline bool + exists(const path& __p, error_code& __ec) noexcept + { return exists(status(__p, __ec)); } + + bool + equivalent(const path& __p1, const path& __p2); + + bool + equivalent(const path& __p1, const path& __p2, error_code& __ec) noexcept; + + uintmax_t file_size(const path& __p); + uintmax_t file_size(const path& __p, error_code& __ec) noexcept; + + uintmax_t hard_link_count(const path& __p); + uintmax_t hard_link_count(const path& __p, error_code& __ec) noexcept; + + inline bool + is_block_file(file_status __s) noexcept + { return __s.type() == file_type::block; } + + inline bool + is_block_file(const path& __p) + { return is_block_file(status(__p)); } + + inline bool + is_block_file(const path& __p, error_code& __ec) noexcept + { return is_block_file(status(__p, __ec)); } + + inline bool + is_character_file(file_status __s) noexcept + { return __s.type() == file_type::character; } + + inline bool + is_character_file(const path& __p) + { return is_character_file(status(__p)); } + + inline bool + is_character_file(const path& __p, error_code& __ec) noexcept + { return is_character_file(status(__p, __ec)); } + + inline bool + is_directory(file_status __s) noexcept + { return __s.type() == file_type::directory; } + + inline bool + is_directory(const path& __p) + { return is_directory(status(__p)); } + + inline bool + is_directory(const path& __p, error_code& __ec) noexcept + { return is_directory(status(__p, __ec)); } + + bool is_empty(const path& __p); + bool is_empty(const path& __p, error_code& __ec) noexcept; + + inline bool + is_fifo(file_status __s) noexcept + { return __s.type() == file_type::fifo; } + + inline bool + is_fifo(const path& __p) + { return is_fifo(status(__p)); } + + inline bool + is_fifo(const path& __p, error_code& __ec) noexcept + { return is_fifo(status(__p, __ec)); } + + inline bool + is_other(file_status __s) noexcept + { + return exists(__s) && !is_regular_file(__s) && !is_directory(__s) + && !is_symlink(__s); + } + + inline bool + is_other(const path& __p) + { return is_other(status(__p)); } + + inline bool + is_other(const path& __p, error_code& __ec) noexcept + { return is_other(status(__p, __ec)); } + + inline bool + is_regular_file(file_status __s) noexcept + { return __s.type() == file_type::regular; } + + inline bool + is_regular_file(const path& __p) + { return is_regular_file(status(__p)); } + + inline bool + is_regular_file(const path& __p, error_code& __ec) noexcept + { return is_regular_file(status(__p, __ec)); } + + inline bool + is_socket(file_status __s) noexcept + { return __s.type() == file_type::socket; } + + inline bool + is_socket(const path& __p) + { return is_socket(status(__p)); } + + inline bool + is_socket(const path& __p, error_code& __ec) noexcept + { return is_socket(status(__p, __ec)); } + + inline bool + is_symlink(file_status __s) noexcept + { return __s.type() == file_type::symlink; } + + inline bool + is_symlink(const path& __p) + { return is_symlink(symlink_status(__p)); } + + inline bool + is_symlink(const path& __p, error_code& __ec) noexcept + { return is_symlink(symlink_status(__p, __ec)); } + + file_time_type last_write_time(const path& __p); + file_time_type last_write_time(const path& __p, error_code& __ec) noexcept; + void last_write_time(const path& __p, file_time_type __new_time); + void last_write_time(const path& __p, file_time_type __new_time, + error_code& __ec) noexcept; + + void permissions(const path& __p, perms __prms); + void permissions(const path& __p, perms __prms, error_code& __ec) noexcept; + + path read_symlink(const path& __p); + path read_symlink(const path& __p, error_code& __ec); + + bool remove(const path& __p); + bool remove(const path& __p, error_code& __ec) noexcept; + + uintmax_t remove_all(const path& __p); + uintmax_t remove_all(const path& __p, error_code& __ec) noexcept; + + void rename(const path& __from, const path& __to); + void rename(const path& __from, const path& __to, error_code& __ec) noexcept; + + void resize_file(const path& __p, uintmax_t __size); + void resize_file(const path& __p, uintmax_t __size, error_code& __ec) noexcept; + + space_info space(const path& __p); + space_info space(const path& __p, error_code& __ec) noexcept; + + file_status status(const path& __p); + file_status status(const path& __p, error_code& __ec) noexcept; + + inline bool status_known(file_status __s) noexcept + { return __s.type() != file_type::none; } + + file_status symlink_status(const path& __p); + file_status symlink_status(const path& __p, error_code& __ec) noexcept; + + path system_complete(const path& __p); + path system_complete(const path& __p, error_code& __ec); + + path temp_directory_path(); + path temp_directory_path(error_code& __ec); + + // @} group filesystem +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace v1 +} // namespace filesystem +} // namespace experimental +} // namespace std + +#endif // C++11 + +#endif // _GLIBCXX_EXPERIMENTAL_FS_OPS_H Index: libstdc++-v3/include/experimental/filesystem =================================================================== --- a/src/libstdc++-v3/include/experimental/filesystem (.../tags/gcc_5_2_0_release) +++ b/src/libstdc++-v3/include/experimental/filesystem (.../branches/gcc-5-branch) @@ -0,0 +1,77 @@ +// -*- C++ -*- + +// Copyright (C) 2014-2015 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file experimental/filesystem + * This is a TS C++ Library header. + */ + +#ifndef _GLIBCXX_EXPERIMENTAL_FILESYSTEM +#define _GLIBCXX_EXPERIMENTAL_FILESYSTEM 1 + +#pragma GCC system_header + +#if __cplusplus < 201103L +# include +#else + +#include +#include +#include +#include + +#define __cpp_lib_experimental_filesystem 201406 + +namespace std _GLIBCXX_VISIBILITY(default) +{ +namespace experimental +{ +namespace filesystem +{ +inline namespace v1 +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + /** + * @ingroup filesystem + */ + inline std::string filesystem_error::_M_gen_what() + { + std::string __what = "filesystem error: "; + __what += system_error::what(); + if (!_M_path1.empty()) + __what += " [" + _M_path1.string() + ']'; + if (!_M_path2.empty()) + __what += " [" + _M_path2.string() + ']'; + return __what; + } + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace v1 +} // namespace filesystem +} // namespace experimental +} // namespace std + +#endif // C++11 + +#endif // _GLIBCXX_EXPERIMENTAL_FILESYSTEM Index: libstdc++-v3/include/experimental/fs_dir.h =================================================================== --- a/src/libstdc++-v3/include/experimental/fs_dir.h (.../tags/gcc_5_2_0_release) +++ b/src/libstdc++-v3/include/experimental/fs_dir.h (.../branches/gcc-5-branch) @@ -0,0 +1,326 @@ +// Filesystem directory utilities -*- C++ -*- + +// Copyright (C) 2014-2015 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file experimental/fs_dir.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{experimental/filesystem} + */ + +#ifndef _GLIBCXX_EXPERIMENTAL_FS_DIR_H +#define _GLIBCXX_EXPERIMENTAL_FS_DIR_H 1 + +#if __cplusplus < 201103L +# include +#else +# include +# include +# include +# include + +namespace std _GLIBCXX_VISIBILITY(default) +{ +namespace experimental +{ +namespace filesystem +{ +inline namespace v1 +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + /** + * @ingroup filesystem + * @{ + */ + + class file_status + { + public: + // constructors + explicit + file_status(file_type __ft = file_type::none, + perms __prms = perms::unknown) noexcept + : _M_type(__ft), _M_perms(__prms) { } + + file_status(const file_status&) noexcept = default; + file_status(file_status&&) noexcept = default; + ~file_status() = default; + + file_status& operator=(const file_status&) noexcept = default; + file_status& operator=(file_status&&) noexcept = default; + + // observers + file_type type() const noexcept { return _M_type; } + perms permissions() const noexcept { return _M_perms; } + + // modifiers + void type(file_type __ft) noexcept { _M_type = __ft; } + void permissions(perms __prms) noexcept { _M_perms = __prms; } + + private: + file_type _M_type; + perms _M_perms; + }; + +_GLIBCXX_BEGIN_NAMESPACE_CXX11 + + class directory_entry + { + public: + // constructors and destructor + directory_entry() noexcept = default; + directory_entry(const directory_entry&) = default; + directory_entry(directory_entry&&) noexcept = default; + explicit directory_entry(const filesystem::path& __p) : _M_path(__p) { } + ~directory_entry() = default; + + // modifiers + directory_entry& operator=(const directory_entry&) = default; + directory_entry& operator=(directory_entry&&) noexcept = default; + + void assign(const filesystem::path& __p) { _M_path = __p; } + + void + replace_filename(const filesystem::path& __p) + { _M_path = _M_path.parent_path() / __p; } + + // observers + const filesystem::path& path() const noexcept { return _M_path; } + operator const filesystem::path&() const noexcept { return _M_path; } + + file_status + status() const + { return filesystem::status(_M_path); } + + file_status + status(error_code& __ec) const noexcept + { return filesystem::status(_M_path, __ec); } + + file_status + symlink_status() const + { return filesystem::symlink_status(_M_path); } + + file_status + symlink_status(error_code& __ec) const noexcept + { return filesystem::symlink_status(_M_path, __ec); } + + bool + operator< (const directory_entry& __rhs) const noexcept + { return _M_path < __rhs._M_path; } + + bool + operator==(const directory_entry& __rhs) const noexcept + { return _M_path == __rhs._M_path; } + + bool + operator!=(const directory_entry& __rhs) const noexcept + { return _M_path != __rhs._M_path; } + + bool + operator<=(const directory_entry& __rhs) const noexcept + { return _M_path <= __rhs._M_path; } + + bool + operator> (const directory_entry& __rhs) const noexcept + { return _M_path > __rhs._M_path; } + + bool + operator>=(const directory_entry& __rhs) const noexcept + { return _M_path >= __rhs._M_path; } + + private: + filesystem::path _M_path; + }; + + struct _Dir; + class recursive_directory_iterator; + + class directory_iterator + { + public: + typedef directory_entry value_type; + typedef ptrdiff_t difference_type; + typedef const directory_entry* pointer; + typedef const directory_entry& reference; + typedef input_iterator_tag iterator_category; + + directory_iterator() noexcept = default; + + explicit + directory_iterator(const path& __p) + : directory_iterator(__p, directory_options::none, nullptr) { } + + directory_iterator(const path& __p, directory_options __options) + : directory_iterator(__p, __options, nullptr) { } + + directory_iterator(const path& __p, error_code& __ec) noexcept + : directory_iterator(__p, directory_options::none, __ec) { } + + directory_iterator(const path& __p, + directory_options __options, error_code& __ec) noexcept + : directory_iterator(__p, __options, &__ec) { } + + directory_iterator(const directory_iterator& __rhs) = default; + + directory_iterator(directory_iterator&& __rhs) noexcept = default; + + ~directory_iterator() = default; + + directory_iterator& operator=(const directory_iterator& __rhs) = default; + directory_iterator& operator=(directory_iterator&& __rhs) noexcept = default; + + const directory_entry& operator*() const; + const directory_entry* operator->() const { return &**this; } + directory_iterator& operator++(); + directory_iterator& increment(error_code& __ec) noexcept; + + directory_iterator operator++(int) + { + auto __tmp = *this; + ++*this; + return __tmp; + } + + friend bool + operator==(const directory_iterator& __lhs, + const directory_iterator& __rhs) + { return __lhs._M_dir == __rhs._M_dir; } + + private: + directory_iterator(const path&, directory_options, error_code*); + directory_iterator(std::shared_ptr<_Dir>, error_code*); + + friend class recursive_directory_iterator; + + std::shared_ptr<_Dir> _M_dir; + }; + + inline directory_iterator + begin(directory_iterator __iter) { return __iter; } + + inline directory_iterator + end(directory_iterator) { return directory_iterator(); } + + inline bool + operator!=(const directory_iterator& __lhs, const directory_iterator& __rhs) + { return !(__lhs == __rhs); } + + class recursive_directory_iterator + { + public: + typedef directory_entry value_type; + typedef ptrdiff_t difference_type; + typedef const directory_entry* pointer; + typedef const directory_entry& reference; + typedef input_iterator_tag iterator_category; + + recursive_directory_iterator() noexcept = default; + + explicit + recursive_directory_iterator(const path& __p) + : recursive_directory_iterator(__p, directory_options::none, nullptr) { } + + recursive_directory_iterator(const path& __p, directory_options __options) + : recursive_directory_iterator(__p, __options, nullptr) { } + + recursive_directory_iterator(const path& __p, + directory_options __options, + error_code& __ec) noexcept + : recursive_directory_iterator(__p, __options, &__ec) { } + + recursive_directory_iterator(const path& __p, error_code& __ec) noexcept + : recursive_directory_iterator(__p, directory_options::none, &__ec) { } + + recursive_directory_iterator( + const recursive_directory_iterator&) = default; + + recursive_directory_iterator( + recursive_directory_iterator&&) noexcept = default; + + ~recursive_directory_iterator(); + + // observers + directory_options options() const { return _M_options; } + int depth() const; + bool recursion_pending() const { return _M_pending; } + + const directory_entry& operator*() const; + const directory_entry* operator->() const { return &**this; } + + // modifiers + recursive_directory_iterator& + operator=(const recursive_directory_iterator& __rhs) noexcept; + recursive_directory_iterator& + operator=(recursive_directory_iterator&& __rhs) noexcept; + + recursive_directory_iterator& operator++(); + recursive_directory_iterator& increment(error_code& __ec) noexcept; + + recursive_directory_iterator operator++(int) + { + auto __tmp = *this; + ++*this; + return __tmp; + } + + void pop(); + + void disable_recursion_pending() { _M_pending = false; } + + friend bool + operator==(const recursive_directory_iterator& __lhs, + const recursive_directory_iterator& __rhs) + { return __lhs._M_dirs == __rhs._M_dirs; } + + private: + recursive_directory_iterator(const path&, directory_options, error_code*); + + struct _Dir_stack; + std::shared_ptr<_Dir_stack> _M_dirs; + directory_options _M_options; + bool _M_pending; + }; + + inline recursive_directory_iterator + begin(recursive_directory_iterator __iter) { return __iter; } + + inline recursive_directory_iterator + end(recursive_directory_iterator) { return recursive_directory_iterator(); } + + inline bool + operator!=(const recursive_directory_iterator& __lhs, + const recursive_directory_iterator& __rhs) + { return !(__lhs == __rhs); } + +_GLIBCXX_END_NAMESPACE_CXX11 + + // @} group filesystem +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace v1 +} // namespace filesystem +} // namespace experimental +} // namespace std + +#endif // C++11 + +#endif // _GLIBCXX_EXPERIMENTAL_FS_DIR_H Index: libstdc++-v3/include/experimental/fs_fwd.h =================================================================== --- a/src/libstdc++-v3/include/experimental/fs_fwd.h (.../tags/gcc_5_2_0_release) +++ b/src/libstdc++-v3/include/experimental/fs_fwd.h (.../branches/gcc-5-branch) @@ -0,0 +1,289 @@ +// Filesystem declarations -*- C++ -*- + +// Copyright (C) 2014-2015 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file experimental/filesystem + * This is a TS C++ Library header. + */ + +#ifndef _GLIBCXX_EXPERIMENTAL_FS_FWD_H +#define _GLIBCXX_EXPERIMENTAL_FS_FWD_H 1 + +#if __cplusplus < 201103L +# include +#else + +#include +#include +#include + +namespace std _GLIBCXX_VISIBILITY(default) +{ +namespace experimental +{ +namespace filesystem +{ +inline namespace v1 +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + +#if _GLIBCXX_USE_CXX11_ABI + inline namespace __cxx11 __attribute__((__abi_tag__ ("cxx11"))) { } +#endif + + /** + * @defgroup filesystem + * @ingroup experimental + * + * Utilities for performing operations on file systems and their components, + * such as paths, regular files, and directories. + * + * @{ + */ + + class file_status; +_GLIBCXX_BEGIN_NAMESPACE_CXX11 + class path; + class filesystem_error; + class directory_entry; + class directory_iterator; + class recursive_directory_iterator; +_GLIBCXX_END_NAMESPACE_CXX11 + + struct space_info + { + uintmax_t capacity; + uintmax_t free; + uintmax_t available; + }; + + enum class file_type : signed char { + none = 0, not_found = -1, regular = 1, directory = 2, symlink = 3, + block = 4, character = 5, fifo = 6, socket = 7, unknown = 8 + }; + + /// Bitmask type + enum class copy_options : unsigned short { + none = 0, + skip_existing = 1, overwrite_existing = 2, update_existing = 4, + recursive = 8, + copy_symlinks = 16, skip_symlinks = 32, + directories_only = 64, create_symlinks = 128, create_hard_links = 256 + }; + + constexpr copy_options + operator&(copy_options __x, copy_options __y) + { + using __utype = typename std::underlying_type::type; + return static_cast( + static_cast<__utype>(__x) & static_cast<__utype>(__y)); + } + + constexpr copy_options + operator|(copy_options __x, copy_options __y) + { + using __utype = typename std::underlying_type::type; + return static_cast( + static_cast<__utype>(__x) | static_cast<__utype>(__y)); + } + + constexpr copy_options + operator^(copy_options __x, copy_options __y) + { + using __utype = typename std::underlying_type::type; + return static_cast( + static_cast<__utype>(__x) ^ static_cast<__utype>(__y)); + } + + constexpr copy_options + operator~(copy_options __x) + { + using __utype = typename std::underlying_type::type; + return static_cast(~static_cast<__utype>(__x)); + } + + inline copy_options& + operator&=(copy_options& __x, copy_options __y) + { return __x = __x & __y; } + + inline copy_options& + operator|=(copy_options& __x, copy_options __y) + { return __x = __x | __y; } + + inline copy_options& + operator^=(copy_options& __x, copy_options __y) + { return __x = __x ^ __y; } + + + /// Bitmask type + enum class perms : unsigned { + none = 0, + owner_read = 0400, + owner_write = 0200, + owner_exec = 0100, + owner_all = 0700, + group_read = 040, + group_write = 020, + group_exec = 010, + group_all = 070, + others_read = 04, + others_write = 02, + others_exec = 01, + others_all = 07, + all = 0777, + set_uid = 04000, + set_gid = 02000, + sticky_bit = 01000, + mask = 07777, + unknown = 0xFFFF, + add_perms = 0x10000, + remove_perms = 0x20000, + resolve_symlinks = 0x40000 + }; + + constexpr perms + operator&(perms __x, perms __y) + { + using __utype = typename std::underlying_type::type; + return static_cast( + static_cast<__utype>(__x) & static_cast<__utype>(__y)); + } + + constexpr perms + operator|(perms __x, perms __y) + { + using __utype = typename std::underlying_type::type; + return static_cast( + static_cast<__utype>(__x) | static_cast<__utype>(__y)); + } + + constexpr perms + operator^(perms __x, perms __y) + { + using __utype = typename std::underlying_type::type; + return static_cast( + static_cast<__utype>(__x) ^ static_cast<__utype>(__y)); + } + + constexpr perms + operator~(perms __x) + { + using __utype = typename std::underlying_type::type; + return static_cast(~static_cast<__utype>(__x)); + } + + inline perms& + operator&=(perms& __x, perms __y) + { return __x = __x & __y; } + + inline perms& + operator|=(perms& __x, perms __y) + { return __x = __x | __y; } + + inline perms& + operator^=(perms& __x, perms __y) + { return __x = __x ^ __y; } + + // Bitmask type + enum class directory_options : unsigned char { + none = 0, follow_directory_symlink = 1, skip_permission_denied = 2 + }; + + constexpr directory_options + operator&(directory_options __x, directory_options __y) + { + using __utype = typename std::underlying_type::type; + return static_cast( + static_cast<__utype>(__x) & static_cast<__utype>(__y)); + } + + constexpr directory_options + operator|(directory_options __x, directory_options __y) + { + using __utype = typename std::underlying_type::type; + return static_cast( + static_cast<__utype>(__x) | static_cast<__utype>(__y)); + } + + constexpr directory_options + operator^(directory_options __x, directory_options __y) + { + using __utype = typename std::underlying_type::type; + return static_cast( + static_cast<__utype>(__x) ^ static_cast<__utype>(__y)); + } + + constexpr directory_options + operator~(directory_options __x) + { + using __utype = typename std::underlying_type::type; + return static_cast(~static_cast<__utype>(__x)); + } + + inline directory_options& + operator&=(directory_options& __x, directory_options __y) + { return __x = __x & __y; } + + inline directory_options& + operator|=(directory_options& __x, directory_options __y) + { return __x = __x | __y; } + + inline directory_options& + operator^=(directory_options& __x, directory_options __y) + { return __x = __x ^ __y; } + + typedef chrono::time_point file_time_type; + + // operational functions + + void copy(const path& __from, const path& __to, copy_options __options); + void copy(const path& __from, const path& __to, copy_options __options, + error_code&) noexcept; + + bool copy_file(const path& __from, const path& __to, copy_options __option); + bool copy_file(const path& __from, const path& __to, copy_options __option, + error_code&) noexcept; + + path current_path(); + + file_status status(const path&); + file_status status(const path&, error_code&) noexcept; + + bool status_known(file_status) noexcept; + + file_status symlink_status(const path&); + file_status symlink_status(const path&, error_code&) noexcept; + + bool is_regular_file(file_status) noexcept; + bool is_symlink(file_status) noexcept; + + // @} group filesystem +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace v1 +} // namespace filesystem +} // namespace experimental +} // namespace std + +#endif // C++11 + +#endif // _GLIBCXX_EXPERIMENTAL_FS_FWD_H Index: libstdc++-v3/include/experimental/fs_path.h =================================================================== --- a/src/libstdc++-v3/include/experimental/fs_path.h (.../tags/gcc_5_2_0_release) +++ b/src/libstdc++-v3/include/experimental/fs_path.h (.../branches/gcc-5-branch) @@ -0,0 +1,1016 @@ +// Class filesystem::path -*- C++ -*- + +// Copyright (C) 2014-2015 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file experimental/fs_path.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{experimental/filesystem} + */ + +#ifndef _GLIBCXX_EXPERIMENTAL_FS_PATH_H +#define _GLIBCXX_EXPERIMENTAL_FS_PATH_H 1 + +#if __cplusplus < 201103L +# include +#else + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#if defined(_WIN32) && !defined(__CYGWIN__) +# define _GLIBCXX_FILESYSTEM_IS_WINDOWS 1 +# include +#endif + +namespace std _GLIBCXX_VISIBILITY(default) +{ +namespace experimental +{ +namespace filesystem +{ +inline namespace v1 +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION +_GLIBCXX_BEGIN_NAMESPACE_CXX11 + + /** + * @ingroup filesystem + * @{ + */ + + /// A filesystem path. + class path + { + template + struct __is_encoded_char : std::false_type { }; + + template> + using __is_path_iter_src + = __and_<__is_encoded_char, + std::is_base_of>; + + template + static __is_path_iter_src<_Iter> + __is_path_src(_Iter, int); + + template + static __is_encoded_char<_CharT> + __is_path_src(const basic_string<_CharT, _Traits, _Alloc>&, int); + + template + static std::false_type + __is_path_src(const _Unknown&, ...); + + template + struct __constructible_from; + + template + struct __constructible_from<_Iter, _Iter> + : __is_path_iter_src<_Iter> + { }; + + template + struct __constructible_from<_Source, void> + : decltype(__is_path_src(std::declval<_Source>(), 0)) + { }; + + template + using _Path = typename + std::enable_if<__and_<__not_>, + __constructible_from<_Tp1, _Tp2>>::value, + path>::type; + + template + static _Source + _S_range_begin(_Source __begin) { return __begin; } + + struct __null_terminated { }; + + template + static __null_terminated + _S_range_end(_Source) { return {}; } + + template + static const _CharT* + _S_range_begin(const basic_string<_CharT, _Traits, _Alloc>& __str) + { return __str.data(); } + + template + static const _CharT* + _S_range_end(const basic_string<_CharT, _Traits, _Alloc>& __str) + { return __str.data() + __str.size(); } + + template())), + typename _Val = typename std::iterator_traits<_Iter>::value_type> + using __value_type_is_char + = typename std::enable_if::value>::type; + + public: +#ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS + typedef wchar_t value_type; + static constexpr value_type preferred_separator = L'\\'; +#else + typedef char value_type; + static constexpr value_type preferred_separator = '/'; +#endif + typedef std::basic_string string_type; + + // constructors and destructor + + path() noexcept { } + + path(const path& __p) = default; + + path(path&& __p) noexcept + : _M_pathname(std::move(__p._M_pathname)), _M_type(__p._M_type) + { + _M_split_cmpts(); + __p.clear(); + } + + template> + path(_Source const& __source) + : _M_pathname(_S_convert(_S_range_begin(__source), + _S_range_end(__source))) + { _M_split_cmpts(); } + + template> + path(_InputIterator __first, _InputIterator __last) + : _M_pathname(_S_convert(__first, __last)) + { _M_split_cmpts(); } + + template, + typename _Require2 = __value_type_is_char<_Source>> + path(_Source const& __source, const locale& __loc) + : _M_pathname(_S_convert_loc(_S_range_begin(__source), + _S_range_end(__source), __loc)) + { _M_split_cmpts(); } + + template, + typename _Require2 = __value_type_is_char<_InputIterator>> + path(_InputIterator __first, _InputIterator __last, const locale& __loc) + : _M_pathname(_S_convert_loc(__first, __last, __loc)) + { _M_split_cmpts(); } + + ~path() = default; + + // assignments + + path& operator=(const path& __p) = default; + path& operator=(path&& __p) noexcept; + + template + _Path<_Source>& + operator=(_Source const& __source) + { return *this = path(__source); } + + template + _Path<_Source>& + assign(_Source const& __source) + { return *this = path(__source); } + + template + _Path<_InputIterator, _InputIterator>& + assign(_InputIterator __first, _InputIterator __last) + { return *this = path(__first, __last); } + + // appends + + path& operator/=(const path& __p) { return _M_append(__p._M_pathname); } + + template + _Path<_Source>& + operator/=(_Source const& __source) + { return append(__source); } + + template + _Path<_Source>& + append(_Source const& __source) + { + return _M_append(_S_convert(_S_range_begin(__source), + _S_range_end(__source))); + } + + template + _Path<_InputIterator, _InputIterator>& + append(_InputIterator __first, _InputIterator __last) + { return _M_append(_S_convert(__first, __last)); } + + // concatenation + + path& operator+=(const path& __x); + path& operator+=(const string_type& __x); + path& operator+=(const value_type* __x); + path& operator+=(value_type __x); + + template + _Path<_Source>& + operator+=(_Source const& __x) { return concat(__x); } + + template + _Path<_CharT*, _CharT*>& + operator+=(_CharT __x); + + template + _Path<_Source>& + concat(_Source const& __x) + { return *this += _S_convert(_S_range_begin(__x), _S_range_end(__x)); } + + template + _Path<_InputIterator, _InputIterator>& + concat(_InputIterator __first, _InputIterator __last) + { return *this += _S_convert(__first, __last); } + + // modifiers + + void clear() noexcept { _M_pathname.clear(); _M_split_cmpts(); } + + path& make_preferred(); + path& remove_filename(); + path& replace_filename(const path& __replacement); + path& replace_extension(const path& __replacement = path()); + + void swap(path& __rhs) noexcept; + + // native format observers + + const string_type& native() const noexcept { return _M_pathname; } + const value_type* c_str() const noexcept { return _M_pathname.c_str(); } + operator string_type() const { return _M_pathname; } + + template, + typename _Allocator = std::allocator<_CharT>> + std::basic_string<_CharT, _Traits, _Allocator> + string(const _Allocator& __a = _Allocator()) const; + + std::string string() const; + std::wstring wstring() const; + std::string u8string() const; + std::u16string u16string() const; + std::u32string u32string() const; + + // generic format observers + template, + typename _Allocator = std::allocator<_CharT>> + std::basic_string<_CharT, _Traits, _Allocator> + generic_string(const _Allocator& __a = _Allocator()) const; + + std::string generic_string() const; + std::wstring generic_wstring() const; + std::string generic_u8string() const; + std::u16string generic_u16string() const; + std::u32string generic_u32string() const; + + // compare + + int compare(const path& __p) const noexcept; + int compare(const string_type& __s) const; + int compare(const value_type* __s) const; + + // decomposition + + path root_name() const; + path root_directory() const; + path root_path() const; + path relative_path() const; + path parent_path() const; + path filename() const; + path stem() const; + path extension() const; + + // query + + bool empty() const noexcept { return _M_pathname.empty(); } + bool has_root_name() const; + bool has_root_directory() const; + bool has_root_path() const; + bool has_relative_path() const; + bool has_parent_path() const; + bool has_filename() const; + bool has_stem() const; + bool has_extension() const; + bool is_absolute() const; + bool is_relative() const { return !is_absolute(); } + + // iterators + class iterator; + typedef iterator const_iterator; + + iterator begin() const; + iterator end() const; + + private: + enum class _Type : unsigned char { + _Multi, _Root_name, _Root_dir, _Filename + }; + + path(string_type __str, _Type __type) : _M_pathname(__str), _M_type(__type) + { + _GLIBCXX_DEBUG_ASSERT(!empty()); + _GLIBCXX_DEBUG_ASSERT(_M_type != _Type::_Multi); + } + + enum class _Split { _Stem, _Extension }; + + path& _M_append(const string_type& __str) + { + if (!_M_pathname.empty() && !_S_is_dir_sep(_M_pathname.back()) + && !__str.empty() && !_S_is_dir_sep(__str.front())) + _M_pathname += preferred_separator; + _M_pathname += __str; + _M_split_cmpts(); + return *this; + } + + pair _M_find_extension() const; + + template + struct _Cvt; + + static string_type + _S_convert(value_type* __src, __null_terminated) + { return string_type(__src); } + + static string_type + _S_convert(const value_type* __src, __null_terminated) + { return string_type(__src); } + + template + static string_type + _S_convert(_Iter __first, _Iter __last) + { + using __value_type = typename std::iterator_traits<_Iter>::value_type; + return _Cvt<__value_type>::_S_convert(__first, __last); + } + + template + static string_type + _S_convert(_InputIterator __src, __null_terminated) + { + using _Tp = typename std::iterator_traits<_InputIterator>::value_type; + std::basic_string<_Tp> __tmp; + while (*__src != _Tp{}) + __tmp.push_back(*__src++); + return _S_convert(__tmp.data(), __tmp.data() + __tmp.size()); + } + + static string_type + _S_convert_loc(const char* __first, const char* __last, + const std::locale& __loc); + + template + static string_type + _S_convert_loc(_Iter __first, _Iter __last, const std::locale& __loc) + { + const std::string __str(__first, __last); + return _S_convert_loc(__str.data(), __str.data()+__str.size(), __loc); + } + + template + static string_type + _S_convert_loc(_InputIterator __src, __null_terminated, + const std::locale& __loc) + { + std::string __tmp; + while (*__src != '\0') + __tmp.push_back(*__src++); + return _S_convert_loc(__tmp.data(), __tmp.data()+__tmp.size(), __loc); + } + + bool _S_is_dir_sep(value_type __ch) + { +#ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS + return __ch == L'/' || __ch == preferred_separator; +#else + return __ch == '/'; +#endif + } + + void _M_split_cmpts(); + void _M_trim(); + void _M_add_root_name(size_t __n); + void _M_add_root_dir(size_t __pos); + void _M_add_filename(size_t __pos, size_t __n); + + string_type _M_pathname; + + struct _Cmpt; + using _List = _GLIBCXX_STD_C::vector<_Cmpt>; + _List _M_cmpts; // empty unless _M_type == _Type::_Multi + _Type _M_type = _Type::_Multi; + }; + + inline void swap(path& __lhs, path& __rhs) noexcept { __lhs.swap(__rhs); } + + size_t hash_value(const path& __p) noexcept; + + /// Compare paths + inline bool operator<(const path& __lhs, const path& __rhs) noexcept + { return __lhs.compare(__rhs) < 0; } + + /// Compare paths + inline bool operator<=(const path& __lhs, const path& __rhs) noexcept + { return !(__rhs < __lhs); } + + /// Compare paths + inline bool operator>(const path& __lhs, const path& __rhs) noexcept + { return __rhs < __lhs; } + + /// Compare paths + inline bool operator>=(const path& __lhs, const path& __rhs) noexcept + { return !(__lhs < __rhs); } + + /// Compare paths + inline bool operator==(const path& __lhs, const path& __rhs) noexcept + { return __lhs.compare(__rhs) == 0; } + + /// Compare paths + inline bool operator!=(const path& __lhs, const path& __rhs) noexcept + { return !(__lhs == __rhs); } + + /// Append one path to another + inline path operator/(const path& __lhs, const path& __rhs) + { return path(__lhs) /= __rhs; } + + /// Write a path to a stream + template + basic_ostream<_CharT, _Traits>& + operator<<(basic_ostream<_CharT, _Traits>& __os, const path& __p) + { + auto __tmp = __p.string<_CharT, _Traits>(); + using __quoted_string + = std::__detail::_Quoted_string; + __os << __quoted_string{__tmp, '"', '\\'}; + return __os; + } + + /// Read a path from a stream + template + basic_istream<_CharT, _Traits>& + operator>>(basic_istream<_CharT, _Traits>& __is, path& __p) + { + basic_string<_CharT, _Traits> __tmp; + using __quoted_string + = std::__detail::_Quoted_string; + if (__is >> __quoted_string{ __tmp, '"', '\\' }) + __p = std::move(__tmp); + return __is; + } + + // TODO constrain with _Path and __value_type_is_char + template + inline path + u8path(const _Source& __source) + { +#ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS + return path{ path::string_type{__source} }; +#else + return path{ __source }; +#endif + } + + // TODO constrain with _Path and __value_type_is_char + template + inline path + u8path(_InputIterator __first, _InputIterator __last) + { +#ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS + return path{ path::string_type{__first, __last} }; +#else + return path{ __first, __last }; +#endif + } + + class filesystem_error : public std::system_error + { + public: + filesystem_error(const string& __what_arg, error_code __ec) + : system_error(__ec, __what_arg) { } + + filesystem_error(const string& __what_arg, const path& __p1, + error_code __ec) + : system_error(__ec, __what_arg), _M_path1(__p1) { } + + filesystem_error(const string& __what_arg, const path& __p1, + const path& __p2, error_code __ec) + : system_error(__ec, __what_arg), _M_path1(__p1), _M_path2(__p2) + { } + + ~filesystem_error(); + + const path& path1() const noexcept { return _M_path1; } + const path& path2() const noexcept { return _M_path2; } + const char* what() const noexcept { return _M_what.c_str(); } + + private: + std::string _M_gen_what(); + + path _M_path1; + path _M_path2; + std::string _M_what = _M_gen_what(); + }; + + struct path::_Cmpt : path + { + _Cmpt(string_type __s, _Type __t, size_t __pos) + : path(std::move(__s), __t), _M_pos(__pos) { } + + _Cmpt() : _M_pos(-1) { } + + size_t _M_pos; + }; + + template<> + struct path::__is_encoded_char : std::true_type + { using value_type = char; }; + + template<> + struct path::__is_encoded_char : std::true_type + { using value_type = wchar_t; }; + + template<> + struct path::__is_encoded_char : std::true_type + { using value_type = char16_t; }; + + template<> + struct path::__is_encoded_char : std::true_type + { using value_type = char32_t; }; + + // specialize _Cvt for degenerate 'noconv' case + template<> + struct path::_Cvt + { + template + static string_type + _S_convert(_Iter __first, _Iter __last) + { return string_type{__first, __last}; } + }; + + template + struct path::_Cvt + { +#ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS + static string_type + _S_wconvert(const char* __f, const char* __l, true_type) + { + using _Cvt = std::codecvt; + const auto& __cvt = std::use_facet<_Cvt>(std::locale{}); + std::wstring __wstr; + if (__str_codecvt_in(__f, __l, __wstr, __cvt)) + return __wstr; + _GLIBCXX_THROW_OR_ABORT(filesystem_error( + "Cannot convert character sequence", + std::make_error_code(errc::illegal_byte_sequence))); + } + + static string_type + _S_wconvert(const _CharT* __f, const _CharT* __l, false_type) + { + std::codecvt_utf8<_CharT> __cvt; + std::string __str; + if (__str_codecvt_out(__f, __l, __str, __cvt)) + { + const char* __f2 = __str.data(); + const char* __l2 = __f2 + __str.size(); + std::codecvt_utf8 __wcvt; + std::wstring __wstr; + if (__str_codecvt_in(__f2, __l2, __wstr, __wcvt)) + return __wstr; + } + _GLIBCXX_THROW_OR_ABORT(filesystem_error( + "Cannot convert character sequence", + std::make_error_code(errc::illegal_byte_sequence))); + } + + static string_type + _S_convert(const _CharT* __f, const _CharT* __l) + { + return _S_wconvert(__f, __l, is_same<_CharT, char>{}); + } +#else + static string_type + _S_convert(const _CharT* __f, const _CharT* __l) + { + std::codecvt_utf8<_CharT> __cvt; + std::string __str; + if (__str_codecvt_out(__f, __l, __str, __cvt)) + return __str; + _GLIBCXX_THROW_OR_ABORT(filesystem_error( + "Cannot convert character sequence", + std::make_error_code(errc::illegal_byte_sequence))); + } +#endif + + static string_type + _S_convert(_CharT* __f, _CharT* __l) + { + return _S_convert(const_cast(__f), + const_cast(__l)); + } + + template + static string_type + _S_convert(_Iter __first, _Iter __last) + { + const std::basic_string<_CharT> __str(__first, __last); + return _S_convert(__str.data(), __str.data() + __str.size()); + } + + template + static string_type + _S_convert(__gnu_cxx::__normal_iterator<_Iter, _Cont> __first, + __gnu_cxx::__normal_iterator<_Iter, _Cont> __last) + { return _S_convert(__first.base(), __last.base()); } + }; + + /// An iterator for the components of a path + class path::iterator + { + public: + using difference_type = std::ptrdiff_t; + using value_type = path; + using reference = const path&; + using pointer = const path*; + using iterator_category = std::bidirectional_iterator_tag; + + iterator() : _M_path(nullptr), _M_cur(), _M_at_end() { } + + iterator(const iterator&) = default; + iterator& operator=(const iterator&) = default; + + reference operator*() const; + pointer operator->() const { return std::__addressof(**this); } + + iterator& operator++(); + iterator operator++(int) { auto __tmp = *this; ++_M_cur; return __tmp; } + + iterator& operator--(); + iterator operator--(int) { auto __tmp = *this; --_M_cur; return __tmp; } + + friend bool operator==(const iterator& __lhs, const iterator& __rhs) + { return __lhs._M_equals(__rhs); } + + friend bool operator!=(const iterator& __lhs, const iterator& __rhs) + { return !__lhs._M_equals(__rhs); } + + private: + friend class path; + + iterator(const path* __path, path::_List::const_iterator __iter) + : _M_path(__path), _M_cur(__iter), _M_at_end() + { } + + iterator(const path* __path, bool __at_end) + : _M_path(__path), _M_cur(), _M_at_end(__at_end) + { } + + bool _M_equals(iterator) const; + + const path* _M_path; + path::_List::const_iterator _M_cur; + bool _M_at_end; // only used when type != _Multi + }; + + + inline path& + path::operator=(path&& __p) noexcept + { + _M_pathname = std::move(__p._M_pathname); + _M_cmpts = std::move(__p._M_cmpts); + _M_type = __p._M_type; + __p.clear(); + return *this; + } + + inline path& + path::operator+=(const path& __p) + { + return operator+=(__p.native()); + } + + inline path& + path::operator+=(const string_type& __x) + { + _M_pathname += __x; + _M_split_cmpts(); + return *this; + } + + inline path& + path::operator+=(const value_type* __x) + { + _M_pathname += __x; + _M_split_cmpts(); + return *this; + } + + inline path& + path::operator+=(value_type __x) + { + _M_pathname += __x; + _M_split_cmpts(); + return *this; + } + + template + inline path::_Path<_CharT*, _CharT*>& + path::operator+=(_CharT __x) + { + auto* __addr = std::__addressof(__x); + return concat(__addr, __addr + 1); + } + + inline path& + path::make_preferred() + { +#ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS + std::replace(_M_pathname.begin(), _M_pathname.end(), L'/', + preferred_separator); +#endif + return *this; + } + + inline void path::swap(path& __rhs) noexcept + { + _M_pathname.swap(__rhs._M_pathname); + _M_cmpts.swap(__rhs._M_cmpts); + std::swap(_M_type, __rhs._M_type); + } + + template + inline std::basic_string<_CharT, _Traits, _Allocator> + path::string(const _Allocator& __a) const + { + if (is_same<_CharT, value_type>::value) + return { _M_pathname.begin(), _M_pathname.end(), __a }; + + const value_type* __first = _M_pathname.data(); + const value_type* __last = __first + _M_pathname.size(); + +#ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS + using _CharAlloc = __alloc_rebind<_Allocator, char>; + using _String = basic_string, _CharAlloc>; + using _WString = basic_string<_CharT, _Traits, _Allocator>; + + // use codecvt_utf8 to convert native string to UTF-8 + codecvt_utf8 __cvt; + _String __u8str{_CharAlloc{__a}}; + if (__str_codecvt_out(__first, __last, __u8str, __cvt)) + { + struct + { + const _String* + operator()(const _String& __from, _String&, true_type) + { return std::__addressof(__from); } + + _WString* + operator()(const _String& __from, _WString& __to, false_type) + { + // use codecvt_utf8<_CharT> to convert UTF-8 to wide string + codecvt_utf8<_CharT> __cvt; + const char* __f = __from.data(); + const char* __l = __f + __from.size(); + if (__str_codecvt_in(__f, __l, __to, __cvt)) + return std::__addressof(__to); + return nullptr; + } + } __dispatch; + _WString __wstr; + if (auto* __p = __dispatch(__u8str, __wstr, is_same<_CharT, char>{})) + return *__p; + } +#else + codecvt_utf8<_CharT> __cvt; + basic_string<_CharT, _Traits, _Allocator> __wstr{__a}; + if (__str_codecvt_in(__first, __last, __wstr, __cvt)) + return __wstr; +#endif + _GLIBCXX_THROW_OR_ABORT(filesystem_error( + "Cannot convert character sequence", + std::make_error_code(errc::illegal_byte_sequence))); + } + + inline std::string + path::string() const { return string(); } + + inline std::wstring + path::wstring() const { return string(); } + + inline std::string + path::u8string() const + { +#ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS + std::string __str; + // convert from native encoding to UTF-8 + codecvt_utf8 __cvt; + const value_type* __first = _M_pathname.data(); + const value_type* __last = __first + _M_pathname.size(); + if (__str_codecvt_out(__first, __last, __str, __cvt)) + return __str; + _GLIBCXX_THROW_OR_ABORT(filesystem_error( + "Cannot convert character sequence", + std::make_error_code(errc::illegal_byte_sequence))); +#else + return _M_pathname; +#endif + } + + inline std::u16string + path::u16string() const { return string(); } + + inline std::u32string + path::u32string() const { return string(); } + +#ifndef _GLIBCXX_FILESYSTEM_IS_WINDOWS + template + inline std::basic_string<_CharT, _Traits, _Allocator> + path::generic_string(const _Allocator& __a) const + { return string<_CharT, _Traits, _Allocator>(__a); } + + inline std::string + path::generic_string() const { return string(); } + + inline std::wstring + path::generic_wstring() const { return wstring(); } + + inline std::string + path::generic_u8string() const { return u8string(); } + + inline std::u16string + path::generic_u16string() const { return u16string(); } + + inline std::u32string + path::generic_u32string() const { return u32string(); } +#endif + + inline int + path::compare(const string_type& __s) const { return compare(path(__s)); } + + inline int + path::compare(const value_type* __s) const { return compare(path(__s)); } + + inline path + path::filename() const { return empty() ? path() : *--end(); } + + inline path + path::stem() const + { + auto ext = _M_find_extension(); + if (ext.first && ext.second != 0) + return path{ext.first->substr(0, ext.second)}; + return {}; + } + + inline path + path::extension() const + { + auto ext = _M_find_extension(); + if (ext.first && ext.second != string_type::npos) + return path{ext.first->substr(ext.second)}; + return {}; + } + + inline bool + path::has_stem() const + { + auto ext = _M_find_extension(); + return ext.first && ext.second != 0; + } + + inline bool + path::has_extension() const + { + auto ext = _M_find_extension(); + return ext.first && ext.second != string_type::npos; + } + + inline bool + path::is_absolute() const + { +#ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS + return has_root_name(); +#else + return has_root_directory(); +#endif + } + + inline path::iterator + path::begin() const + { + if (_M_type == _Type::_Multi) + return iterator(this, _M_cmpts.begin()); + return iterator(this, false); + } + + inline path::iterator + path::end() const + { + if (_M_type == _Type::_Multi) + return iterator(this, _M_cmpts.end()); + return iterator(this, true); + } + + inline path::iterator& + path::iterator::operator++() + { + _GLIBCXX_DEBUG_ASSERT(_M_path != nullptr); + if (_M_path->_M_type == _Type::_Multi) + { + _GLIBCXX_DEBUG_ASSERT(_M_cur != _M_path->_M_cmpts.end()); + ++_M_cur; + } + else + { + _GLIBCXX_DEBUG_ASSERT(!_M_at_end); + _M_at_end = true; + } + return *this; + } + + inline path::iterator& + path::iterator::operator--() + { + _GLIBCXX_DEBUG_ASSERT(_M_path != nullptr); + if (_M_path->_M_type == _Type::_Multi) + { + _GLIBCXX_DEBUG_ASSERT(_M_cur != _M_path->_M_cmpts.begin()); + --_M_cur; + } + else + { + _GLIBCXX_DEBUG_ASSERT(_M_at_end); + _M_at_end = false; + } + return *this; + } + + inline path::iterator::reference + path::iterator::operator*() const + { + _GLIBCXX_DEBUG_ASSERT(_M_path != nullptr); + if (_M_path->_M_type == _Type::_Multi) + { + _GLIBCXX_DEBUG_ASSERT(_M_cur != _M_path->_M_cmpts.end()); + return *_M_cur; + } + return *_M_path; + } + + inline bool + path::iterator::_M_equals(iterator __rhs) const + { + if (_M_path != __rhs._M_path) + return false; + if (_M_path == nullptr) + return true; + if (_M_path->_M_type == path::_Type::_Multi) + return _M_cur == __rhs._M_cur; + return _M_at_end == __rhs._M_at_end; + } + + // @} group filesystem +_GLIBCXX_END_NAMESPACE_CXX11 +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace v1 +} // namespace filesystem +} // namespace experimental +} // namespace std + +#endif // C++11 + +#endif // _GLIBCXX_EXPERIMENTAL_FS_PATH_H Index: libstdc++-v3/include/bits/regex_compiler.h =================================================================== --- a/src/libstdc++-v3/include/bits/regex_compiler.h (.../tags/gcc_5_2_0_release) +++ b/src/libstdc++-v3/include/bits/regex_compiler.h (.../branches/gcc-5-branch) @@ -116,8 +116,10 @@ void _M_insert_bracket_matcher(bool __neg); + // Returns true if successfully matched one term and should continue. + // Returns false if the compiler should move on. template - void + bool _M_expression_term(pair& __last_char, _BracketMatcher<_TraitsT, __icase, __collate>& __matcher); @@ -389,8 +391,8 @@ #endif } - void - _M_add_collating_element(const _StringT& __s) + _StringT + _M_add_collate_element(const _StringT& __s) { auto __st = _M_traits.lookup_collatename(__s.data(), __s.data() + __s.size()); @@ -400,6 +402,7 @@ #ifdef _GLIBCXX_DEBUG _M_is_ready = false; #endif + return __st; } void Index: libstdc++-v3/include/bits/locale_conv.h =================================================================== --- a/src/libstdc++-v3/include/bits/locale_conv.h (.../tags/gcc_5_2_0_release) +++ b/src/libstdc++-v3/include/bits/locale_conv.h (.../branches/gcc-5-branch) @@ -51,7 +51,114 @@ * @{ */ + template + bool + __do_str_codecvt(const _InChar* __first, const _InChar* __last, + _OutStr& __outstr, const _Codecvt& __cvt, _State& __state, + size_t& __count, _Fn __fn) + { + if (__first == __last) + { + __outstr.clear(); + __count = 0; + return true; + } + + size_t __outchars = 0; + auto __next = __first; + const auto __maxlen = __cvt.max_length() + 1; + + codecvt_base::result __result; + do + { + __outstr.resize(__outstr.size() + (__last - __next) * __maxlen); + auto __outnext = &__outstr.front() + __outchars; + auto const __outlast = &__outstr.back() + 1; + __result = (__cvt.*__fn)(__state, __next, __last, __next, + __outnext, __outlast, __outnext); + __outchars = __outnext - &__outstr.front(); + } + while (__result == codecvt_base::partial && __next != __last + && (__outstr.size() - __outchars) < __maxlen); + + if (__result == codecvt_base::error) + return false; + + if (__result == codecvt_base::noconv) + { + __outstr.assign(__first, __last); + __count = __last - __first; + } + else + { + __outstr.resize(__outchars); + __count = __next - __first; + } + + return true; + } + + // Convert narrow character string to wide. + template + inline bool + __str_codecvt_in(const char* __first, const char* __last, + basic_string<_CharT, _Traits, _Alloc>& __outstr, + const codecvt<_CharT, char, _State>& __cvt, + _State& __state, size_t& __count) + { + using _Codecvt = codecvt<_CharT, char, _State>; + using _ConvFn + = codecvt_base::result + (_Codecvt::*)(_State&, const char*, const char*, const char*&, + _CharT*, _CharT*, _CharT*&) const; + _ConvFn __fn = &codecvt<_CharT, char, _State>::in; + return __do_str_codecvt(__first, __last, __outstr, __cvt, __state, + __count, __fn); + } + + template + inline bool + __str_codecvt_in(const char* __first, const char* __last, + basic_string<_CharT, _Traits, _Alloc>& __outstr, + const codecvt<_CharT, char, _State>& __cvt) + { + _State __state = {}; + size_t __n; + return __str_codecvt_in(__first, __last, __outstr, __cvt, __state, __n); + } + + // Convert wide character string to narrow. + template + inline bool + __str_codecvt_out(const _CharT* __first, const _CharT* __last, + basic_string& __outstr, + const codecvt<_CharT, char, _State>& __cvt, + _State& __state, size_t& __count) + { + using _Codecvt = codecvt<_CharT, char, _State>; + using _ConvFn + = codecvt_base::result + (_Codecvt::*)(_State&, const _CharT*, const _CharT*, const _CharT*&, + char*, char*, char*&) const; + _ConvFn __fn = &codecvt<_CharT, char, _State>::out; + return __do_str_codecvt(__first, __last, __outstr, __cvt, __state, + __count, __fn); + } + + template + inline bool + __str_codecvt_out(const _CharT* __first, const _CharT* __last, + basic_string& __outstr, + const codecvt<_CharT, char, _State>& __cvt) + { + _State __state = {}; + size_t __n; + return __str_codecvt_out(__first, __last, __outstr, __cvt, __state, __n); + } + _GLIBCXX_BEGIN_NAMESPACE_CXX11 + /// String conversions template, @@ -137,9 +244,15 @@ wide_string from_bytes(const char* __first, const char* __last) { - auto __errstr = _M_with_strings ? &_M_wide_err_string : nullptr; - _ConvFn __fn = &_Codecvt::in; - return _M_conv(__first, __last, __errstr, __fn); + if (!_M_with_cvtstate) + _M_state = state_type(); + wide_string __out{ _M_wide_err_string.get_allocator() }; + if (__str_codecvt_in(__first, __last, __out, *_M_cvt, _M_state, + _M_count)) + return __out; + if (_M_with_strings) + return _M_wide_err_string; + __throw_range_error("wstring_convert::from_bytes"); } /// @} @@ -167,9 +280,15 @@ byte_string to_bytes(const _Elem* __first, const _Elem* __last) { - auto __errstr = _M_with_strings ? &_M_byte_err_string : nullptr; - _ConvFn<_Elem, char> __fn = &_Codecvt::out; - return _M_conv(__first, __last, __errstr, __fn); + if (!_M_with_cvtstate) + _M_state = state_type(); + byte_string __out{ _M_byte_err_string.get_allocator() }; + if (__str_codecvt_out(__first, __last, __out, *_M_cvt, _M_state, + _M_count)) + return __out; + if (_M_with_strings) + return _M_byte_err_string; + __throw_range_error("wstring_convert::to_bytes"); } /// @} @@ -182,63 +301,6 @@ state_type state() const { return _M_state; } private: - template - using _ConvFn - = codecvt_base::result - (_Codecvt::*)(state_type&, const _InC*, const _InC*, const _InC*&, - _OutC*, _OutC*, _OutC*&) const; - - template - _OutStr - _M_conv(const _InChar* __first, const _InChar* __last, - const _OutStr* __err, _MemFn __memfn) - { - auto __outstr = __err ? _OutStr(__err->get_allocator()) : _OutStr(); - - if (__first == __last) - { - _M_count = 0; - return __outstr; - } - - if (!_M_with_cvtstate) - _M_state = state_type(); - - size_t __outchars = 0; - auto __next = __first; - const auto __maxlen = _M_cvt->max_length() + 1; - - codecvt_base::result __result; - do - { - __outstr.resize(__outstr.size() + (__last - __next) * __maxlen); - auto __outnext = &__outstr.front() + __outchars; - auto const __outlast = &__outstr.back() + 1; - __result = ((*_M_cvt).*__memfn)(_M_state, __next, __last, __next, - __outnext, __outlast, __outnext); - __outchars = __outnext - &__outstr.front(); - } - while (__result == codecvt_base::partial && __next != __last - && (__outstr.size() - __outchars) < __maxlen); - - if (__result == codecvt_base::noconv) - { - __outstr.assign(__first, __last); - _M_count = __outstr.size(); - return __outstr; - } - - __outstr.resize(__outchars); - _M_count = __next - __first; - - if (__result != codecvt_base::error) - return __outstr; - else if (__err) - return *__err; - else - __throw_range_error("wstring_convert"); - } - unique_ptr<_Codecvt> _M_cvt; byte_string _M_byte_err_string; wide_string _M_wide_err_string; @@ -247,6 +309,7 @@ bool _M_with_cvtstate = false; bool _M_with_strings = false; }; + _GLIBCXX_END_NAMESPACE_CXX11 /// Buffer conversions Index: libstdc++-v3/include/bits/regex_scanner.tcc =================================================================== --- a/src/libstdc++-v3/include/bits/regex_scanner.tcc (.../tags/gcc_5_2_0_release) +++ b/src/libstdc++-v3/include/bits/regex_scanner.tcc (.../branches/gcc-5-branch) @@ -99,6 +99,12 @@ auto __c = *_M_current++; const char* __pos; + if (std::strchr(_M_spec_char, _M_ctype.narrow(__c, '\0')) == nullptr) + { + _M_token = _S_token_ord_char; + _M_value.assign(1, __c); + return; + } if (__c == '\\') { if (_M_current == _M_end) Index: libstdc++-v3/include/bits/quoted_string.h =================================================================== --- a/src/libstdc++-v3/include/bits/quoted_string.h (.../tags/gcc_5_2_0_release) +++ b/src/libstdc++-v3/include/bits/quoted_string.h (.../branches/gcc-5-branch) @@ -0,0 +1,164 @@ +// Helpers for quoted stream manipulators -*- C++ -*- + +// Copyright (C) 2013-2015 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file bits/quoted_string.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{iomanip} + */ + +#ifndef _GLIBCXX_QUOTED_STRING_H +#define _GLIBCXX_QUOTED_STRING_H 1 + +#pragma GCC system_header + +#if __cplusplus < 201103L +# include +#else +#include + +namespace std _GLIBCXX_VISIBILITY(default) +{ + namespace __detail { + _GLIBCXX_BEGIN_NAMESPACE_VERSION + + /** + * @brief Struct for delimited strings. + */ + template + struct _Quoted_string + { + static_assert(is_reference<_String>::value + || is_pointer<_String>::value, + "String type must be pointer or reference"); + + _Quoted_string(_String __str, _CharT __del, _CharT __esc) + : _M_string(__str), _M_delim{__del}, _M_escape{__esc} + { } + + _Quoted_string& + operator=(_Quoted_string&) = delete; + + _String _M_string; + _CharT _M_delim; + _CharT _M_escape; + }; + + /** + * @brief Inserter for quoted strings. + * + * _GLIBCXX_RESOLVE_LIB_DEFECTS + * DR 2344 quoted()'s interaction with padding is unclear + */ + template + std::basic_ostream<_CharT, _Traits>& + operator<<(std::basic_ostream<_CharT, _Traits>& __os, + const _Quoted_string& __str) + { + std::basic_ostringstream<_CharT, _Traits> __ostr; + __ostr << __str._M_delim; + for (const _CharT* __c = __str._M_string; *__c; ++__c) + { + if (*__c == __str._M_delim || *__c == __str._M_escape) + __ostr << __str._M_escape; + __ostr << *__c; + } + __ostr << __str._M_delim; + + return __os << __ostr.str(); + } + + /** + * @brief Inserter for quoted strings. + * + * _GLIBCXX_RESOLVE_LIB_DEFECTS + * DR 2344 quoted()'s interaction with padding is unclear + */ + template + std::basic_ostream<_CharT, _Traits>& + operator<<(std::basic_ostream<_CharT, _Traits>& __os, + const _Quoted_string<_String, _CharT>& __str) + { + std::basic_ostringstream<_CharT, _Traits> __ostr; + __ostr << __str._M_delim; + for (auto& __c : __str._M_string) + { + if (__c == __str._M_delim || __c == __str._M_escape) + __ostr << __str._M_escape; + __ostr << __c; + } + __ostr << __str._M_delim; + + return __os << __ostr.str(); + } + + /** + * @brief Extractor for delimited strings. + * The left and right delimiters can be different. + */ + template + std::basic_istream<_CharT, _Traits>& + operator>>(std::basic_istream<_CharT, _Traits>& __is, + const _Quoted_string&, + _CharT>& __str) + { + _CharT __c; + __is >> __c; + if (!__is.good()) + return __is; + if (__c != __str._M_delim) + { + __is.unget(); + __is >> __str._M_string; + return __is; + } + __str._M_string.clear(); + std::ios_base::fmtflags __flags + = __is.flags(__is.flags() & ~std::ios_base::skipws); + do + { + __is >> __c; + if (!__is.good()) + break; + if (__c == __str._M_escape) + { + __is >> __c; + if (!__is.good()) + break; + } + else if (__c == __str._M_delim) + break; + __str._M_string += __c; + } + while (true); + __is.setf(__flags); + + return __is; + } + + _GLIBCXX_END_NAMESPACE_VERSION + } // namespace __detail +} // namespace std + +#endif // C++11 +#endif /* _GLIBCXX_QUOTED_STRING_H */ Index: libstdc++-v3/include/bits/regex_compiler.tcc =================================================================== --- a/src/libstdc++-v3/include/bits/regex_compiler.tcc (.../tags/gcc_5_2_0_release) +++ b/src/libstdc++-v3/include/bits/regex_compiler.tcc (.../branches/gcc-5-branch) @@ -424,8 +424,7 @@ __last_char.first = true; __last_char.second = _M_value[0]; } - while (!_M_match_token(_ScannerT::_S_token_bracket_end)) - _M_expression_term(__last_char, __matcher); + while (_M_expression_term(__last_char, __matcher)); __matcher._M_ready(); _M_stack.push(_StateSeqT( *_M_nfa, @@ -434,21 +433,31 @@ template template - void + bool _Compiler<_TraitsT>:: _M_expression_term(pair& __last_char, _BracketMatcher<_TraitsT, __icase, __collate>& __matcher) { + if (_M_match_token(_ScannerT::_S_token_bracket_end)) + return false; + if (_M_match_token(_ScannerT::_S_token_collsymbol)) - __matcher._M_add_collating_element(_M_value); + { + auto __symbol = __matcher._M_add_collate_element(_M_value); + if (__symbol.size() == 1) + { + __last_char.first = true; + __last_char.second = __symbol[0]; + } + } else if (_M_match_token(_ScannerT::_S_token_equiv_class_name)) __matcher._M_add_equivalence_class(_M_value); else if (_M_match_token(_ScannerT::_S_token_char_class_name)) __matcher._M_add_character_class(_M_value, false); - // POSIX doesn't permit '-' as a start-range char (say [a-z--0]), - // except when the '-' is the first character in the bracket expression - // ([--0]). ECMAScript treats all '-' after a range as a normal character. - // Also see above, where _M_expression_term gets called. + // POSIX doesn't allow '-' as a start-range char (say [a-z--0]), + // except when the '-' is the first or last character in the bracket + // expression ([--0]). ECMAScript treats all '-' after a range as a + // normal character. Also see above, where _M_expression_term gets called. // // As a result, POSIX rejects [-----], but ECMAScript doesn't. // Boost (1.57.0) always uses POSIX style even in its ECMAScript syntax. @@ -459,10 +468,14 @@ { if (!__last_char.first) { + __matcher._M_add_char(_M_value[0]); if (_M_value[0] == '-' && !(_M_flags & regex_constants::ECMAScript)) - __throw_regex_error(regex_constants::error_range); - __matcher._M_add_char(_M_value[0]); + { + if (_M_match_token(_ScannerT::_S_token_bracket_end)) + return false; + __throw_regex_error(regex_constants::error_range); + } __last_char.first = true; __last_char.second = _M_value[0]; } @@ -496,6 +509,8 @@ _M_value[0])); else __throw_regex_error(regex_constants::error_brack); + + return true; } template Index: libstdc++-v3/include/Makefile.am =================================================================== --- a/src/libstdc++-v3/include/Makefile.am (.../tags/gcc_5_2_0_release) +++ b/src/libstdc++-v3/include/Makefile.am (.../branches/gcc-5-branch) @@ -128,6 +128,7 @@ ${bits_srcdir}/postypes.h \ ${bits_srcdir}/predefined_ops.h \ ${bits_srcdir}/ptr_traits.h \ + ${bits_srcdir}/quoted_string.h \ ${bits_srcdir}/random.h \ ${bits_srcdir}/random.tcc \ ${bits_srcdir}/range_access.h \ @@ -650,11 +651,23 @@ ${experimental_srcdir}/optional \ ${experimental_srcdir}/ratio \ ${experimental_srcdir}/string_view \ + ${experimental_srcdir}/string_view.tcc \ ${experimental_srcdir}/system_error \ - ${experimental_srcdir}/string_view.tcc \ ${experimental_srcdir}/tuple \ - ${experimental_srcdir}/type_traits + ${experimental_srcdir}/type_traits \ + ${experimental_filesystem_headers} +if ENABLE_FILESYSTEM_TS +experimental_filesystem_headers = \ + ${experimental_srcdir}/filesystem \ + ${experimental_srcdir}/fs_dir.h \ + ${experimental_srcdir}/fs_fwd.h \ + ${experimental_srcdir}/fs_ops.h \ + ${experimental_srcdir}/fs_path.h +else +experimental_filesystem_headers = +endif + # This is the common subset of C++ files that all three "C" header models use. c_base_srcdir = $(C_INCLUDE_DIR) c_base_builddir = . Index: libstdc++-v3/libsupc++/Makefile.in =================================================================== --- a/src/libstdc++-v3/libsupc++/Makefile.in (.../tags/gcc_5_2_0_release) +++ b/src/libstdc++-v3/libsupc++/Makefile.in (.../branches/gcc-5-branch) @@ -1,9 +1,9 @@ -# Makefile.in generated by automake 1.11.1 from Makefile.am. +# Makefile.in generated by automake 1.11.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, -# Inc. +# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software +# Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -17,6 +17,23 @@ VPATH = @srcdir@ +am__make_dryrun = \ + { \ + am__dry=no; \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ + | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ + *) \ + for am__flg in $$MAKEFLAGS; do \ + case $$am__flg in \ + *=*|--*) ;; \ + *n*) am__dry=yes; break;; \ + esac; \ + done;; \ + esac; \ + test $$am__dry = yes; \ + } pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ @@ -87,6 +104,12 @@ am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } am__installdirs = "$(DESTDIR)$(toolexeclibdir)" "$(DESTDIR)$(bitsdir)" \ "$(DESTDIR)$(stddir)" LTLIBRARIES = $(noinst_LTLIBRARIES) $(toolexeclib_LTLIBRARIES) @@ -129,6 +152,11 @@ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) CXXLD = $(CXX) SOURCES = $(libsupc___la_SOURCES) $(libsupc__convenience_la_SOURCES) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac HEADERS = $(bits_HEADERS) $(std_HEADERS) ETAGS = etags CTAGS = ctags @@ -544,6 +572,7 @@ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; +$(top_srcdir)/fragment.am: $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh @@ -564,7 +593,6 @@ done install-toolexeclibLTLIBRARIES: $(toolexeclib_LTLIBRARIES) @$(NORMAL_INSTALL) - test -z "$(toolexeclibdir)" || $(MKDIR_P) "$(DESTDIR)$(toolexeclibdir)" @list='$(toolexeclib_LTLIBRARIES)'; test -n "$(toolexeclibdir)" || list=; \ list2=; for p in $$list; do \ if test -f $$p; then \ @@ -572,6 +600,8 @@ else :; fi; \ done; \ test -z "$$list2" || { \ + echo " $(MKDIR_P) '$(DESTDIR)$(toolexeclibdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(toolexeclibdir)" || exit 1; \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(toolexeclibdir)'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(toolexeclibdir)"; \ } @@ -593,9 +623,9 @@ echo "rm -f \"$${dir}/so_locations\""; \ rm -f "$${dir}/so_locations"; \ done -libsupc++.la: $(libsupc___la_OBJECTS) $(libsupc___la_DEPENDENCIES) +libsupc++.la: $(libsupc___la_OBJECTS) $(libsupc___la_DEPENDENCIES) $(EXTRA_libsupc___la_DEPENDENCIES) $(CXXLINK) -rpath $(toolexeclibdir) $(libsupc___la_OBJECTS) $(libsupc___la_LIBADD) $(LIBS) -libsupc++convenience.la: $(libsupc__convenience_la_OBJECTS) $(libsupc__convenience_la_DEPENDENCIES) +libsupc++convenience.la: $(libsupc__convenience_la_OBJECTS) $(libsupc__convenience_la_DEPENDENCIES) $(EXTRA_libsupc__convenience_la_DEPENDENCIES) $(CXXLINK) $(libsupc__convenience_la_OBJECTS) $(libsupc__convenience_la_LIBADD) $(LIBS) mostlyclean-compile: @@ -696,10 +726,15 @@ installcheck: installcheck-am install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi mostlyclean-generic: clean-generic: Index: libstdc++-v3/ChangeLog =================================================================== --- a/src/libstdc++-v3/ChangeLog (.../tags/gcc_5_2_0_release) +++ b/src/libstdc++-v3/ChangeLog (.../branches/gcc-5-branch) @@ -1,3 +1,144 @@ +2015-08-28 Tim Shen + + Backport from mainline + 2015-08-28 Tim Shen + + PR libstdc++/67362 + * include/bits/regex_scanner.tcc (_Scanner<>::_M_scan_normal): + Always returns ordinary char token if the char isn't + considered a special char. + * testsuite/28_regex/regression.cc: New test file for collecting + regression testcases from, typically, bugzilla. + +2015-08-20 Jonathan Wakely + + * python/Makefile.am: Ensure gdb.py is installed for libstdc++ not + libstdc++fs. + * python/Makefile.in: Regenerate. + +2015-08-18 Jonathan Wakely + + Backport Filesystem TS from mainline + * acinclude.m4 (GLIBCXX_ENABLE_FILESYSTEM_TS, + GLIBCXX_CHECK_FILESYSTEM_DEPS): Define. + * configure.ac: Use them. + * configure: Regenerate. + * config.h.in: Regenerate. + * include/Makefile.am: Add filesystem headers. Fix order of headers. + * include/Makefile.in: Regenerate. + * include/bits/locale_conv.h (__do_str_codecvt, __str_codecvt_in, + __str_codecvt_out, wstring_convert): Refactor to move all conversion + logic to non-member functions. + * include/bits/quoted_string.h (_Quoted_string, operator<<, + operator>>): Move from to new header. + * 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, operator<<, operator>>): Move + to . + * libstdcxx/v6/printers.py (StdExpPathPrinter): Define. + * scripts/testsuite_flags.in: Add filesystem dir to ldflags. + * src/Makefile.am: Add filesystem sub-dir. + * 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/operations/exists.cc: New. + * testsuite/experimental/filesystem/operations/file_size.cc: New. + * testsuite/experimental/filesystem/operations/status.cc: New. + * testsuite/experimental/filesystem/operations/temp_directory_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/lib/dg-options.exp (dg-require-filesystem-ts): Define. + * testsuite/lib/libstdc++.exp (check_v3_target_filesystem_ts): Define. + * testsuite/util/testsuite_fs.h: New. + +2015-08-18 Jonathan Wakely + + * Makefile.in: Regenerate with automake-1.11.6. + * aclocal.m4: Likewise. + * configure: Likewise. + * doc/Makefile.in: Likewise. + * include/Makefile.in: Likewise. + * libsupc++/Makefile.in: Likewise. + * po/Makefile.in: Likewise. + * python/Makefile.in: Likewise. + * src/Makefile.in: Likewise. + * src/c++11/Makefile.in: Likewise. + * src/c++98/Makefile.in: Likewise. + * testsuite/Makefile.in: Likewise. + +2015-07-29 Tim Shen + + Backport from mainline + 2015-07-29 Tim Shen + + PR libstdc++/67015 + * include/bits/regex_compiler.h (_Compiler<>::_M_expression_term, + _BracketMatcher<>::_M_add_collating_element): Change signature + to make checking the and of bracket expression easier. + * include/bits/regex_compiler.tcc (_Compiler<>::_M_expression_term): + Treat '-' as a valid literal if it's at the end of bracket expression. + * testsuite/28_regex/algorithms/regex_match/cstring_bracket_01.cc: + New testcases. + 2015-07-16 Release Manager * GCC 5.2.0 released. Index: libstdc++-v3/testsuite/Makefile.in =================================================================== --- a/src/libstdc++-v3/testsuite/Makefile.in (.../tags/gcc_5_2_0_release) +++ b/src/libstdc++-v3/testsuite/Makefile.in (.../branches/gcc-5-branch) @@ -1,9 +1,9 @@ -# Makefile.in generated by automake 1.11.1 from Makefile.am. +# Makefile.in generated by automake 1.11.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, -# Inc. +# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software +# Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -15,6 +15,23 @@ @SET_MAKE@ VPATH = @srcdir@ +am__make_dryrun = \ + { \ + am__dry=no; \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ + | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ + *) \ + for am__flg in $$MAKEFLAGS; do \ + case $$am__flg in \ + *=*|--*) ;; \ + *n*) am__dry=yes; break;; \ + esac; \ + done;; \ + esac; \ + test $$am__dry = yes; \ + } pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ @@ -67,6 +84,11 @@ depcomp = am__depfiles_maybe = SOURCES = +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac ABI_TWEAKS_SRCDIR = @ABI_TWEAKS_SRCDIR@ ACLOCAL = @ACLOCAL@ ALLOCATOR_H = @ALLOCATOR_H@ @@ -370,6 +392,7 @@ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; +$(top_srcdir)/fragment.am: $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh @@ -405,10 +428,15 @@ installcheck: installcheck-am install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi mostlyclean-generic: clean-generic: Index: libstdc++-v3/testsuite/28_regex/regression.cc =================================================================== --- a/src/libstdc++-v3/testsuite/28_regex/regression.cc (.../tags/gcc_5_2_0_release) +++ b/src/libstdc++-v3/testsuite/28_regex/regression.cc (.../branches/gcc-5-branch) @@ -0,0 +1,42 @@ +// { dg-options "-std=gnu++11" } + +// +// Copyright (C) 2015 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +#include +#include + +using namespace __gnu_test; +using namespace std; + +// PR libstdc++/67362 +void +test01() +{ + bool test __attribute__((unused)) = true; + + regex re("((.)", regex_constants::basic); +} + +int +main() +{ + test01(); + return 0; +} + Index: libstdc++-v3/testsuite/28_regex/algorithms/regex_match/cstring_bracket_01.cc =================================================================== --- a/src/libstdc++-v3/testsuite/28_regex/algorithms/regex_match/cstring_bracket_01.cc (.../tags/gcc_5_2_0_release) +++ b/src/libstdc++-v3/testsuite/28_regex/algorithms/regex_match/cstring_bracket_01.cc (.../branches/gcc-5-branch) @@ -82,6 +82,22 @@ VERIFY(e.code() == std::regex_constants::error_range); } std::regex re("[-----]", std::regex::ECMAScript); + + VERIFY(!regex_match("b", regex("[-ac]", regex_constants::extended))); + VERIFY(!regex_match("b", regex("[ac-]", regex_constants::extended))); + VERIFY(regex_match("b", regex("[^-ac]", regex_constants::extended))); + VERIFY(regex_match("b", regex("[^ac-]", regex_constants::extended))); + VERIFY(regex_match("&", regex("[%--]", regex_constants::extended))); + VERIFY(regex_match(".", regex("[--@]", regex_constants::extended))); + try + { + regex("[a--@]", regex_constants::extended); + VERIFY(false); + } + catch (const std::regex_error& e) + { + } + VERIFY(regex_match("].", regex("[][.hyphen.]-0]*", regex_constants::extended))); } void @@ -115,6 +131,44 @@ VERIFY(regex_match_debug("w", re)); } +// libstdc++/67015 +void +test05() +{ + bool test __attribute__((unused)) = true; + + regex lanana_namespace("^[a-z0-9]+$", regex::extended); + regex lsb_namespace("^_?([a-z0-9_.]+-, regex::extended)+[a-z0-9]+$"); + regex debian_dpkg_conffile_cruft("dpkg-(old|dist|new|tmp, regex::extended)$"); + regex debian_cron_namespace("^[a-z0-9][a-z0-9-]*$", regex::extended); + VERIFY(regex_match("test", debian_cron_namespace)); + VERIFY(!regex_match("-a", debian_cron_namespace)); + VERIFY(regex_match("a-", debian_cron_namespace)); + regex debian_cron_namespace_ok("^[a-z0-9][-a-z0-9]*$", regex::extended); + VERIFY(regex_match("test", debian_cron_namespace_ok)); + VERIFY(!regex_match("-a", debian_cron_namespace_ok)); + VERIFY(regex_match("a-", debian_cron_namespace_ok)); +} + +// libstdc++/67015 +void +test06() +{ + bool test __attribute__((unused)) = true; + + regex lanana_namespace("^[a-z0-9]+$"); + regex lsb_namespace("^_?([a-z0-9_.]+-)+[a-z0-9]+$"); + regex debian_dpkg_conffile_cruft("dpkg-(old|dist|new|tmp)$"); + regex debian_cron_namespace("^[a-z0-9][a-z0-9-]*$"); + VERIFY(regex_match("test", debian_cron_namespace)); + VERIFY(!regex_match("-a", debian_cron_namespace)); + VERIFY(regex_match("a-", debian_cron_namespace)); + regex debian_cron_namespace_ok("^[a-z0-9][-a-z0-9]*$"); + VERIFY(regex_match("test", debian_cron_namespace_ok)); + VERIFY(!regex_match("-a", debian_cron_namespace_ok)); + VERIFY(regex_match("a-", debian_cron_namespace_ok)); +} + int main() { @@ -122,5 +176,8 @@ test02(); test03(); test04(); + test05(); + test06(); + return 0; } Index: libstdc++-v3/testsuite/lib/libstdc++.exp =================================================================== --- a/src/libstdc++-v3/testsuite/lib/libstdc++.exp (.../tags/gcc_5_2_0_release) +++ b/src/libstdc++-v3/testsuite/lib/libstdc++.exp (.../branches/gcc-5-branch) @@ -1894,6 +1894,59 @@ return $et_little_endian } +proc check_v3_target_filesystem_ts { } { + global cxxflags + global DEFAULT_CXXFLAGS + global et_filesystem_ts + global tool + + if { ![info exists et_filesystem_ts_target_name] } { + set et_filesystem_ts_target_name "" + } + + # If the target has changed since we set the cached value, clear it. + set current_target [current_target_name] + if { $current_target != $et_filesystem_ts_target_name } { + verbose "check_v3_target_filesystem_ts: `$et_filesystem_ts_target_name'" 2 + set et_filesystem_ts_target_name $current_target + if [info exists et_filesystem_ts] { + verbose "check_v3_target_filesystem_ts: removing cached result" 2 + unset et_filesystem_ts + } + } + + if [info exists et_filesystem_ts] { + verbose "check_v3_target_filesystem_ts: using cached result" 2 + } else { + set et_filesystem_ts 0 + + # Set up and preprocess a C++ test program that depends + # on debug mode activated. + set src filesystem_ts[pid].cc + + set f [open $src "w"] + puts $f "#include " + puts $f "#if ! __cpp_lib_experimental_filesystem" + puts $f "# error No Filesystem TS support" + puts $f "#endif" + close $f + + set cxxflags_saved $cxxflags + set cxxflags "$cxxflags $DEFAULT_CXXFLAGS -Werror -std=gnu++11" + + set lines [v3_target_compile $src /dev/null preprocess ""] + set cxxflags $cxxflags_saved + file delete $src + + if [string match "" $lines] { + # No error message, preprocessing succeeded. + set et_filesystem_ts 1 + } + } + verbose "check_v3_target_filesystem_ts: $et_filesystem_ts" 2 + return $et_filesystem_ts +} + set additional_prunes "" if { [info exists env(GCC_RUNTEST_PARALLELIZE_DIR)] \ Index: libstdc++-v3/testsuite/lib/dg-options.exp =================================================================== --- a/src/libstdc++-v3/testsuite/lib/dg-options.exp (.../tags/gcc_5_2_0_release) +++ b/src/libstdc++-v3/testsuite/lib/dg-options.exp (.../branches/gcc-5-branch) @@ -223,6 +223,15 @@ return } +proc dg-require-filesystem-ts { args } { + if { ![ check_v3_target_filesystem_ts ] } { + upvar dg-do-what dg-do-what + set dg-do-what [list [lindex ${dg-do-what} 0] "N" "P"] + return + } + return +} + proc add_options_for_no_pch { flags } { # This forces any generated and possibly included PCH to be invalid. return "-D__GLIBCXX__=99999999" Index: libstdc++-v3/testsuite/experimental/filesystem/operations/absolute.cc =================================================================== --- a/src/libstdc++-v3/testsuite/experimental/filesystem/operations/absolute.cc (.../tags/gcc_5_2_0_release) +++ b/src/libstdc++-v3/testsuite/experimental/filesystem/operations/absolute.cc (.../branches/gcc-5-branch) @@ -0,0 +1,55 @@ +// { dg-options "-std=gnu++11 -lstdc++fs" } +// { dg-require-filesystem-ts "" } + +// Copyright (C) 2014-2015 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 15.1 Absolute [fs.op.absolute] + +#include +#include +#include + +using std::experimental::filesystem::path; + +void +test01() +{ + for (const path& p : __gnu_test::test_paths) + VERIFY( absolute(p).is_absolute() ); +} + +void +test02() +{ + path p1("/"); + VERIFY( absolute(p1) == p1 ); + VERIFY( absolute(p1, "/bar") == p1 ); + path p2("/foo"); + VERIFY( absolute(p2) == p2 ); + VERIFY( absolute(p2, "/bar") == p2 ); + path p3("foo"); + VERIFY( absolute(p3) != p3 ); + VERIFY( absolute(p3, "/bar") == "/bar/foo" ); +} + +int +main() +{ + test01(); + test02(); +} Index: libstdc++-v3/testsuite/experimental/filesystem/operations/current_path.cc =================================================================== --- a/src/libstdc++-v3/testsuite/experimental/filesystem/operations/current_path.cc (.../tags/gcc_5_2_0_release) +++ b/src/libstdc++-v3/testsuite/experimental/filesystem/operations/current_path.cc (.../branches/gcc-5-branch) @@ -0,0 +1,57 @@ +// { dg-options "-std=gnu++11 -lstdc++fs" } +// { dg-require-filesystem-ts "" } + +// Copyright (C) 2014-2015 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 15.11 Current path [fs.op.current_path] + +#include +#include +#include + +namespace fs = std::experimental::filesystem; + +void +test01() +{ + fs::path dot("."); + fs::path cwd = fs::current_path(); + std::error_code ec; + fs::path cwd2 = fs::current_path(ec); + VERIFY( cwd == cwd2 ); +} + +void +test02() +{ + auto oldwd = fs::current_path(); + auto tmpdir = fs::temp_directory_path(); + current_path(tmpdir); + VERIFY( canonical(fs::current_path()) == canonical(tmpdir) ); + std::error_code ec; + current_path(oldwd, ec); + VERIFY( canonical(fs::current_path()) == canonical(oldwd) ); + VERIFY( canonical(fs::current_path(ec)) == canonical(oldwd) ); +} + +int +main() +{ + test01(); + test02(); +} Index: libstdc++-v3/testsuite/experimental/filesystem/operations/exists.cc =================================================================== --- a/src/libstdc++-v3/testsuite/experimental/filesystem/operations/exists.cc (.../tags/gcc_5_2_0_release) +++ b/src/libstdc++-v3/testsuite/experimental/filesystem/operations/exists.cc (.../branches/gcc-5-branch) @@ -0,0 +1,58 @@ +// Copyright (C) 2015 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// { dg-options "-std=gnu++11 -lstdc++fs" } +// { dg-require-filesystem-ts "" } + +#include +#include + +using std::experimental::filesystem::path; + +void +test01() +{ + VERIFY( exists(path{"/"}) ); + VERIFY( exists(path{"/."}) ); + VERIFY( exists(path{"."}) ); +} + +void +test02() +{ + path rel{"xXxXx"}; + while (exists(rel)) + rel /= "x"; + VERIFY( !exists(rel) ); +} + +void +test03() +{ + path abs{"/xXxXx"}; + while (exists(abs)) + abs /= "x"; + VERIFY( !exists(abs) ); +} + +int +main() +{ + test01(); + test02(); + test03(); +} Index: libstdc++-v3/testsuite/experimental/filesystem/operations/status.cc =================================================================== --- a/src/libstdc++-v3/testsuite/experimental/filesystem/operations/status.cc (.../tags/gcc_5_2_0_release) +++ b/src/libstdc++-v3/testsuite/experimental/filesystem/operations/status.cc (.../branches/gcc-5-branch) @@ -0,0 +1,58 @@ +// Copyright (C) 2015 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// { dg-options "-std=gnu++11 -lstdc++fs" } +// { dg-require-filesystem-ts "" } + +#include +#include +#include + +namespace fs = std::experimental::filesystem; + +void +test01() +{ + std::error_code ec; + fs::file_status st1 = fs::status(".", ec); + VERIFY( !ec ); + VERIFY( st1.type() == fs::file_type::directory ); + + fs::file_status st2 = fs::status("."); + VERIFY( st2.type() == fs::file_type::directory ); +} + +void +test02() +{ + fs::path p = __gnu_test::nonexistent_path(); + + std::error_code ec; + fs::file_status st1 = fs::status(p, ec); + VERIFY( ec ); + VERIFY( st1.type() == fs::file_type::not_found ); + + fs::file_status st2 = fs::status(p); + VERIFY( st2.type() == fs::file_type::not_found ); +} + +int +main() +{ + test01(); + test02(); +} Index: libstdc++-v3/testsuite/experimental/filesystem/operations/temp_directory_path.cc =================================================================== --- a/src/libstdc++-v3/testsuite/experimental/filesystem/operations/temp_directory_path.cc (.../tags/gcc_5_2_0_release) +++ b/src/libstdc++-v3/testsuite/experimental/filesystem/operations/temp_directory_path.cc (.../branches/gcc-5-branch) @@ -0,0 +1,80 @@ +// Copyright (C) 2015 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// { dg-options "-std=gnu++11 -lstdc++fs" } +// { dg-require-filesystem-ts "" } + +#include +#include +#include +#include + +void +clean_env() +{ + ::unsetenv("TMPDIR"); + ::unsetenv("TMP"); + ::unsetenv("TEMPDIR"); + ::unsetenv("TEMP"); +} + +namespace fs = std::experimental::filesystem; + +void +test01() +{ + clean_env(); + + if (!fs::exists("/tmp")) + return; // just give up + + std::error_code ec; + fs::path p1 = fs::temp_directory_path(ec); + VERIFY( exists(p1) ); + + fs::path p2 = fs::temp_directory_path(); + VERIFY( p1 == p2 ); +} + +void +test02() +{ + clean_env(); + + if (::setenv("TMPDIR", __gnu_test::nonexistent_path().string().c_str(), 1)) + return; // just give up + + std::error_code ec; + fs::path p = fs::temp_directory_path(ec); + VERIFY( ec ); + + std::error_code ec2; + try { + p = fs::temp_directory_path(); + } catch (const fs::filesystem_error& e) { + ec2 = e.code(); + } + VERIFY( ec2 == ec ); +} + + +int +main() +{ + test01(); + test02(); +} Index: libstdc++-v3/testsuite/experimental/filesystem/operations/file_size.cc =================================================================== --- a/src/libstdc++-v3/testsuite/experimental/filesystem/operations/file_size.cc (.../tags/gcc_5_2_0_release) +++ b/src/libstdc++-v3/testsuite/experimental/filesystem/operations/file_size.cc (.../branches/gcc-5-branch) @@ -0,0 +1,70 @@ +// Copyright (C) 2015 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// { dg-options "-std=gnu++11 -lstdc++fs" } +// { dg-require-filesystem-ts "" } + +#include +#include +#include + +namespace fs = std::experimental::filesystem; + +void +test01() +{ + std::error_code ec; + size_t size = fs::file_size(".", ec); + VERIFY( ec == std::errc::is_a_directory ); + VERIFY( size == -1 ); + + try { + size = fs::file_size("."); + ec.clear(); + } catch (const fs::filesystem_error& e) { + ec = e.code(); + } + VERIFY( ec == std::errc::is_a_directory ); + VERIFY( size == -1 ); +} + +void +test02() +{ + fs::path p = __gnu_test::nonexistent_path(); + + std::error_code ec; + size_t size = fs::file_size(p, ec); + VERIFY( ec ); + VERIFY( size == -1 ); + + try { + size = fs::file_size(p); + ec.clear(); + } catch (const fs::filesystem_error& e) { + ec = e.code(); + } + VERIFY( ec ); + VERIFY( size == -1 ); +} + +int +main() +{ + test01(); + test02(); +} Index: libstdc++-v3/testsuite/experimental/filesystem/operations/copy.cc =================================================================== --- a/src/libstdc++-v3/testsuite/experimental/filesystem/operations/copy.cc (.../tags/gcc_5_2_0_release) +++ b/src/libstdc++-v3/testsuite/experimental/filesystem/operations/copy.cc (.../branches/gcc-5-branch) @@ -0,0 +1,55 @@ +// { dg-options "-std=gnu++11 -lstdc++fs" } +// { dg-require-filesystem-ts "" } + +// Copyright (C) 2014-2015 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 15.3 Copy [fs.op.copy] + +#include +#include +#include + +using std::experimental::filesystem::path; + +void +test01() +{ + for (const path& p : __gnu_test::test_paths) + VERIFY( absolute(p).is_absolute() ); +} + +void +test02() +{ + path p1("/"); + VERIFY( absolute(p1) == p1 ); + VERIFY( absolute(p1, "/bar") == p1 ); + path p2("/foo"); + VERIFY( absolute(p2) == p2 ); + VERIFY( absolute(p2, "/bar") == p2 ); + path p3("foo"); + VERIFY( absolute(p3) != p3 ); + VERIFY( absolute(p3, "/bar") == "/bar/foo" ); +} + +int +main() +{ + test01(); + test02(); +} Index: libstdc++-v3/testsuite/experimental/filesystem/path/modifiers/make_preferred.cc =================================================================== --- a/src/libstdc++-v3/testsuite/experimental/filesystem/path/modifiers/make_preferred.cc (.../tags/gcc_5_2_0_release) +++ b/src/libstdc++-v3/testsuite/experimental/filesystem/path/modifiers/make_preferred.cc (.../branches/gcc-5-branch) @@ -0,0 +1,63 @@ +// { dg-options "-std=gnu++11 -lstdc++fs" } +// { dg-require-filesystem-ts "" } + +// Copyright (C) 2014-2015 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 8.4.5 path modifiers [path.modifiers] + +#include +#include +#include + +using std::experimental::filesystem::path; + +template +struct checker +{ + static void check(const char* s) { } +}; + +template<> +struct checker +{ + static void check() + { + VERIFY( path("foo/bar").make_preferred() == "foo/bar" ); + } +}; + +template<> +struct checker +{ + static void check() + { + VERIFY( path("foo/bar").make_preferred() == L"foo\\bar" ); + } +}; + +void +test01() +{ + checker::check(); +} + +int +main() +{ + test01(); +} Index: libstdc++-v3/testsuite/experimental/filesystem/path/modifiers/replace_filename.cc =================================================================== --- a/src/libstdc++-v3/testsuite/experimental/filesystem/path/modifiers/replace_filename.cc (.../tags/gcc_5_2_0_release) +++ b/src/libstdc++-v3/testsuite/experimental/filesystem/path/modifiers/replace_filename.cc (.../branches/gcc-5-branch) @@ -0,0 +1,52 @@ +// { dg-options "-std=gnu++11 -lstdc++fs" } +// { dg-require-filesystem-ts "" } + +// Copyright (C) 2014-2015 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 8.4.5 path modifiers [path.modifiers] + +#include +#include +#include + +using std::experimental::filesystem::path; + +void +test01() +{ + VERIFY( path("/foo").replace_filename("bar") == "/bar" ); + VERIFY( path("/").replace_filename("bar") == "bar" ); +} + +void +test02() +{ + for (const path& p : __gnu_test::test_paths) + { + path p2(p); + p2.replace_filename(p.filename()); + VERIFY( p2 == p ); + } +} + +int +main() +{ + test01(); + test02(); +} Index: libstdc++-v3/testsuite/experimental/filesystem/path/modifiers/remove_filename.cc =================================================================== --- a/src/libstdc++-v3/testsuite/experimental/filesystem/path/modifiers/remove_filename.cc (.../tags/gcc_5_2_0_release) +++ b/src/libstdc++-v3/testsuite/experimental/filesystem/path/modifiers/remove_filename.cc (.../branches/gcc-5-branch) @@ -0,0 +1,53 @@ +// { dg-options "-std=gnu++11 -lstdc++fs" } +// { dg-require-filesystem-ts "" } + +// Copyright (C) 2014-2015 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 8.4.5 path modifiers [path.modifiers] + +#include +#include +#include + +using std::experimental::filesystem::path; + +void +test01() +{ + VERIFY( path("/foo").remove_filename() == "/" ); + VERIFY( path("/").remove_filename() == "" ); +} + +void +test02() +{ + for (const path& p : __gnu_test::test_paths) + { + path p2(p); + p2.remove_filename(); + p2 /= p.filename(); + VERIFY( p2 == p ); + } +} + +int +main() +{ + test01(); + test02(); +} Index: libstdc++-v3/testsuite/experimental/filesystem/path/modifiers/clear.cc =================================================================== --- a/src/libstdc++-v3/testsuite/experimental/filesystem/path/modifiers/clear.cc (.../tags/gcc_5_2_0_release) +++ b/src/libstdc++-v3/testsuite/experimental/filesystem/path/modifiers/clear.cc (.../branches/gcc-5-branch) @@ -0,0 +1,45 @@ +// { dg-options "-std=gnu++11 -lstdc++fs" } +// { dg-require-filesystem-ts "" } + +// Copyright (C) 2014-2015 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 8.4.5 path modifiers [path.modifiers] + +#include +#include +#include + +using std::experimental::filesystem::path; + +void +test01() +{ + for (path p : __gnu_test::test_paths) + { + path empty; + p.clear(); + VERIFY( p.empty() ); + __gnu_test::compare_paths(p, empty); + } +} + +int +main() +{ + test01(); +} Index: libstdc++-v3/testsuite/experimental/filesystem/path/modifiers/replace_extension.cc =================================================================== --- a/src/libstdc++-v3/testsuite/experimental/filesystem/path/modifiers/replace_extension.cc (.../tags/gcc_5_2_0_release) +++ b/src/libstdc++-v3/testsuite/experimental/filesystem/path/modifiers/replace_extension.cc (.../branches/gcc-5-branch) @@ -0,0 +1,52 @@ +// { dg-options "-std=gnu++11 -lstdc++fs" } +// { dg-require-filesystem-ts "" } + +// Copyright (C) 2014-2015 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 8.4.5 path modifiers [path.modifiers] + +#include +#include +#include + +using std::experimental::filesystem::path; + +void +test01() +{ + VERIFY( path("/foo.txt").replace_extension("cpp") == "/foo.cpp" ); + VERIFY( path("/foo.txt").replace_extension(".cpp") == "/foo.cpp" ); + VERIFY( path("/").replace_extension("bar") == "/.bar" ); +} + +void +test02() +{ + for (const path& p : __gnu_test::test_paths) + { + path p2 = p; + VERIFY(p2.replace_extension(p2.extension()) == p); + } +} + +int +main() +{ + test01(); + test02(); +} Index: libstdc++-v3/testsuite/experimental/filesystem/path/modifiers/swap.cc =================================================================== --- a/src/libstdc++-v3/testsuite/experimental/filesystem/path/modifiers/swap.cc (.../tags/gcc_5_2_0_release) +++ b/src/libstdc++-v3/testsuite/experimental/filesystem/path/modifiers/swap.cc (.../branches/gcc-5-branch) @@ -0,0 +1,44 @@ +// { dg-options "-std=gnu++11 -lstdc++fs" } +// { dg-require-filesystem-ts "" } + +// Copyright (C) 2014-2015 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 8.4.5 path modifiers [path.modifiers] + +#include +#include +#include + +using std::experimental::filesystem::path; + +void +test01() +{ + const path p("/foo/bar"); + path p1; + path p2 = p; + p1.swap(p2); + VERIFY( p2.empty() ); + __gnu_test::compare_paths(p1, p); +} + +int +main() +{ + test01(); +} Index: libstdc++-v3/testsuite/experimental/filesystem/path/nonmember/hash_value.cc =================================================================== --- a/src/libstdc++-v3/testsuite/experimental/filesystem/path/nonmember/hash_value.cc (.../tags/gcc_5_2_0_release) +++ b/src/libstdc++-v3/testsuite/experimental/filesystem/path/nonmember/hash_value.cc (.../branches/gcc-5-branch) @@ -0,0 +1,51 @@ +// { dg-options "-std=gnu++11 -lstdc++fs" } +// { dg-require-filesystem-ts "" } + +// Copyright (C) 2014-2015 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 8.6 path non-member functions [path.non-member] + +#include +#include +#include + +using std::experimental::filesystem::path; + +void +test01() +{ + VERIFY( hash_value(path("a//b")) == hash_value(path("a/b")) ); + VERIFY( hash_value(path("a/")) == hash_value(path("a/.")) ); +} + +void +test02() +{ + for (const path& p : __gnu_test::test_paths) + { + path pp = p.native(); + VERIFY( hash_value(p) == hash_value(pp) ); + } +} + +int +main() +{ + test01(); + test02(); +} Index: libstdc++-v3/testsuite/experimental/filesystem/path/assign/assign.cc =================================================================== --- a/src/libstdc++-v3/testsuite/experimental/filesystem/path/assign/assign.cc (.../tags/gcc_5_2_0_release) +++ b/src/libstdc++-v3/testsuite/experimental/filesystem/path/assign/assign.cc (.../branches/gcc-5-branch) @@ -0,0 +1,89 @@ +// { dg-options "-std=gnu++11 -lstdc++fs" } +// { dg-require-filesystem-ts "" } + +// Copyright (C) 2014-2015 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +#include + +using std::experimental::filesystem::path; +using __gnu_test::compare_paths; + +void +test01() +{ + for (std::string s : __gnu_test::test_paths) + { + path p0 = s, p1, p2, p3, p4; + + p1 = s; + compare_paths(p0, p1); + + p2 = s.c_str(); + compare_paths(p0, p2); + + std::wstring ws(s.begin(), s.end()); + + p3 = ws; + compare_paths(p0, p3); + + p4 = ws.c_str(); + compare_paths(p0, p4); + } +} + +void +test02() +{ + for (std::string s : __gnu_test::test_paths) + { + path p0 = s, p1, p2, p3, p4, p5, p6, p7, p8; + + p1.assign(s); + compare_paths(p0, p1); + + p2.assign( s.begin(), s.end() ); + compare_paths(p0, p2); + + p3.assign( s.c_str() ); + compare_paths(p0, p3); + + p4.assign( s.c_str(), s.c_str() + s.size() ); + compare_paths(p0, p4); + + std::wstring ws(s.begin(), s.end()); + + p5.assign(ws); + compare_paths(p0, p5); + + p6.assign( ws.begin(), ws.end() ); + compare_paths(p0, p6); + + p7.assign( ws.c_str() ); + compare_paths(p0, p7); + + p8.assign( ws.c_str(), ws.c_str() + ws.size() ); + compare_paths(p0, p8); + } +} + +int +main() +{ + test01(); + test02(); +} Index: libstdc++-v3/testsuite/experimental/filesystem/path/assign/copy.cc =================================================================== --- a/src/libstdc++-v3/testsuite/experimental/filesystem/path/assign/copy.cc (.../tags/gcc_5_2_0_release) +++ b/src/libstdc++-v3/testsuite/experimental/filesystem/path/assign/copy.cc (.../branches/gcc-5-branch) @@ -0,0 +1,55 @@ +// { dg-options "-std=gnu++11 -lstdc++fs" } +// { dg-require-filesystem-ts "" } + +// Copyright (C) 2014-2015 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +#include +#include + +using std::experimental::filesystem::path; +using __gnu_test::compare_paths; + +void +test01() +{ + for (const path& p : __gnu_test::test_paths) + { + path copy; + copy = p; + __gnu_test::compare_paths(p, copy); + } +} + +void +test02() +{ + for (const path& p : __gnu_test::test_paths) + { + path copy = p; + path move; + move = std::move(copy); + __gnu_test::compare_paths(p, move); + } +} + +int +main() +{ + test01(); + test02(); +} Index: libstdc++-v3/testsuite/experimental/filesystem/path/construct/range.cc =================================================================== --- a/src/libstdc++-v3/testsuite/experimental/filesystem/path/construct/range.cc (.../tags/gcc_5_2_0_release) +++ b/src/libstdc++-v3/testsuite/experimental/filesystem/path/construct/range.cc (.../branches/gcc-5-branch) @@ -0,0 +1,60 @@ +// { dg-options "-std=gnu++11 -lstdc++fs" } +// { dg-require-filesystem-ts "" } + +// Copyright (C) 2014-2015 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 8.4.1 path constructors [path.construct] + +#include +#include +#include + +using std::experimental::filesystem::path; +using __gnu_test::compare_paths; + +void +test01() +{ + for (std::string s : __gnu_test::test_paths) + { + path p1 = s; + path p2( s.begin(), s.end() ); + path p3( s.c_str() ); + path p4( s.c_str(), s.c_str() + s.size() ); + + std::wstring ws(s.begin(), s.end()); + path p5 = ws; + path p6( ws.begin(), ws.end() ); + path p7( ws.c_str() ); + path p8( ws.c_str(), ws.c_str() + ws.size() ); + + compare_paths(p1, p2); + compare_paths(p1, p3); + compare_paths(p1, p4); + compare_paths(p1, p5); + compare_paths(p1, p6); + compare_paths(p1, p7); + compare_paths(p1, p8); + } +} + +int +main() +{ + test01(); +} Index: libstdc++-v3/testsuite/experimental/filesystem/path/construct/locale.cc =================================================================== --- a/src/libstdc++-v3/testsuite/experimental/filesystem/path/construct/locale.cc (.../tags/gcc_5_2_0_release) +++ b/src/libstdc++-v3/testsuite/experimental/filesystem/path/construct/locale.cc (.../branches/gcc-5-branch) @@ -0,0 +1,39 @@ +// { dg-options "-std=gnu++11 -lstdc++fs" } +// { dg-require-filesystem-ts "" } + +// Copyright (C) 2014-2015 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 8.4.1 path constructors [path.construct] + +#include +#include + +using std::experimental::filesystem::path; + +void +test01() +{ + path p("/foo/bar", std::locale::classic()); + VERIFY( p.string() == "/foo/bar" ); +} + +int +main() +{ + test01(); +} Index: libstdc++-v3/testsuite/experimental/filesystem/path/construct/default.cc =================================================================== --- a/src/libstdc++-v3/testsuite/experimental/filesystem/path/construct/default.cc (.../tags/gcc_5_2_0_release) +++ b/src/libstdc++-v3/testsuite/experimental/filesystem/path/construct/default.cc (.../branches/gcc-5-branch) @@ -0,0 +1,50 @@ +// { dg-options "-std=gnu++11 -lstdc++fs" } +// { dg-require-filesystem-ts "" } + +// Copyright (C) 2014-2015 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 8.4.1 path constructors [path.construct] + +#include +#include + +using std::experimental::filesystem::path; + +void +test01() +{ + path p; + VERIFY( p.empty() ); + VERIFY( !p.has_root_path() ); + VERIFY( !p.has_root_name() ); + VERIFY( !p.has_root_directory() ); + VERIFY( !p.has_relative_path() ); + VERIFY( !p.has_parent_path() ); + VERIFY( !p.has_filename() ); + VERIFY( !p.has_stem() ); + VERIFY( !p.has_extension() ); + VERIFY( !p.is_absolute() ); + VERIFY( p.is_relative() ); + VERIFY( std::distance(p.begin(), p.end()) == 0 ); +} + +int +main() +{ + test01(); +} Index: libstdc++-v3/testsuite/experimental/filesystem/path/construct/copy.cc =================================================================== --- a/src/libstdc++-v3/testsuite/experimental/filesystem/path/construct/copy.cc (.../tags/gcc_5_2_0_release) +++ b/src/libstdc++-v3/testsuite/experimental/filesystem/path/construct/copy.cc (.../branches/gcc-5-branch) @@ -0,0 +1,54 @@ +// { dg-options "-std=gnu++11 -lstdc++fs" } +// { dg-require-filesystem-ts "" } + +// Copyright (C) 2014-2015 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 8.4.1 path constructors [path.construct] + +#include +#include + +using std::experimental::filesystem::path; + +void +test01() +{ + for (const path& p : __gnu_test::test_paths) + { + path copy = p; + __gnu_test::compare_paths(p, copy); + } +} + +void +test02() +{ + for (const path& p : __gnu_test::test_paths) + { + path copy = p; + path move = std::move(copy); + __gnu_test::compare_paths(p, move); + } +} + +int +main() +{ + test01(); + test02(); +} Index: libstdc++-v3/testsuite/experimental/filesystem/path/query/has_filename.cc =================================================================== --- a/src/libstdc++-v3/testsuite/experimental/filesystem/path/query/has_filename.cc (.../tags/gcc_5_2_0_release) +++ b/src/libstdc++-v3/testsuite/experimental/filesystem/path/query/has_filename.cc (.../branches/gcc-5-branch) @@ -0,0 +1,43 @@ +// { dg-options "-std=gnu++11 -lstdc++fs" } +// { dg-require-filesystem-ts "" } + +// Copyright (C) 2014-2015 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 8.4.9 path decomposition [path.decompose] + +#include +#include +#include +#include + +using std::experimental::filesystem::path; + +void +test01() +{ + for (const path& p : __gnu_test::test_paths) + { + VERIFY( p.has_filename() == !p.filename().empty() ); + } +} + +int +main() +{ + test01(); +} Index: libstdc++-v3/testsuite/experimental/filesystem/path/query/empty.cc =================================================================== --- a/src/libstdc++-v3/testsuite/experimental/filesystem/path/query/empty.cc (.../tags/gcc_5_2_0_release) +++ b/src/libstdc++-v3/testsuite/experimental/filesystem/path/query/empty.cc (.../branches/gcc-5-branch) @@ -0,0 +1,43 @@ +// { dg-options "-std=gnu++11 -lstdc++fs" } +// { dg-require-filesystem-ts "" } + +// Copyright (C) 2014-2015 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 8.4.9 path decomposition [path.decompose] + +#include +#include +#include +#include + +using std::experimental::filesystem::path; + +void +test01() +{ + for (const std::string& s : __gnu_test::test_paths) + { + VERIFY( s.empty() == path(s).empty() ); + } +} + +int +main() +{ + test01(); +} Index: libstdc++-v3/testsuite/experimental/filesystem/path/query/has_root_name.cc =================================================================== --- a/src/libstdc++-v3/testsuite/experimental/filesystem/path/query/has_root_name.cc (.../tags/gcc_5_2_0_release) +++ b/src/libstdc++-v3/testsuite/experimental/filesystem/path/query/has_root_name.cc (.../branches/gcc-5-branch) @@ -0,0 +1,43 @@ +// { dg-options "-std=gnu++11 -lstdc++fs" } +// { dg-require-filesystem-ts "" } + +// Copyright (C) 2014-2015 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 8.4.9 path decomposition [path.decompose] + +#include +#include +#include +#include + +using std::experimental::filesystem::path; + +void +test01() +{ + for (const path& p : __gnu_test::test_paths) + { + VERIFY( p.has_root_name() == !p.root_name().empty() ); + } +} + +int +main() +{ + test01(); +} Index: libstdc++-v3/testsuite/experimental/filesystem/path/query/has_parent_path.cc =================================================================== --- a/src/libstdc++-v3/testsuite/experimental/filesystem/path/query/has_parent_path.cc (.../tags/gcc_5_2_0_release) +++ b/src/libstdc++-v3/testsuite/experimental/filesystem/path/query/has_parent_path.cc (.../branches/gcc-5-branch) @@ -0,0 +1,43 @@ +// { dg-options "-std=gnu++11 -lstdc++fs" } +// { dg-require-filesystem-ts "" } + +// Copyright (C) 2014-2015 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 8.4.9 path decomposition [path.decompose] + +#include +#include +#include +#include + +using std::experimental::filesystem::path; + +void +test01() +{ + for (const path& p : __gnu_test::test_paths) + { + VERIFY( p.has_parent_path() == !p.parent_path().empty() ); + } +} + +int +main() +{ + test01(); +} Index: libstdc++-v3/testsuite/experimental/filesystem/path/query/has_relative_path.cc =================================================================== --- a/src/libstdc++-v3/testsuite/experimental/filesystem/path/query/has_relative_path.cc (.../tags/gcc_5_2_0_release) +++ b/src/libstdc++-v3/testsuite/experimental/filesystem/path/query/has_relative_path.cc (.../branches/gcc-5-branch) @@ -0,0 +1,43 @@ +// { dg-options "-std=gnu++11 -lstdc++fs" } +// { dg-require-filesystem-ts "" } + +// Copyright (C) 2014-2015 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 8.4.9 path decomposition [path.decompose] + +#include +#include +#include +#include + +using std::experimental::filesystem::path; + +void +test01() +{ + for (const path& p : __gnu_test::test_paths) + { + VERIFY( p.has_relative_path() == !p.relative_path().empty() ); + } +} + +int +main() +{ + test01(); +} Index: libstdc++-v3/testsuite/experimental/filesystem/path/query/has_root_directory.cc =================================================================== --- a/src/libstdc++-v3/testsuite/experimental/filesystem/path/query/has_root_directory.cc (.../tags/gcc_5_2_0_release) +++ b/src/libstdc++-v3/testsuite/experimental/filesystem/path/query/has_root_directory.cc (.../branches/gcc-5-branch) @@ -0,0 +1,43 @@ +// { dg-options "-std=gnu++11 -lstdc++fs" } +// { dg-require-filesystem-ts "" } + +// Copyright (C) 2014-2015 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 8.4.9 path decomposition [path.decompose] + +#include +#include +#include +#include + +using std::experimental::filesystem::path; + +void +test01() +{ + for (const path& p : __gnu_test::test_paths) + { + VERIFY( p.has_root_directory() == !p.root_directory().empty() ); + } +} + +int +main() +{ + test01(); +} Index: libstdc++-v3/testsuite/experimental/filesystem/path/query/has_stem.cc =================================================================== --- a/src/libstdc++-v3/testsuite/experimental/filesystem/path/query/has_stem.cc (.../tags/gcc_5_2_0_release) +++ b/src/libstdc++-v3/testsuite/experimental/filesystem/path/query/has_stem.cc (.../branches/gcc-5-branch) @@ -0,0 +1,43 @@ +// { dg-options "-std=gnu++11 -lstdc++fs" } +// { dg-require-filesystem-ts "" } + +// Copyright (C) 2014-2015 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 8.4.9 path decomposition [path.decompose] + +#include +#include +#include +#include + +using std::experimental::filesystem::path; + +void +test01() +{ + for (const path& p : __gnu_test::test_paths) + { + VERIFY( p.has_stem() == !p.stem().empty() ); + } +} + +int +main() +{ + test01(); +} Index: libstdc++-v3/testsuite/experimental/filesystem/path/query/is_relative.cc =================================================================== --- a/src/libstdc++-v3/testsuite/experimental/filesystem/path/query/is_relative.cc (.../tags/gcc_5_2_0_release) +++ b/src/libstdc++-v3/testsuite/experimental/filesystem/path/query/is_relative.cc (.../branches/gcc-5-branch) @@ -0,0 +1,43 @@ +// { dg-options "-std=gnu++11 -lstdc++fs" } +// { dg-require-filesystem-ts "" } + +// Copyright (C) 2014-2015 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 8.4.9 path decomposition [path.decompose] + +#include +#include +#include +#include + +using std::experimental::filesystem::path; + +void +test01() +{ + for (const path& p : __gnu_test::test_paths) + { + VERIFY( p.is_relative() == !p.is_absolute() ); + } +} + +int +main() +{ + test01(); +} Index: libstdc++-v3/testsuite/experimental/filesystem/path/query/has_extension.cc =================================================================== --- a/src/libstdc++-v3/testsuite/experimental/filesystem/path/query/has_extension.cc (.../tags/gcc_5_2_0_release) +++ b/src/libstdc++-v3/testsuite/experimental/filesystem/path/query/has_extension.cc (.../branches/gcc-5-branch) @@ -0,0 +1,43 @@ +// { dg-options "-std=gnu++11 -lstdc++fs" } +// { dg-require-filesystem-ts "" } + +// Copyright (C) 2014-2015 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 8.4.9 path decomposition [path.decompose] + +#include +#include +#include +#include + +using std::experimental::filesystem::path; + +void +test01() +{ + for (const path& p : __gnu_test::test_paths) + { + VERIFY( p.has_extension() == !p.extension().empty() ); + } +} + +int +main() +{ + test01(); +} Index: libstdc++-v3/testsuite/experimental/filesystem/path/query/has_root_path.cc =================================================================== --- a/src/libstdc++-v3/testsuite/experimental/filesystem/path/query/has_root_path.cc (.../tags/gcc_5_2_0_release) +++ b/src/libstdc++-v3/testsuite/experimental/filesystem/path/query/has_root_path.cc (.../branches/gcc-5-branch) @@ -0,0 +1,43 @@ +// { dg-options "-std=gnu++11 -lstdc++fs" } +// { dg-require-filesystem-ts "" } + +// Copyright (C) 2014-2015 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 8.4.9 path decomposition [path.decompose] + +#include +#include +#include +#include + +using std::experimental::filesystem::path; + +void +test01() +{ + for (const path& p : __gnu_test::test_paths) + { + VERIFY( p.has_root_path() == !p.root_path().empty() ); + } +} + +int +main() +{ + test01(); +} Index: libstdc++-v3/testsuite/experimental/filesystem/path/compare/path.cc =================================================================== --- a/src/libstdc++-v3/testsuite/experimental/filesystem/path/compare/path.cc (.../tags/gcc_5_2_0_release) +++ b/src/libstdc++-v3/testsuite/experimental/filesystem/path/compare/path.cc (.../branches/gcc-5-branch) @@ -0,0 +1,50 @@ +// { dg-options "-std=gnu++11 -lstdc++fs" } +// { dg-require-filesystem-ts "" } + +// Copyright (C) 2014-2015 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 8.4.8 path compare [path.compare] + +#include +#include +#include + +using std::experimental::filesystem::path; + +void +test01() +{ + const path p0 = "/a/a/b/b"; + for (const path& p : __gnu_test::test_paths) + { + VERIFY( p.compare(p) == 0 ); + int cmp = p.compare(p0); + if (cmp == 0) + VERIFY( p0.compare(p) == 0 ); + else if (cmp < 0) + VERIFY( p0.compare(p) > 0 ); + else if (cmp > 0) + VERIFY( p0.compare(p) < 0 ); + } +} + +int +main() +{ + test01(); +} Index: libstdc++-v3/testsuite/experimental/filesystem/path/compare/compare.cc =================================================================== --- a/src/libstdc++-v3/testsuite/experimental/filesystem/path/compare/compare.cc (.../tags/gcc_5_2_0_release) +++ b/src/libstdc++-v3/testsuite/experimental/filesystem/path/compare/compare.cc (.../branches/gcc-5-branch) @@ -0,0 +1,50 @@ +// { dg-options "-std=gnu++11 -lstdc++fs" } +// { dg-require-filesystem-ts "" } + +// Copyright (C) 2014-2015 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 8.4.8 path compare [path.compare] + +#include +#include +#include + +using std::experimental::filesystem::path; + +void +test01() +{ + path p("/foo/bar"); + VERIFY( p.compare(p) == 0 ); + VERIFY( p.compare("/foo//bar") == 0 ); + + path q("/foo/baz"); + VERIFY( p.compare(q) < 0 ); + VERIFY( q.compare(p) > 0 ); + + path r("/foo/bar/."); + VERIFY( p.compare(r) < 0 ); + + VERIFY( path("a/b/").compare("a/b/.") == 0 ); +} + +int +main() +{ + test01(); +} Index: libstdc++-v3/testsuite/experimental/filesystem/path/compare/strings.cc =================================================================== --- a/src/libstdc++-v3/testsuite/experimental/filesystem/path/compare/strings.cc (.../tags/gcc_5_2_0_release) +++ b/src/libstdc++-v3/testsuite/experimental/filesystem/path/compare/strings.cc (.../branches/gcc-5-branch) @@ -0,0 +1,48 @@ +// { dg-options "-std=gnu++11 -lstdc++fs" } +// { dg-require-filesystem-ts "" } + +// Copyright (C) 2014-2015 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 8.4.8 path compare [path.compare] + +#include +#include +#include + +using std::experimental::filesystem::path; + +void +test01() +{ + const std::string s0 = "/a/a/b/b"; + const path p0 = s0; + for (const std::string& s : __gnu_test::test_paths) + { + path p(s); + VERIFY( p.compare(s) == 0 ); + VERIFY( p.compare(s.c_str()) == 0 ); + VERIFY( p.compare(p0) == p.compare(s0) ); + VERIFY( p.compare(p0) == p.compare(s0.c_str()) ); + } +} + +int +main() +{ + test01(); +} Index: libstdc++-v3/testsuite/experimental/filesystem/path/native/TODO =================================================================== Index: libstdc++-v3/testsuite/experimental/filesystem/path/append/path.cc =================================================================== --- a/src/libstdc++-v3/testsuite/experimental/filesystem/path/append/path.cc (.../tags/gcc_5_2_0_release) +++ b/src/libstdc++-v3/testsuite/experimental/filesystem/path/append/path.cc (.../branches/gcc-5-branch) @@ -0,0 +1,63 @@ +// { dg-options "-std=gnu++11 -lstdc++fs" } +// { dg-require-filesystem-ts "" } + +// Copyright (C) 2014-2015 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 8.4.3 path appends [path.append] + +#include +#include +#include + +using std::experimental::filesystem::path; + +void +test01() +{ + const path p("/foo/bar"); + + path pp = p; + pp /= p; + VERIFY( pp.native() == "/foo/bar/foo/bar" ); + + path q("baz"); + + path qq = q; + qq /= q; + VERIFY( qq.native() == "baz/baz" ); + + q /= p; + VERIFY( q.native() == "baz/foo/bar" ); + + path r = ""; + r /= path(); + VERIFY( r.empty() ); + + r /= path("rel"); + VERIFY( !r.is_absolute() ); + + path s = "dir/"; + s /= path("/file"); + VERIFY( s.native() == "dir//file" ); +} + +int +main() +{ + test01(); +} Index: libstdc++-v3/testsuite/experimental/filesystem/path/concat/path.cc =================================================================== --- a/src/libstdc++-v3/testsuite/experimental/filesystem/path/concat/path.cc (.../tags/gcc_5_2_0_release) +++ b/src/libstdc++-v3/testsuite/experimental/filesystem/path/concat/path.cc (.../branches/gcc-5-branch) @@ -0,0 +1,68 @@ +// { dg-options "-std=gnu++11 -lstdc++fs" } +// { dg-require-filesystem-ts "" } + +// Copyright (C) 2014-2015 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 8.4.4 path concatenation [path.concat] + +#include +#include +#include + +using std::experimental::filesystem::path; + +void +test01() +{ + const path p("/foo/bar"); + + path pp = p; + pp += p; + VERIFY( pp.native() == "/foo/bar/foo/bar" ); + VERIFY( std::distance(pp.begin(), pp.end()) == 5 ); + + path q("foo/bar"); + + path qq = q; + qq += q; + VERIFY( qq.native() == "foo/barfoo/bar" ); + VERIFY( std::distance(qq.begin(), qq.end()) == 3 ); + + q += p; + VERIFY( q.native() == "foo/bar/foo/bar" ); + VERIFY( std::distance(q.begin(), q.end()) == 4 ); +} + +void +test02() +{ + for (path p : __gnu_test::test_paths) + { + auto prior_native = p.native(); + path x("//blah/di/blah"); + p += x; + VERIFY( p.native() == prior_native + x.native() ); + } +} + +int +main() +{ + test01(); + test02(); +} Index: libstdc++-v3/testsuite/experimental/filesystem/path/concat/strings.cc =================================================================== --- a/src/libstdc++-v3/testsuite/experimental/filesystem/path/concat/strings.cc (.../tags/gcc_5_2_0_release) +++ b/src/libstdc++-v3/testsuite/experimental/filesystem/path/concat/strings.cc (.../branches/gcc-5-branch) @@ -0,0 +1,51 @@ +// { dg-options "-std=gnu++11 -lstdc++fs" } +// { dg-require-filesystem-ts "" } + +// Copyright (C) 2014-2015 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 8.4.4 path concatenation [path.concat] + +#include +#include + +using std::experimental::filesystem::path; + +void +test01() +{ + path p("/"); + p += path::string_type("foo"); + VERIFY( p.filename() == "foo" ); + p += "bar"; + VERIFY( p.filename() == "foobar" ); + p += '/'; + VERIFY( p.parent_path() == "/foobar" && p.filename() == "." ); + p += L"baz.txt"; + VERIFY( p.filename() == "baz.txt" ); + p.concat("/dir/"); + VERIFY( p.parent_path() == "/foobar/baz.txt/dir" && p.filename() == "." ); + std::string file = "file"; + p.concat(file.begin(), file.end()); + VERIFY( p.filename() == "file" ); +} + +int +main() +{ + test01(); +} Index: libstdc++-v3/testsuite/experimental/filesystem/path/factory/TODO =================================================================== Index: libstdc++-v3/testsuite/experimental/filesystem/path/io/TODO =================================================================== Index: libstdc++-v3/testsuite/experimental/filesystem/path/generic/generic_string.cc =================================================================== --- a/src/libstdc++-v3/testsuite/experimental/filesystem/path/generic/generic_string.cc (.../tags/gcc_5_2_0_release) +++ b/src/libstdc++-v3/testsuite/experimental/filesystem/path/generic/generic_string.cc (.../branches/gcc-5-branch) @@ -0,0 +1,48 @@ +// { dg-options "-std=gnu++11 -lstdc++fs" } +// { dg-require-filesystem-ts "" } + +// Copyright (C) 2014-2015 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 8.4.7 path generic format observers [path.generic.obs] + +#include +#include +#include + +using std::experimental::filesystem::path; + +void +test01() +{ + for (const path& p : __gnu_test::test_paths) + { + path p2(p), p3; + p2.swap(p3); + VERIFY( p2 == path() ); + VERIFY( p3 == p ); + p2.swap(p3); + VERIFY( p2 == p ); + VERIFY( p3 == path() ); + } +} + +int +main() +{ + test01(); +} Index: libstdc++-v3/testsuite/experimental/filesystem/path/decompose/extension.cc =================================================================== --- a/src/libstdc++-v3/testsuite/experimental/filesystem/path/decompose/extension.cc (.../tags/gcc_5_2_0_release) +++ b/src/libstdc++-v3/testsuite/experimental/filesystem/path/decompose/extension.cc (.../branches/gcc-5-branch) @@ -0,0 +1,61 @@ +// { dg-options "-std=gnu++11 -lstdc++fs" } +// { dg-require-filesystem-ts "" } + +// Copyright (C) 2014-2015 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 8.4.9 path decomposition [path.decompose] + +#include +#include +#include +#include + +using std::experimental::filesystem::path; + +void +test01() +{ + VERIFY( path("/foo/bar.txt").extension() == path(".txt") ); + VERIFY( path("/foo/bar.baz.txt").extension() == path(".txt") ); + VERIFY( path(".bar.baz.txt").extension() == path(".txt") ); + + VERIFY( path(".hidden").extension() == path(".hidden") ); + + VERIFY( path().extension() == path() ); + VERIFY( path(".").extension() == path() ); + VERIFY( path("..").extension() == path() ); +} + +void +test02() +{ + for (const path& p : __gnu_test::test_paths) + { + auto stem = p.stem(); + auto ext = p.extension(); + auto file = p.filename(); + VERIFY( stem.native() + ext.native() == file.native() ); + } +} + +int +main() +{ + test01(); + test02(); +} Index: libstdc++-v3/testsuite/experimental/filesystem/path/decompose/root_path.cc =================================================================== --- a/src/libstdc++-v3/testsuite/experimental/filesystem/path/decompose/root_path.cc (.../tags/gcc_5_2_0_release) +++ b/src/libstdc++-v3/testsuite/experimental/filesystem/path/decompose/root_path.cc (.../branches/gcc-5-branch) @@ -0,0 +1,55 @@ +// { dg-options "-std=gnu++11 -lstdc++fs" } +// { dg-require-filesystem-ts "" } + +// Copyright (C) 2014-2015 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 8.4.9 path decomposition [path.decompose] + +#include +#include +#include + +using std::experimental::filesystem::path; + +void +test01() +{ + path p1 = "foo/bar"; + VERIFY( p1.root_path() == path() ); + path p2 = "/foo/bar"; + VERIFY( p2.root_path() == path("/") ); +} + +void +test02() +{ + for (const path& p : __gnu_test::test_paths) + { + path rootp = p.root_path(); + path rootn = p.root_name(); + path rootd = p.root_directory(); + VERIFY( rootp == (rootn / rootd) ); + } +} + +int +main() +{ + test01(); + test02(); +} Index: libstdc++-v3/testsuite/experimental/filesystem/path/decompose/filename.cc =================================================================== --- a/src/libstdc++-v3/testsuite/experimental/filesystem/path/decompose/filename.cc (.../tags/gcc_5_2_0_release) +++ b/src/libstdc++-v3/testsuite/experimental/filesystem/path/decompose/filename.cc (.../branches/gcc-5-branch) @@ -0,0 +1,58 @@ +// { dg-options "-std=gnu++11 -lstdc++fs" } +// { dg-require-filesystem-ts "" } + +// Copyright (C) 2014-2015 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 8.4.9 path decomposition [path.decompose] + +#include +#include +#include + +using std::experimental::filesystem::path; + +void +test01() +{ + VERIFY( path("/foo/bar.txt").filename() == "bar.txt" ); + VERIFY( path("/").filename() == "/" ); + VERIFY( path(".").filename() == "." ); + VERIFY( path("..").filename() == ".." ); +} + +void +test02() +{ + for (const path& p : __gnu_test::test_paths) + { + path f = p.filename(); + if (p.empty()) + VERIFY( f.empty() ); + else + VERIFY( f == *--p.end() ); + if (p != p.root_path()) + VERIFY( !f.has_root_path() ); + } +} + +int +main() +{ + test01(); + test02(); +} Index: libstdc++-v3/testsuite/experimental/filesystem/path/decompose/root_name.cc =================================================================== --- a/src/libstdc++-v3/testsuite/experimental/filesystem/path/decompose/root_name.cc (.../tags/gcc_5_2_0_release) +++ b/src/libstdc++-v3/testsuite/experimental/filesystem/path/decompose/root_name.cc (.../branches/gcc-5-branch) @@ -0,0 +1,42 @@ +// { dg-options "-std=gnu++11 -lstdc++fs" } +// { dg-require-filesystem-ts "" } + +// Copyright (C) 2014-2015 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 8.4.9 path decomposition [path.decompose] + +#include +#include +#include + +using std::experimental::filesystem::path; + +void +test01() +{ + VERIFY( path("/foo/bar.txt").extension() == ".txt" ); + VERIFY( path("/foo/bar.baz.txt").extension() == ".txt" ); + VERIFY( path(".").extension().empty() ); + VERIFY( path("..").extension().empty() ); +} + +int +main() +{ + test01(); +} Index: libstdc++-v3/testsuite/experimental/filesystem/path/decompose/parent_path.cc =================================================================== --- a/src/libstdc++-v3/testsuite/experimental/filesystem/path/decompose/parent_path.cc (.../tags/gcc_5_2_0_release) +++ b/src/libstdc++-v3/testsuite/experimental/filesystem/path/decompose/parent_path.cc (.../branches/gcc-5-branch) @@ -0,0 +1,63 @@ +// { dg-options "-std=gnu++11 -lstdc++fs" } +// { dg-require-filesystem-ts "" } + +// Copyright (C) 2014-2015 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 8.4.9 path decomposition [path.decompose] + +#include +#include +#include + +using std::experimental::filesystem::path; + +void +test01() +{ + path p0; + VERIFY( p0.parent_path() == p0 ); + path p1 = "foo"; + VERIFY( p1.parent_path() == p0 ); + path p2 = "foo/bar"; + VERIFY( p2.parent_path() == p1 ); + path p3 = "/foo/bar"; + VERIFY( p3.parent_path() == path("/foo") ); +} + +void +test02() +{ + for (const path& p : __gnu_test::test_paths) + { + if (p.begin() == p.end()) + continue; + path pp; + for (auto i = p.begin(), end = --p.end(); i != end; ++i) + { + pp /= *i; + } + VERIFY( p.parent_path() == pp ); + } +} + +int +main() +{ + test01(); + test02(); +} Index: libstdc++-v3/testsuite/experimental/filesystem/path/decompose/relative_path.cc =================================================================== --- a/src/libstdc++-v3/testsuite/experimental/filesystem/path/decompose/relative_path.cc (.../tags/gcc_5_2_0_release) +++ b/src/libstdc++-v3/testsuite/experimental/filesystem/path/decompose/relative_path.cc (.../branches/gcc-5-branch) @@ -0,0 +1,65 @@ +// { dg-options "-std=gnu++11 -lstdc++fs" } +// { dg-require-filesystem-ts "" } + +// Copyright (C) 2014-2015 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 8.4.9 path decomposition [path.decompose] + +#include +#include +#include + +using std::experimental::filesystem::path; + +void +test01() +{ + path p1 = "foo"; + VERIFY( p1.relative_path() == p1 ); + path p2 = "foo/bar"; + VERIFY( p2.relative_path() == p2 ); + path p3 = "/foo/bar"; + VERIFY( p3.relative_path() == p2 ); +} + +void +test02() +{ + for (const path& p : __gnu_test::test_paths) + { + bool after_root = false; + const path prel = p.relative_path(); + VERIFY( !prel.has_root_name() ); + path rel; + for (const auto& cmpt : p) + { + if (!cmpt.has_root_path()) + after_root = true; + if (after_root) + rel /= cmpt; + } + VERIFY( prel == rel ); + } +} + +int +main() +{ + test01(); + test02(); +} Index: libstdc++-v3/testsuite/experimental/filesystem/path/decompose/root_directory.cc =================================================================== --- a/src/libstdc++-v3/testsuite/experimental/filesystem/path/decompose/root_directory.cc (.../tags/gcc_5_2_0_release) +++ b/src/libstdc++-v3/testsuite/experimental/filesystem/path/decompose/root_directory.cc (.../branches/gcc-5-branch) @@ -0,0 +1,60 @@ +// { dg-options "-std=gnu++11 -lstdc++fs" } +// { dg-require-filesystem-ts "" } + +// Copyright (C) 2014-2015 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 8.4.9 path decomposition [path.decompose] + +#include +#include +#include + +using std::experimental::filesystem::path; + +void +test01() +{ + path p1 = "foo/bar"; + VERIFY( p1.root_directory() == path() ); + path p2 = "/foo/bar"; + VERIFY( p2.root_directory() == path("/") ); + path p3 = "//foo"; + VERIFY( p3.root_directory() == path() ); + path p4 = "///foo"; + VERIFY( p4.root_directory() == path("/") ); +} + +void +test02() +{ + for (const path& p : __gnu_test::test_paths) + { + path rootdir = p.root_directory(); + // If root-directory is composed of 'slash name', + // 'slash' is excluded from the returned string. + if (!rootdir.empty() && rootdir.native() != "/") + VERIFY( rootdir.native()[0] != '/' ); + } +} + +int +main() +{ + test01(); + test02(); +} Index: libstdc++-v3/testsuite/experimental/filesystem/path/decompose/stem.cc =================================================================== --- a/src/libstdc++-v3/testsuite/experimental/filesystem/path/decompose/stem.cc (.../tags/gcc_5_2_0_release) +++ b/src/libstdc++-v3/testsuite/experimental/filesystem/path/decompose/stem.cc (.../branches/gcc-5-branch) @@ -0,0 +1,53 @@ +// { dg-options "-std=gnu++11 -lstdc++fs" } +// { dg-require-filesystem-ts "" } + +// Copyright (C) 2014-2015 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 8.4.9 path decomposition [path.decompose] + +#include +#include +#include +#include + +using std::experimental::filesystem::path; + +void +test01() +{ + VERIFY( path("/foo/bar.txt").stem() == path("bar") ); + path p = "foo.bar.baz.tar"; + std::vector v; + for (; !p.extension().empty(); p = p.stem()) + v.push_back(p.extension().native()); + VERIFY( v.at(0) == ".tar" ); + VERIFY( v.at(1) == ".baz" ); + VERIFY( v.at(2) == ".bar" ); + + VERIFY( path(".hidden").stem() == path() ); + + VERIFY( path().stem() == path() ); + VERIFY( path(".").stem() == path(".") ); + VERIFY( path("..").stem() == path("..") ); +} + +int +main() +{ + test01(); +} Index: libstdc++-v3/testsuite/experimental/filesystem/path/itr/traversal.cc =================================================================== --- a/src/libstdc++-v3/testsuite/experimental/filesystem/path/itr/traversal.cc (.../tags/gcc_5_2_0_release) +++ b/src/libstdc++-v3/testsuite/experimental/filesystem/path/itr/traversal.cc (.../branches/gcc-5-branch) @@ -0,0 +1,86 @@ +// { dg-options "-std=gnu++11 -lstdc++fs" } +// { dg-require-filesystem-ts "" } + +// Copyright (C) 2014-2015 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 8.5 path iterators [path.itr] + +#include +#include +#include +#include +#include + +using std::experimental::filesystem::path; + +void +test01() +{ + path p; + VERIFY( p.begin() == p.end() ); + + std::vector v, v2; + + p = "/"; + v.assign(p.begin(), p.end()); + v2 = { "/" }; + VERIFY( v == v2 ); + + p = "filename"; + v.assign(p.begin(), p.end()); + v2 = { "filename" }; + VERIFY( v == v2 ); + + p = "dir/"; + v.assign(p.begin(), p.end()); + v2 = { "dir", "." }; + VERIFY( v == v2 ); + + p = "//rootname/dir/"; + v.assign(p.begin(), p.end()); + v2 = { "//rootname", "/", "dir", "." }; + VERIFY( v == v2 ); + + p = "//rootname/dir/filename"; + v.assign(p.begin(), p.end()); + v2 = { "//rootname", "/", "dir", "filename" }; + VERIFY( v == v2 ); +} + +void +test02() +{ + using reverse_iterator = std::reverse_iterator; + std::vector fwd, rev; + + for (const path& p : __gnu_test::test_paths) + { + const auto begin = p.begin(), end = p.end(); + fwd.assign(begin, end); + rev.assign(reverse_iterator(end), reverse_iterator(begin)); + VERIFY( fwd.size() == rev.size() ); + VERIFY( std::equal(fwd.begin(), fwd.end(), rev.rbegin()) ); + } +} + +int +main() +{ + test01(); + test02(); +} Index: libstdc++-v3/testsuite/util/testsuite_fs.h =================================================================== --- a/src/libstdc++-v3/testsuite/util/testsuite_fs.h (.../tags/gcc_5_2_0_release) +++ b/src/libstdc++-v3/testsuite/util/testsuite_fs.h (.../branches/gcc-5-branch) @@ -0,0 +1,93 @@ +// -*- C++ -*- +// Filesystem utils for the C++ library testsuite. +// +// Copyright (C) 2014-2015 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . +// + +#ifndef _TESTSUITE_FS_H +#define _TESTSUITE_FS_H 1 + +#include +#include +#include +#include +#include +#include + +namespace __gnu_test +{ +#define PATH_CHK(p1, p2, fn) \ + if ( p1.fn() != p2.fn() ) \ + throw std::experimental::filesystem::filesystem_error( #fn, p1, p2, \ + std::make_error_code(std::errc::invalid_argument) ) + + void + compare_paths(const std::experimental::filesystem::path& p1, + const std::experimental::filesystem::path& p2) + { + // std::cout << "Comparing " << p1 << " and " << p2 << std::endl; + PATH_CHK( p1, p2, string ); + PATH_CHK( p1, p2, empty ); + PATH_CHK( p1, p2, has_root_path ); + PATH_CHK( p1, p2, has_root_name ); + PATH_CHK( p1, p2, has_root_directory ); + PATH_CHK( p1, p2, has_relative_path ); + PATH_CHK( p1, p2, has_parent_path ); + PATH_CHK( p1, p2, has_filename ); + PATH_CHK( p1, p2, has_stem ); + PATH_CHK( p1, p2, has_extension ); + PATH_CHK( p1, p2, is_absolute ); + PATH_CHK( p1, p2, is_relative ); + auto d1 = std::distance(p1.begin(), p1.end()); + auto d2 = std::distance(p2.begin(), p2.end()); + if( d1 != d2 ) + throw std::experimental::filesystem::filesystem_error( + "distance(begin, end)", p1, p2, + std::make_error_code(std::errc::invalid_argument) ); + } + + const std::string test_paths[] = { + "", "/", "//", "/.", "/./", "/a", "/a/", "/a//", "/a/b/c/d", "/a//b", + "a", "a/b", "a/b/", "a/b/c", "a/b/c.d", "a/b/..", "a/b/c.", "a/b/.c" + }; + + // This is NOT supposed to be a secure way to get a unique name! + // We just need a path that doesn't exist for testing purposes. + std::experimental::filesystem::path + nonexistent_path() + { + std::experimental::filesystem::path p; +#if defined(_GNU_SOURCE) || _XOPEN_SOURCE >= 500 || _POSIX_C_SOURCE >= 200112L + char tmp[] = "test.XXXXXX"; + int fd = ::mkstemp(tmp); + if (fd == -1) + throw std::experimental::filesystem::filesystem_error("mkstemp failed", + std::error_code(errno, std::generic_category())); + ::unlink(tmp); + ::close(fd); + p = tmp; +#else + char buf[64]; + std::sprintf(buf, "test.%lu", (unsigned long)::getpid()); + p = buf; +#endif + return p; + } + +} // namespace __gnu_test +#endif Index: libstdc++-v3/config.h.in =================================================================== --- a/src/libstdc++-v3/config.h.in (.../tags/gcc_5_2_0_release) +++ b/src/libstdc++-v3/config.h.in (.../branches/gcc-5-branch) @@ -54,6 +54,9 @@ /* Define to 1 if you have the `cosl' function. */ #undef HAVE_COSL +/* Define to 1 if you have the header file. */ +#undef HAVE_DIRENT_H + /* Define to 1 if you have the header file. */ #undef HAVE_DLFCN_H @@ -132,6 +135,9 @@ /* Define to 1 if you have the `fabsl' function. */ #undef HAVE_FABSL +/* Define to 1 if you have the header file. */ +#undef HAVE_FCNTL_H + /* Define to 1 if you have the header file. */ #undef HAVE_FENV_H @@ -406,6 +412,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_SYS_SEM_H +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_STATVFS_H + /* Define to 1 if you have the header file. */ #undef HAVE_SYS_STAT_H @@ -451,6 +460,9 @@ /* Defined if usleep exists. */ #undef HAVE_USLEEP +/* Define to 1 if you have the header file. */ +#undef HAVE_UTIME_H + /* Defined if vfwscanf exists. */ #undef HAVE_VFWSCANF @@ -726,6 +738,9 @@ /* Define if gthreads library is available. */ #undef _GLIBCXX_HAS_GTHREADS +/* Define to 1 if `d_type' is a member of `struct dirent'. */ +#undef _GLIBCXX_HAVE_STRUCT_DIRENT_D_TYPE + /* Define to 1 if a full hosted library is built, or 0 if freestanding. */ #undef _GLIBCXX_HOSTED @@ -824,6 +839,12 @@ this host. */ #undef _GLIBCXX_USE_DECIMAL_FLOAT +/* Define if fchmod is available in . */ +#undef _GLIBCXX_USE_FCHMOD + +/* Define if fchmodat is available in . */ +#undef _GLIBCXX_USE_FCHMODAT + /* Define if __float128 is supported on this host. */ #undef _GLIBCXX_USE_FLOAT128 @@ -858,6 +879,9 @@ of TR1 (Chapter 5.1). */ #undef _GLIBCXX_USE_RANDOM_TR1 +/* Define if realpath is available in . */ +#undef _GLIBCXX_USE_REALPATH + /* Defined if sched_yield is available. */ #undef _GLIBCXX_USE_SCHED_YIELD @@ -867,6 +891,12 @@ /* Define if _SC_NPROC_ONLN is available in . */ #undef _GLIBCXX_USE_SC_NPROC_ONLN +/* Define if sendfile is available in . */ +#undef _GLIBCXX_USE_SENDFILE + +/* Define if struct stat has timespec members. */ +#undef _GLIBCXX_USE_ST_MTIM + /* Define if sysctl(), CTL_HW and HW_NCPU are available in . */ #undef _GLIBCXX_USE_SYSCTL_HW_NCPU @@ -873,6 +903,10 @@ /* Define if obsolescent tmpnam is available in . */ #undef _GLIBCXX_USE_TMPNAM +/* Define if utimensat and UTIME_OMIT are available in and + AT_FDCWD in . */ +#undef _GLIBCXX_USE_UTIMENSAT + /* Define if code specialized for wchar_t should be used. */ #undef _GLIBCXX_USE_WCHAR_T Index: libstdc++-v3/acinclude.m4 =================================================================== --- a/src/libstdc++-v3/acinclude.m4 (.../tags/gcc_5_2_0_release) +++ b/src/libstdc++-v3/acinclude.m4 (.../branches/gcc-5-branch) @@ -49,7 +49,7 @@ # Keep these sync'd with the list in Makefile.am. The first provides an # expandable list at autoconf time; the second provides an expandable list # (i.e., shell variable) at configure time. - m4_define([glibcxx_SUBDIRS],[include libsupc++ python src src/c++98 src/c++11 doc po testsuite]) + m4_define([glibcxx_SUBDIRS],[include libsupc++ src src/c++98 src/c++11 src/filesystem doc po testsuite python]) SUBDIRS='glibcxx_SUBDIRS' # These need to be absolute paths, yet at the same time need to @@ -3905,7 +3905,168 @@ GLIBCXX_CONDITIONAL(ENABLE_CXX11_ABI, test $glibcxx_cxx11_abi = 1) ]) +dnl +dnl Check to see whether to build libstdc++fs.a +dnl +dnl --enable-libstdcxx-filesystem-ts +dnl +AC_DEFUN([GLIBCXX_ENABLE_FILESYSTEM_TS], [ + GLIBCXX_ENABLE(libstdcxx-filesystem-ts,auto,, + [turns on ISO/IEC TS 18822 support], + [permit yes|no|auto]) + AC_MSG_CHECKING([whether to build Filesystem TS support]) + if test x"$ac_cv_header_dirent_h" != x"yes"; then + enable_libstdcxx_filesystem_ts=no + fi + if test x"$enable_libstdcxx_filesystem_ts" = x"auto"; then + case "${target_os}" in + freebsd*|netbsd*|openbsd*|dragonfly*|darwin*) + enable_libstdcxx_filesystem_ts=yes + ;; + gnu* | linux* | kfreebsd*-gnu | knetbsd*-gnu) + enable_libstdcxx_filesystem_ts=yes + ;; + solaris*) + enable_libstdcxx_filesystem_ts=yes + ;; + *) + enable_libstdcxx_filesystem_ts=no + ;; + esac + fi + AC_MSG_RESULT($enable_libstdcxx_filesystem_ts) + GLIBCXX_CONDITIONAL(ENABLE_FILESYSTEM_TS, test $enable_libstdcxx_filesystem_ts = yes) +]) + +dnl +dnl Check whether the library calls required by the Filesystem TS are present +dnl and define _GLIBCXX_USE_REALPATH and _GLIBCXX_USE_UTIMENSAT. +dnl +AC_DEFUN([GLIBCXX_CHECK_FILESYSTEM_DEPS], [dnl +dnl + AC_LANG_SAVE + AC_LANG_CPLUSPLUS + ac_save_CXXFLAGS="$CXXFLAGS" + CXXFLAGS="$CXXFLAGS -fno-exceptions" +dnl + AC_MSG_CHECKING([for struct dirent.d_type]) + AC_CACHE_VAL(glibcxx_cv_dirent_d_type, [dnl + GCC_TRY_COMPILE_OR_LINK( + [#include ], + [ + struct dirent d; + if (sizeof d.d_type) return 0; + ], + [glibcxx_cv_dirent_d_type=yes], + [glibcxx_cv_dirent_d_type=no]) + ]) + if test $glibcxx_cv_dirent_d_type = yes; then + AC_DEFINE(_GLIBCXX_HAVE_STRUCT_DIRENT_D_TYPE, 1, [Define to 1 if `d_type' is a member of `struct dirent'.]) + fi + AC_MSG_RESULT($glibcxx_cv_dirent_d_type) +dnl + AC_MSG_CHECKING([for realpath]) + AC_CACHE_VAL(glibcxx_cv_realpath, [dnl + GCC_TRY_COMPILE_OR_LINK( + [#include ], + [char *tmp = realpath((const char*)NULL, (char*)NULL);], + [glibcxx_cv_realpath=yes], + [glibcxx_cv_realpath=no]) + ]) + if test $glibcxx_cv_realpath = yes; then + AC_DEFINE(_GLIBCXX_USE_REALPATH, 1, [Define if realpath is available in .]) + fi + AC_MSG_RESULT($glibcxx_cv_realpath) +dnl + AC_MSG_CHECKING([for utimensat]) + AC_CACHE_VAL(glibcxx_cv_utimensat, [dnl + GCC_TRY_COMPILE_OR_LINK( + [ + #include + #include + ], + [ + struct timespec ts[2] = { { 0, UTIME_OMIT }, { 1, 1 } }; + int i = utimensat(AT_FDCWD, "path", ts, 0); + ], + [glibcxx_cv_utimensat=yes], + [glibcxx_cv_utimensat=no]) + ]) + if test $glibcxx_cv_utimensat = yes; then + AC_DEFINE(_GLIBCXX_USE_UTIMENSAT, 1, [Define if utimensat and UTIME_OMIT are available in and AT_FDCWD in .]) + fi + AC_MSG_RESULT($glibcxx_cv_utimensat) +dnl + AC_MSG_CHECKING([for struct stat.st_mtim.tv_nsec]) + AC_CACHE_VAL(glibcxx_cv_st_mtim, [dnl + GCC_TRY_COMPILE_OR_LINK( + [ #include ], + [ + struct stat st; + return st.st_mtim.tv_nsec; + ], + [glibcxx_cv_st_mtim=yes], + [glibcxx_cv_st_mtim=no]) + ]) + if test $glibcxx_cv_st_mtim = yes; then + AC_DEFINE(_GLIBCXX_USE_ST_MTIM, 1, [Define if struct stat has timespec members.]) + fi + AC_MSG_RESULT($glibcxx_cv_st_mtim) +dnl + AC_MSG_CHECKING([for fchmod]) + AC_CACHE_VAL(glibcxx_cv_fchmod, [dnl + GCC_TRY_COMPILE_OR_LINK( + [#include ], + [fchmod(1, S_IWUSR);], + [glibcxx_cv_fchmod=yes], + [glibcxx_cv_fchmod=no]) + ]) + if test $glibcxx_cv_fchmod = yes; then + AC_DEFINE(_GLIBCXX_USE_FCHMOD, 1, [Define if fchmod is available in .]) + fi + AC_MSG_RESULT($glibcxx_cv_fchmod) +dnl + AC_MSG_CHECKING([for fchmodat]) + AC_CACHE_VAL(glibcxx_cv_fchmodat, [dnl + GCC_TRY_COMPILE_OR_LINK( + [ + #include + #include + ], + [fchmodat(AT_FDCWD, "", 0, AT_SYMLINK_NOFOLLOW);], + [glibcxx_cv_fchmodat=yes], + [glibcxx_cv_fchmodat=no]) + ]) + if test $glibcxx_cv_fchmodat = yes; then + AC_DEFINE(_GLIBCXX_USE_FCHMODAT, 1, [Define if fchmodat is available in .]) + fi + AC_MSG_RESULT($glibcxx_cv_fchmodat) +dnl + AC_MSG_CHECKING([for sendfile that can copy files]) + AC_CACHE_VAL(glibcxx_cv_sendfile, [dnl + case "${target_os}" in + gnu* | linux* | solaris*) + GCC_TRY_COMPILE_OR_LINK( + [#include ], + [sendfile(1, 2, (off_t*)NULL, sizeof 1);], + [glibcxx_cv_sendfile=yes], + [glibcxx_cv_sendfile=no]) + ;; + *) + glibcxx_cv_sendfile=no + ;; + esac + ]) + if test $glibcxx_cv_sendfile = yes; then + AC_DEFINE(_GLIBCXX_USE_SENDFILE, 1, [Define if sendfile is available in .]) + fi + AC_MSG_RESULT($glibcxx_cv_sendfile) +dnl + CXXFLAGS="$ac_save_CXXFLAGS" + AC_LANG_RESTORE +]) + # Macros from the top-level gcc directory. m4_include([../config/gc++filt.m4]) m4_include([../config/tls.m4]) Index: libstdc++-v3/aclocal.m4 =================================================================== --- a/src/libstdc++-v3/aclocal.m4 (.../tags/gcc_5_2_0_release) +++ b/src/libstdc++-v3/aclocal.m4 (.../branches/gcc-5-branch) @@ -1,7 +1,8 @@ -# generated automatically by aclocal 1.11.1 -*- Autoconf -*- +# generated automatically by aclocal 1.11.6 -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, -# 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc. +# 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, +# Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -19,12 +20,15 @@ If you have problems, you may need to regenerate the build system entirely. To do so, use the procedure documented by the package, typically `autoreconf'.])]) -# Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. +# Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008, 2011 Free Software +# Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. +# serial 1 + # AM_AUTOMAKE_VERSION(VERSION) # ---------------------------- # Automake X.Y traces this macro to ensure aclocal.m4 has been @@ -34,7 +38,7 @@ [am__api_version='1.11' dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to dnl require some minimum version. Point them to the right macro. -m4_if([$1], [1.11.1], [], +m4_if([$1], [1.11.6], [], [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl ]) @@ -50,7 +54,7 @@ # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. # This function is AC_REQUIREd by AM_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], -[AM_AUTOMAKE_VERSION([1.11.1])dnl +[AM_AUTOMAKE_VERSION([1.11.6])dnl m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) @@ -57,12 +61,14 @@ # AM_AUX_DIR_EXPAND -*- Autoconf -*- -# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. +# Copyright (C) 2001, 2003, 2005, 2011 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. +# serial 1 + # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets # $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to # `$srcdir', `$srcdir/..', or `$srcdir/../..'. @@ -283,12 +289,15 @@ done echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) -# Copyright (C) 2001, 2003, 2005, 2008 Free Software Foundation, Inc. +# Copyright (C) 2001, 2003, 2005, 2008, 2011 Free Software Foundation, +# Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. +# serial 1 + # AM_PROG_INSTALL_SH # ------------------ # Define $install_sh. @@ -307,8 +316,8 @@ # Add --enable-maintainer-mode option to configure. -*- Autoconf -*- # From Jim Meyering -# Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004, 2005, 2008 -# Free Software Foundation, Inc. +# Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004, 2005, 2008, +# 2011 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -328,7 +337,7 @@ [disable], [m4_define([am_maintainer_other], [enable])], [m4_define([am_maintainer_other], [enable]) m4_warn([syntax], [unexpected argument to AM@&t@_MAINTAINER_MODE: $1])]) -AC_MSG_CHECKING([whether to am_maintainer_other maintainer-specific portions of Makefiles]) +AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles]) dnl maintainer-mode's default is 'disable' unless 'enable' is passed AC_ARG_ENABLE([maintainer-mode], [ --][am_maintainer_other][-maintainer-mode am_maintainer_other make rules and dependencies not useful @@ -387,12 +396,15 @@ fi ]) -# Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc. +# Copyright (C) 2003, 2004, 2005, 2006, 2011 Free Software Foundation, +# Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. +# serial 1 + # AM_PROG_MKDIR_P # --------------- # Check for `mkdir -p'. @@ -415,13 +427,14 @@ # Helper functions for option handling. -*- Autoconf -*- -# Copyright (C) 2001, 2002, 2003, 2005, 2008 Free Software Foundation, Inc. +# Copyright (C) 2001, 2002, 2003, 2005, 2008, 2010 Free Software +# Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. -# serial 4 +# serial 5 # _AM_MANGLE_OPTION(NAME) # ----------------------- @@ -429,13 +442,13 @@ [[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) # _AM_SET_OPTION(NAME) -# ------------------------------ +# -------------------- # Set option NAME. Presently that only means defining a flag for this option. AC_DEFUN([_AM_SET_OPTION], [m4_define(_AM_MANGLE_OPTION([$1]), 1)]) # _AM_SET_OPTIONS(OPTIONS) -# ---------------------------------- +# ------------------------ # OPTIONS is a space-separated list of Automake options. AC_DEFUN([_AM_SET_OPTIONS], [m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) @@ -511,12 +524,14 @@ fi AC_MSG_RESULT(yes)]) -# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. +# Copyright (C) 2001, 2003, 2005, 2011 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. +# serial 1 + # AM_PROG_INSTALL_STRIP # --------------------- # One issue with vendor `install' (even GNU) is that you can't @@ -539,13 +554,13 @@ INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" AC_SUBST([INSTALL_STRIP_PROGRAM])]) -# Copyright (C) 2006, 2008 Free Software Foundation, Inc. +# Copyright (C) 2006, 2008, 2010 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. -# serial 2 +# serial 3 # _AM_SUBST_NOTMAKE(VARIABLE) # --------------------------- @@ -554,13 +569,13 @@ AC_DEFUN([_AM_SUBST_NOTMAKE]) # AM_SUBST_NOTMAKE(VARIABLE) -# --------------------------- +# -------------------------- # Public sister of _AM_SUBST_NOTMAKE. AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) # Check how to create a tarball. -*- Autoconf -*- -# Copyright (C) 2004, 2005 Free Software Foundation, Inc. +# Copyright (C) 2004, 2005, 2012 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -582,10 +597,11 @@ # a tarball read from stdin. # $(am__untar) < result.tar AC_DEFUN([_AM_PROG_TAR], -[# Always define AMTAR for backward compatibility. -AM_MISSING_PROG([AMTAR], [tar]) +[# Always define AMTAR for backward compatibility. Yes, it's still used +# in the wild :-( We should find a proper way to deprecate it ... +AC_SUBST([AMTAR], ['$${TAR-tar}']) m4_if([$1], [v7], - [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'], + [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'], [m4_case([$1], [ustar],, [pax],, [m4_fatal([Unknown tar format])]) AC_MSG_CHECKING([how to create a $1 tar archive]) Index: libgcc/ChangeLog =================================================================== --- a/src/libgcc/ChangeLog (.../tags/gcc_5_2_0_release) +++ b/src/libgcc/ChangeLog (.../branches/gcc-5-branch) @@ -1,3 +1,11 @@ +2015-07-23 Chung-Lin Tang + + Backport from mainline: + 2015-07-22 Chung-Lin Tang + + * config/nios2/linux-atomic.c (): Remove #include. + (EFAULT,EBUSY,ENOSYS): Delete unused #defines. + 2015-07-16 Release Manager * GCC 5.2.0 released. Index: libgcc/config/nios2/linux-atomic.c =================================================================== --- a/src/libgcc/config/nios2/linux-atomic.c (.../tags/gcc_5_2_0_release) +++ b/src/libgcc/config/nios2/linux-atomic.c (.../branches/gcc-5-branch) @@ -20,11 +20,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see . */ -#include -#define EFAULT 14 -#define EBUSY 16 -#define ENOSYS 38 - /* We implement byte, short and int versions of each atomic operation using the kernel helper defined below. There is no support for 64-bit operations yet. */ Index: gcc/ipa-chkp.c =================================================================== --- a/src/gcc/ipa-chkp.c (.../tags/gcc_5_2_0_release) +++ b/src/gcc/ipa-chkp.c (.../branches/gcc-5-branch) @@ -104,7 +104,7 @@ /* Return 1 calls to FNDECL should be replaced with a call to wrapper function. */ -static bool +bool chkp_wrap_function (tree fndecl) { if (!flag_chkp_use_wrappers) @@ -139,6 +139,51 @@ return false; } +static const char * +chkp_wrap_function_name (tree fndecl) +{ + gcc_assert (DECL_BUILT_IN_CLASS (fndecl) == BUILT_IN_NORMAL); + + switch (DECL_FUNCTION_CODE (fndecl)) + { + case BUILT_IN_STRLEN: + return CHKP_WRAPPER_SYMBOL_PREFIX "strlen"; + case BUILT_IN_STRCPY: + return CHKP_WRAPPER_SYMBOL_PREFIX "strcpy"; + case BUILT_IN_STRNCPY: + return CHKP_WRAPPER_SYMBOL_PREFIX "strncpy"; + case BUILT_IN_STPCPY: + return CHKP_WRAPPER_SYMBOL_PREFIX "stpcpy"; + case BUILT_IN_STPNCPY: + return CHKP_WRAPPER_SYMBOL_PREFIX "stpncpy"; + case BUILT_IN_STRCAT: + return CHKP_WRAPPER_SYMBOL_PREFIX "strcat"; + case BUILT_IN_STRNCAT: + return CHKP_WRAPPER_SYMBOL_PREFIX "strncat"; + case BUILT_IN_MEMCPY: + return CHKP_WRAPPER_SYMBOL_PREFIX "memcpy"; + case BUILT_IN_MEMPCPY: + return CHKP_WRAPPER_SYMBOL_PREFIX "mempcpy"; + case BUILT_IN_MEMSET: + return CHKP_WRAPPER_SYMBOL_PREFIX "memset"; + case BUILT_IN_MEMMOVE: + return CHKP_WRAPPER_SYMBOL_PREFIX "memmove"; + case BUILT_IN_BZERO: + return CHKP_WRAPPER_SYMBOL_PREFIX "bzero"; + case BUILT_IN_MALLOC: + return CHKP_WRAPPER_SYMBOL_PREFIX "malloc"; + case BUILT_IN_CALLOC: + return CHKP_WRAPPER_SYMBOL_PREFIX "calloc"; + case BUILT_IN_REALLOC: + return CHKP_WRAPPER_SYMBOL_PREFIX "realloc"; + + default: + gcc_unreachable (); + } + + return ""; +} + /* Build a clone of FNDECL with a modified name. */ static tree @@ -164,9 +209,8 @@ instrumented version. */ if (chkp_wrap_function(fndecl)) { - s = CHKP_WRAPPER_SYMBOL_PREFIX; - s += IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (fndecl)); - new_name = get_identifier (s.c_str ()); + new_name = get_identifier (chkp_wrap_function_name (fndecl)); + DECL_VISIBILITY (new_decl) = VISIBILITY_DEFAULT; } else { @@ -541,25 +585,10 @@ if (gimple_has_body_p (fndecl)) { - /* If function will not be instrumented, then it's instrumented - version is a thunk for the original. */ - if (!chkp_instrumentable_p (fndecl)) - { - clone->remove_callees (); - clone->remove_all_references (); - clone->thunk.thunk_p = true; - clone->thunk.add_pointer_bounds_args = true; - clone->create_edge (node, NULL, 0, CGRAPH_FREQ_BASE); - /* Thunk shouldn't be a cdtor. */ - DECL_STATIC_CONSTRUCTOR (clone->decl) = 0; - DECL_STATIC_DESTRUCTOR (clone->decl) = 0; - } - else - { - tree_function_versioning (fndecl, new_decl, NULL, false, - NULL, false, NULL, NULL); - clone->lowered = true; - } + gcc_assert (chkp_instrumentable_p (fndecl)); + tree_function_versioning (fndecl, new_decl, NULL, false, + NULL, false, NULL, NULL); + clone->lowered = true; } /* New params are inserted after versioning because it @@ -586,12 +615,7 @@ /* Clone all aliases. */ for (i = 0; node->iterate_direct_aliases (i, ref); i++) - { - struct cgraph_node *alias = dyn_cast (ref->referring); - struct cgraph_node *chkp_alias - = chkp_maybe_create_clone (alias->decl); - chkp_alias->create_reference (clone, IPA_REF_ALIAS, NULL); - } + chkp_maybe_create_clone (ref->referring->decl); /* Clone all thunks. */ for (e = node->callers; e; e = e->next_caller) @@ -615,7 +639,10 @@ ref = node->ref_list.first_reference (); if (ref) - chkp_maybe_create_clone (ref->referred->decl); + { + target = chkp_maybe_create_clone (ref->referred->decl); + clone->create_reference (target, IPA_REF_ALIAS); + } if (node->alias_target) { Index: gcc/ipa-chkp.h =================================================================== --- a/src/gcc/ipa-chkp.h (.../tags/gcc_5_2_0_release) +++ b/src/gcc/ipa-chkp.h (.../branches/gcc-5-branch) @@ -24,5 +24,6 @@ extern tree chkp_maybe_clone_builtin_fndecl (tree fndecl); extern cgraph_node *chkp_maybe_create_clone (tree fndecl); extern bool chkp_instrumentable_p (tree fndecl); +extern bool chkp_wrap_function (tree fndecl); #endif /* GCC_IPA_CHKP_H */ Index: gcc/tree-chkp.c =================================================================== --- a/src/gcc/tree-chkp.c (.../tags/gcc_5_2_0_release) +++ b/src/gcc/tree-chkp.c (.../branches/gcc-5-branch) @@ -479,6 +479,21 @@ return false; } +/* Emit code to build zero bounds and return RTL holding + the result. */ +rtx +chkp_expand_zero_bounds () +{ + tree zero_bnd; + + if (flag_chkp_use_static_const_bounds) + zero_bnd = chkp_get_zero_bounds_var (); + else + zero_bnd = chkp_build_make_bounds_call (integer_zero_node, + integer_zero_node); + return expand_normal (zero_bnd); +} + /* Emit code to store zero bounds for PTR located at MEM. */ void chkp_expand_bounds_reset_for_mem (tree mem, tree ptr) @@ -1161,7 +1176,20 @@ return bnd_var; } +/* If BND is an abnormal bounds copy, return a copied value. + Otherwise return BND. */ +static tree +chkp_get_orginal_bounds_for_abnormal_copy (tree bnd) +{ + if (bitmap_bit_p (chkp_abnormal_copies, SSA_NAME_VERSION (bnd))) + { + gimple bnd_def = SSA_NAME_DEF_STMT (bnd); + gcc_checking_assert (gimple_code (bnd_def) == GIMPLE_ASSIGN); + bnd = gimple_assign_rhs1 (bnd_def); + } + return bnd; +} /* Register bounds BND for object PTR in global bounds table. A copy of bounds may be created for abnormal ssa names. @@ -1205,11 +1233,7 @@ /* For abnormal copies we may just find original bounds and use them. */ if (!abnormal_ptr && !SSA_NAME_IS_DEFAULT_DEF (bnd)) - { - gimple bnd_def = SSA_NAME_DEF_STMT (bnd); - gcc_checking_assert (gimple_code (bnd_def) == GIMPLE_ASSIGN); - bnd = gimple_assign_rhs1 (bnd_def); - } + bnd = chkp_get_orginal_bounds_for_abnormal_copy (bnd); /* For undefined values we usually use none bounds value but in case of abnormal edge it may cause coalescing failures. Use default definition of @@ -1241,6 +1265,7 @@ copy = make_temp_ssa_name (pointer_bounds_type_node, gimple_build_nop (), CHKP_BOUND_TMP_NAME); + bnd = chkp_get_orginal_bounds_for_abnormal_copy (bnd); assign = gimple_build_assign (copy, bnd); if (dump_file && (dump_flags & TDF_DETAILS)) @@ -2513,6 +2538,7 @@ tree rhs1 = gimple_assign_rhs1 (assign); tree bounds = NULL_TREE; gimple_stmt_iterator iter = gsi_for_stmt (assign); + tree base = NULL; if (dump_file && (dump_flags & TDF_DETAILS)) { @@ -2539,6 +2565,7 @@ case INTEGER_CST: /* Bounds are just propagated from RHS. */ bounds = chkp_find_bounds (rhs1, &iter); + base = rhs1; break; case VIEW_CONVERT_EXPR: @@ -2609,6 +2636,8 @@ (e.g. pointer minus pointer). In such case use default invalid op bounds. */ bounds = chkp_get_invalid_op_bounds (); + + base = (bounds == bnd1) ? rhs1 : (bounds == bnd2) ? rhs2 : NULL; } break; @@ -2704,6 +2733,19 @@ gcc_assert (bounds); + /* We may reuse bounds of other pointer we copy/modify. But it is not + allowed for abnormal ssa names. If we produced a pointer using + abnormal ssa name, we better make a bounds copy to avoid coalescing + issues. */ + if (base + && TREE_CODE (base) == SSA_NAME + && SSA_NAME_OCCURS_IN_ABNORMAL_PHI (base)) + { + gimple stmt = gimple_build_assign (chkp_get_tmp_reg (NULL), bounds); + gsi_insert_after (&iter, stmt, GSI_SAME_STMT); + bounds = gimple_assign_lhs (stmt); + } + if (node) bounds = chkp_maybe_copy_and_register_bounds (node, bounds); @@ -4090,7 +4132,7 @@ void *data ATTRIBUTE_UNUSED) { if (TREE_CODE (*op) == FUNCTION_DECL - && !lookup_attribute ("bnd_legacy", DECL_ATTRIBUTES (*op)) + && chkp_instrumentable_p (*op) && (DECL_BUILT_IN_CLASS (*op) == NOT_BUILT_IN /* For builtins we replace pointers only for selected function and functions having definitions. */ Index: gcc/tree-chkp.h =================================================================== --- a/src/gcc/tree-chkp.h (.../tags/gcc_5_2_0_release) +++ b/src/gcc/tree-chkp.h (.../branches/gcc-5-branch) @@ -53,6 +53,7 @@ struct cgraph_edge *edge); extern bool chkp_gimple_call_builtin_p (gimple call, enum built_in_function code); +extern rtx chkp_expand_zero_bounds (void); extern void chkp_expand_bounds_reset_for_mem (tree mem, tree ptr); extern tree chkp_insert_retbnd_call (tree bndval, tree retval, gimple_stmt_iterator *gsi); Index: gcc/c-family/ChangeLog =================================================================== --- a/src/gcc/c-family/ChangeLog (.../tags/gcc_5_2_0_release) +++ b/src/gcc/c-family/ChangeLog (.../branches/gcc-5-branch) @@ -1,3 +1,13 @@ +2015-08-11 Marek Polacek + + Backported from mainline + 2015-08-03 Marek Polacek + + PR sanitizer/66908 + * c-ubsan.c: Include gimplify.h. + (ubsan_instrument_division): Unshare OP0 and OP1. + (ubsan_instrument_shift): Likewise. + 2015-07-16 Release Manager * GCC 5.2.0 released. Index: gcc/c-family/c-common.c =================================================================== --- a/src/gcc/c-family/c-common.c (.../tags/gcc_5_2_0_release) +++ b/src/gcc/c-family/c-common.c (.../branches/gcc-5-branch) @@ -10741,7 +10741,7 @@ if (TREE_CODE (p) == INTEGER_CST) { int i = tree_to_uhwi (p); - if (i < 0 || (i & MEMMODEL_MASK) >= MEMMODEL_LAST) + if (i < 0 || (memmodel_base (i) >= MEMMODEL_LAST)) { warning_at (loc, OPT_Winvalid_memory_model, "invalid memory model argument %d of %qE", x + 1, Index: gcc/c-family/c-ubsan.c =================================================================== --- a/src/gcc/c-family/c-ubsan.c (.../tags/gcc_5_2_0_release) +++ b/src/gcc/c-family/c-ubsan.c (.../branches/gcc-5-branch) @@ -55,6 +55,7 @@ #include "internal-fn.h" #include "stor-layout.h" #include "builtins.h" +#include "gimplify.h" /* Instrument division by zero and INT_MIN / -1. If not instrumenting, return NULL_TREE. */ @@ -71,6 +72,9 @@ gcc_assert (TYPE_MAIN_VARIANT (TREE_TYPE (op0)) == TYPE_MAIN_VARIANT (TREE_TYPE (op1))); + op0 = unshare_expr (op0); + op1 = unshare_expr (op1); + if (TREE_CODE (type) == INTEGER_TYPE && (flag_sanitize & SANITIZE_DIVIDE)) t = fold_build2 (EQ_EXPR, boolean_type_node, @@ -151,6 +155,9 @@ HOST_WIDE_INT op0_prec = TYPE_PRECISION (type0); tree uprecm1 = build_int_cst (op1_utype, op0_prec - 1); + op0 = unshare_expr (op0); + op1 = unshare_expr (op1); + t = fold_convert_loc (loc, op1_utype, op1); t = fold_build2 (GT_EXPR, boolean_type_node, t, uprecm1); Index: gcc/lra-int.h =================================================================== --- a/src/gcc/lra-int.h (.../tags/gcc_5_2_0_release) +++ b/src/gcc/lra-int.h (.../branches/gcc-5-branch) @@ -314,8 +314,8 @@ extern void lra_process_new_insns (rtx_insn *, rtx_insn *, rtx_insn *, const char *); -extern bool lra_substitute_pseudo (rtx *, int, rtx); -extern bool lra_substitute_pseudo_within_insn (rtx_insn *, int, rtx); +extern bool lra_substitute_pseudo (rtx *, int, rtx, bool); +extern bool lra_substitute_pseudo_within_insn (rtx_insn *, int, rtx, bool); extern lra_insn_recog_data_t lra_set_insn_recog_data (rtx_insn *); extern lra_insn_recog_data_t lra_update_insn_recog_data (rtx_insn *); Index: gcc/optabs.c =================================================================== --- a/src/gcc/optabs.c (.../tags/gcc_5_2_0_release) +++ b/src/gcc/optabs.c (.../branches/gcc-5-branch) @@ -7178,7 +7178,7 @@ success = NULL_RTX; oldval = cmp_reg; if (!expand_atomic_compare_and_swap (&success, &oldval, mem, old_reg, - new_reg, false, MEMMODEL_SEQ_CST, + new_reg, false, MEMMODEL_SYNC_SEQ_CST, MEMMODEL_RELAXED)) return false; @@ -7239,9 +7239,7 @@ exists, and the memory model is stronger than acquire, add a release barrier before the instruction. */ - if ((model & MEMMODEL_MASK) == MEMMODEL_SEQ_CST - || (model & MEMMODEL_MASK) == MEMMODEL_RELEASE - || (model & MEMMODEL_MASK) == MEMMODEL_ACQ_REL) + if (is_mm_seq_cst (model) || is_mm_release (model) || is_mm_acq_rel (model)) expand_mem_thread_fence (model); if (icode != CODE_FOR_nothing) @@ -7348,11 +7346,12 @@ rtx ret; /* Try an atomic_exchange first. */ - ret = maybe_emit_atomic_exchange (target, mem, val, MEMMODEL_ACQUIRE); + ret = maybe_emit_atomic_exchange (target, mem, val, MEMMODEL_SYNC_ACQUIRE); if (ret) return ret; - ret = maybe_emit_sync_lock_test_and_set (target, mem, val, MEMMODEL_ACQUIRE); + ret = maybe_emit_sync_lock_test_and_set (target, mem, val, + MEMMODEL_SYNC_ACQUIRE); if (ret) return ret; @@ -7363,7 +7362,7 @@ /* If there are no other options, try atomic_test_and_set if the value being stored is 1. */ if (val == const1_rtx) - ret = maybe_emit_atomic_test_and_set (target, mem, MEMMODEL_ACQUIRE); + ret = maybe_emit_atomic_test_and_set (target, mem, MEMMODEL_SYNC_ACQUIRE); return ret; } @@ -7620,7 +7619,7 @@ { if (HAVE_mem_thread_fence) emit_insn (gen_mem_thread_fence (GEN_INT (model))); - else if ((model & MEMMODEL_MASK) != MEMMODEL_RELAXED) + else if (!is_mm_relaxed (model)) { if (HAVE_memory_barrier) emit_insn (gen_memory_barrier ()); @@ -7644,7 +7643,7 @@ { if (HAVE_mem_signal_fence) emit_insn (gen_mem_signal_fence (GEN_INT (model))); - else if ((model & MEMMODEL_MASK) != MEMMODEL_RELAXED) + else if (!is_mm_relaxed (model)) { /* By default targets are coherent between a thread and the signal handler running on the same thread. Thus this really becomes a @@ -7699,7 +7698,7 @@ target = gen_reg_rtx (mode); /* For SEQ_CST, emit a barrier before the load. */ - if ((model & MEMMODEL_MASK) == MEMMODEL_SEQ_CST) + if (is_mm_seq_cst (model)) expand_mem_thread_fence (model); emit_move_insn (target, mem); @@ -7745,7 +7744,7 @@ if (maybe_expand_insn (icode, 2, ops)) { /* lock_release is only a release barrier. */ - if ((model & MEMMODEL_MASK) == MEMMODEL_SEQ_CST) + if (is_mm_seq_cst (model)) expand_mem_thread_fence (model); return const0_rtx; } @@ -7772,7 +7771,7 @@ emit_move_insn (mem, val); /* For SEQ_CST, also emit a barrier after the store. */ - if ((model & MEMMODEL_MASK) == MEMMODEL_SEQ_CST) + if (is_mm_seq_cst (model)) expand_mem_thread_fence (model); return const0_rtx; Index: gcc/DATESTAMP =================================================================== --- a/src/gcc/DATESTAMP (.../tags/gcc_5_2_0_release) +++ b/src/gcc/DATESTAMP (.../branches/gcc-5-branch) @@ -1 +1 @@ -20150716 +20150903 Index: gcc/postreload.c =================================================================== --- a/src/gcc/postreload.c (.../tags/gcc_5_2_0_release) +++ b/src/gcc/postreload.c (.../branches/gcc-5-branch) @@ -2164,6 +2164,8 @@ unknown values. */ if (CALL_P (insn)) { + rtx link; + for (i = FIRST_PSEUDO_REGISTER - 1; i >= 0; i--) { if (call_used_regs[i]) @@ -2170,6 +2172,21 @@ /* Reset the information about this register. */ reg_mode[i] = VOIDmode; } + + for (link = CALL_INSN_FUNCTION_USAGE (insn); link; + link = XEXP (link, 1)) + { + rtx setuse = XEXP (link, 0); + rtx usage_rtx = XEXP (setuse, 0); + if (GET_CODE (setuse) == CLOBBER + && REG_P (usage_rtx)) + { + unsigned int end_regno = END_REGNO (usage_rtx); + for (unsigned int r = REGNO (usage_rtx); r < end_regno; ++r) + /* Reset the information about this register. */ + reg_mode[r] = VOIDmode; + } + } } } return changed; Index: gcc/lra.c =================================================================== --- a/src/gcc/lra.c (.../tags/gcc_5_2_0_release) +++ b/src/gcc/lra.c (.../branches/gcc-5-branch) @@ -1818,9 +1818,10 @@ /* Replace all references to register OLD_REGNO in *LOC with pseudo - register NEW_REG. Return true if any change was made. */ + register NEW_REG. Try to simplify subreg of constant if SUBREG_P. + Return true if any change was made. */ bool -lra_substitute_pseudo (rtx *loc, int old_regno, rtx new_reg) +lra_substitute_pseudo (rtx *loc, int old_regno, rtx new_reg, bool subreg_p) { rtx x = *loc; bool result = false; @@ -1832,9 +1833,25 @@ return false; code = GET_CODE (x); - if (code == REG && (int) REGNO (x) == old_regno) + if (code == SUBREG && subreg_p) { - machine_mode mode = GET_MODE (*loc); + rtx subst, inner = SUBREG_REG (x); + /* Transform subreg of constant while we still have inner mode + of the subreg. The subreg internal should not be an insn + operand. */ + if (REG_P (inner) && (int) REGNO (inner) == old_regno + && CONSTANT_P (new_reg) + && (subst = simplify_subreg (GET_MODE (x), new_reg, GET_MODE (inner), + SUBREG_BYTE (x))) != NULL_RTX) + { + *loc = subst; + return true; + } + + } + else if (code == REG && (int) REGNO (x) == old_regno) + { + machine_mode mode = GET_MODE (x); machine_mode inner_mode = GET_MODE (new_reg); if (mode != inner_mode @@ -1856,13 +1873,15 @@ { if (fmt[i] == 'e') { - if (lra_substitute_pseudo (&XEXP (x, i), old_regno, new_reg)) + if (lra_substitute_pseudo (&XEXP (x, i), old_regno, + new_reg, subreg_p)) result = true; } else if (fmt[i] == 'E') { for (j = XVECLEN (x, i) - 1; j >= 0; j--) - if (lra_substitute_pseudo (&XVECEXP (x, i, j), old_regno, new_reg)) + if (lra_substitute_pseudo (&XVECEXP (x, i, j), old_regno, + new_reg, subreg_p)) result = true; } } @@ -1869,13 +1888,15 @@ return result; } -/* Call lra_substitute_pseudo within an insn. This won't update the insn ptr, - just the contents of the insn. */ +/* Call lra_substitute_pseudo within an insn. Try to simplify subreg + of constant if SUBREG_P. This won't update the insn ptr, just the + contents of the insn. */ bool -lra_substitute_pseudo_within_insn (rtx_insn *insn, int old_regno, rtx new_reg) +lra_substitute_pseudo_within_insn (rtx_insn *insn, int old_regno, + rtx new_reg, bool subreg_p) { rtx loc = insn; - return lra_substitute_pseudo (&loc, old_regno, new_reg); + return lra_substitute_pseudo (&loc, old_regno, new_reg, subreg_p); } Index: gcc/tree.h =================================================================== --- a/src/gcc/tree.h (.../tags/gcc_5_2_0_release) +++ b/src/gcc/tree.h (.../branches/gcc-5-branch) @@ -4381,6 +4381,69 @@ extern void warn_deprecated_use (tree, tree); extern void cache_integer_cst (tree); +/* Return the memory model from a host integer. */ +static inline enum memmodel +memmodel_from_int (unsigned HOST_WIDE_INT val) +{ + return (enum memmodel) (val & MEMMODEL_MASK); +} + +/* Return the base memory model from a host integer. */ +static inline enum memmodel +memmodel_base (unsigned HOST_WIDE_INT val) +{ + return (enum memmodel) (val & MEMMODEL_BASE_MASK); +} + +/* Return TRUE if the memory model is RELAXED. */ +static inline bool +is_mm_relaxed (enum memmodel model) +{ + return (model & MEMMODEL_BASE_MASK) == MEMMODEL_RELAXED; +} + +/* Return TRUE if the memory model is CONSUME. */ +static inline bool +is_mm_consume (enum memmodel model) +{ + return (model & MEMMODEL_BASE_MASK) == MEMMODEL_CONSUME; +} + +/* Return TRUE if the memory model is ACQUIRE. */ +static inline bool +is_mm_acquire (enum memmodel model) +{ + return (model & MEMMODEL_BASE_MASK) == MEMMODEL_ACQUIRE; +} + +/* Return TRUE if the memory model is RELEASE. */ +static inline bool +is_mm_release (enum memmodel model) +{ + return (model & MEMMODEL_BASE_MASK) == MEMMODEL_RELEASE; +} + +/* Return TRUE if the memory model is ACQ_REL. */ +static inline bool +is_mm_acq_rel (enum memmodel model) +{ + return (model & MEMMODEL_BASE_MASK) == MEMMODEL_ACQ_REL; +} + +/* Return TRUE if the memory model is SEQ_CST. */ +static inline bool +is_mm_seq_cst (enum memmodel model) +{ + return (model & MEMMODEL_BASE_MASK) == MEMMODEL_SEQ_CST; +} + +/* Return TRUE if the memory model is a SYNC variant. */ +static inline bool +is_mm_sync (enum memmodel model) +{ + return (model & MEMMODEL_SYNC); +} + /* Compare and hash for any structure which begins with a canonical pointer. Assumes all pointers are interchangeable, which is sort of already assumed by gcc elsewhere IIRC. */ Index: gcc/builtins.c =================================================================== --- a/src/gcc/builtins.c (.../tags/gcc_5_2_0_release) +++ b/src/gcc/builtins.c (.../branches/gcc-5-branch) @@ -5271,7 +5271,7 @@ mem = get_builtin_sync_mem (CALL_EXPR_ARG (exp, 0), mode); val = expand_expr_force_mode (CALL_EXPR_ARG (exp, 1), mode); - return expand_atomic_fetch_op (target, mem, val, code, MEMMODEL_SEQ_CST, + return expand_atomic_fetch_op (target, mem, val, code, MEMMODEL_SYNC_SEQ_CST, after); } @@ -5301,8 +5301,8 @@ poval = ⌖ } if (!expand_atomic_compare_and_swap (pbool, poval, mem, old_val, new_val, - false, MEMMODEL_SEQ_CST, - MEMMODEL_SEQ_CST)) + false, MEMMODEL_SYNC_SEQ_CST, + MEMMODEL_SYNC_SEQ_CST)) return NULL_RTX; return target; @@ -5337,7 +5337,7 @@ /* Expand the operands. */ mem = get_builtin_sync_mem (CALL_EXPR_ARG (exp, 0), mode); - expand_atomic_store (mem, const0_rtx, MEMMODEL_RELEASE, true); + expand_atomic_store (mem, const0_rtx, MEMMODEL_SYNC_RELEASE, true); } /* Given an integer representing an ``enum memmodel'', verify its @@ -5366,7 +5366,8 @@ return MEMMODEL_SEQ_CST; } - if ((INTVAL (op) & MEMMODEL_MASK) >= MEMMODEL_LAST) + /* Should never see a user explicit SYNC memodel model, so >= LAST works. */ + if (memmodel_base (val) >= MEMMODEL_LAST) { warning (OPT_Winvalid_memory_model, "invalid memory model argument to builtin"); @@ -5433,8 +5434,7 @@ success = MEMMODEL_SEQ_CST; } - if ((failure & MEMMODEL_MASK) == MEMMODEL_RELEASE - || (failure & MEMMODEL_MASK) == MEMMODEL_ACQ_REL) + if (is_mm_release (failure) || is_mm_acq_rel (failure)) { warning (OPT_Winvalid_memory_model, "invalid failure memory model for " @@ -5496,8 +5496,7 @@ enum memmodel model; model = get_memmodel (CALL_EXPR_ARG (exp, 1)); - if ((model & MEMMODEL_MASK) == MEMMODEL_RELEASE - || (model & MEMMODEL_MASK) == MEMMODEL_ACQ_REL) + if (is_mm_release (model) || is_mm_acq_rel (model)) { warning (OPT_Winvalid_memory_model, "invalid memory model for %<__atomic_load%>"); @@ -5526,9 +5525,8 @@ enum memmodel model; model = get_memmodel (CALL_EXPR_ARG (exp, 2)); - if ((model & MEMMODEL_MASK) != MEMMODEL_RELAXED - && (model & MEMMODEL_MASK) != MEMMODEL_SEQ_CST - && (model & MEMMODEL_MASK) != MEMMODEL_RELEASE) + if (!(is_mm_relaxed (model) || is_mm_seq_cst (model) + || is_mm_release (model))) { warning (OPT_Winvalid_memory_model, "invalid memory model for %<__atomic_store%>"); @@ -5635,9 +5633,7 @@ mem = get_builtin_sync_mem (CALL_EXPR_ARG (exp, 0), mode); model = get_memmodel (CALL_EXPR_ARG (exp, 1)); - if ((model & MEMMODEL_MASK) == MEMMODEL_CONSUME - || (model & MEMMODEL_MASK) == MEMMODEL_ACQUIRE - || (model & MEMMODEL_MASK) == MEMMODEL_ACQ_REL) + if (is_mm_consume (model) || is_mm_acquire (model) || is_mm_acq_rel (model)) { warning (OPT_Winvalid_memory_model, "invalid memory model for %<__atomic_store%>"); @@ -5833,7 +5829,7 @@ static void expand_builtin_sync_synchronize (void) { - expand_mem_thread_fence (MEMMODEL_SEQ_CST); + expand_mem_thread_fence (MEMMODEL_SYNC_SEQ_CST); } static rtx Index: gcc/jit/ChangeLog =================================================================== --- a/src/gcc/jit/ChangeLog (.../tags/gcc_5_2_0_release) +++ b/src/gcc/jit/ChangeLog (.../branches/gcc-5-branch) @@ -1,3 +1,32 @@ +2015-08-13 David Malcolm + + Backport from mainline r226882 + 2015-08-13 David Malcolm + + * jit-playback.c (invoke_driver): On OS X, add + "-Wl,-undefined,dynamic_lookup" to the driver arguments. + +2015-07-23 David Malcolm + + Backport from mainline r226126 + 2015-07-23 David Malcolm + + * jit-playback.c (invoke_driver): Convert local "argvec" + to an auto_argvec, so that it owns copies of the strings, + rather than borrows them, updating ADD_ARG to use xstrdup + and special-casing the NULL terminator to avoid + xstrdup (NULL). Call add_multilib_driver_arguments at the front + of the arguments. + (MULTILIB_DEFAULTS): Provide a default definition. + (multilib_defaults_raw): New constant array. + (gcc::jit::playback::context::add_multilib_driver_arguments): New + method. + * jit-playback.h + (gcc::jit::playback::context::add_multilib_driver_arguments): New + method. + * docs/internals/test-hello-world.exe.log.txt: Update. + * docs/_build/texinfo/libgccjit.texi: Regenerate. + 2015-07-16 Release Manager * GCC 5.2.0 released. Index: gcc/jit/docs/internals/test-hello-world.exe.log.txt =================================================================== --- a/src/gcc/jit/docs/internals/test-hello-world.exe.log.txt (.../tags/gcc_5_2_0_release) +++ b/src/gcc/jit/docs/internals/test-hello-world.exe.log.txt (.../branches/gcc-5-branch) @@ -1,4 +1,4 @@ -JIT: libgccjit (GCC) version 5.0.0 20150123 (experimental) (x86_64-unknown-linux-gnu) +JIT: libgccjit (GCC) version 5.2.1 20150723 (x86_64-unknown-linux-gnu) JIT: compiled by GNU C version 4.8.3 20140911 (Red Hat 4.8.3-7), GMP version 5.1.2, MPFR version 3.1.2, MPC version 1.0.1 JIT: entering: gcc_jit_context_set_str_option JIT: GCC_JIT_STR_OPTION_PROGNAME: "./test-hello-world.c.exe" @@ -64,6 +64,7 @@ JIT: GCC_JIT_BOOL_OPTION_DUMP_EVERYTHING: false JIT: GCC_JIT_BOOL_OPTION_SELFCHECK_GC: true JIT: GCC_JIT_BOOL_OPTION_KEEP_INTERMEDIATES: false +JIT: gcc_jit_context_set_bool_allow_unreachable_blocks: false JIT: entering: void gcc::jit::recording::context::validate() JIT: exiting: void gcc::jit::recording::context::validate() JIT: entering: gcc::jit::playback::context::context(gcc::jit::recording::context*) @@ -129,13 +130,16 @@ JIT: entering: virtual void gcc::jit::playback::compile_to_memory::postprocess(const char*) JIT: entering: void gcc::jit::playback::context::convert_to_dso(const char*) JIT: entering: void gcc::jit::playback::context::invoke_driver(const char*, const char*, const char*, timevar_id_t, bool, bool) -JIT: argv[0]: x86_64-unknown-linux-gnu-gcc-5.0.0 -JIT: argv[1]: -shared -JIT: argv[2]: /tmp/libgccjit-CKq1M9/fake.s -JIT: argv[3]: -o -JIT: argv[4]: /tmp/libgccjit-CKq1M9/fake.so -JIT: argv[5]: -fno-use-linker-plugin -JIT: argv[6]: (null) +JIT: entering: void gcc::jit::playback::context::add_multilib_driver_arguments(vec*) +JIT: exiting: void gcc::jit::playback::context::add_multilib_driver_arguments(vec*) +JIT: argv[0]: x86_64-unknown-linux-gnu-gcc-5.2.1 +JIT: argv[1]: -m64 +JIT: argv[2]: -shared +JIT: argv[3]: /tmp/libgccjit-CKq1M9/fake.s +JIT: argv[4]: -o +JIT: argv[5]: /tmp/libgccjit-CKq1M9/fake.so +JIT: argv[6]: -fno-use-linker-plugin +JIT: argv[7]: (null) JIT: exiting: void gcc::jit::playback::context::invoke_driver(const char*, const char*, const char*, timevar_id_t, bool, bool) JIT: exiting: void gcc::jit::playback::context::convert_to_dso(const char*) JIT: entering: gcc::jit::result* gcc::jit::playback::context::dlopen_built_dso() Index: gcc/jit/jit-playback.c =================================================================== --- a/src/gcc/jit/jit-playback.c (.../tags/gcc_5_2_0_release) +++ b/src/gcc/jit/jit-playback.c (.../branches/gcc-5-branch) @@ -2432,8 +2432,8 @@ TV_ASSEMBLE. */ auto_timevar assemble_timevar (tv_id); const char *errmsg; - auto_vec argvec; -#define ADD_ARG(arg) argvec.safe_push (arg) + auto_argvec argvec; +#define ADD_ARG(arg) argvec.safe_push (xstrdup (arg)) int exit_status = 0; int err = 0; const char *gcc_driver_name = GCC_DRIVER_NAME; @@ -2440,6 +2440,8 @@ ADD_ARG (gcc_driver_name); + add_multilib_driver_arguments (&argvec); + if (shared) ADD_ARG ("-shared"); @@ -2459,8 +2461,17 @@ time. */ ADD_ARG ("-fno-use-linker-plugin"); +#if defined (DARWIN_X86) || defined (DARWIN_PPC) + /* OS X's linker defaults to treating undefined symbols as errors. + If the context has any imported functions or globals they will be + undefined until the .so is dynamically-linked into the process. + Ensure that the driver passes in "-undefined dynamic_lookup" to the + linker. */ + ADD_ARG ("-Wl,-undefined,dynamic_lookup"); +#endif + /* pex argv arrays are NULL-terminated. */ - ADD_ARG (NULL); + argvec.safe_push (NULL); /* pex_one's error-handling requires pname to be non-NULL. */ gcc_assert (ctxt_progname); @@ -2501,6 +2512,36 @@ #undef ADD_ARG } +/* Extract the target-specific MULTILIB_DEFAULTS to + multilib_defaults_raw for use by + playback::context::add_multilib_driver_arguments (). */ + +#ifndef MULTILIB_DEFAULTS +#define MULTILIB_DEFAULTS { "" } +#endif + +static const char *const multilib_defaults_raw[] = MULTILIB_DEFAULTS; + +/* Helper function for playback::context::invoke_driver (). + + 32-bit and 64-bit multilib peer builds of libgccjit.so may share + a driver binary. We need to pass in options to the shared driver + to get the appropriate assembler/linker options for this multilib + peer. */ + +void +playback::context:: +add_multilib_driver_arguments (vec *argvec) +{ + JIT_LOG_SCOPE (get_logger ()); + + /* Add copies of the arguments in multilib_defaults_raw to argvec, + prepending each with a "-". */ + for (size_t i = 0; i < ARRAY_SIZE (multilib_defaults_raw); i++) + if (multilib_defaults_raw[i][0]) + argvec->safe_push (concat ("-", multilib_defaults_raw[i], NULL)); +} + /* Dynamically-link the built DSO file into this process, using dlopen. Wrap it up within a jit::result *, and return that. Return NULL if any errors occur, reporting them on this context. */ Index: gcc/jit/jit-playback.h =================================================================== --- a/src/gcc/jit/jit-playback.h (.../tags/gcc_5_2_0_release) +++ b/src/gcc/jit/jit-playback.h (.../branches/gcc-5-branch) @@ -276,6 +276,9 @@ bool shared, bool run_linker); + void + add_multilib_driver_arguments (vec *argvec); + result * dlopen_built_dso (); Index: gcc/ChangeLog =================================================================== --- a/src/gcc/ChangeLog (.../tags/gcc_5_2_0_release) +++ b/src/gcc/ChangeLog (.../branches/gcc-5-branch) @@ -1,3 +1,609 @@ +2015-09-03 Richard Biener + + PR ipa/66705 + * tree-ssa-structalias.c (ctor_for_analysis): New function. + (create_variable_info_for_1): Use ctor_for_analysis instead + of get_constructor. + (create_variable_info_for): Likewise. + +2015-09-02 Uros Bizjak + + Backport from mainline: + 2015-08-27 Uros Bizjak + + PR target/67317 + * config/i386/i386.md (*add3_cc): Remove insn pattern. + (addqi3_cc): Ditto. + (UNSPEC_ADD_CARRY): Remove. + (addqi3_cconly_overflow): New expander. + (*add3_doubleword): Split to add3_cconly_overflow. + Adjust for changed add3_carry. + (*neg2_doubleword): Adjust for changed add3_carry. + (*sub3_doubleword): Adjust for changed sub3_carry. + (3_carry): Remove expander. + (*3_carry): Split insn pattern to + add3_carry and sub3_carry. + (plusminus_carry_mnemonic): Remove code attribute. + (add3_carry): Canonicalize insn pattern. + (*addsi3_carry_zext): Ditto. + (sub3_carry): Ditto. + (*subsi3_carry_zext): Ditto. + (adcx3): Remove insn pattern. + (addcarry): New insn pattern. + (subborrow): Ditto. + * config/i386/i386.c (ix86_expand_strlensi_unroll_1): Use + gen_addqi3_cconly_overflow instead of gen_addqi3_cc. + (ix86_expand_builtin) : Use CODE_FOR_subborrowsi, + CODE_FOR_subborrowdi, CODE_FOR_addcarrysi and CODE_FOR_addcarrydi. + Rewrite expander to not clobber carry flag chains. + +2015-09-02 Alan Modra + + PR target/67417 + * config/rs6000/predicates.md (current_file_function_operand): Don't + return true for weak symbols. + * config/rs6000/rs6000.c (rs6000_function_ok_for_sibcall): Likewise. + +2015-08-31 Marek Polacek + + Backport from mainline + 2015-08-27 Marek Polacek + + PR middle-end/67005 + * tree-ssa-dce.c (remove_dead_stmt): Also schedule fixup if removing + an entry into an irreducible region. + +2015-08-27 Pat Haugen + + Backport from mainline: + 2015-08-27 Pat Haugen + + * config/rs6000/vector.md (vec_shr_): Fix to do a shift + instead of a rotate. + +2015-08-26 Renlin Li + + Backport from mainline + 2015-08-24 Renlin Li + + * config/arm/arm-protos.h (arm_valid_symbolic_address_p): Declare. + * config/arm/arm.c (arm_valid_symbolic_address_p): Define. + * config/arm/arm.md (arm_movt): Use arm_valid_symbolic_address_p. + * config/arm/constraints.md ("j"): Add check for high code. + +2015-08-25 Dominik Vogt + + Backport from mainline + 2015-08-21 Dominik Vogt + + * config/s390/s390-builtins.def: Fix value range of vec_load_bndry. + +2015-08-24 Michael Meissner + + Back port from mainline: + 2015-08-24 Michael Meissner + + PR target/67211 + * config/rs6000/rs6000-cpus.def (ISA_2_7_MASKS_SERVER): Set + -mefficient-unaligned-vsx on ISA 2.7. + + * config/rs6000/rs6000.opt (-mefficient-unaligned-vsx): Convert + option to a masked option. + + * config/rs6000/rs6000.c (rs6000_option_override_internal): Rework + logic for -mefficient-unaligned-vsx so that it is set via an arch + ISA option, instead of being set if -mtune=power8 is set. Move + -mefficient-unaligned-vsx and -mallow-movmisalign handling to be + near other default option handling. + +2015-08-20 Georg-Johann Lay + + * config/avr/avr.c (avr_insert_attributes): In diagnostic essage: + Multiply argument avr_n_flash by 64 to match unit of "KiB". + (avr_pgm_check_var_decl): Same. + +2015-08-18 Segher Boessenkool + + Backport from mainline: + 2015-08-08 Segher Boessenkool + + PR rtl-optimization/67028 + * combine.c (simplify_comparison): Fix comment. Rearrange code. + Add test to see if a const_int fits in the new mode. + +2015-08-17 Jason Merrill + + PR c++/65734 + * stor-layout.c (layout_type): Layout the TYPE_MAIN_VARIANT. + (finalize_type_size): Respect TYPE_USER_ALIGN. + (layout_type) [ARRAY_TYPE]: Likewise. + +2015-08-17 Yvan Roux + + Backport from mainline: + 2015-08-12 Yvan Roux + + PR target/67127 + * config/arm/arm.md (movdi): Restrict illegitimate ldrd/strd checking + to ARM core registers. + +2015-08-16 Uros Bizjak + + Backport from mainline: + 2015-07-25 Uros Bizjak + + PR target/66648 + * config/i386/i386.c (ix86_expand_set_or_movmem): Emit main loop + execution guard when min_size is less than size_needed. + +2015-08-11 Thomas Preud'homme + + Backport from mainline + 2015-07-28 Thomas Preud'homme + + PR tree-optimization/66828 + * tree-ssa-math-opts.c (perform_symbolic_merge): Change type of inc + from int64_t to uint64_t. + +2015-08-07 Kaz Kojima + + Backport from mainline + 2015-08-07 Kaz Kojima + + PR target/67002 + * config/sh/sh.c (sh_recog_treg_set_expr): Return false when + currently_expanding_to_rtl is set. + +2015-08-07 Kirill Yukhin + + * config/i386/i386.md (define_attr "isa"): Addd avx512vl and + noavx512vl. + (define_attr "enabled"): Handle avx521vl and noavx512vl. + * config/i386/sse.md (define_insn "vec_dupv2df"): Split + AVX-512 alternative out of SSE. + (define_insn "*vec_concatv2df"): Ditto. + +2015-08-05 Matthew Wahab + + Backport from trunk: + 2015-06-29 Matthew Wahab + + PR target/65697 + * config/arm/arm.c (arm_split_compare_and_swap): For ARMv8, + replace an initial acquire barrier with final barrier. + +2015-08-05 Matthew Wahab + + Backport from trunk: + 2015-06-29 Matthew Wahab + + PR target/65697 + * config/arm/arm.c (arm_split_atomic_op): For ARMv8, replace an + initial acquire barrier with final barrier. + +2015-08-05 Matthew Wahab + + Backport from trunk. + 2015-06-01 Matthew Wahab + + PR target/65697 + * config/aarch64/aarch64.c (aarch64_split_compare_and_swap): Check + for __sync memory models, emit initial loads and final barriers as + appropriate. + +2015-08-05 Matthew Wahab + + Backport from trunk. + 2015-06-01 Matthew Wahab + + PR target/65697 + * config/aarch64/aarch64.c (aarch64_emit_post_barrier): New. + (aarch64_split_atomic_op): Check for __sync memory models, emit + appropriate initial loads and final barriers. + +2015-08-05 Matthew Wahab + + Backport from trunk + 2015-05-12 Andrew MacLeod + + PR target/65697 + * coretypes.h (MEMMODEL_SYNC, MEMMODEL_BASE_MASK): New macros. + (enum memmodel): Add SYNC_{ACQUIRE,RELEASE,SEQ_CST}. + * tree.h (memmodel_from_int, memmodel_base, is_mm_relaxed) + (is_mm_consume,is_mm_acquire, is_mm_release, is_mm_acq_rel) + (is_mm_seq_cst, is_mm_sync): New accessor functions. + * builtins.c (expand_builtin_sync_operation) + (expand_builtin_compare_and_swap): Use MEMMODEL_SYNC_SEQ_CST. + (expand_builtin_sync_lock_release): Use MEMMODEL_SYNC_RELEASE. + (get_memmodel, expand_builtin_atomic_compare_exchange) + (expand_builtin_atomic_load, expand_builtin_atomic_store) + (expand_builtin_atomic_clear): Use new accessor routines. + (expand_builtin_sync_synchronize): Use MEMMODEL_SYNC_SEQ_CST. + * optabs.c (expand_compare_and_swap_loop): Use MEMMODEL_SYNC_SEQ_CST. + (maybe_emit_sync_lock_test_and_set): Use new accessors and + MEMMODEL_SYNC_ACQUIRE. + (expand_sync_lock_test_and_set): Use MEMMODEL_SYNC_ACQUIRE. + (expand_mem_thread_fence, expand_mem_signal_fence, expand_atomic_load) + (expand_atomic_store): Use new accessors. + * emit-rtl.c (need_atomic_barrier_p): Add additional enum cases. + * tsan.c (instrument_builtin_call): Update check for memory model beyond + final enum to use MEMMODEL_LAST. + * c-family/c-common.c: Use new accessor for memmodel_base. + * config/aarch64/aarch64.c (aarch64_expand_compare_and_swap): Use new + accessors. + * config/aarch64/atomics.md (atomic_load,atomic_store) + (arch64_load_exclusive, aarch64_store_exclusive) + (mem_thread_fence, *dmb): Likewise. + * config/alpha/alpha.c (alpha_split_compare_and_swap) + (alpha_split_compare_and_swap_12): Likewise. + * config/arm/arm.c (arm_expand_compare_and_swap) + (arm_split_compare_and_swap, arm_split_atomic_op): Likewise. + * config/arm/sync.md (atomic_load, atomic_store) + (atomic_loaddi): Likewise. + * config/i386/i386.c (ix86_destroy_cost_data, ix86_memmodel_check): + Likewise. + * config/i386/sync.md (mem_thread_fence, atomic_store): Likewise. + * config/ia64/ia64.c (ia64_expand_atomic_op): Add new memmodel cases and + use new accessors. + * config/ia64/sync.md (mem_thread_fence, atomic_load) + (atomic_store, atomic_compare_and_swap) + (atomic_exchange): Use new accessors. + * config/mips/mips.c (mips_process_sync_loop): Likewise. + * config/pa/pa.md (atomic_loaddi, atomic_storedi): Likewise. + * config/rs6000/rs6000.c (rs6000_pre_atomic_barrier) + (rs6000_post_atomic_barrier): Add new cases. + (rs6000_expand_atomic_compare_and_swap): Use new accessors. + * config/rs6000/sync.md (mem_thread_fence): Add new cases. + (atomic_load): Add new cases and use new accessors. + (store_quadpti): Add new cases. + * config/s390/s390.md (mem_thread_fence, atomic_store): Use new + accessors. + * config/sparc/sparc.c (sparc_emit_membar_for_model): Use new accessors. + * doc/extend.texi: Update docs to indicate 16 bits are used for memory + model, not 8. + +2015-08-04 Szabolcs Nagy + + Backport from mainline: + 2015-08-04 Szabolcs Nagy + + PR target/66731 + * config/aarch64/aarch64.c (aarch64_rtx_costs): Fix NEG cost for FNMUL. + (aarch64_rtx_mult_cost): Fix MULT cost with -frounding-math. + + 2015-07-06 Szabolcs Nagy + + PR target/66731 + * config/aarch64/aarch64.md (fnmul3): Handle -frounding-math. + +2015-08-03 Peter Bergner + + Backport from mainline: + 2015-08-03 Peter Bergner + + * config/rs6000/htm.md (tabort.): Restrict the source operand to + using a base register. + +2015-08-03 John David Anglin + + PR target/67060 + * config/pa/pa.md (call_reg_64bit): Remove reg:DI 1 clobber. + Adjust splits to match new pattern. + +2015-08-03 Szabolcs Nagy + + Backport form mainline r226496. + 2015-08-03 Szabolcs Nagy + + PR target/66731 + * config/arm/vfp.md (negmuldf3_vfp): Add new pattern. + (negmulsf3_vfp): Likewise. + (muldf3negdf_vfp): Disable for -frounding-math. + (mulsf3negsf_vfp): Likewise. + * config/arm/arm.c (arm_new_rtx_costs): Fix NEG cost for VNMUL, + fix MULT cost with -frounding-math. + +2015-07-31 Kaz Kojima + + Backport form mainline + 2015-07-31 Kaz Kojima + + PR target/67049 + * config/sh/sh.md (GOTaddr2picreg): Fix typo. + +2015-07-31 Vladimir Makarov + + PR debug/66691 + * lra-int.h (lra_substitute_pseudo): Add a parameter. + (lra_substitute_pseudo_within_insn): Ditto. + * lra.c (lra_substitute_pseudo): Add a parameter. Simplify subreg + of constant. + (lra_substitute_pseudo_within_insn): Add a parameter. Transfer it + to lra_substitute_pseudo. + * lra-lives.c (process_bb_lives): Add an argument to + lra_substitute_pseudo_within_insn call. + * lra-constraints.c (inherit_reload_reg, split_reg): Add an + argument to lra_substitute_pseudo and + lra_substitute_pseudo_within_insn calls. + (remove_inheritance_pseudos, undo_optional_reloads): Ditto. + +2015-07-27 Marek Polacek + + Backport from mainline + 2015-07-27 Marek Polacek + + * ipa-devirt.c (types_same_for_odr): Fix typo. + +2015-07-25 Oleg Endo + + Backport from mainline + 2015-07-25 Oleg Endo + + PR target/66930 + * config/sh/sh.c (sh_split_movrt_negc_to_movt_xor): Add missing + T bit register modified_between_p check. + +2015-07-25 Tom de Vries + + backport from trunk: + 2015-07-24 Tom de Vries + + * graphite-sese-to-poly.c (is_reduction_operation_p): Limit + flag_associative_math to FLOAT_TYPE_P. Honour + TYPE_OVERFLOW_WRAPS for INTEGRAL_TYPE_P. Don't allow any other types. + +2015-07-25 Kaz Kojima + + Backport from mainline + 2015-07-16 Kaz Kojima + + PR target/65249 + * config/sh/sh.md (movdi): Split simple reg move to two movsi + when the destination is R0. + +2015-07-24 Szabolcs Nagy + + Backport from mainline r226159. + 2015-07-24 Szabolcs Nagy + + * config/aarch64/aarch64-elf-raw.h (LINK_SPEC): Handle -h, -static, + -shared, -symbolic, -rdynamic. + +2015-07-24 Szabolcs Nagy + + Backport from mainline r226158. + 2015-07-24 Szabolcs Nagy + + PR target/65711 + * config/aarch64/aarch64-linux.h (LINUX_TARGET_LINK_SPEC): Move + -dynamic-linker within %{!static %{!shared, and -rdynamic within + %{!static. + +2015-07-24 Ilya Enkovich + + Backport from mainline r226155. + 2015-07-24 Ilya Enkovich + + PR ipa/66566 + * ipa-inline-analysis.c (estimate_calls_size_and_time): Check + edge summary is available. + +2015-07-23 Uros Bizjak + + Backport from mainline: + 2015-07-17 Uros Bizjak + + PR rtl-optimization/66891 + * calls.c (expand_call): Wrap precompute_register_parameters with + NO_DEFER_POP/OK_DEFER_POP to prevent deferred pops. + + 2015-07-15 Uros Bizjak + + PR target/58066 + * config/i386/i386.md (*tls_global_dynamic_64_): Depend on SP_REG. + (*tls_local_dynamic_base_64_): Ditto. + (*tls_local_dynamic_base_64_largepic): Ditto. + (tls_global_dynamic_64_): Update expander pattern. + (tls_local_dynamic_base_64_): Ditto. + + 2015-07-15 Uros Bizjak + + PR rtl-optimization/58066 + * calls.c (expand_call): Precompute register parameters before stack + alignment is performed. + +2015-07-23 Martin Jambor + + Backport from mainline r225867. + 2015-07-16 Martin Jambor + + * ipa-prop.h (param_aa_status): Rename to ipa_param_aa_status. Adjust + all uses. Fix two typos in its general comment. + (func_body_info): Rename to ipa_func_body_info. Adjust all uses. + +2015-07-23 Martin Jambor + + Backport from mainline r225838. + 2015-07-15 Paolo Bonzini + Martin Jambor + + PR ipa/66760 + * ipa-inline-analysis.c (unmodified_parm_or_parm_agg_item): Accept + struct func_body_info* instead of struct ipa_node_params*, expecting + fbi->info to be filled in. Replace throughout. Adjust call to + ipa_load_from_parm_agg. + (set_cond_stmt_execution_predicate): Accept struct func_body_info* + instead of struct ipa_node_params*. Adjust calls to other functions + so that they pass either fbi or fbi->info. + (set_switch_stmt_execution_predicate): Likewise. + (will_be_nonconstant_predicate): Likewise. + (compute_bb_predicates): Likewise. + (estimate_function_body_sizes): Move asserts earlier. Fill in + struct func_body_info, replace parms_info with fbi.info. Adjust + calls to functions that now accept struct func_body_info. + * ipa-prop.c (param_aa_status, struct ipa_bb_info): Move to ipa-prop.h. + (struct func_body_info): Likewise. + (ipa_load_from_parm_agg_1): Rename to ipa_load_from_parm_agg, + remove static. Adjust callers. + (ipa_load_from_parm_agg): Remove. + * ipa-prop.h (param_aa_status, ipa_bb_info): Move from ipa-prop.c. + (func_body_info): Likewise. + (ipa_load_from_parm_agg): Adjust prototype. + +2015-07-23 Ilya Enkovich + + Backport from mainline r224643. + 2015-06-19 Ilya Enkovich + + PR middle-end/pr66581 + * tree-chkp.c (chkp_compute_bounds_for_assignment): Don't + reuse bounds created for abnormal ssa names. + +2015-07-23 Ilya Enkovich + + Backport from mainline r224602. + 2015-06-18 Ilya Enkovich + + PR target/66569 + * function.c (assign_bounds): Add arguments assign_regs, + assign_special, assign_bt. + (assign_parms): For vararg functions handle bounds in BT + and special slots after incoming vararg bounds. + +2015-07-23 Ilya Enkovich + + Backport from mainline r224601. + 2015-06-18 Ilya Enkovich + + PR middle-end/66568 + * cfgexpand.c (expand_return): Handle missing bounds. + (expand_gimple_stmt_1): Likewise. + * tree-chkp.c (chkp_expand_zero_bounds): New. + * tree-chkp.h (chkp_expand_zero_bounds): New. + +2015-07-23 Ilya Enkovich + + Backport from mainline r224600. + 2015-06-18 Ilya Enkovich + + PR middle-end/66567 + * ipa-chkp.c (chkp_maybe_create_clone): Require + functions to be instrumentable. + * tree-chkp.c (chkp_replace_function_pointer): Use + chkp_instrumentable_p instead of attribute check. + +2015-07-23 Ilya Enkovich + + Backport from mainline r223215. + 2015-05-15 Ilya Enkovich + + PR middle-end/66134 + * tree-chkp.c (chkp_get_orginal_bounds_for_abnormal_copy): New. + (chkp_maybe_copy_and_register_bounds): Don't copy abnormal copy. + +2015-07-23 Ilya Enkovich + + Backport from mainline r223114. + 2015-05-13 Ilya Enkovich + + PR target/66048 + * function.c (diddle_return_value_1): Process bounds first. + * config/i38/i386.c (ix86_function_value_regno_p): Add bnd1 + register. + +2015-07-23 Ilya Enkovich + + Backport from mainline r223216. + 2015-05-15 Ilya Enkovich + + * ipa-chkp.h (chkp_wrap_function): New. + * ipa-chkp.c (chkp_wrap_function): Remove 'static'. + (chkp_wrap_function_name): New. + (chkp_build_instrumented_fndecl): Use chkp_wrap_function_name + to get wrapper name. + * lto-cgraph.c: Include ipa-chkp.h. + (input_cgraph_1): Avoid alias chain for wrappers. + +2015-07-23 Ilya Enkovich + + Backport from mainline r224074. + 2015-06-03 Ilya Enkovich + + * ipa-chkp.c (chkp_maybe_create_clone): Create alias + reference when cloning alias node. + +2015-07-21 Georg-Johann Lay + + Backport from 2015-07-21 trunk r226046. + + PR target/66956 + * config/avr/avr-dimode.md (mulsidi3_insn) + (mulsidi3): Don't use if !AVR_HAVE_MUL. + +2015-07-21 Richard Biener + + PR tree-optimization/66948 + * genmatch.c (capture_info::walk_match): Also recurse to + captures. Properly compute expr state from captures of + captures. + +2015-07-18 Uros Bizjak + + PR target/66922 + * config/i386/i386.c (ix86_expand_pinsr): Reject insertions + to misaligned positions. + +2015-07-17 Uros Bizjak + + PR target/66866 + * config/i386/i386.c (ix86_expand_pinsr): Reject non-lowpart + source subregs. + +2015-07-17 Uros Bizjak + + Backport from mainline: + 2015-07-10 Uros Bizjak + + * config/i386/sse.md (movdi_to_sse): Use gen_lowpart + and gen_higpart instead of gen_rtx_SUBREG. + * config/i386/i386.md + (floatdi2_i387_with_xmm splitter): Ditto. + (read-modify peephole2): Use gen_lowpart instead of + gen_rtx_SUBREG for operand 5. + +2015-07-17 Uros Bizjak + + Backport from mainline: + 2015-07-08 Uros Bizjak + + PR target/66814 + * config/i386/predicates.md (nonimmediate_gr_operand): New predicate. + * config/i386/i386.md (not peephole2): Use nonimmediate_gr_operand. + (varous peephole2s): Use {GENERAL,SSE,MMX}_REGNO_P instead of + {GENERAL,SSE,MMX}_REG_P where appropriate. + +2015-07-17 Uros Bizjak + + Backport from mainline: + 2015-07-15 Uros Bizjak + + PR rtl-optimization/66838 + * postreload.c (reload_cse_move2add): Also process + CALL_INSN_FUNCTION_USAGE when resetting information of + call-clobbered registers. + +2015-07-16 Martin Liska + + PR ipa/66896 + * ipa-prop.c (update_jump_functions_after_inlining): Create properly + dst_ctx if it does not exist. + +2015-07-16 Richard Biener + + * BASE-VER: Set to 5.2.1. + 2015-07-16 Release Manager * GCC 5.2.0 released. @@ -119,8 +725,8 @@ 2015-07-09 Iain Sandoe PR target/66523 - * config/darwin.c (darwin_mark_decl_preserved): Exclude 'L' label names from - preservation. + * config/darwin.c (darwin_mark_decl_preserved): Exclude 'L' label + names from preservation. 2015-07-06 Alan Lawrence Index: gcc/testsuite/jit.dg/test-benchmark.c =================================================================== --- a/src/gcc/testsuite/jit.dg/test-benchmark.c (.../tags/gcc_5_2_0_release) +++ b/src/gcc/testsuite/jit.dg/test-benchmark.c (.../branches/gcc-5-branch) @@ -209,6 +209,7 @@ { int opt_level; int num_iterations = 100; + double elapsed_time[4]; ticks_to_msec = TICKS_TO_MSEC; @@ -215,7 +216,7 @@ for (opt_level = 0; opt_level < 4; opt_level++) { int i; - double start_time, end_time, elapsed_time; + double start_time, end_time; start_time = get_wallclock_time (); for (i = 1; i <= num_iterations; i++) { @@ -226,15 +227,26 @@ test_jit (argv[0], opt_level); } end_time = get_wallclock_time (); - elapsed_time = end_time - start_time; + elapsed_time[opt_level] = end_time - start_time; pass ("%s: survived %i iterations at optlevel %i", argv[0], num_iterations, opt_level); note (("%s: %i iterations at optlevel %i" " took a total of %.3fs (%.3fs per iteration)"), argv[0], num_iterations, opt_level, - elapsed_time, elapsed_time / num_iterations); + elapsed_time[opt_level], + elapsed_time[opt_level] / num_iterations); } + totals (); + /* Print a summary. */ + printf ("%s: %i iterations: time taken (lower is better)\n", + argv[0], num_iterations); + for (opt_level = 0; opt_level < 4; opt_level++) + printf ("optlevel %i: %.3fs (%.3fs per iteration)\n", + opt_level, + elapsed_time[opt_level], + elapsed_time[opt_level] / num_iterations); + return 0; } Index: gcc/testsuite/gcc.target/powerpc/htm-tabort-no-r0.c =================================================================== --- a/src/gcc/testsuite/gcc.target/powerpc/htm-tabort-no-r0.c (.../tags/gcc_5_2_0_release) +++ b/src/gcc/testsuite/gcc.target/powerpc/htm-tabort-no-r0.c (.../branches/gcc-5-branch) @@ -0,0 +1,12 @@ +/* { dg-do compile { target { powerpc*-*-* } } } */ +/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */ +/* { dg-require-effective-target powerpc_htm_ok } */ +/* { dg-options "-O2 -mhtm -ffixed-r3 -ffixed-r4 -ffixed-r5 -ffixed-r6 -ffixed-r7 -ffixed-r8 -ffixed-r9 -ffixed-r10 -ffixed-r11 -ffixed-r12" } */ + +/* { dg-final { scan-assembler-not "tabort\\.\[ \t\]0" } } */ + +int +foo (void) +{ + return __builtin_tabort (10); +} Index: gcc/testsuite/gcc.target/powerpc/vec-shr.c =================================================================== --- a/src/gcc/testsuite/gcc.target/powerpc/vec-shr.c (.../tags/gcc_5_2_0_release) +++ b/src/gcc/testsuite/gcc.target/powerpc/vec-shr.c (.../branches/gcc-5-branch) @@ -0,0 +1,34 @@ +/* { dg-do run } */ +/* { dg-options "-O3 -fno-inline" } */ + +#include + +typedef struct { double r, i; } complex; +#define LEN 30 +complex c[LEN]; +double d[LEN]; + +void +foo (complex *c, double *d, int len1) +{ + int i; + for (i = 0; i < len1; i++) + { + c[i].r = d[i]; + c[i].i = 0.0; + } +} + +int +main (void) +{ + int i; + for (i = 0; i < LEN; i++) + d[i] = (double) i; + foo (c, d, LEN); + for (i=0;i d) Index: gcc/testsuite/gcc.target/arm/vnmul-1.c =================================================================== --- a/src/gcc/testsuite/gcc.target/arm/vnmul-1.c (.../tags/gcc_5_2_0_release) +++ b/src/gcc/testsuite/gcc.target/arm/vnmul-1.c (.../branches/gcc-5-branch) @@ -0,0 +1,18 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target arm_vfp_ok } */ +/* { dg-skip-if "need fp instructions" { *-*-* } { "-mfloat-abi=soft" } { "" } } */ +/* { dg-options "-O2 -fno-rounding-math -mfpu=vfp -mfloat-abi=hard" } */ + +double +foo_d (double a, double b) +{ + /* { dg-final { scan-assembler "vnmul\\.f64" } } */ + return -a * b; +} + +float +foo_s (float a, float b) +{ + /* { dg-final { scan-assembler "vnmul\\.f32" } } */ + return -a * b; +} Index: gcc/testsuite/gcc.target/arm/vnmul-2.c =================================================================== --- a/src/gcc/testsuite/gcc.target/arm/vnmul-2.c (.../tags/gcc_5_2_0_release) +++ b/src/gcc/testsuite/gcc.target/arm/vnmul-2.c (.../branches/gcc-5-branch) @@ -0,0 +1,18 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target arm_vfp_ok } */ +/* { dg-skip-if "need fp instructions" { *-*-* } { "-mfloat-abi=soft" } { "" } } */ +/* { dg-options "-O2 -frounding-math -mfpu=vfp -mfloat-abi=hard" } */ + +double +foo_d (double a, double b) +{ + /* { dg-final { scan-assembler-not "vnmul\\.f64" } } */ + return -a * b; +} + +float +foo_s (float a, float b) +{ + /* { dg-final { scan-assembler-not "vnmul\\.f32" } } */ + return -a * b; +} Index: gcc/testsuite/gcc.target/arm/vnmul-3.c =================================================================== --- a/src/gcc/testsuite/gcc.target/arm/vnmul-3.c (.../tags/gcc_5_2_0_release) +++ b/src/gcc/testsuite/gcc.target/arm/vnmul-3.c (.../branches/gcc-5-branch) @@ -0,0 +1,18 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target arm_vfp_ok } */ +/* { dg-skip-if "need fp instructions" { *-*-* } { "-mfloat-abi=soft" } { "" } } */ +/* { dg-options "-O2 -fno-rounding-math -mfpu=vfp -mfloat-abi=hard" } */ + +double +foo_d (double a, double b) +{ + /* { dg-final { scan-assembler "vnmul\\.f64" } } */ + return -(a * b); +} + +float +foo_s (float a, float b) +{ + /* { dg-final { scan-assembler "vnmul\\.f32" } } */ + return -(a * b); +} Index: gcc/testsuite/gcc.target/arm/armv8-sync-op-acquire.c =================================================================== --- a/src/gcc/testsuite/gcc.target/arm/armv8-sync-op-acquire.c (.../tags/gcc_5_2_0_release) +++ b/src/gcc/testsuite/gcc.target/arm/armv8-sync-op-acquire.c (.../branches/gcc-5-branch) @@ -0,0 +1,10 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target arm_arch_v8a_ok } */ +/* { dg-options "-O2" } */ +/* { dg-add-options arm_arch_v8a } */ + +#include "../aarch64/sync-op-acquire.x" + +/* { dg-final { scan-assembler-times "ldrex" 1 } } */ +/* { dg-final { scan-assembler-times "strex" 1 } } */ +/* { dg-final { scan-assembler-times "dmb" 1 } } */ Index: gcc/testsuite/gcc.target/arm/macro_defs0.c =================================================================== --- a/src/gcc/testsuite/gcc.target/arm/macro_defs0.c (.../tags/gcc_5_2_0_release) +++ b/src/gcc/testsuite/gcc.target/arm/macro_defs0.c (.../branches/gcc-5-branch) @@ -1,6 +1,7 @@ /* { dg-do compile } */ /* { dg-skip-if "avoid conflicting multilib options" { *-*-* } { "-march=*" } { "-march=armv7-m" } } */ /* { dg-skip-if "avoid conflicting multilib options" { *-*-* } { "-mfloat-abi=*" } { "-mfloat-abi=soft" } } */ +/* { dg-skip-if "avoid conflicting multilib options" { *-*-* } { "-marm" } { "" } } */ /* { dg-options "-march=armv7-m -mcpu=cortex-m3 -mfloat-abi=soft -mthumb" } */ #ifdef __ARM_FP Index: gcc/testsuite/gcc.target/arm/armv8-sync-op-full.c =================================================================== --- a/src/gcc/testsuite/gcc.target/arm/armv8-sync-op-full.c (.../tags/gcc_5_2_0_release) +++ b/src/gcc/testsuite/gcc.target/arm/armv8-sync-op-full.c (.../branches/gcc-5-branch) @@ -0,0 +1,10 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target arm_arch_v8a_ok } */ +/* { dg-options "-O2" } */ +/* { dg-add-options arm_arch_v8a } */ + +#include "../aarch64/sync-op-full.x" + +/* { dg-final { scan-assembler-times "ldrex" 12 } } */ +/* { dg-final { scan-assembler-times "stlex" 12 } } */ +/* { dg-final { scan-assembler-times "dmb" 12 } } */ Index: gcc/testsuite/gcc.target/arm/vnmul-4.c =================================================================== --- a/src/gcc/testsuite/gcc.target/arm/vnmul-4.c (.../tags/gcc_5_2_0_release) +++ b/src/gcc/testsuite/gcc.target/arm/vnmul-4.c (.../branches/gcc-5-branch) @@ -0,0 +1,18 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target arm_vfp_ok } */ +/* { dg-skip-if "need fp instructions" { *-*-* } { "-mfloat-abi=soft" } { "" } } */ +/* { dg-options "-O2 -frounding-math -mfpu=vfp -mfloat-abi=hard" } */ + +double +foo_d (double a, double b) +{ + /* { dg-final { scan-assembler "vnmul\\.f64" } } */ + return -(a * b); +} + +float +foo_s (float a, float b) +{ + /* { dg-final { scan-assembler "vnmul\\.f32" } } */ + return -(a * b); +} Index: gcc/testsuite/gcc.target/arm/macro_defs1.c =================================================================== --- a/src/gcc/testsuite/gcc.target/arm/macro_defs1.c (.../tags/gcc_5_2_0_release) +++ b/src/gcc/testsuite/gcc.target/arm/macro_defs1.c (.../branches/gcc-5-branch) @@ -1,5 +1,6 @@ /* { dg-do compile } */ /* { dg-skip-if "avoid conflicting multilib options" { *-*-* } { "-march=*" } { "-march=armv6-m" } } */ +/* { dg-skip-if "avoid conflicting multilib options" { *-*-* } { "-marm" } { "" } } */ /* { dg-options "-march=armv6-m -mthumb" } */ #ifdef __ARM_NEON_FP Index: gcc/testsuite/gcc.target/arm/thumb-bitfld1.c =================================================================== --- a/src/gcc/testsuite/gcc.target/arm/thumb-bitfld1.c (.../tags/gcc_5_2_0_release) +++ b/src/gcc/testsuite/gcc.target/arm/thumb-bitfld1.c (.../branches/gcc-5-branch) @@ -10,6 +10,8 @@ unsigned b28 : 1; unsigned rest : 28; }; + +unsigned foo(a) struct foo a; { Index: gcc/testsuite/gcc.target/arm/split-live-ranges-for-shrink-wrap.c =================================================================== --- a/src/gcc/testsuite/gcc.target/arm/split-live-ranges-for-shrink-wrap.c (.../tags/gcc_5_2_0_release) +++ b/src/gcc/testsuite/gcc.target/arm/split-live-ranges-for-shrink-wrap.c (.../branches/gcc-5-branch) @@ -1,6 +1,8 @@ /* { dg-do assemble } */ /* { dg-options "-mthumb -Os -fdump-rtl-ira " } */ /* { dg-require-effective-target arm_thumb1_ok } */ +/* { dg-skip-if "do not test on armv4t" { *-*-* } { "-march=armv4t" } } */ +/* { dg-additional-options "-march=armv5t" {target arm_arch_v5t_ok} } */ int foo (char *, char *, int); int test (int d, char * out, char *in, int len) Index: gcc/testsuite/gcc.target/arm/armv8-sync-op-release.c =================================================================== --- a/src/gcc/testsuite/gcc.target/arm/armv8-sync-op-release.c (.../tags/gcc_5_2_0_release) +++ b/src/gcc/testsuite/gcc.target/arm/armv8-sync-op-release.c (.../branches/gcc-5-branch) @@ -0,0 +1,8 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target arm_arch_v8a_ok } */ +/* { dg-options "-O2" } */ +/* { dg-add-options arm_arch_v8a } */ + +#include "../aarch64/sync-op-release.x" + +/* { dg-final { scan-assembler-times "stl" 1 } } */ Index: gcc/testsuite/gcc.target/aarch64/sync-op-release.c =================================================================== --- a/src/gcc/testsuite/gcc.target/aarch64/sync-op-release.c (.../tags/gcc_5_2_0_release) +++ b/src/gcc/testsuite/gcc.target/aarch64/sync-op-release.c (.../branches/gcc-5-branch) @@ -0,0 +1,6 @@ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ + +#include "sync-op-release.x" + +/* { dg-final { scan-assembler-times "stlr" 1 } } */ Index: gcc/testsuite/gcc.target/aarch64/sync-op-release.x =================================================================== --- a/src/gcc/testsuite/gcc.target/aarch64/sync-op-release.x (.../tags/gcc_5_2_0_release) +++ b/src/gcc/testsuite/gcc.target/aarch64/sync-op-release.x (.../branches/gcc-5-branch) @@ -0,0 +1,7 @@ +int v; + +void +sync_lock_release (void) +{ + __sync_lock_release (&v); +} Index: gcc/testsuite/gcc.target/aarch64/fnmul-1.c =================================================================== --- a/src/gcc/testsuite/gcc.target/aarch64/fnmul-1.c (.../tags/gcc_5_2_0_release) +++ b/src/gcc/testsuite/gcc.target/aarch64/fnmul-1.c (.../branches/gcc-5-branch) @@ -0,0 +1,16 @@ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ + +double +foo_d (double a, double b) +{ + /* { dg-final { scan-assembler "fnmul\\td\[0-9\]+, d\[0-9\]+, d\[0-9\]+" } } */ + return -a * b; +} + +float +foo_s (float a, float b) +{ + /* { dg-final { scan-assembler "fnmul\\ts\[0-9\]+, s\[0-9\]+, s\[0-9\]+" } } */ + return -a * b; +} Index: gcc/testsuite/gcc.target/aarch64/sync-op-acquire.c =================================================================== --- a/src/gcc/testsuite/gcc.target/aarch64/sync-op-acquire.c (.../tags/gcc_5_2_0_release) +++ b/src/gcc/testsuite/gcc.target/aarch64/sync-op-acquire.c (.../branches/gcc-5-branch) @@ -0,0 +1,8 @@ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ + +#include "sync-op-acquire.x" + +/* { dg-final { scan-assembler-times "ldxr\tw\[0-9\]+, \\\[x\[0-9\]+\\\]" 1 } } */ +/* { dg-final { scan-assembler-times "stxr\tw\[0-9\]+, w\[0-9\]+, \\\[x\[0-9\]+\\\]" 1 } } */ +/* { dg-final { scan-assembler-times "dmb\tish" 1 } } */ Index: gcc/testsuite/gcc.target/aarch64/sync-op-acquire.x =================================================================== --- a/src/gcc/testsuite/gcc.target/aarch64/sync-op-acquire.x (.../tags/gcc_5_2_0_release) +++ b/src/gcc/testsuite/gcc.target/aarch64/sync-op-acquire.x (.../branches/gcc-5-branch) @@ -0,0 +1,7 @@ +int v; + +int +sync_lock_test_and_set (int a) +{ + return __sync_lock_test_and_set (&v, a); +} Index: gcc/testsuite/gcc.target/aarch64/fnmul-2.c =================================================================== --- a/src/gcc/testsuite/gcc.target/aarch64/fnmul-2.c (.../tags/gcc_5_2_0_release) +++ b/src/gcc/testsuite/gcc.target/aarch64/fnmul-2.c (.../branches/gcc-5-branch) @@ -0,0 +1,18 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -frounding-math" } */ + +double +foo_d (double a, double b) +{ + /* { dg-final { scan-assembler "fneg\\td\[0-9\]+, d\[0-9\]+" } } */ + /* { dg-final { scan-assembler "fmul\\td\[0-9\]+, d\[0-9\]+, d\[0-9\]+" } } */ + return -a * b; +} + +float +foo_s (float a, float b) +{ + /* { dg-final { scan-assembler "fneg\\ts\[0-9\]+, s\[0-9\]+" } } */ + /* { dg-final { scan-assembler "fmul\\ts\[0-9\]+, s\[0-9\]+, s\[0-9\]+" } } */ + return -a * b; +} Index: gcc/testsuite/gcc.target/aarch64/sync-comp-swap.c =================================================================== --- a/src/gcc/testsuite/gcc.target/aarch64/sync-comp-swap.c (.../tags/gcc_5_2_0_release) +++ b/src/gcc/testsuite/gcc.target/aarch64/sync-comp-swap.c (.../branches/gcc-5-branch) @@ -0,0 +1,8 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fno-ipa-icf" } */ + +#include "sync-comp-swap.x" + +/* { dg-final { scan-assembler-times "ldxr\tw\[0-9\]+, \\\[x\[0-9\]+\\\]" 2 } } */ +/* { dg-final { scan-assembler-times "stlxr\tw\[0-9\]+, w\[0-9\]+, \\\[x\[0-9\]+\\\]" 2 } } */ +/* { dg-final { scan-assembler-times "dmb\tish" 2 } } */ Index: gcc/testsuite/gcc.target/aarch64/sync-op-full.c =================================================================== --- a/src/gcc/testsuite/gcc.target/aarch64/sync-op-full.c (.../tags/gcc_5_2_0_release) +++ b/src/gcc/testsuite/gcc.target/aarch64/sync-op-full.c (.../branches/gcc-5-branch) @@ -0,0 +1,8 @@ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ + +#include "sync-op-full.x" + +/* { dg-final { scan-assembler-times "ldxr\tw\[0-9\]+, \\\[x\[0-9\]+\\\]" 12 } } */ +/* { dg-final { scan-assembler-times "stlxr\tw\[0-9\]+, w\[0-9\]+, \\\[x\[0-9\]+\\\]" 12 } } */ +/* { dg-final { scan-assembler-times "dmb\tish" 12 } } */ Index: gcc/testsuite/gcc.target/aarch64/sync-comp-swap.x =================================================================== --- a/src/gcc/testsuite/gcc.target/aarch64/sync-comp-swap.x (.../tags/gcc_5_2_0_release) +++ b/src/gcc/testsuite/gcc.target/aarch64/sync-comp-swap.x (.../branches/gcc-5-branch) @@ -0,0 +1,13 @@ +int v = 0; + +int +sync_bool_compare_swap (int a, int b) +{ + return __sync_bool_compare_and_swap (&v, &a, &b); +} + +int +sync_val_compare_swap (int a, int b) +{ + return __sync_val_compare_and_swap (&v, &a, &b); +} Index: gcc/testsuite/gcc.target/aarch64/sync-op-full.x =================================================================== --- a/src/gcc/testsuite/gcc.target/aarch64/sync-op-full.x (.../tags/gcc_5_2_0_release) +++ b/src/gcc/testsuite/gcc.target/aarch64/sync-op-full.x (.../branches/gcc-5-branch) @@ -0,0 +1,73 @@ +int v = 0; + +int +sync_fetch_and_add (int a) +{ + return __sync_fetch_and_add (&v, a); +} + +int +sync_fetch_and_sub (int a) +{ + return __sync_fetch_and_sub (&v, a); +} + +int +sync_fetch_and_and (int a) +{ + return __sync_fetch_and_and (&v, a); +} + +int +sync_fetch_and_nand (int a) +{ + return __sync_fetch_and_nand (&v, a); +} + +int +sync_fetch_and_xor (int a) +{ + return __sync_fetch_and_xor (&v, a); +} + +int +sync_fetch_and_or (int a) +{ + return __sync_fetch_and_or (&v, a); +} + +int +sync_add_and_fetch (int a) +{ + return __sync_add_and_fetch (&v, a); +} + +int +sync_sub_and_fetch (int a) +{ + return __sync_sub_and_fetch (&v, a); +} + +int +sync_and_and_fetch (int a) +{ + return __sync_and_and_fetch (&v, a); +} + +int +sync_nand_and_fetch (int a) +{ + return __sync_nand_and_fetch (&v, a); +} + +int +sync_xor_and_fetch (int a) +{ + return __sync_xor_and_fetch (&v, a); +} + +int +sync_or_and_fetch (int a) +{ + return __sync_or_and_fetch (&v, a); +} Index: gcc/testsuite/gcc.target/aarch64/fnmul-3.c =================================================================== --- a/src/gcc/testsuite/gcc.target/aarch64/fnmul-3.c (.../tags/gcc_5_2_0_release) +++ b/src/gcc/testsuite/gcc.target/aarch64/fnmul-3.c (.../branches/gcc-5-branch) @@ -0,0 +1,16 @@ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ + +double +foo_d (double a, double b) +{ + /* { dg-final { scan-assembler "fnmul\\td\[0-9\]+, d\[0-9\]+, d\[0-9\]+" } } */ + return -(a * b); +} + +float +foo_s (float a, float b) +{ + /* { dg-final { scan-assembler "fnmul\\ts\[0-9\]+, s\[0-9\]+, s\[0-9\]+" } } */ + return -(a * b); +} Index: gcc/testsuite/gcc.target/aarch64/fnmul-4.c =================================================================== --- a/src/gcc/testsuite/gcc.target/aarch64/fnmul-4.c (.../tags/gcc_5_2_0_release) +++ b/src/gcc/testsuite/gcc.target/aarch64/fnmul-4.c (.../branches/gcc-5-branch) @@ -0,0 +1,16 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -frounding-math" } */ + +double +foo_d (double a, double b) +{ + /* { dg-final { scan-assembler "fnmul\\td\[0-9\]+, d\[0-9\]+, d\[0-9\]+" } } */ + return -(a * b); +} + +float +foo_s (float a, float b) +{ + /* { dg-final { scan-assembler "fnmul\\ts\[0-9\]+, s\[0-9\]+, s\[0-9\]+" } } */ + return -(a * b); +} Index: gcc/testsuite/gcc.target/i386/adx-addcarryx64-1.c =================================================================== --- a/src/gcc/testsuite/gcc.target/i386/adx-addcarryx64-1.c (.../tags/gcc_5_2_0_release) +++ b/src/gcc/testsuite/gcc.target/i386/adx-addcarryx64-1.c (.../branches/gcc-5-branch) @@ -1,6 +1,6 @@ /* { dg-do compile { target { ! ia32 } } } */ /* { dg-options "-madx -O2" } */ -/* { dg-final { scan-assembler-times "adcx" 2 } } */ +/* { dg-final { scan-assembler-times "adc\[xq\]" 2 } } */ /* { dg-final { scan-assembler-times "sbbq" 1 } } */ #include Index: gcc/testsuite/gcc.target/i386/pr66648.c =================================================================== --- a/src/gcc/testsuite/gcc.target/i386/pr66648.c (.../tags/gcc_5_2_0_release) +++ b/src/gcc/testsuite/gcc.target/i386/pr66648.c (.../branches/gcc-5-branch) @@ -0,0 +1,33 @@ +/* { dg-do run } */ +/* { dg-options "-O2 -mstringop-strategy=unrolled_loop -mtune=nocona" } */ + +#define PATTERN 0xdeadbeef +#define SIZE 32 + +struct S { int i; char str[SIZE]; int j; }; + +void __attribute__((noclone, noinline)) +my_memcpy (char *, const char *, unsigned int); + +void +my_memcpy (char *dst, const char *src, unsigned int len) +{ + if (len < 8) + __builtin_abort (); + + __builtin_memcpy (dst, src, len); +} + +int +main (void) +{ + const char str[SIZE]= "1234567890123456789012345678901"; + struct S *s = __builtin_malloc (sizeof (struct S)); + + s->j = PATTERN; + my_memcpy (s->str, str, SIZE); + if (s->j != PATTERN) + __builtin_abort (); + + return 0; +} Index: gcc/testsuite/gcc.target/i386/pr66691.c =================================================================== --- a/src/gcc/testsuite/gcc.target/i386/pr66691.c (.../tags/gcc_5_2_0_release) +++ b/src/gcc/testsuite/gcc.target/i386/pr66691.c (.../branches/gcc-5-branch) @@ -0,0 +1,64 @@ +/* PR debug/66691 */ +/* { dg-do compile } */ +/* { dg-require-effective-target ia32 } */ +/* { dg-options "-O3 -g -mtune=generic -march=i686" } */ + +unsigned int a; +int b[2], c, d, e, f, g, h, i, k[8], l, m, s, t, w; +static int j; + +void +fn1 (long long p) +{ + int t = p; + c = c ^ b[c ^ (t & 1)]; +} + +static void +fn2 (long long p) +{ + c = c ^ b[1 ^ (d & 1)]; + fn1 (p >> 1 & 1); + fn1 (p >> 2); +} + +static void +fn3 () +{ + unsigned char p; + f = g = 0; + for (h = 0; h < 6; h++) + { + for (s = 0; s < 7; s++) + if (k[s+1]) + g = 0; + else + for (j = 0; j < 2; j++) + ; + t = j > 2 ? 0 : 1 >> j; + } + if (l) + { + short q[2]; + q[0] = q[1] = 0; + if (m) + for (i = 0; i < 2; i++) + { + unsigned char r = q[i]; + p = f ? r % f : r; + e = ((p > 0) <= (q[i] ^ 1)) + a; + if (k[1]) + for (e = 0; e != 18; ++e) + k[0] = 0; + } + } +} + +int +main () +{ + fn3 (); + fn2 (w); + fn2 (j); + return 0; +} Index: gcc/testsuite/gcc.target/i386/pr66838.c =================================================================== --- a/src/gcc/testsuite/gcc.target/i386/pr66838.c (.../tags/gcc_5_2_0_release) +++ b/src/gcc/testsuite/gcc.target/i386/pr66838.c (.../branches/gcc-5-branch) @@ -0,0 +1,36 @@ +/* { dg-do run { target lp64 } } */ +/* { dg-options "-O2" } */ + +void abort (void); + +char global; + +__attribute__((sysv_abi, noinline, noclone)) +void sysv_abi_func(char const *desc, void *local) +{ + register int esi asm ("esi"); + register int edi asm ("edi"); + + if (local != &global) + abort (); + + /* Clobber some of the extra SYSV ABI registers. */ + asm volatile ("movl\t%2, %0\n\tmovl\t%2, %1" + : "=r" (esi), "=r" (edi) + : "i" (0xdeadbeef)); +} + +__attribute__((ms_abi, noinline, noclone)) +void ms_abi_func () +{ + sysv_abi_func ("1st call", &global); + sysv_abi_func ("2nd call", &global); + sysv_abi_func ("3rd call", &global); +} + +int +main(void) +{ + ms_abi_func(); + return 0; +} Index: gcc/testsuite/gcc.target/i386/pr67317-1.c =================================================================== --- a/src/gcc/testsuite/gcc.target/i386/pr67317-1.c (.../tags/gcc_5_2_0_release) +++ b/src/gcc/testsuite/gcc.target/i386/pr67317-1.c (.../branches/gcc-5-branch) @@ -0,0 +1,18 @@ +/* PR target/67317 */ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ + +typedef unsigned int u32; + +u32 testcarry_u32 (u32 a, u32 b, u32 c, u32 d) +{ + u32 result0, result1; + + __builtin_ia32_addcarryx_u32 + (__builtin_ia32_addcarryx_u32 (0, a, c, &result0), b, d, &result1); + + return result0 ^ result1; +} + +/* { dg-final { scan-assembler-not "addb" } } */ +/* { dg-final { scan-assembler-not "setn?c" } } */ Index: gcc/testsuite/gcc.target/i386/pr67317-2.c =================================================================== --- a/src/gcc/testsuite/gcc.target/i386/pr67317-2.c (.../tags/gcc_5_2_0_release) +++ b/src/gcc/testsuite/gcc.target/i386/pr67317-2.c (.../branches/gcc-5-branch) @@ -0,0 +1,18 @@ +/* PR target/67317 */ +/* { dg-do compile { target { ! ia32 } } } */ +/* { dg-options "-O2" } */ + +typedef unsigned long long u64; + +u64 testcarry_u64 (u64 a, u64 b, u64 c, u64 d) +{ + u64 result0, result1; + + __builtin_ia32_addcarryx_u64 + (__builtin_ia32_addcarryx_u64 (0, a, c, &result0), b, d, &result1); + + return result0 ^ result1; +} + +/* { dg-final { scan-assembler-not "addb" } } */ +/* { dg-final { scan-assembler-not "setn?c" } } */ Index: gcc/testsuite/gcc.target/i386/pr67317-3.c =================================================================== --- a/src/gcc/testsuite/gcc.target/i386/pr67317-3.c (.../tags/gcc_5_2_0_release) +++ b/src/gcc/testsuite/gcc.target/i386/pr67317-3.c (.../branches/gcc-5-branch) @@ -0,0 +1,18 @@ +/* PR target/67317 */ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ + +typedef unsigned int u32; + +u32 testcarry_u32 (u32 a, u32 b, u32 c, u32 d) +{ + u32 result0, result1; + + __builtin_ia32_sbb_u32 + (__builtin_ia32_sbb_u32 (0, a, c, &result0), b, d, &result1); + + return result0 ^ result1; +} + +/* { dg-final { scan-assembler-not "addb" } } */ +/* { dg-final { scan-assembler-not "setn?c" } } */ Index: gcc/testsuite/gcc.target/i386/readeflags-1.c =================================================================== --- a/src/gcc/testsuite/gcc.target/i386/readeflags-1.c (.../tags/gcc_5_2_0_release) +++ b/src/gcc/testsuite/gcc.target/i386/readeflags-1.c (.../branches/gcc-5-branch) @@ -9,10 +9,11 @@ #define EFLAGS_TYPE unsigned int #endif -static EFLAGS_TYPE +__attribute__((noinline, noclone)) +EFLAGS_TYPE readeflags_test (unsigned int a, unsigned int b) { - unsigned x = (a == b); + volatile char x = (a == b); return __readeflags (); } Index: gcc/testsuite/gcc.target/i386/pr66891.c =================================================================== --- a/src/gcc/testsuite/gcc.target/i386/pr66891.c (.../tags/gcc_5_2_0_release) +++ b/src/gcc/testsuite/gcc.target/i386/pr66891.c (.../branches/gcc-5-branch) @@ -0,0 +1,16 @@ +/* { dg-do compile { target ia32 } } */ +/* { dg-options "-O2" } */ + +__attribute__((__stdcall__)) void fn1(); + +int a; + +static void fn2() { + for (;;) + ; +} + +void fn3() { + fn1(0); + fn2(a == 0); +} Index: gcc/testsuite/gcc.target/i386/pr66703.c =================================================================== --- a/src/gcc/testsuite/gcc.target/i386/pr66703.c (.../tags/gcc_5_2_0_release) +++ b/src/gcc/testsuite/gcc.target/i386/pr66703.c (.../branches/gcc-5-branch) @@ -0,0 +1,4 @@ +/* { dg-do run { target { ia32 } } } */ +/* { dg-options "-O0 -mtune=pentium" } */ + +#include "readeflags-1.c" Index: gcc/testsuite/gcc.target/i386/pr67317-4.c =================================================================== --- a/src/gcc/testsuite/gcc.target/i386/pr67317-4.c (.../tags/gcc_5_2_0_release) +++ b/src/gcc/testsuite/gcc.target/i386/pr67317-4.c (.../branches/gcc-5-branch) @@ -0,0 +1,18 @@ +/* PR target/67317 */ +/* { dg-do compile { target { ! ia32 } } } */ +/* { dg-options "-O2" } */ + +typedef unsigned long long u64; + +u64 testcarry_u64 (u64 a, u64 b, u64 c, u64 d) +{ + u64 result0, result1; + + __builtin_ia32_sbb_u64 + (__builtin_ia32_sbb_u64 (0, a, c, &result0), b, d, &result1); + + return result0 ^ result1; +} + +/* { dg-final { scan-assembler-not "addb" } } */ +/* { dg-final { scan-assembler-not "setn?c" } } */ Index: gcc/testsuite/gcc.target/i386/adx-addcarryx32-1.c =================================================================== --- a/src/gcc/testsuite/gcc.target/i386/adx-addcarryx32-1.c (.../tags/gcc_5_2_0_release) +++ b/src/gcc/testsuite/gcc.target/i386/adx-addcarryx32-1.c (.../branches/gcc-5-branch) @@ -1,6 +1,6 @@ /* { dg-do compile } */ /* { dg-options "-madx -O2" } */ -/* { dg-final { scan-assembler-times "adcx" 2 } } */ +/* { dg-final { scan-assembler-times "adc\[xl\]" 2 } } */ /* { dg-final { scan-assembler-times "sbbl" 1 } } */ #include Index: gcc/testsuite/gcc.target/i386/pr66922.c =================================================================== --- a/src/gcc/testsuite/gcc.target/i386/pr66922.c (.../tags/gcc_5_2_0_release) +++ b/src/gcc/testsuite/gcc.target/i386/pr66922.c (.../branches/gcc-5-branch) @@ -0,0 +1,23 @@ +/* { dg-do run } */ +/* { dg-options "-O1 -msse2" } */ +/* { dg-require-effective-target sse2 } */ + +#include "sse2-check.h" + +struct S +{ + int:31; + int:2; + int f0:16; + int f1; + int f2; +}; + +static void +sse2_test (void) +{ + struct S a = { 1, 0, 0 }; + + if (a.f0 != 1) + __builtin_abort(); +} Index: gcc/testsuite/gcc.target/i386/pr66814.c =================================================================== --- a/src/gcc/testsuite/gcc.target/i386/pr66814.c (.../tags/gcc_5_2_0_release) +++ b/src/gcc/testsuite/gcc.target/i386/pr66814.c (.../branches/gcc-5-branch) @@ -0,0 +1,4 @@ +/* { dg-do compile { target { ia32 } } } */ +/* { dg-options "-march=i586 -mavx512f -O2" } */ + +#include "avx512f-klogic-2.c" Index: gcc/testsuite/gcc.target/i386/mpx/pr66566.c =================================================================== --- a/src/gcc/testsuite/gcc.target/i386/mpx/pr66566.c (.../tags/gcc_5_2_0_release) +++ b/src/gcc/testsuite/gcc.target/i386/mpx/pr66566.c (.../branches/gcc-5-branch) @@ -0,0 +1,12 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fcheck-pointer-bounds -mmpx" } */ + +union jsval_layout +{ + void *asPtr; +}; +union jsval_layout a; +union jsval_layout b; +union jsval_layout __inline__ fn1() { return b; } + +void fn2() { a = fn1(); } Index: gcc/testsuite/gcc.target/i386/mpx/pr66567.c =================================================================== --- a/src/gcc/testsuite/gcc.target/i386/mpx/pr66567.c (.../tags/gcc_5_2_0_release) +++ b/src/gcc/testsuite/gcc.target/i386/mpx/pr66567.c (.../branches/gcc-5-branch) @@ -0,0 +1,16 @@ +/* { dg-do compile } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + +void (*b) (); + +void fn1 (const int *p1) +{ + static void *a = &&conv_1234_123C; + conv_1234_123C: + ; +} + +void fn2 () +{ + b = fn1; +} Index: gcc/testsuite/gcc.target/i386/mpx/pr66134.c =================================================================== --- a/src/gcc/testsuite/gcc.target/i386/mpx/pr66134.c (.../tags/gcc_5_2_0_release) +++ b/src/gcc/testsuite/gcc.target/i386/mpx/pr66134.c (.../branches/gcc-5-branch) @@ -0,0 +1,17 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fcheck-pointer-bounds -mmpx -fno-tree-ccp" } */ + +extern int vfork (void) __attribute__ ((__nothrow__ , __leaf__)); +void test1 (void); +void test2 (void); +void test3 (int *); + +void test (int *p) +{ + test1 (); + p++; + test2 (); + p++; + vfork (); + test3 (p); +} Index: gcc/testsuite/gcc.target/i386/mpx/pr66568.c =================================================================== --- a/src/gcc/testsuite/gcc.target/i386/mpx/pr66568.c (.../tags/gcc_5_2_0_release) +++ b/src/gcc/testsuite/gcc.target/i386/mpx/pr66568.c (.../branches/gcc-5-branch) @@ -0,0 +1,11 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target fpic } */ +/* { dg-options "-O2 -fcheck-pointer-bounds -mmpx -O2 -fPIC" } */ + +extern void exit (int); +int a, b, c; +void *set_test () { + if (b) + a ? exit (0) : exit (1); + b = c; +} Index: gcc/testsuite/gcc.target/i386/mpx/pr66569.c =================================================================== --- a/src/gcc/testsuite/gcc.target/i386/mpx/pr66569.c (.../tags/gcc_5_2_0_release) +++ b/src/gcc/testsuite/gcc.target/i386/mpx/pr66569.c (.../branches/gcc-5-branch) @@ -0,0 +1,14 @@ +/* { dg-do compile } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + +struct s1 { + int *p; + int i; +}; + +struct s2 { + struct s1 s; + int i; +}; + +int test (struct s2 s, ...) { } Index: gcc/testsuite/gcc.target/i386/mpx/pr66048.cc =================================================================== --- a/src/gcc/testsuite/gcc.target/i386/mpx/pr66048.cc (.../tags/gcc_5_2_0_release) +++ b/src/gcc/testsuite/gcc.target/i386/mpx/pr66048.cc (.../branches/gcc-5-branch) @@ -0,0 +1,16 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fcheck-pointer-bounds -mmpx -march=corei7-avx" } */ + +struct c1 +{ + c1 (const c1 &other) : p (other.p) { }; + int *p; +}; + +struct c2 : public c1 { }; + +c1 +test (c2 a) +{ + return a; +} Index: gcc/testsuite/gcc.target/i386/mpx/pr66581.c =================================================================== --- a/src/gcc/testsuite/gcc.target/i386/mpx/pr66581.c (.../tags/gcc_5_2_0_release) +++ b/src/gcc/testsuite/gcc.target/i386/mpx/pr66581.c (.../branches/gcc-5-branch) @@ -0,0 +1,18 @@ +/* { dg-do compile } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + +void *a; +int b; + +void +fn1 (void) +{ + void *c = &&l_nop; +l_nop: + for (; b;) + ; + int *d = c; + c = fn1; + *d = 1; + goto *a; +} Index: gcc/testsuite/gcc.target/s390/zvector/vec-load_bndry-1.c =================================================================== --- a/src/gcc/testsuite/gcc.target/s390/zvector/vec-load_bndry-1.c (.../tags/gcc_5_2_0_release) +++ b/src/gcc/testsuite/gcc.target/s390/zvector/vec-load_bndry-1.c (.../branches/gcc-5-branch) @@ -0,0 +1,80 @@ +/* { dg-do compile { target { s390*-*-* } } } */ +/* { dg-options "-O0 -mzarch -march=z13 -mzvector" } */ + +#include + +signed char +foo64 (signed char *p) +{ + return vec_load_bndry (p, 64)[0]; + /* { dg-final { scan-assembler-times "\tvlbb\t%v..?,0\\(%r..?\\),0" 1 } } */ +} + +signed char +foo128 (signed char *p) +{ + return + vec_load_bndry (p, 128)[0] + + vec_load_bndry (p + 16, 128)[0]; + /* { dg-final { scan-assembler-times "\tvlbb\t%v..?,0\\(%r..?\\),1" 2 } } */ +} + +signed char +foo256 (signed char *p) +{ + return + vec_load_bndry (p, 256)[0] + + vec_load_bndry (p + 16, 256)[0] + + vec_load_bndry (p + 32, 256)[0]; + /* { dg-final { scan-assembler-times "\tvlbb\t%v..?,0\\(%r..?\\),2" 3 } } */ +} + +signed char +foo512 (signed char *p) +{ + return + vec_load_bndry (p, 512)[0] + + vec_load_bndry (p + 16, 512)[0] + + vec_load_bndry (p + 32, 512)[0] + + vec_load_bndry (p + 48, 512)[0]; + /* { dg-final { scan-assembler-times "\tvlbb\t%v..?,0\\(%r..?\\),3" 4 } } */ +} + +signed char +foo1024 (signed char *p) +{ + return + vec_load_bndry (p, 1024)[0] + + vec_load_bndry (p + 16, 1024)[0] + + vec_load_bndry (p + 32, 1024)[0] + + vec_load_bndry (p + 48, 1024)[0] + + vec_load_bndry (p + 64, 1024)[0]; + /* { dg-final { scan-assembler-times "\tvlbb\t%v..?,0\\(%r..?\\),4" 5 } } */ +} + +signed char +foo2048 (signed char *p) +{ + return + vec_load_bndry (p, 2048)[0] + + vec_load_bndry (p + 16, 2048)[0] + + vec_load_bndry (p + 32, 2048)[0] + + vec_load_bndry (p + 48, 2048)[0] + + vec_load_bndry (p + 64, 2048)[0] + + vec_load_bndry (p + 80, 2048)[0]; + /* { dg-final { scan-assembler-times "\tvlbb\t%v..?,0\\(%r..?\\),5" 6 } } */ +} + +signed char +foo4096 (signed char *p) +{ + return + vec_load_bndry (p, 4096)[0] + + vec_load_bndry (p + 16, 4096)[0] + + vec_load_bndry (p + 32, 4096)[0] + + vec_load_bndry (p + 48, 4096)[0] + + vec_load_bndry (p + 64, 4096)[0] + + vec_load_bndry (p + 80, 4096)[0] + + vec_load_bndry (p + 96, 4096)[0]; + /* { dg-final { scan-assembler-times "\tvlbb\t%v..?,0\\(%r..?\\),6" 7 } } */ +} Index: gcc/testsuite/gfortran.dg/pr66864.f90 =================================================================== --- a/src/gcc/testsuite/gfortran.dg/pr66864.f90 (.../tags/gcc_5_2_0_release) +++ b/src/gcc/testsuite/gfortran.dg/pr66864.f90 (.../branches/gcc-5-branch) @@ -0,0 +1,16 @@ +! { dg-do run } +! PR fortran/66864 +! +program t + implicit none + real(8) x + x = 2.0d0**26.5d0 + if (floor(x) /= 94906265) call abort + if (floor(2.0d0**26.5d0)/= 94906265) call abort + x = 777666555.6d0 + if (floor(x) /= 777666555) call abort + if (floor(777666555.6d0) /= 777666555) call abort + x = 2000111222.6d0 + if (floor(x) /= 2000111222) call abort + if (floor(2000111222.6d0) /= 2000111222) call abort +end program t Index: gcc/testsuite/gfortran.dg/pr66545_1.f90 =================================================================== --- a/src/gcc/testsuite/gfortran.dg/pr66545_1.f90 (.../tags/gcc_5_2_0_release) +++ b/src/gcc/testsuite/gfortran.dg/pr66545_1.f90 (.../branches/gcc-5-branch) @@ -0,0 +1,17 @@ +! { dg-do compile } +! { dg-options "-Wall" } +! PR fortran/66545 +! +subroutine p + complex, parameter :: c1 = (c1) ! { dg-error "before its definition" } + complex, parameter :: c2 = c2 ! { dg-error "before its definition" } + complex :: c3 = (c3) ! { dg-error "has not been declared or is a variable" } + complex :: c4 = c4 ! { dg-error "has not been declared or is a variable" } +end subroutine p + +subroutine q + real, parameter :: r1 = (r1) ! { dg-error "before its definition" } + real, parameter :: r2 = r2 ! { dg-error "before its definition" } + real :: r3 = (r3) ! { dg-error "has not been declared or is a variable" } + real :: r4 = r4 ! { dg-error "has not been declared or is a variable" } +end subroutine q Index: gcc/testsuite/gfortran.dg/iomsg_2.f90 =================================================================== --- a/src/gcc/testsuite/gfortran.dg/iomsg_2.f90 (.../tags/gcc_5_2_0_release) +++ b/src/gcc/testsuite/gfortran.dg/iomsg_2.f90 (.../branches/gcc-5-branch) @@ -0,0 +1,44 @@ +! { dg-do compile } +subroutine foo1 + implicit none + integer i + open(1, iomsg=666) ! { dg-error "IOMSG must be" } + open(1, iomsg='sgk') ! { dg-error "IOMSG must be" } + open(1, iomsg=i) ! { dg-error "IOMSG must be" } + close(1, iomsg=666) ! { dg-error "IOMSG must be" } + close(1, iomsg='sgk') ! { dg-error "IOMSG must be" } + close(1, iomsg=i) ! { dg-error "IOMSG must be" } +end subroutine foo1 + +subroutine foo + implicit none + integer i + real :: x = 1 + write(1, *, iomsg='sgk') x ! { dg-error "IOMSG must be" } + write(1, *, iomsg=i) x ! { dg-error "IOMSG must be" } + read(1, *, iomsg='sgk') x ! { dg-error "IOMSG must be" } + read(1, *, iomsg=i) x ! { dg-error "IOMSG must be" } + flush(1, iomsg='sgk') ! { dg-error "IOMSG must be" } + flush(1, iomsg=i) ! { dg-error "IOMSG must be" } + rewind(1, iomsg='sgk') ! { dg-error "IOMSG must be" } + rewind(1, iomsg=i) ! { dg-error "IOMSG must be" } + backspace(1,iomsg='sgk') ! { dg-error "IOMSG must be" } + backspace(1,iomsg=i) ! { dg-error "IOMSG must be" } + wait(1, iomsg='sgk') ! { dg-error "IOMSG must be" } + wait(1, iomsg=i) ! { dg-error "IOMSG must be" } +end subroutine foo + +subroutine bar + implicit none + integer i + real :: x = 1 + character(len=20) s(2) + open(1, iomsg=s) ! { dg-error "must be scalar" } + close(1, iomsg=s) ! { dg-error "must be scalar" } + write(1, *, iomsg=s) x ! { dg-error "must be scalar" } + read(1, *, iomsg=s) x ! { dg-error "must be scalar" } + flush(1, iomsg=s) ! { dg-error "must be scalar" } + rewind(1, iomsg=s) ! { dg-error "must be scalar" } + backspace(1,iomsg=s) ! { dg-error "must be scalar" } + wait(1, iomsg=s) ! { dg-error "must be scalar" } +end subroutine bar Index: gcc/testsuite/gfortran.dg/co_reduce_1.f90 =================================================================== --- a/src/gcc/testsuite/gfortran.dg/co_reduce_1.f90 (.../tags/gcc_5_2_0_release) +++ b/src/gcc/testsuite/gfortran.dg/co_reduce_1.f90 (.../branches/gcc-5-branch) @@ -0,0 +1,33 @@ +! { dg-do compile } +! { dg-additional-options "-fdump-tree-original -fcoarray=lib" } +! +! Check that we don't take twice the address of procedure simple_reduction +! in the generated code. +! +! Contributed by Alessandro Fanfarillo + +program simple_reduce + implicit none + + integer :: me + + me = this_image() + + sync all + + call co_reduce(me,simple_reduction) + + write(*,*) this_image(),me + +contains + + pure function simple_reduction(a,b) + integer,intent(in) :: a,b + integer :: simple_reduction + + simple_reduction = a * b + end function simple_reduction + +end program simple_reduce + +! { dg-final { scan-tree-dump "_gfortran_caf_co_reduce \\(&desc\\.\\d+,\\s*simple_reduction," "original" } } Index: gcc/testsuite/gfortran.dg/generic_31.f90 =================================================================== --- a/src/gcc/testsuite/gfortran.dg/generic_31.f90 (.../tags/gcc_5_2_0_release) +++ b/src/gcc/testsuite/gfortran.dg/generic_31.f90 (.../branches/gcc-5-branch) @@ -0,0 +1,35 @@ +! { dg-do run } +! +! PR fortran/66929 +! Check that the specific FIRST symbol is used for the call to FOO, +! so that the J argument is not assumed to be present + +module m + interface foo + module procedure first + end interface foo +contains + elemental function bar(j) result(r) + integer, intent(in), optional :: j + integer :: r, s(2) + ! We used to have NULL dereference here, in case of a missing J argument + s = foo(j, [3, 7]) + r = sum(s) + end function bar + elemental function first(i, j) result(r) + integer, intent(in), optional :: i + integer, intent(in) :: j + integer :: r + if (present(i)) then + r = i + else + r = -5 + end if + end function first +end module m +program p + use m + integer :: i + i = bar() + if (i /= -10) call abort +end program p Index: gcc/testsuite/gfortran.dg/pr56520.f90 =================================================================== --- a/src/gcc/testsuite/gfortran.dg/pr56520.f90 (.../tags/gcc_5_2_0_release) +++ b/src/gcc/testsuite/gfortran.dg/pr56520.f90 (.../branches/gcc-5-branch) @@ -0,0 +1,13 @@ +! { dg-do compile } +! PR fortran/56520 +! +program misleading + implicit none + real a, c + a = 1.0 + c = exp(+a) ) ! { dg-error "Unclassifiable statement" } + c = exp(-a) ) ! { dg-error "Unclassifiable statement" } + c = exp((a)) ) ! { dg-error "Unclassifiable statement" } + c = exp(a) ) ! { dg-error "Unclassifiable statement" } + c = exp(a) +end program misleading Index: gcc/testsuite/gfortran.dg/coarray_collectives_16.f90 =================================================================== --- a/src/gcc/testsuite/gfortran.dg/coarray_collectives_16.f90 (.../tags/gcc_5_2_0_release) +++ b/src/gcc/testsuite/gfortran.dg/coarray_collectives_16.f90 (.../branches/gcc-5-branch) @@ -33,7 +33,7 @@ end function hc end program test -! { dg-final { scan-tree-dump-times "_gfortran_caf_co_reduce \\(&desc.., &fr, 4, _gfortran_caf_num_images \\(0, -1\\), &stat1, errmesg1, 0, 6\\);" 1 "original" } } -! { dg-final { scan-tree-dump-times "_gfortran_caf_co_reduce \\(&val2, &gz, 0, 4, &stat2, errmesg2, 0, 7\\);" 1 "original" } } -! { dg-final { scan-tree-dump-times "_gfortran_caf_co_reduce \\(&desc.., &hc, 1, res, &stat3, errmesg3, 99, 8\\);" 1 "original" } } +! { dg-final { scan-tree-dump-times "_gfortran_caf_co_reduce \\(&desc.., fr, 4, _gfortran_caf_num_images \\(0, -1\\), &stat1, errmesg1, 0, 6\\);" 1 "original" } } +! { dg-final { scan-tree-dump-times "_gfortran_caf_co_reduce \\(&val2, gz, 0, 4, &stat2, errmesg2, 0, 7\\);" 1 "original" } } +! { dg-final { scan-tree-dump-times "_gfortran_caf_co_reduce \\(&desc.., hc, 1, res, &stat3, errmesg3, 99, 8\\);" 1 "original" } } ! { dg-final { cleanup-tree-dump "original" } } Index: gcc/testsuite/gfortran.dg/class_allocate_20.f90 =================================================================== --- a/src/gcc/testsuite/gfortran.dg/class_allocate_20.f90 (.../tags/gcc_5_2_0_release) +++ b/src/gcc/testsuite/gfortran.dg/class_allocate_20.f90 (.../branches/gcc-5-branch) @@ -0,0 +1,32 @@ +! { dg-do run } +! +! PR fortran/64921 +! Test that the finalization wrapper procedure get the always_explicit +! attribute so that the array is not passed without descriptor from +! T3's finalization wrapper procedure to T2's one. +! +! Contributed by Mat Cross + +Program test + Implicit None + Type :: t1 + Integer, Allocatable :: i + End Type + Type :: t2 + Integer, Allocatable :: i + End Type + Type, Extends (t1) :: t3 + Type (t2) :: j + End Type + Type, Extends (t3) :: t4 + Integer, Allocatable :: k + End Type + Call s + Print *, 'ok' +Contains + Subroutine s + Class (t1), Allocatable :: x + Allocate (t4 :: x) + End Subroutine +End Program +! { dg-output "ok" } Index: gcc/testsuite/gfortran.dg/pr66545_2.f90 =================================================================== --- a/src/gcc/testsuite/gfortran.dg/pr66545_2.f90 (.../tags/gcc_5_2_0_release) +++ b/src/gcc/testsuite/gfortran.dg/pr66545_2.f90 (.../branches/gcc-5-branch) @@ -0,0 +1,23 @@ +! { dg-do compile } +! { dg-options "-Wuninitialized" } +! PR fortran/66545 +! +program foo + implicit none + call p1 + call q1 +end program foo + +subroutine p1 + complex :: c5 + complex :: c6 + c5 = (c5) ! { dg-warning "used uninitialized in this" } + c6 = c6 ! { dg-warning "used uninitialized in this" } +end subroutine p1 + +subroutine q1 + real :: r5 + real :: r6 + r5 = (r5) ! { dg-warning "used uninitialized in this" } + r6 = r6 ! { dg-warning "used uninitialized in this" } +end subroutine q1 Index: gcc/testsuite/gfortran.dg/pr66725.f90 =================================================================== --- a/src/gcc/testsuite/gfortran.dg/pr66725.f90 (.../tags/gcc_5_2_0_release) +++ b/src/gcc/testsuite/gfortran.dg/pr66725.f90 (.../branches/gcc-5-branch) @@ -0,0 +1,31 @@ +! { dg-do compile } +! PR fortran/66725 +! +program foo + + open(unit=1,access = 999) ! { dg-error "ACCESS requires" } + open(unit=1,action = 999) ! { dg-error "ACTION requires" } + open(unit=1,asynchronous = 999) ! { dg-error "ASYNCHRONOUS requires" } + open(unit=1,blank = 999) ! { dg-error "BLANK requires" } + open(unit=1,decimal = 999) ! { dg-error "DECIMAL requires" } + open(unit=1,delim = 999) ! { dg-error "DELIM requires" } + open(unit=1,encoding = 999) ! { dg-error "ENCODING requires" } + open(unit=1,form = 999) ! { dg-error "FORM requires" } + open(unit=1,pad = 999) ! { dg-error "PAD requires" } + open(unit=1,position = 999) ! { dg-error "POSITION requires" } + open(unit=1,round = 999) ! { dg-error "ROUND requires" } + open(unit=1,sign = 999) ! { dg-error "SIGN requires" } + open(unit=1,status = 999) ! { dg-error "STATUS requires" } + + close(unit=1, status=999) ! { dg-error "STATUS requires" } + + write (unit=1, asynchronous=257) ! { dg-error "ASYNCHRONOUS requires" } + write (unit=1, delim=257) ! { dg-error "DELIM requires" } + write (unit=1, decimal=257) ! { dg-error "DECIMAL requires" } + write (unit=1, round=257) ! { dg-error "ROUND requires" } + write (unit=1, sign=257) ! { dg-error "SIGN requires" } + + write (unit=1, blank=257) ! { dg-error "BLANK requires" } + write (unit=1, pad=257) ! { dg-error "PAD requires" } + +end program foo Index: gcc/testsuite/gfortran.dg/generic_30.f90 =================================================================== --- a/src/gcc/testsuite/gfortran.dg/generic_30.f90 (.../tags/gcc_5_2_0_release) +++ b/src/gcc/testsuite/gfortran.dg/generic_30.f90 (.../branches/gcc-5-branch) @@ -0,0 +1,41 @@ +! { dg-do compile } +! +! PR fortran/66929 +! Generic procedures as actual argument used to lead to +! a NULL pointer dereference in gfc_get_proc_ifc_for_expr +! because the generic symbol was used as procedure symbol, +! instead of the specific one. + +module iso_varying_string + type, public :: varying_string + character(LEN=1), dimension(:), allocatable :: chars + end type varying_string + interface operator(/=) + module procedure op_ne_VS_CH + end interface operator (/=) + interface trim + module procedure trim_ + end interface +contains + elemental function op_ne_VS_CH (string_a, string_b) result (op_ne) + type(varying_string), intent(in) :: string_a + character(LEN=*), intent(in) :: string_b + logical :: op_ne + op_ne = .true. + end function op_ne_VS_CH + elemental function trim_ (string) result (trim_string) + type(varying_string), intent(in) :: string + type(varying_string) :: trim_string + trim_string = varying_string(["t", "r", "i", "m", "m", "e", "d"]) + end function trim_ +end module iso_varying_string +module syntax_rules + use iso_varying_string, string_t => varying_string +contains + subroutine set_rule_type_and_key + type(string_t) :: key + if (trim (key) /= "") then + print *, "non-empty" + end if + end subroutine set_rule_type_and_key +end module syntax_rules Index: gcc/testsuite/gfortran.dg/structure_constructor_13.f03 =================================================================== --- a/src/gcc/testsuite/gfortran.dg/structure_constructor_13.f03 (.../tags/gcc_5_2_0_release) +++ b/src/gcc/testsuite/gfortran.dg/structure_constructor_13.f03 (.../branches/gcc-5-branch) @@ -0,0 +1,28 @@ +! { dg-do run } +! +! Contributed by Melven Roehrig-Zoellner +! PR fortran/66035 + +program test_pr66035 + type t + end type t + type w + class(t), allocatable :: c + end type w + + type(t) :: o + + call test(o) +contains + subroutine test(o) + class(t), intent(inout) :: o + type(w), dimension(:), allocatable :: list + + select type (o) + class is (t) + list = [w(o)] ! This caused an ICE + class default + call abort() + end select + end subroutine +end program Index: gcc/testsuite/gcc.dg/graphite/interchange-15.c =================================================================== --- a/src/gcc/testsuite/gcc.dg/graphite/interchange-15.c (.../tags/gcc_5_2_0_release) +++ b/src/gcc/testsuite/gcc.dg/graphite/interchange-15.c (.../branches/gcc-5-branch) @@ -49,6 +49,6 @@ } /* PRE destroys the perfect nest and we can't cope with that yet. */ -/* { dg-final { scan-tree-dump-times "will be interchanged" 1 "graphite" } } */ +/* { dg-final { scan-tree-dump-times "will be interchanged" 1 "graphite" { xfail *-*-* } } } */ /* { dg-final { cleanup-tree-dump "graphite" } } */ Index: gcc/testsuite/gcc.dg/graphite/uns-interchange-14.c =================================================================== --- a/src/gcc/testsuite/gcc.dg/graphite/uns-interchange-14.c (.../tags/gcc_5_2_0_release) +++ b/src/gcc/testsuite/gcc.dg/graphite/uns-interchange-14.c (.../branches/gcc-5-branch) @@ -0,0 +1,60 @@ +/* { dg-require-effective-target size32plus } */ + +#define DEBUG 0 +#if DEBUG +#include +#endif + +#define N 200 + +unsigned int A[N][N], B[N][N], C[N][N]; + +static void __attribute__((noinline)) +matmult (void) +{ + int i, j, k; + + for (i = 0; i < N; i++) + for (j = 0; j < N; j++) + A[i][j] = 0; + + /* Loops J and K should be interchanged. */ + for (i = 0; i < N; i++) + for (j = 0; j < N; j++) + for (k = 0; k < N; k++) + A[i][j] += B[i][k] * C[k][j]; +} + +extern void abort (); + +int +main (void) +{ + int i, j; + unsigned res = 0; + + for (i = 0; i < N; i++) + for (j = 0; j < N; j++) + { + B[i][j] = j; + C[i][j] = i; + } + + matmult (); + + for (i = 0; i < N; i++) + res += A[i][i]; + +#if DEBUG + fprintf (stderr, "res = %d \n", res); +#endif + + if (res != 529340000) + abort (); + + return 0; +} + +/* PRE destroys the perfect nest and we can't cope with that yet. */ +/* { dg-final { scan-tree-dump-times "will be interchanged" 1 "graphite" } } */ +/* { dg-final { cleanup-tree-dump "graphite" } } */ Index: gcc/testsuite/gcc.dg/graphite/interchange-12.c =================================================================== --- a/src/gcc/testsuite/gcc.dg/graphite/interchange-12.c (.../tags/gcc_5_2_0_release) +++ b/src/gcc/testsuite/gcc.dg/graphite/interchange-12.c (.../branches/gcc-5-branch) @@ -53,5 +53,5 @@ return 0; } -/* { dg-final { scan-tree-dump-times "will be interchanged" 1 "graphite" } } */ +/* { dg-final { scan-tree-dump-times "will be interchanged" 1 "graphite" { xfail *-*-* } } } */ /* { dg-final { cleanup-tree-dump "graphite" } } */ Index: gcc/testsuite/gcc.dg/graphite/uns-interchange-15.c =================================================================== --- a/src/gcc/testsuite/gcc.dg/graphite/uns-interchange-15.c (.../tags/gcc_5_2_0_release) +++ b/src/gcc/testsuite/gcc.dg/graphite/uns-interchange-15.c (.../branches/gcc-5-branch) @@ -0,0 +1,55 @@ +/* { dg-require-effective-target size32plus } */ + +#define DEBUG 0 +#if DEBUG +#include +#endif + +#define NMAX 2000 + +static unsigned int x[NMAX], a[NMAX][NMAX]; + +static unsigned int __attribute__((noinline)) +mvt (long N) +{ + int i,j; + + /* These two loops should be interchanged. */ + for (i = 0; i < N; i++) + for (j = 0; j < N; j++) + x[i] += a[j][i]; + + return x[1]; +} + +extern void abort (); + +int +main (void) +{ + int i, j; + unsigned int res; + + for (i = 0; i < NMAX; i++) + for (j = 0; j < NMAX; j++) + a[i][j] = j; + + for (i = 0; i < NMAX; i++) + x[i] = i; + + res = mvt (NMAX); + +#if DEBUG + fprintf (stderr, "res = %d \n", res); +#endif + + if (res != 2001) + abort (); + + return 0; +} + +/* PRE destroys the perfect nest and we can't cope with that yet. */ +/* { dg-final { scan-tree-dump-times "will be interchanged" 1 "graphite" } } */ +/* { dg-final { cleanup-tree-dump "graphite" } } */ + Index: gcc/testsuite/gcc.dg/graphite/graphite.exp =================================================================== --- a/src/gcc/testsuite/gcc.dg/graphite/graphite.exp (.../tags/gcc_5_2_0_release) +++ b/src/gcc/testsuite/gcc.dg/graphite/graphite.exp (.../branches/gcc-5-branch) @@ -41,8 +41,10 @@ set scop_files [lsort [glob -nocomplain $srcdir/$subdir/scop-*.c ] ] set id_files [lsort [glob -nocomplain $srcdir/$subdir/id-*.c ] ] set run_id_files [lsort [glob -nocomplain $srcdir/$subdir/run-id-*.c ] ] -set interchange_files [lsort [glob -nocomplain $srcdir/$subdir/interchange-*.c ] ] -set block_files [lsort [glob -nocomplain $srcdir/$subdir/block-*.c ] ] +set interchange_files [lsort [glob -nocomplain $srcdir/$subdir/interchange-*.c \ + $srcdir/$subdir/uns-interchange-*.c ] ] +set block_files [lsort [glob -nocomplain $srcdir/$subdir/block-*.c \ + $srcdir/$subdir/uns-block-*.c ] ] set vect_files [lsort [glob -nocomplain $srcdir/$subdir/vect-*.c ] ] # Tests to be compiled. Index: gcc/testsuite/gcc.dg/graphite/uns-interchange-mvt.c =================================================================== --- a/src/gcc/testsuite/gcc.dg/graphite/uns-interchange-mvt.c (.../tags/gcc_5_2_0_release) +++ b/src/gcc/testsuite/gcc.dg/graphite/uns-interchange-mvt.c (.../branches/gcc-5-branch) @@ -0,0 +1,65 @@ +/* { dg-require-effective-target size32plus } */ + +#define DEBUG 0 +#if DEBUG +#include +#endif + +#define NMAX 2000 + +static unsigned int x1[NMAX], x2[NMAX], a[NMAX][NMAX], y1[NMAX], y2[NMAX]; + +static unsigned int __attribute__((noinline)) +mvt (long N) +{ + + int i,j; + + for (i = 0; i < N; i++) + for (j = 0; j < N; j++) + x1[i] = x1[i] + a[i][j] * y1[j]; + + /* These two loops should be interchanged. */ + for (i = 0; i < N; i++) + for (j = 0; j < N; j++) + x2[i] = x2[i] + a[j][i] * y2[j]; + + return x1[0] + x2[0]; +} + +extern void abort (); + +int +main (void) +{ + int i, j; + unsigned int res; + + for (i = 0; i < NMAX; i++) + for (j = 0; j < NMAX; j++) + a[i][j] = i + j; + + for (i = 0; i < NMAX; i++) + { + x1[i] = 0; + x2[i] = 2*i; + y1[i] = 100 - i; + y2[i] = i; + } + + res = mvt (NMAX); + +#if DEBUG + fprintf (stderr, "res = %d \n", res); +#endif + + if (res != 199900000) + abort (); + + return 0; +} + +/* PRE destroys the perfect nest and we can't cope with that yet. */ +/* { dg-final { scan-tree-dump-times "will be interchanged" 1 "graphite" } } */ +/* { dg-final { cleanup-tree-dump "graphite" } } */ + Index: gcc/testsuite/gcc.dg/graphite/uns-interchange-12.c =================================================================== --- a/src/gcc/testsuite/gcc.dg/graphite/uns-interchange-12.c (.../tags/gcc_5_2_0_release) +++ b/src/gcc/testsuite/gcc.dg/graphite/uns-interchange-12.c (.../branches/gcc-5-branch) @@ -0,0 +1,58 @@ +/* { dg-require-effective-target size32plus } */ + +#define DEBUG 0 +#if DEBUG +#include +#endif + +#define N 200 + +unsigned int A[N][N], B[N][N], C[N][N]; + +static unsigned int __attribute__((noinline)) +matmult (void) +{ + int i, j, k; + + /* Loops J and K should be interchanged. */ + for (i = 0; i < N; i++) + for (j = 0; j < N; j++) + { + A[i][j] = 0; + for (k = 0; k < N; k++) + A[i][j] += B[i][k] * C[k][j]; + } + + return A[0][0] + A[N-1][N-1]; +} + +extern void abort (); + +int +main (void) +{ + int i, j; + unsigned int res; + + for (i = 0; i < N; i++) + for (j = 0; j < N; j++) + { + A[i][j] = 0; + B[i][j] = i - j; + C[i][j] = i + j; + } + + res = matmult (); + +#if DEBUG + fprintf (stderr, "res = %d \n", res); +#endif + + if (res != 2626800) + abort (); + + return 0; +} + +/* { dg-final { scan-tree-dump-times "will be interchanged" 1 "graphite" } } */ +/* { dg-final { cleanup-tree-dump "graphite" } } */ Index: gcc/testsuite/gcc.dg/graphite/uns-block-1.c =================================================================== --- a/src/gcc/testsuite/gcc.dg/graphite/uns-block-1.c (.../tags/gcc_5_2_0_release) +++ b/src/gcc/testsuite/gcc.dg/graphite/uns-block-1.c (.../branches/gcc-5-branch) @@ -0,0 +1,49 @@ +/* { dg-require-effective-target size32plus } */ + +#define DEBUG 0 +#if DEBUG +#include +#endif + +#define MAX 100 + +extern void abort (); + +int +main (void) +{ + int i, j; + unsigned int sum = 0; + unsigned int A[MAX * MAX]; + unsigned int B[MAX * MAX]; + + /* These loops should be loop blocked. */ + for (i = 0; i < MAX; i++) + for (j = 0; j < MAX; j++) + { + A[i*MAX + j] = j; + B[i*MAX + j] = j; + } + + /* These loops should be loop blocked. */ + for (i = 0; i < MAX; i++) + for (j = 0; j < MAX; j++) + A[i*MAX + j] += B[j*MAX + i]; + + /* These loops should be loop blocked. */ + for (i = 0; i < MAX; i++) + for (j = 0; j < MAX; j++) + sum += A[i*MAX + j]; + +#if DEBUG + fprintf (stderr, "sum = %d \n", sum); +#endif + + if (sum != 990000) + abort (); + + return 0; +} + +/* { dg-final { scan-tree-dump-times "will be loop blocked" 3 "graphite" } } */ +/* { dg-final { cleanup-tree-dump "graphite" } } */ Index: gcc/testsuite/gcc.dg/graphite/interchange-mvt.c =================================================================== --- a/src/gcc/testsuite/gcc.dg/graphite/interchange-mvt.c (.../tags/gcc_5_2_0_release) +++ b/src/gcc/testsuite/gcc.dg/graphite/interchange-mvt.c (.../branches/gcc-5-branch) @@ -59,6 +59,6 @@ } /* PRE destroys the perfect nest and we can't cope with that yet. */ -/* { dg-final { scan-tree-dump-times "will be interchanged" 1 "graphite" } } */ +/* { dg-final { scan-tree-dump-times "will be interchanged" 1 "graphite" { xfail *-*-* } } } */ /* { dg-final { cleanup-tree-dump "graphite" } } */ Index: gcc/testsuite/gcc.dg/graphite/uns-interchange-9.c =================================================================== --- a/src/gcc/testsuite/gcc.dg/graphite/uns-interchange-9.c (.../tags/gcc_5_2_0_release) +++ b/src/gcc/testsuite/gcc.dg/graphite/uns-interchange-9.c (.../branches/gcc-5-branch) @@ -0,0 +1,49 @@ +/* { dg-require-effective-target size32plus } */ + +#define DEBUG 0 +#if DEBUG +#include +#endif + +#define N 111 +#define M 111 + +static unsigned int __attribute__((noinline)) +foo (unsigned int *x) +{ + int i, j; + unsigned int sum = 0; + + for (j = 0; j < M; ++j) + for (i = 0; i < N; ++i) + sum += x[M * i + j]; + + return sum; +} + +extern void abort (); + +int +main (void) +{ + unsigned int A[N*M]; + int i; + unsigned int res; + + for (i = 0; i < N*M; i++) + A[i] = 2; + + res = foo (A); + +#if DEBUG + fprintf (stderr, "res = %d \n", res); +#endif + + if (res != 24642) + abort (); + + return 0; +} + +/* { dg-final { scan-tree-dump-times "will be interchanged" 1 "graphite" } } */ +/* { dg-final { cleanup-tree-dump "graphite" } } */ Index: gcc/testsuite/gcc.dg/graphite/interchange-14.c =================================================================== --- a/src/gcc/testsuite/gcc.dg/graphite/interchange-14.c (.../tags/gcc_5_2_0_release) +++ b/src/gcc/testsuite/gcc.dg/graphite/interchange-14.c (.../branches/gcc-5-branch) @@ -55,5 +55,5 @@ } /* PRE destroys the perfect nest and we can't cope with that yet. */ -/* { dg-final { scan-tree-dump-times "will be interchanged" 1 "graphite" } } */ +/* { dg-final { scan-tree-dump-times "will be interchanged" 1 "graphite" { xfail *-*-* } } } */ /* { dg-final { cleanup-tree-dump "graphite" } } */ Index: gcc/testsuite/gcc.dg/graphite/interchange-9.c =================================================================== --- a/src/gcc/testsuite/gcc.dg/graphite/interchange-9.c (.../tags/gcc_5_2_0_release) +++ b/src/gcc/testsuite/gcc.dg/graphite/interchange-9.c (.../branches/gcc-5-branch) @@ -44,5 +44,5 @@ return 0; } -/* { dg-final { scan-tree-dump-times "will be interchanged" 1 "graphite" } } */ +/* { dg-final { scan-tree-dump-times "will be interchanged" 1 "graphite" { xfail *-*-* } } } */ /* { dg-final { cleanup-tree-dump "graphite" } } */ Index: gcc/testsuite/gcc.dg/graphite/block-1.c =================================================================== --- a/src/gcc/testsuite/gcc.dg/graphite/block-1.c (.../tags/gcc_5_2_0_release) +++ b/src/gcc/testsuite/gcc.dg/graphite/block-1.c (.../branches/gcc-5-branch) @@ -45,5 +45,5 @@ return 0; } -/* { dg-final { scan-tree-dump-times "will be loop blocked" 3 "graphite" } } */ +/* { dg-final { scan-tree-dump-times "will be loop blocked" 3 "graphite" { xfail *-*-* } } } */ /* { dg-final { cleanup-tree-dump "graphite" } } */ Index: gcc/testsuite/gcc.dg/lto/chkp-wrap-asm-name_0.c =================================================================== --- a/src/gcc/testsuite/gcc.dg/lto/chkp-wrap-asm-name_0.c (.../tags/gcc_5_2_0_release) +++ b/src/gcc/testsuite/gcc.dg/lto/chkp-wrap-asm-name_0.c (.../branches/gcc-5-branch) @@ -0,0 +1,20 @@ +/* { dg-lto-do link } */ +/* { dg-require-effective-target mpx } */ +/* { dg-lto-options { { -O2 -flto -fcheck-pointer-bounds -mmpx } } } */ + +typedef long unsigned int size_t; + +extern size_t strlen (const char *); +extern __typeof (strlen) strlen __asm__ ("" "__hidden_strlen") __attribute__ ((visibility ("hidden"))); + +size_t +test1 (const char *p) { return strlen (p); } + +size_t +test2 (const char *p) { return __builtin_strlen (p); } + +int +main (int argc, const char **argv) +{ + return test1 (argv[0]) - test2 (argv[0]); +} Index: gcc/testsuite/gcc.dg/lto/chkp-removed-alias_0.c =================================================================== --- a/src/gcc/testsuite/gcc.dg/lto/chkp-removed-alias_0.c (.../tags/gcc_5_2_0_release) +++ b/src/gcc/testsuite/gcc.dg/lto/chkp-removed-alias_0.c (.../branches/gcc-5-branch) @@ -0,0 +1,28 @@ +/* { dg-lto-do link } */ +/* { dg-require-effective-target mpx } */ +/* { dg-lto-options { { -O2 -flto -flto-partition=max -fcheck-pointer-bounds -mmpx } } } */ + +int test1 (const char *c) +{ + return c[0] * 2; +} + +int test2 (const char *c) +{ + return c[1] * 3; +} + +int test1_alias (const char *c) __attribute__ ((alias ("test1"))); +int test2_alias (const char *c) __attribute__ ((alias ("test2"))); + +struct S +{ + int (*fnptr[2]) (const char *); +} S; + +struct S s = {test1_alias, test2_alias}; + +int main (int argc, const char **argv) +{ + return s.fnptr[argc] (argv[0]); +} Index: gcc/testsuite/gcc.dg/torture/pr67005.c =================================================================== --- a/src/gcc/testsuite/gcc.dg/torture/pr67005.c (.../tags/gcc_5_2_0_release) +++ b/src/gcc/testsuite/gcc.dg/torture/pr67005.c (.../branches/gcc-5-branch) @@ -0,0 +1,15 @@ +/* { dg-do compile } */ + +int a; +void +f (void) +{ + if (!a); + else + lbl: + a = a; + + if (a) + a = 8; + goto lbl; +} Index: gcc/testsuite/gcc.dg/pr67028.c =================================================================== --- a/src/gcc/testsuite/gcc.dg/pr67028.c (.../tags/gcc_5_2_0_release) +++ b/src/gcc/testsuite/gcc.dg/pr67028.c (.../branches/gcc-5-branch) @@ -0,0 +1,21 @@ +/* { dg-do run } */ +/* { dg-options "-O3" } */ + +short c = 0; + +int __attribute__ ((noinline)) f(void) +{ + int d = 5; + signed char e = (c != 1) * -2; + int a = (unsigned short)e > d; + + return a; +} + +int main(void) +{ + if (!f()) + __builtin_abort(); + + return 0; +} Index: gcc/testsuite/ChangeLog =================================================================== --- a/src/gcc/testsuite/ChangeLog (.../tags/gcc_5_2_0_release) +++ b/src/gcc/testsuite/ChangeLog (.../branches/gcc-5-branch) @@ -1,3 +1,410 @@ +2015-09-03 Richard Biener + + PR ipa/66705 + * g++.dg/lto/pr66705_0.C: New testcase. + +2015-09-02 Uros Bizjak + + Backport from mainline: + 2015-08-27 Uros Bizjak + + PR target/67317 + * gcc.target/i386/pr67317-1.c: New test. + * gcc.target/i386/pr67317-2.c: Ditto. + * gcc.target/i386/pr67317-3.c: Ditto. + * gcc.target/i386/pr67317-4.c: Ditto. + * gcc.target/i386/adx-addcarryx32-1.c: Also scan for adcl. + * gcc.target/i386/adx-addcarryx32-2.c: Also scan for adcq. + +2015-08-31 Marek Polacek + + Backport from mainline + 2015-08-27 Marek Polacek + + PR middle-end/67005 + * gcc.dg/torture/pr67005.c: New test. + +2015-08-27 Pat Haugen + + Backport from mainline: + 2015-08-27 Pat Haugen + + * gcc.target/powerpc/vec-shr.c: New. + +2015-08-25 Dominik Vogt + + Backport from mainline + 2015-08-21 Dominik Vogt + + * gcc.target/s390/zvector/vec-load_bndry-1.c: New test. + +2015-08-24 Michael Meissner + + Backport from mainline: + 2015-08-24 Michael Meissner + + PR target/67211 + * g++.dg/pr67211.C: New test. + +2015-08-18 Segher Boessenkool + + Backport from mainline: + 2015-08-08 Segher Boessenkool + + PR rtl-optimization/67028 + * gcc.dg/pr67028.c: New testcase. + +2015-08-16 Uros Bizjak + + Backport from mainline: + 2015-07-25 Uros Bizjak + + PR target/66648 + * gcc.target/i386/pr66648.c: New test. + +2015-08-11 Marek Polacek + + Backported from mainline + 2015-08-03 Marek Polacek + + PR sanitizer/66908 + * c-c++-common/ubsan/pr66908.c: New test. + +2015-08-07 Mikael Morin + + PR fortran/66929 + * gfortran.dg/generic_30.f90: New. + * gfortran.dg/generic_31.f90: New. + +2015-08-06 David Malcolm + + Backport from trunk r226697: + 2015-08-06 David Malcolm + + * jit.dg/test-benchmark.c (main): Record all elapsed times at each + optimization level, and print a summary at the end. + +2015-08-05 Mikael Morin + + PR fortran/64921 + * gfortran.dg/class_allocate_20.f90: New. + +2015-08-05 Matthew Wahab + + Backport from trunk: + 2015-07-01 Matthew Wahab + + * gcc.target/arm/armv8-sync-comp-swap.c: Replace + 'do-require-effective-target' with 'dg-require-effective-target'. + * gcc.target/arm/armv8-sync-op-full.c: Likewise. + * gcc.target/arm/armv8-sync-op-release.c: Likewise. + * gcc.target/arm/armv8-sync-op-acquire.c: Likewise. Also, replace + 'stlex' with 'strex' as the expected output. + +2015-08-05 Matthew Wahab + + Backport from trunk: + 2015-06-29 Matthew Wahab + + PR target/65697 + * gcc.target/arm/armv-sync-comp-swap.c: New. + * gcc.target/arm/armv-sync-op-acquire.c: New. + * gcc.target/arm/armv-sync-op-full.c: New. + * gcc.target/arm/armv-sync-op-release.c: New. + +2015-08-05 Matthew Wahab + + Backport from trunk + 2015-06-01 Matthew Wahab + + PR target/65697 + * gcc.target/aarch64/sync-comp-swap.c: New. + * gcc.target/aarch64/sync-comp-swap.x: New. + * gcc.target/aarch64/sync-op-acquire.c: New. + * gcc.target/aarch64/sync-op-acquire.x: New. + * gcc.target/aarch64/sync-op-full.c: New. + * gcc.target/aarch64/sync-op-full.x: New. + * gcc.target/aarch64/sync-op-release.c: New. + * gcc.target/aarch64/sync-op-release.x: New. + +2015-08-04 Szabolcs Nagy + + * gcc.target/aarch64/fnmul-1.c: Fix whitespace. + * gcc.target/aarch64/fnmul-2.c: Likewise. + * gcc.target/aarch64/fnmul-3.c: Likewise. + * gcc.target/aarch64/fnmul-4.c: Likewise. + +2015-08-04 Szabolcs Nagy + + Backport from mainline r225450: + 2015-07-06 Szabolcs Nagy + + PR target/66731 + * gcc.target/aarch64/fnmul-1.c: New. + * gcc.target/aarch64/fnmul-2.c: New. + * gcc.target/aarch64/fnmul-3.c: New. + * gcc.target/aarch64/fnmul-4.c: New. + +2015-08-03 Peter Bergner + + Backport from mainline: + 2015-08-03 Peter Bergner + + * gcc.target/powerpc/htm-tabort-no-r0.c: New test. + +2015-08-03 Szabolcs Nagy + + Backport form mainline r226496. + 2015-08-03 Szabolcs Nagy + + PR target/66731 + * gcc.target/arm/vnmul-1.c: New. + * gcc.target/arm/vnmul-2.c: New. + * gcc.target/arm/vnmul-3.c: New. + * gcc.target/arm/vnmul-4.c: New. + +2015-07-31 Vladimir Makarov + + PR debug/66691 + * gcc.target/i386/pr66691.c: New. + +2015-07-28 Alex Velenko + + backport from trunk: + 2015-07-21 Alex Velenko + + * gcc.target/arm/split-live-ranges-for-shrink-wrap.c (dg-skip-if): + Skip -march=armv4t. + (dg-additional-options): Set armv5t flag. + +2015-07-25 Tom de Vries + + backport from trunk: + 2015-07-25 Tom de Vries + + * gcc.dg/graphite/graphite.exp: Include uns-*.c files in + interchange_files and block_files variables. + * gcc.dg/graphite/uns-block-1.c (main): Change signed into unsigned + arithmetic. + * gcc.dg/graphite/uns-interchange-12.c: Same. + * gcc.dg/graphite/uns-interchange-14.c: Same. + * gcc.dg/graphite/uns-interchange-15.c: Same. + * gcc.dg/graphite/uns-interchange-9.c (foo): Same. + * gcc.dg/graphite/uns-interchange-mvt.c: Same. + + 2015-07-24 Tom de Vries + + * gcc.dg/graphite/block-1.c: Xfail scan. + * gcc.dg/graphite/interchange-12.c: Same. + * gcc.dg/graphite/interchange-14.c: Same. + * gcc.dg/graphite/interchange-15.c: Same. + * gcc.dg/graphite/interchange-9.c: Same. + * gcc.dg/graphite/interchange-mvt.c: Same. + * gcc.dg/graphite/uns-block-1.c: New test. + * gcc.dg/graphite/uns-interchange-12.c: New test. + * gcc.dg/graphite/uns-interchange-14.c: New test. + * gcc.dg/graphite/uns-interchange-15.c: New test. + * gcc.dg/graphite/uns-interchange-9.c: New test. + * gcc.dg/graphite/uns-interchange-mvt.c: New test. + +2015-07-24 Ilya Enkovich + + Backport from mainline r226155. + 2015-07-24 Ilya Enkovich + + PR ipa/66566 + * gcc.target/i386/mpx/pr66566.c: New test. + +2015-07-23 Uros Bizjak + + Backport from mainline: + 2015-07-17 Uros Bizjak + + PR target/66891 + * gcc.target/i386/pr66891.c: New test. + +2015-07-23 Ilya Enkovich + + Backport from mainline r224643. + 2015-06-19 Ilya Enkovich + + PR middle-end/pr66581 + * gcc.target/i386/mpx/pr66581.c: New test. + +2015-07-23 Ilya Enkovich + + Backport from mainline r224602. + 2015-06-18 Ilya Enkovich + + PR target/66569 + * gcc.target/i386/mpx/chkp-vararg.c: New test. + +2015-07-23 Ilya Enkovich + + Backport from mainline r224601. + 2015-06-18 Ilya Enkovich + + PR middle-end/66568 + * gcc.target/i386/mpx/pr66568.c: New test. + + Backport from mainline r225296. + 2015-07-01 H.J. Lu + + * gcc.target/i386/mpx/pr66568.c (exit): New prototype. +2015-07-23 Ilya Enkovich + + Backport from mainline r224600. + 2015-06-18 Ilya Enkovich + + PR middle-end/66567 + * gcc.target/i386/mpx/pr66567.c: New test. + +2015-07-23 Ilya Enkovich + + Backport from mainline r223215. + 2015-05-15 Ilya Enkovich + + PR middle-end/66134 + * gcc.target/i386/mpx/pr66134.c: New test. + +2015-07-23 Ilya Enkovich + + Backport from mainline r223114. + 2015-05-13 Ilya Enkovich + + PR target/66048 + * gcc.target/i386/mpx/pr66048.cc: New. + +2015-07-23 Ilya Enkovich + + Backport from mainline r223216. + 2015-05-15 Ilya Enkovich + + * gcc.dg/lto/chkp-wrap-asm-name_0.c: New. + +2015-07-23 Ilya Enkovich + + Backport from mainline r224074. + 2015-06-03 Ilya Enkovich + + * gcc.dg/lto/chkp-removed-alias_0.c: New. + +2015-07-21 Alex Velenko + + Backport from mainline: + 2015-07-21 Alex Velenko + + * gcc.target/arm/thumb-bitfld1.c (foo): Add explicit return type. + +2015-07-21 Andre Vehreschild + + PR fortran/66035 + * gfortran.dg/structure_constructor_13.f03: New test. + +2015-07-21 Alex Velenko + + Backport from mainline: + 2015-05-20 Alex Velenko + + * gcc.target/arm/thumb1-far-jump-2.c (r4): Added int in definition. + +2015-07-21 Alex Velenko + + Backport from mainline: + 2015-06-01 Alex Velenko + + * gcc.target/arm/thumb-ltu.c (foo): Predefined. + (bar): Predefined. + +2015-07-21 Mantas Mikaitis + + * gcc.target/arm/macro_defs0.c: Add directive to skip + test if -marm is present. + * gcc.target/arm/macro_defs1.c: Likewise. + +2015-07-18 Uros Bizjak + + PR target/66922 + * gcc.target/i386/pr66922.c: New test. + +2015-07-17 Mikael Morin + + * gfortran.dg/coarray_collectives_16.f90: Fix patterns + as follow-up to r225932. + +2015-07-17 Uros Bizjak + + PR target/66866 + * g++.dg/pr66866.C: New test. + +2015-07-17 Uros Bizjak + + Backport from mainline: + 2015-07-10 Uros Bizjak + + PR target/66703 + * gcc.target/i386/readeflags-1.c (readeflags_test): Declare with + __attribute__((noinline, noclone)). Change "x" to "volatile char" + type to prevent possible flag-clobbering zero-extensions. + * gcc.target/i386/pr66703.c: New test. + +2015-07-17 Uros Bizjak + + Backport from mainline: + 2015-07-09 Uros Bizjak + + PR target/66814 + * gcc.target/i386/pr66814.c: New test. + +2015-07-17 Uros Bizjak + + Backport from mainline: + 2015-07-15 Uros Bizjak + + PR rtl-optimization/66838 + * gcc.target/i386/pr66838.c: New test. + +2015-07-17 Alessandro Fanfarillo + + * gfortran.dg/co_reduce_1.f90: New file. + +2015-07-16 Steven G. Kargl + + PR fortran/66864 + * gfortran.dg/pr66864.f90: New test. + +2015-07-16 Steven G. Kargl + + PR fortran/66545 + * gfortran.dg/pr66545_1.f90: New test. + * gfortran.dg/pr66545_2.f90: New test. + +2015-07-16 Steven G. Kargl + + PR fortran/56520 + * gfortran.dg/pr56520.f90: New test. + +2015-07-16 Steven G. Kargl + + * gfortran.dg/iomsg_2.f90: New test. + +2015-07-16 Steven G. Kargl + + PR fortran/66725 + * gfortran.dg/pr66725.f90: New test. + +2015-07-16 Martin Liska + + * g++.dg/ipa/pr66896.c: New test. + +2015-07-16 Marek Polacek + + Backported from mainline + 2015-07-08 Marek Polacek + + PR c++/66748 + * g++.dg/abi/abi-tag15.C: New test. + 2015-07-16 Release Manager * GCC 5.2.0 released. @@ -792,7 +1199,7 @@ Add missing ChangeLog entry for r222341. Backport from trunk r222273 - 2015-04-21 Andreas Tobler + 2015-04-21 Andreas Tobler * gcc.target/i386/avx512bw-vpermi2w-2.c: Fix includes to use actual headers. * gcc.target/i386/avx512bw-vpermt2w-2.c: Likewise. Index: gcc/testsuite/g++.dg/pr67211.C =================================================================== --- a/src/gcc/testsuite/g++.dg/pr67211.C (.../tags/gcc_5_2_0_release) +++ b/src/gcc/testsuite/g++.dg/pr67211.C (.../branches/gcc-5-branch) @@ -0,0 +1,50 @@ +/* { dg-do compile { target { powerpc*-*-* && lp64 } } } */ +/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */ +/* { dg-require-effective-target powerpc_p8vector_ok } */ +/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power7" } } */ +/* { dg-options "-mcpu=power7 -mtune=power8 -O3 -w" } */ + +/* target/67211, compiler got a 'insn does not satisfy its constraints' error. */ + +template +void find_first_of(_InputIterator, _InputIterator, _ForwardIterator p3, + _ForwardIterator p4) { + for (; p3 != p4; ++p3) + ; +} + +template struct A { + int _S_buffer_size; + int *_M_cur; + int *_M_first; + int *_M_last; + int **_M_node; + void operator++() { + if (_M_cur == _M_last) + m_fn1(_M_node + 1); + } + void m_fn1(int **p1) { + _M_node = p1; + _M_first = *p1; + _M_last = _M_first + _S_buffer_size; + } +}; + +template +bool operator==(A<_Tp, _Ref, _Ptr>, A<_Tp, _Ref, _Ptr>); +template +bool operator!=(A<_Tp, _Ref, _Ptr> p1, A<_Tp, _Ref, _Ptr> p2) { + return p1 == p2; +} + +class B { +public: + A m_fn2(); +}; +struct { + B j; +} a; +void Linked() { + A b, c, d; + find_first_of(d, c, b, a.j.m_fn2()); +} Index: gcc/testsuite/g++.dg/cpp0x/alignas1.C =================================================================== --- a/src/gcc/testsuite/g++.dg/cpp0x/alignas1.C (.../tags/gcc_5_2_0_release) +++ b/src/gcc/testsuite/g++.dg/cpp0x/alignas1.C (.../branches/gcc-5-branch) @@ -0,0 +1,16 @@ +// PR c++/65734 +// { dg-do compile { target c++11 } } + +template struct A +{ + T t; +}; + +typedef A T[4] alignas (2 * alignof (int)); +A a[4]; + +typedef A T2[4] alignas (2 * alignof (int)); + +#define SA(X) static_assert((X),#X) +SA(alignof (T) == 2 * alignof(int)); +SA(alignof (T2) == 2 * alignof(int)); Index: gcc/testsuite/g++.dg/cpp0x/lambda/lambda-nested5.C =================================================================== --- a/src/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-nested5.C (.../tags/gcc_5_2_0_release) +++ b/src/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-nested5.C (.../branches/gcc-5-branch) @@ -0,0 +1,29 @@ +// PR c++/67244 +// { dg-do compile { target c++11 } } + +class A { +public: + int operator*(); +}; +template +void searchGen(int, int, T, Predicate p4) { + p4(0); +} +template struct B; +template +struct B { + static void exec() { MetaFunction::template exec; } +}; +template void forEachType() { + B::exec; +} +namespace { +struct C { + template void exec() { + A __trans_tmp_1; + const auto target = *__trans_tmp_1; + searchGen(0, 0, 0, [=](T) { [=] { target; }; }); + } +}; +} +void ____C_A_T_C_H____T_E_S_T____75() { forEachType; } Index: gcc/testsuite/g++.dg/cpp0x/alias-decl-52.C =================================================================== --- a/src/gcc/testsuite/g++.dg/cpp0x/alias-decl-52.C (.../tags/gcc_5_2_0_release) +++ b/src/gcc/testsuite/g++.dg/cpp0x/alias-decl-52.C (.../branches/gcc-5-branch) @@ -0,0 +1,24 @@ +// PR c++/67021 +// { dg-do compile { target c++11 } } + +template struct Dummy; +template<> struct Dummy {}; + +template +struct all_same { static constexpr bool value = true; }; +template +struct all_same : all_same {}; +template +struct all_same { static constexpr bool value = false; }; + +template +using ValueType = int; + +template +constexpr bool A(I i) { + return all_same, ValueType>::value; +} + +int main() { + static_assert(A(42), ""); +} Index: gcc/testsuite/g++.dg/cpp0x/alignas2.C =================================================================== --- a/src/gcc/testsuite/g++.dg/cpp0x/alignas2.C (.../tags/gcc_5_2_0_release) +++ b/src/gcc/testsuite/g++.dg/cpp0x/alignas2.C (.../branches/gcc-5-branch) @@ -0,0 +1,20 @@ +// PR c++/65734 +// { dg-do compile { target c++11 } } + +template +struct BVector +{ + T t; +}; +BVector m; + +template