[libcxx] r337665 - Work around various GCC 4.9 build errors
Eric Fiselier via cfe-commits
cfe-commits at lists.llvm.org
Sun Jul 22 20:06:57 PDT 2018
Author: ericwf
Date: Sun Jul 22 20:06:57 2018
New Revision: 337665
URL: http://llvm.org/viewvc/llvm-project?rev=337665&view=rev
Log:
Work around various GCC 4.9 build errors
Modified:
libcxx/trunk/src/experimental/filesystem/filesystem_common.h
libcxx/trunk/src/experimental/filesystem/operations.cpp
Modified: libcxx/trunk/src/experimental/filesystem/filesystem_common.h
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/experimental/filesystem/filesystem_common.h?rev=337665&r1=337664&r2=337665&view=diff
==============================================================================
--- libcxx/trunk/src/experimental/filesystem/filesystem_common.h (original)
+++ libcxx/trunk/src/experimental/filesystem/filesystem_common.h Sun Jul 22 20:06:57 2018
@@ -72,6 +72,7 @@ static std::string format_string_imp(con
struct GuardVAList {
va_list& target;
bool active = true;
+ GuardVAList(va_list &target) : target(target), active(true) {}
void clear() {
if (active)
va_end(target);
@@ -84,11 +85,11 @@ static std::string format_string_imp(con
};
va_list args;
va_start(args, msg);
- GuardVAList args_guard = {args};
+ GuardVAList args_guard(args);
va_list args_cp;
va_copy(args_cp, args);
- GuardVAList args_copy_guard = {args_cp};
+ GuardVAList args_copy_guard(args_cp);
std::array<char, 256> local_buff;
std::size_t size = local_buff.size();
@@ -131,7 +132,7 @@ std::error_code capture_errno() {
template <class T>
T error_value();
template <>
-constexpr void error_value<void>() {}
+_LIBCPP_CONSTEXPR_AFTER_CXX11 void error_value<void>() {}
template <>
constexpr bool error_value<bool>() {
return false;
@@ -141,7 +142,7 @@ constexpr uintmax_t error_value<uintmax_
return uintmax_t(-1);
}
template <>
-constexpr file_time_type error_value<file_time_type>() {
+_LIBCPP_CONSTEXPR_AFTER_CXX11 file_time_type error_value<file_time_type>() {
return file_time_type::min();
}
template <>
@@ -369,7 +370,7 @@ TimeSpec extract_atime(StatT const& st)
using TimeStruct = struct ::timeval;
using TimeStructArray = TimeStruct[2];
#else
-using TimeStruct = struct ::timespec;
+using TimeStruct = TimeSpec;
using TimeStructArray = TimeStruct[2];
#endif
@@ -413,8 +414,6 @@ bool SetTimeStructTo(TimeStruct& TS, fil
_LIBCPP_END_NAMESPACE_EXPERIMENTAL_FILESYSTEM
-#if defined(__GNUC__)
-#pragma GCC diagnostic pop
-#endif
+
#endif // FILESYSTEM_COMMON_H
Modified: libcxx/trunk/src/experimental/filesystem/operations.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/experimental/filesystem/operations.cpp?rev=337665&r1=337664&r2=337665&view=diff
==============================================================================
--- libcxx/trunk/src/experimental/filesystem/operations.cpp (original)
+++ libcxx/trunk/src/experimental/filesystem/operations.cpp Sun Jul 22 20:06:57 2018
@@ -36,6 +36,12 @@
# define _LIBCPP_USE_COPYFILE
#endif
+#if defined(_LIBCPP_COMPILER_GCC)
+#if _GNUC_VER < 500
+#pragma GCC diagnostic ignored "-Wmissing-field-initializers"
+#endif
+#endif
+
_LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL_FILESYSTEM
filesystem_error::~filesystem_error() {}
@@ -446,7 +452,7 @@ bool stat_equivalent(const StatT& st1, c
file_status FileDescriptor::refresh_status(std::error_code& ec) {
// FD must be open and good.
m_status = file_status{};
- m_stat = StatT{};
+ m_stat = {};
std::error_code m_ec;
if (::fstat(fd, &m_stat) == -1)
m_ec = capture_errno();
More information about the cfe-commits
mailing list