summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Markmann <tm@ayena.de>2014-10-19 20:22:58 (GMT)
committerTobias Markmann <tm@ayena.de>2014-10-20 13:49:33 (GMT)
commit6b22dfcf59474dd016a0355a3102a1dd3692d92c (patch)
tree2b1fd33be433a91e81fee84fdc2bf1b52575d934 /3rdParty/Boost/src/libs/filesystem
parent38b0cb785fea8eae5e48fae56440695fdfd10ee1 (diff)
downloadswift-contrib-6b22dfcf59474dd016a0355a3102a1dd3692d92c.zip
swift-contrib-6b22dfcf59474dd016a0355a3102a1dd3692d92c.tar.bz2
Update Boost in 3rdParty to version 1.56.0.
This updates Boost in our 3rdParty directory to version 1.56.0. Updated our update.sh script to stop on error. Changed error reporting in SwiftTools/CrashReporter.cpp to SWIFT_LOG due to missing include of <iostream> with newer Boost. Change-Id: I4b35c77de951333979a524097f35f5f83d325edc
Diffstat (limited to '3rdParty/Boost/src/libs/filesystem')
-rw-r--r--3rdParty/Boost/src/libs/filesystem/src/codecvt_error_category.cpp4
-rw-r--r--3rdParty/Boost/src/libs/filesystem/src/operations.cpp15
-rw-r--r--3rdParty/Boost/src/libs/filesystem/src/path.cpp175
3 files changed, 77 insertions, 117 deletions
diff --git a/3rdParty/Boost/src/libs/filesystem/src/codecvt_error_category.cpp b/3rdParty/Boost/src/libs/filesystem/src/codecvt_error_category.cpp
index 245c3f3..165c6ea 100644
--- a/3rdParty/Boost/src/libs/filesystem/src/codecvt_error_category.cpp
+++ b/3rdParty/Boost/src/libs/filesystem/src/codecvt_error_category.cpp
@@ -35,11 +35,11 @@ namespace
{
public:
codecvt_error_cat(){}
- const char* name() const;
+ const char* name() const BOOST_SYSTEM_NOEXCEPT;
std::string message(int ev) const;
};
- const char* codecvt_error_cat::name() const
+ const char* codecvt_error_cat::name() const BOOST_SYSTEM_NOEXCEPT
{
return "codecvt";
}
diff --git a/3rdParty/Boost/src/libs/filesystem/src/operations.cpp b/3rdParty/Boost/src/libs/filesystem/src/operations.cpp
index d066e40..09b8853 100644
--- a/3rdParty/Boost/src/libs/filesystem/src/operations.cpp
+++ b/3rdParty/Boost/src/libs/filesystem/src/operations.cpp
@@ -73,17 +73,15 @@ using std::wstring;
const fs::path dot_dot_path("..");
# include <sys/types.h>
# include <sys/stat.h>
-# if !defined(__APPLE__) && !defined(__OpenBSD__) && !defined(ANDROID)
+# if !defined(__APPLE__) && !defined(__OpenBSD__) && !defined(__ANDROID__)
# include <sys/statvfs.h>
# define BOOST_STATVFS statvfs
# define BOOST_STATVFS_F_FRSIZE vfs.f_frsize
-# elif defined (ANDROID)
-# include <sys/vfs.h>
-# define BOOST_STATVFS statfs
-# define BOOST_STATVFS_F_FRSIZE static_cast<boost::uintmax_t>(vfs.f_bsize)
# else
# ifdef __OpenBSD__
# include <sys/param.h>
+# elif defined(__ANDROID__)
+# include <sys/vfs.h>
# endif
# include <sys/mount.h>
# define BOOST_STATVFS statfs
@@ -777,6 +775,7 @@ namespace detail
path canonical(const path& p, const path& base, system::error_code* ec)
{
path source (p.is_absolute() ? p : absolute(p, base));
+ path root(source.root_path());
path result;
system::error_code local_ec;
@@ -811,7 +810,8 @@ namespace detail
continue;
if (*itr == dot_dot_path)
{
- result.remove_filename();
+ if (result != root)
+ result.remove_filename();
continue;
}
@@ -931,6 +931,7 @@ namespace detail
}
path parent = p.parent_path();
+ BOOST_ASSERT_MSG(parent != p, "internal error: p == p.parent_path()");
if (!parent.empty())
{
// determine if the parent exists
@@ -1411,7 +1412,7 @@ namespace detail
// - See the fchmodat() Linux man page:
// "http://man7.org/linux/man-pages/man2/fchmodat.2.html"
# if defined(AT_FDCWD) && defined(AT_SYMLINK_NOFOLLOW) \
- && !(defined(__SUNPRO_CC) || defined(sun)) \
+ && !(defined(__SUNPRO_CC) || defined(__sun) || defined(sun)) \
&& !(defined(linux) || defined(__linux) || defined(__linux__))
if (::fchmodat(AT_FDCWD, p.c_str(), mode_cast(prms),
!(prms & symlink_perms) ? 0 : AT_SYMLINK_NOFOLLOW))
diff --git a/3rdParty/Boost/src/libs/filesystem/src/path.cpp b/3rdParty/Boost/src/libs/filesystem/src/path.cpp
index c740dec..a3b3710 100644
--- a/3rdParty/Boost/src/libs/filesystem/src/path.cpp
+++ b/3rdParty/Boost/src/libs/filesystem/src/path.cpp
@@ -27,6 +27,10 @@
#include <boost/scoped_array.hpp>
#include <boost/system/error_code.hpp>
#include <boost/assert.hpp>
+//#include <boost/detail/lightweight_mutex.hpp>
+// fails on VC++ static builds because the runtime does not permit use of locks in
+// staticly initialized code, and VC++ 2010 (and probably other versions) statically
+// initializes some instances of class path.
#include <algorithm>
#include <cstddef>
#include <cstring>
@@ -35,7 +39,7 @@
#ifdef BOOST_WINDOWS_API
# include "windows_file_codecvt.hpp"
# include <windows.h>
-#elif defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__)
+#elif defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__) || defined(__FreeBSD__)
# include <boost/filesystem/detail/utf8_codecvt_facet.hpp>
#endif
@@ -98,7 +102,6 @@ namespace
const char* const separators = "/";
const char* separator_string = "/";
const char* preferred_separator_string = "/";
- const char colon = ':';
const char dot = '.';
const fs::path dot_path(".");
const fs::path dot_dot_path("..");
@@ -510,7 +513,7 @@ namespace
size_type pos(str.find_last_of(separators, end_pos-1));
# ifdef BOOST_WINDOWS_API
- if (pos == string_type::npos)
+ if (pos == string_type::npos && end_pos > 1)
pos = str.find_last_of(colon, end_pos-2);
# endif
@@ -783,147 +786,103 @@ namespace filesystem
} // namespace filesystem
} // namespace boost
-//--------------------------------------------------------------------------------------//
-// //
-// detail helpers //
-// //
-//--------------------------------------------------------------------------------------//
-
namespace
{
//------------------------------------------------------------------------------------//
- // locale helpers //
+ // locale helpers //
//------------------------------------------------------------------------------------//
-#if defined(BOOST_WINDOWS_API) && defined(BOOST_FILESYSTEM_STATIC_LINK)
+ // Prior versions of these locale and codecvt implementations tried to take advantage
+ // of static initialization where possible, kept a local copy of the current codecvt
+ // facet (to avoid codecvt() having to call use_facet()), and was not multi-threading
+ // safe (again for efficiency).
+ //
+ // This was error prone, and required different implementation techniques depending
+ // on the compiler and also whether static or dynamic linking was used. Furthermore,
+ // users could not easily provide their multi-threading safe wrappers because the
+ // path interface requires the implementation itself to call codecvt() to obtain the
+ // default facet, and the initialization of the static within path_locale() could race.
+ //
+ // The code below is portable to all platforms, is much simpler, and hopefully will be
+ // much more robust. Timing tests (on Windows, using a Visual C++ release build)
+ // indicated the current code is roughly 9% slower than the previous code, and that
+ // seems a small price to pay for better code that is easier to use.
+
+ //boost::detail::lightweight_mutex locale_mutex;
inline std::locale default_locale()
{
+# if defined(BOOST_WINDOWS_API)
std::locale global_loc = std::locale();
- std::locale loc(global_loc, new windows_file_codecvt);
- return loc;
+ return std::locale(global_loc, new windows_file_codecvt);
+# elif defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__) || defined(__FreeBSD__)
+ // "All BSD system functions expect their string parameters to be in UTF-8 encoding
+ // and nothing else." See
+ // http://developer.apple.com/mac/library/documentation/MacOSX/Conceptual/BPInternational/Articles/FileEncodings.html
+ //
+ // "The kernel will reject any filename that is not a valid UTF-8 string, and it will
+ // even be normalized (to Unicode NFD) before stored on disk, at least when using HFS.
+ // The right way to deal with it would be to always convert the filename to UTF-8
+ // before trying to open/create a file." See
+ // http://lists.apple.com/archives/unix-porting/2007/Sep/msg00023.html
+ //
+ // "How a file name looks at the API level depends on the API. Current Carbon APIs
+ // handle file names as an array of UTF-16 characters; POSIX ones handle them as an
+ // array of UTF-8, which is why UTF-8 works well in Terminal. How it's stored on disk
+ // depends on the disk format; HFS+ uses UTF-16, but that's not important in most
+ // cases." See
+ // http://lists.apple.com/archives/applescript-users/2002/Sep/msg00319.html
+ //
+ // Many thanks to Peter Dimov for digging out the above references!
+
+ std::locale global_loc = std::locale();
+ return std::locale(global_loc, new boost::filesystem::detail::utf8_codecvt_facet);
+# else // Other POSIX
+ // ISO C calls std::locale("") "the locale-specific native environment", and this
+ // locale is the default for many POSIX-based operating systems such as Linux.
+ return std::locale("");
+# endif
}
inline std::locale& path_locale()
+ // std::locale("") construction, needed on non-Apple POSIX systems, can throw
+ // (if environmental variables LC_MESSAGES or LANG are wrong, for example), so
+ // path_locale() provides lazy initialization via a local static to ensure that any
+ // exceptions occur after main() starts and so can be caught. Furthermore,
+ // path_locale() is only called if path::codecvt() or path::imbue() are themselves
+ // actually called, ensuring that an exception will only be thrown if std::locale("")
+ // is really needed.
{
static std::locale loc(default_locale());
return loc;
}
-
- inline const path::codecvt_type*& codecvt_facet_ptr()
- {
- static const std::codecvt<wchar_t, char, std::mbstate_t>*
- facet(
- &std::use_facet<std::codecvt<wchar_t, char, std::mbstate_t> >
- (path_locale()));
- return facet;
- }
-
-#elif defined(BOOST_WINDOWS_API) && !defined(BOOST_FILESYSTEM_STATIC_LINK)
-
- std::locale path_locale(std::locale(), new windows_file_codecvt);
-
- const std::codecvt<wchar_t, char, std::mbstate_t>*
- codecvt_facet_ptr(&std::use_facet<std::codecvt<wchar_t, char, std::mbstate_t> >
- (path_locale));
-
-#elif defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__)
-
- // "All BSD system functions expect their string parameters to be in UTF-8 encoding
- // and nothing else." See
- // http://developer.apple.com/mac/library/documentation/MacOSX/Conceptual/BPInternational/Articles/FileEncodings.html
- //
- // "The kernel will reject any filename that is not a valid UTF-8 string, and it will
- // even be normalized (to Unicode NFD) before stored on disk, at least when using HFS.
- // The right way to deal with it would be to always convert the filename to UTF-8
- // before trying to open/create a file." See
- // http://lists.apple.com/archives/unix-porting/2007/Sep/msg00023.html
- //
- // "How a file name looks at the API level depends on the API. Current Carbon APIs
- // handle file names as an array of UTF-16 characters; POSIX ones handle them as an
- // array of UTF-8, which is why UTF-8 works well in Terminal. How it's stored on disk
- // depends on the disk format; HFS+ uses UTF-16, but that's not important in most
- // cases." See
- // http://lists.apple.com/archives/applescript-users/2002/Sep/msg00319.html
- //
- // Many thanks to Peter Dimov for digging out the above references!
-
- std::locale path_locale(std::locale(),
- new boost::filesystem::detail::utf8_codecvt_facet);
-
- const std::codecvt<wchar_t, char, std::mbstate_t>*
- codecvt_facet_ptr(&std::use_facet<std::codecvt<wchar_t, char, std::mbstate_t> >
- (path_locale));
-
-#else // Other POSIX
-
- // ISO C calls std::locale("") "the locale-specific native environment", and this
- // locale is the default for many POSIX-based operating systems such as Linux.
-
- // std::locale("") construction can throw (if environmental variables LC_MESSAGES or
- // or LANG are wrong, for example), so lazy initialization is used to ensure
- // that exceptions occur after main() starts and so can be caught.
-
- std::locale path_locale; // initialized by path::codecvt() below
- const std::codecvt<wchar_t, char, std::mbstate_t>* codecvt_facet_ptr; // ditto
-
-# endif
-
} // unnamed namespace
//--------------------------------------------------------------------------------------//
-// path::imbue implementation //
+// path::codecvt() and path::imbue() implementation //
//--------------------------------------------------------------------------------------//
namespace boost
{
namespace filesystem
{
-
-#if defined(BOOST_WINDOWS_API) && defined(BOOST_FILESYSTEM_STATIC_LINK)
+ // See comments above
const path::codecvt_type& path::codecvt()
{
- BOOST_ASSERT_MSG(codecvt_facet_ptr(), "codecvt_facet_ptr() facet hasn't been properly initialized");
- return *codecvt_facet_ptr();
+ BOOST_ASSERT_MSG(&path_locale(), "boost::filesystem::path locale initialization error");
+// boost::detail::lightweight_mutex::scoped_lock lock(locale_mutex);
+ return std::use_facet<std::codecvt<wchar_t, char, std::mbstate_t> >(path_locale());
}
- std::locale path::imbue(const std::locale & loc)
+ std::locale path::imbue(const std::locale& loc)
{
+// boost::detail::lightweight_mutex::scoped_lock lock(locale_mutex);
std::locale temp(path_locale());
path_locale() = loc;
- codecvt_facet_ptr() =
- &std::use_facet<std::codecvt<wchar_t, char, std::mbstate_t> >(path_locale());
- return temp;
- }
-
-#else
-
- const path::codecvt_type& path::codecvt()
- {
-# if defined(BOOST_POSIX_API) && \
- !(defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__))
- // A local static initialized by calling path::imbue ensures that std::locale(""),
- // which may throw, is called only if path_locale and condecvt_facet will actually
- // be used. Thus misconfigured environmental variables will only cause an
- // exception if a valid std::locale("") is actually needed.
- static std::locale posix_lazy_initialization(path::imbue(std::locale("")));
-# endif
- return *codecvt_facet_ptr;
- }
-
- std::locale path::imbue(const std::locale& loc)
- {
- std::locale temp(path_locale);
- path_locale = loc;
- codecvt_facet_ptr =
- &std::use_facet<std::codecvt<wchar_t, char, std::mbstate_t> >(path_locale);
return temp;
}
-
-#endif
-
} // namespace filesystem
} // namespace boost