diff options
author | Jonathan Wakely <jwakely@redhat.com> | 2019-10-04 16:08:23 +0100 |
---|---|---|
committer | Jonathan Wakely <redi@gcc.gnu.org> | 2019-10-04 16:08:23 +0100 |
commit | 2fc115875e063ec6eb2af2a9634e018a83ffa3b6 (patch) | |
tree | df5ab1d61a4cd3d7e0eac3081e9b7f27bc6146e9 /libstdc++-v3/src/filesystem | |
parent | 0a789c10e91ec8c8f021f72f7df6045d019e5538 (diff) | |
download | gcc-2fc115875e063ec6eb2af2a9634e018a83ffa3b6.zip gcc-2fc115875e063ec6eb2af2a9634e018a83ffa3b6.tar.gz gcc-2fc115875e063ec6eb2af2a9634e018a83ffa3b6.tar.bz2 |
Build filesystem library with large file support
Enable AC_SYS_LARGEFILE to set the macros needed for large file APIs to
be used by default. We do not want to define those macros in the
public headers that users include. The values of the macros are copied
to a separate file that is only included by the filesystem sources
during the build, and then the macros in <bits/c++config.h> are renamed
so that they don't have any effect in user code including our headers.
Also use larger type for result of filesystem::file_size to avoid
truncation of large values on 32-bit systems (PR 91947).
PR libstdc++/81091
PR libstdc++/91947
* configure.ac: Use AC_SYS_LARGEFILE to enable 64-bit file APIs.
* config.h.in: Regenerate:
* configure: Regenerate:
* include/Makefile.am (${host_builddir}/largefile-config.h): New
target to generate config header for filesystem library.
(${host_builddir}/c++config.h): Rename macros for large file support.
* include/Makefile.in: Regenerate.
* src/c++17/fs_dir.cc: Include new config header.
* src/c++17/fs_ops.cc: Likewise.
(filesystem::file_size): Use uintmax_t for size.
* src/filesystem/dir.cc: Include new config header.
* src/filesystem/ops.cc: Likewise.
(experimental::filesystem::file_size): Use uintmax_t for size.
From-SVN: r276585
Diffstat (limited to 'libstdc++-v3/src/filesystem')
-rw-r--r-- | libstdc++-v3/src/filesystem/dir.cc | 1 | ||||
-rw-r--r-- | libstdc++-v3/src/filesystem/ops.cc | 3 |
2 files changed, 3 insertions, 1 deletions
diff --git a/libstdc++-v3/src/filesystem/dir.cc b/libstdc++-v3/src/filesystem/dir.cc index 3e6e598..ac3bd3a 100644 --- a/libstdc++-v3/src/filesystem/dir.cc +++ b/libstdc++-v3/src/filesystem/dir.cc @@ -26,6 +26,7 @@ # define _GLIBCXX_USE_CXX11_ABI 1 #endif +#include <bits/largefile-config.h> #include <experimental/filesystem> #ifndef _GLIBCXX_HAVE_DIRENT_H diff --git a/libstdc++-v3/src/filesystem/ops.cc b/libstdc++-v3/src/filesystem/ops.cc index 36b5d2c..8687fcd 100644 --- a/libstdc++-v3/src/filesystem/ops.cc +++ b/libstdc++-v3/src/filesystem/ops.cc @@ -28,6 +28,7 @@ # define NEED_DO_SPACE #endif +#include <bits/largefile-config.h> #include <experimental/filesystem> #include <functional> #include <ostream> @@ -806,7 +807,7 @@ fs::file_size(const path& p, error_code& ec) noexcept 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; + uintmax_t size; }; auto s = do_stat(p, ec, [](const auto& st) { return S{st}; }, S{}); if (s.type == file_type::regular) |