|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r62343 - in sandbox/filesystem-v3: boost/filesystem libs/filesystem/build libs/filesystem/src libs/filesystem/test
From: bdawes_at_[hidden]
Date: 2010-05-31 08:00:23
Author: bemandawes
Date: 2010-05-31 08:00:21 EDT (Mon, 31 May 2010)
New Revision: 62343
URL: http://svn.boost.org/trac/boost/changeset/62343
Log:
Merge recent bug fixes and config changes from trunk
Text files modified:
sandbox/filesystem-v3/boost/filesystem/config.hpp | 62 +++++--------------------
sandbox/filesystem-v3/boost/filesystem/operations.hpp | 4
sandbox/filesystem-v3/libs/filesystem/build/Jamfile.v2 | 17 +++---
sandbox/filesystem-v3/libs/filesystem/src/operations.cpp | 95 +++++++++++++++++++--------------------
sandbox/filesystem-v3/libs/filesystem/src/unique_path.cpp | 4
sandbox/filesystem-v3/libs/filesystem/test/Jamfile.v2 | 8 +-
sandbox/filesystem-v3/libs/filesystem/test/operations_test.cpp | 34 ++++++-------
sandbox/filesystem-v3/libs/filesystem/test/operations_unit_test.cpp | 86 ++++++++++++++++++-----------------
sandbox/filesystem-v3/libs/filesystem/test/path_test.cpp | 2
sandbox/filesystem-v3/libs/filesystem/test/path_unit_test.cpp | 2
10 files changed, 140 insertions(+), 174 deletions(-)
Modified: sandbox/filesystem-v3/boost/filesystem/config.hpp
==============================================================================
--- sandbox/filesystem-v3/boost/filesystem/config.hpp (original)
+++ sandbox/filesystem-v3/boost/filesystem/config.hpp 2010-05-31 08:00:21 EDT (Mon, 31 May 2010)
@@ -23,6 +23,7 @@
// http://www.boost.org/more/separate_compilation.html
#include <boost/config.hpp>
+#include <boost/system/api_config.hpp> // for BOOST_POSIX_API or BOOST_WINDOWS_API
#include <boost/detail/workaround.hpp>
// BOOST_FILESYSTEM_DEPRECATED needed for source compiles -----------------------------//
@@ -34,76 +35,39 @@
// throw an exception ----------------------------------------------------------------//
//
// Exceptions were originally thrown via boost::throw_exception().
-// As throw_exception() became more complex, it caused catch failures in version tests
-// with various versions of GCC. For all compilers, it also caused user error reporting
+// As throw_exception() became more complex, it caused user error reporting
// to be harder to interpret, since the exception reported became much more complex.
// The immediate fix was to throw directly, wrapped in a macro to make any later change
// easier.
#define BOOST_FILESYSTEM_THROW(EX) throw EX
-// determine platform ----------------------------------------------------------------//
-
-// BOOST_POSIX_API or BOOST_WINDOWS_API specify which API to use
-
-# if defined( BOOST_WINDOWS_API ) && defined( BOOST_POSIX_API )
-# error both BOOST_WINDOWS_API and BOOST_POSIX_API are defined
-# elif !defined( BOOST_WINDOWS_API ) && !defined( BOOST_POSIX_API )
-# if defined(_WIN32) // true for all modern Windows compilers, including MinGW
-# define BOOST_WINDOWS_API
-# else
-# define BOOST_POSIX_API
-# endif
-# endif
-
# if defined( BOOST_NO_STD_WSTRING )
# error Boost.Filesystem V3 and later requires std::wstring support
# endif
-// BOOST_WINDOWS_PATH enables Windows path syntax recognition.
-// BOOST_WINDOWS_API always imples BOOST_WINDOWS_PATH, but BOOST_WINDOWS_PATH is also
-// defined for Cygwin, even though it uses BOOST_POSIX_API, because it is a Windows only
-// environment.
-
-# if !defined(BOOST_POSIX_PATH) && (defined(_WIN32) || defined(__WIN32__) || defined(WIN32) \
- || defined(__CYGWIN__))
+# ifdef BOOST_WINDOWS_API
# define BOOST_WINDOWS_PATH
-# endif
-
-# if !defined(BOOST_POSIX_PATH) && !defined(BOOST_WINDOWS_PATH)
+# else
# define BOOST_POSIX_PATH
# endif
-// enable dynamic linking on Windows -------------------------------------------------//
+// enable dynamic linking -------------------------------------------------------------//
-# if (defined(BOOST_ALL_DYN_LINK) || defined(BOOST_FILESYSTEM_DYN_LINK)) \
- && BOOST_WORKAROUND(__BORLANDC__, <0x610) && defined(__WIN32__)
-# error Dynamic linking Boost.Filesystem does not work for Borland; use static linking instead
-# endif
-
-#ifdef BOOST_HAS_DECLSPEC // defined in config system
-// we need to import/export our code only if the user has specifically
-// asked for it by defining either BOOST_ALL_DYN_LINK if they want all boost
-// libraries to be dynamically linked, or BOOST_FILESYSTEM_DYN_LINK
-// if they want just this one to be dynamically liked:
#if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_FILESYSTEM_DYN_LINK)
-// export if this is our own source, otherwise import:
-#ifdef BOOST_FILESYSTEM_SOURCE
-# define BOOST_FILESYSTEM_DECL __declspec(dllexport)
+# if defined(BOOST_FILESYSTEM_SOURCE)
+# define BOOST_FILESYSTEM_DECL BOOST_SYMBOL_EXPORT
+# else
+# define BOOST_FILESYSTEM_DECL BOOST_SYMBOL_IMPORT
+# endif
#else
-# define BOOST_FILESYSTEM_DECL __declspec(dllimport)
-#endif // BOOST_FILESYSTEM_SOURCE
-#endif // DYN_LINK
-#endif // BOOST_HAS_DECLSPEC
-//
-// if BOOST_FILESYSTEM_DECL isn't defined yet define it now:
-#ifndef BOOST_FILESYSTEM_DECL
-#define BOOST_FILESYSTEM_DECL
+# define BOOST_FILESYSTEM_DECL
#endif
// enable automatic library variant selection ----------------------------------------//
-#if !defined(BOOST_FILESYSTEM_SOURCE) && !defined(BOOST_ALL_NO_LIB) && !defined(BOOST_FILESYSTEM_NO_LIB)
+#if !defined(BOOST_FILESYSTEM_SOURCE) && !defined(BOOST_ALL_NO_LIB) \
+ && !defined(BOOST_FILESYSTEM_NO_LIB)
//
// Set the name of our library, this will get undef'ed by auto_link.hpp
// once it's done with it:
Modified: sandbox/filesystem-v3/boost/filesystem/operations.hpp
==============================================================================
--- sandbox/filesystem-v3/boost/filesystem/operations.hpp (original)
+++ sandbox/filesystem-v3/boost/filesystem/operations.hpp 2010-05-31 08:00:21 EDT (Mon, 31 May 2010)
@@ -582,9 +582,9 @@
private:
friend struct detail::dir_itr_imp;
- friend void detail::directory_iterator_construct(directory_iterator& it,
+ friend BOOST_FILESYSTEM_DECL void detail::directory_iterator_construct(directory_iterator& it,
const path& p, system::error_code* ec);
- friend void detail::directory_iterator_increment(directory_iterator& it,
+ friend BOOST_FILESYSTEM_DECL void detail::directory_iterator_increment(directory_iterator& it,
system::error_code* ec);
// shared_ptr provides shallow-copy semantics required for InputIterators.
Modified: sandbox/filesystem-v3/libs/filesystem/build/Jamfile.v2
==============================================================================
--- sandbox/filesystem-v3/libs/filesystem/build/Jamfile.v2 (original)
+++ sandbox/filesystem-v3/libs/filesystem/build/Jamfile.v2 2010-05-31 08:00:21 EDT (Mon, 31 May 2010)
@@ -11,21 +11,22 @@
: source-location ../src
: usage-requirements # pass these requirement to dependents (i.e. users)
<link>shared:<define>BOOST_FILESYSTEM_DYN_LINK=1
- <link>static:<define>BOOST_FILESYSTEM_STATIC_LINK=1
;
SOURCES =
operations path path_traits portability unique_path utf8_codecvt_facet windows_file_codecvt codecvt_error_category ;
lib boost_filesystem
+ : $(SOURCES).cpp ../../system/build//boost_system
+ : <link>shared:<define>BOOST_FILESYSTEM_DYN_LINK=1 # tell source we're building dll's
:
- $(SOURCES).cpp
- ../../system/build//boost_system
- :
- <link>shared:<define>BOOST_FILESYSTEM_DYN_LINK=1
- <link>static:<define>BOOST_FILESYSTEM_STATIC_LINK=1
- :
- :
+ : # Boost.Filesystem uses some of Boost.System functions in inlined/templated
+ # functions, so clients that use Boost.Filesystem will have direct references
+ # to Boost.System symbols. On Windows, Darwin, and some other platforms, this
+ # means those clients have to be directly linked to Boost.System. For static
+ # linking this happens anyway, but for shared we need to make it happen. Since
+ # doing so is harmless even when not needed, we do it for all platforms.
+ <link>shared:<library>../../system/build//boost_system
;
boost-install boost_filesystem ;
\ No newline at end of file
Modified: sandbox/filesystem-v3/libs/filesystem/src/operations.cpp
==============================================================================
--- sandbox/filesystem-v3/libs/filesystem/src/operations.cpp (original)
+++ sandbox/filesystem-v3/libs/filesystem/src/operations.cpp 2010-05-31 08:00:21 EDT (Mon, 31 May 2010)
@@ -16,11 +16,6 @@
#define _POSIX_PTHREAD_SEMANTICS // Sun readdir_r()needs this
-// enable the XPG-compliant version of readdir_r()on AIX
-#if defined(_AIX)
-# define _LINUX_SOURCE_COMPAT
-#endif
-
#if !(defined(__HP_aCC) && defined(_ILP32) && \
!defined(_STATVFS_ACPP_PROBLEMS_FIXED))
#define _FILE_OFFSET_BITS 64 // at worst, these defines may have no effect,
@@ -39,6 +34,7 @@
#include <boost/filesystem/operations.hpp>
#include <boost/scoped_array.hpp>
#include <boost/detail/workaround.hpp>
+#include <cstdlib> // for malloc, free
#ifdef BOOST_FILEYSTEM_INCLUDE_IOSTREAM
# include <iostream>
@@ -76,8 +72,8 @@
# else // BOOST_WINDOW_API
-# if defined(__MINGW32__) && !defined(WINVER)
- // Versions of MinGW that support Filesystem V3 support at least WINVER 0x501.
+# if (defined(__MINGW32__) || defined(__CYGWIN__)) && !defined(WINVER)
+ // Versions of MinGW or Cygwin that support Filesystem V3 support at least WINVER 0x501.
// See MinGW's windef.h
# define WINVER 0x501
# endif
@@ -239,9 +235,9 @@
{ // error
if (ec == 0)
BOOST_FILESYSTEM_THROW(filesystem_error(message,
- error_code(BOOST_ERRNO, system_category)));
+ error_code(BOOST_ERRNO, system_category())));
else
- ec->assign(BOOST_ERRNO, system_category);
+ ec->assign(BOOST_ERRNO, system_category());
}
return was_error;
}
@@ -256,9 +252,9 @@
{ // error
if (ec == 0)
BOOST_FILESYSTEM_THROW(filesystem_error(message,
- p, error_code(BOOST_ERRNO, system_category)));
+ p, error_code(BOOST_ERRNO, system_category())));
else
- ec->assign(BOOST_ERRNO, system_category);
+ ec->assign(BOOST_ERRNO, system_category());
}
return was_error;
}
@@ -274,9 +270,9 @@
{ // error
if (ec == 0)
BOOST_FILESYSTEM_THROW(filesystem_error(message,
- p1, p2, error_code(BOOST_ERRNO, system_category)));
+ p1, p2, error_code(BOOST_ERRNO, system_category())));
else
- ec->assign(BOOST_ERRNO, system_category);
+ ec->assign(BOOST_ERRNO, system_category());
}
return was_error;
}
@@ -452,6 +448,8 @@
return errval == ERROR_FILE_NOT_FOUND
|| errval == ERROR_PATH_NOT_FOUND
|| errval == ERROR_INVALID_NAME // "tools/jam/src/:sys:stat.h", "//foo"
+ || errval == ERROR_INVALID_DRIVE // USB card reader with no card inserted
+ || errval == ERROR_NOT_READY // CD/DVD drive with no disc inserted
|| errval == ERROR_INVALID_PARAMETER // ":sys:stat.h"
|| errval == ERROR_BAD_PATHNAME // "//nosuch" on Win64
|| errval == ERROR_BAD_NETPATH; // "//nosuch" on Win32
@@ -609,8 +607,8 @@
{
if (ec == 0)
BOOST_FILESYSTEM_THROW(filesystem_error("boost::filesystem::copy",
- from, to, error_code(BOOST_ERROR_NOT_SUPPORTED, system_category)));
- ec->assign(BOOST_ERROR_NOT_SUPPORTED, system_category);
+ from, to, error_code(BOOST_ERROR_NOT_SUPPORTED, system_category())));
+ ec->assign(BOOST_ERROR_NOT_SUPPORTED, system_category());
}
}
@@ -643,14 +641,14 @@
create_symlink(p, to, ec);
# elif _WIN32_WINNT < 0x0600 // SDK earlier than Vista and Server 2008
- error(true, error_code(BOOST_ERROR_NOT_SUPPORTED, system_category), to, from, ec,
+ error(true, error_code(BOOST_ERROR_NOT_SUPPORTED, system_category()), to, from, ec,
"boost::filesystem::copy_symlink");
# else // modern Windows
// see if actually supported by Windows runtime dll
if (error(!create_symbolic_link_api,
- error_code(BOOST_ERROR_NOT_SUPPORTED, system_category),
+ error_code(BOOST_ERROR_NOT_SUPPORTED, system_category()),
to, from, ec,
"boost::filesystem::copy_symlink"))
return;
@@ -673,8 +671,8 @@
if (ec == 0)
BOOST_FILESYSTEM_THROW(filesystem_error(
"boost::filesystem::create_directories", p,
- error_code(system::errc::file_exists, system::generic_category)));
- else ec->assign(system::errc::file_exists, system::generic_category);
+ error_code(system::errc::file_exists, system::generic_category())));
+ else ec->assign(system::errc::file_exists, system::generic_category());
}
return false;
}
@@ -707,9 +705,9 @@
// attempt to create directory failed && it doesn't already exist
if (ec == 0)
BOOST_FILESYSTEM_THROW(filesystem_error("boost::filesystem::create_directory",
- p, error_code(errval, system_category)));
+ p, error_code(errval, system_category())));
else
- ec->assign(errval, system_category);
+ ec->assign(errval, system_category());
return false;
}
@@ -719,14 +717,14 @@
{
# if defined(BOOST_WINDOWS_API) && _WIN32_WINNT < 0x0600 // SDK earlier than Vista and Server 2008
- error(true, error_code(BOOST_ERROR_NOT_SUPPORTED, system_category), to, from, ec,
+ error(true, error_code(BOOST_ERROR_NOT_SUPPORTED, system_category()), to, from, ec,
"boost::filesystem::create_directory_symlink");
# else
# if defined(BOOST_WINDOWS_API) && _WIN32_WINNT >= 0x0600
// see if actually supported by Windows runtime dll
if (error(!create_symbolic_link_api,
- error_code(BOOST_ERROR_NOT_SUPPORTED, system_category),
+ error_code(BOOST_ERROR_NOT_SUPPORTED, system_category()),
to, from, ec,
"boost::filesystem::create_directory_symlink"))
return;
@@ -743,14 +741,14 @@
# if defined(BOOST_WINDOWS_API) && _WIN32_WINNT < 0x0500 // SDK earlier than Win 2K
- error(true, error_code(BOOST_ERROR_NOT_SUPPORTED, system_category), to, from, ec,
+ error(true, error_code(BOOST_ERROR_NOT_SUPPORTED, system_category()), to, from, ec,
"boost::filesystem::create_hard_link");
# else
# if defined(BOOST_WINDOWS_API) && _WIN32_WINNT >= 0x0500
// see if actually supported by Windows runtime dll
if (error(!create_hard_link_api,
- error_code(BOOST_ERROR_NOT_SUPPORTED, system_category),
+ error_code(BOOST_ERROR_NOT_SUPPORTED, system_category()),
to, from, ec,
"boost::filesystem::create_hard_link"))
return;
@@ -765,14 +763,14 @@
void create_symlink(const path& to, const path& from, error_code* ec)
{
# if defined(BOOST_WINDOWS_API) && _WIN32_WINNT < 0x0600 // SDK earlier than Vista and Server 2008
- error(true, error_code(BOOST_ERROR_NOT_SUPPORTED, system_category), to, from, ec,
+ error(true, error_code(BOOST_ERROR_NOT_SUPPORTED, system_category()), to, from, ec,
"boost::filesystem::create_directory_symlink");
# else
# if defined(BOOST_WINDOWS_API) && _WIN32_WINNT >= 0x0600
// see if actually supported by Windows runtime dll
if (error(!create_symbolic_link_api,
- error_code(BOOST_ERROR_NOT_SUPPORTED, system_category),
+ error_code(BOOST_ERROR_NOT_SUPPORTED, system_category()),
to, from, ec,
"boost::filesystem::create_directory_symlink"))
return;
@@ -934,7 +932,7 @@
p, ec, "boost::filesystem::file_size"))
return static_cast<boost::uintmax_t>(-1);
if (error(!S_ISREG(path_stat.st_mode),
- error_code(EPERM, system_category),
+ error_code(EPERM, system_category()),
p, ec, "boost::filesystem::file_size"))
return static_cast<boost::uintmax_t>(-1);
@@ -951,7 +949,7 @@
return static_cast<boost::uintmax_t>(-1);
if (error((fad.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)!= 0,
- error_code(ERROR_NOT_SUPPORTED, system_category),
+ error_code(ERROR_NOT_SUPPORTED, system_category()),
p, ec, "boost::filesystem::file_size"))
return static_cast<boost::uintmax_t>(-1);
@@ -1108,8 +1106,8 @@
{
if (ec == 0)
BOOST_FILESYSTEM_THROW(filesystem_error("boost::filesystem::read_symlink",
- p, error_code(errno, system_category)));
- else ec->assign(errno, system_category);
+ p, error_code(errno, system_category())));
+ else ec->assign(errno, system_category());
break;
}
else
@@ -1124,7 +1122,7 @@
}
# elif _WIN32_WINNT < 0x0600 // SDK earlier than Vista and Server 2008
- error(true, error_code(BOOST_ERROR_NOT_SUPPORTED, system_category), p, ec,
+ error(true, error_code(BOOST_ERROR_NOT_SUPPORTED, system_category()), p, ec,
"boost::filesystem::read_symlink");
# else // Vista and Server 2008 SDK, or later
@@ -1245,7 +1243,7 @@
{
int errval(::GetLastError());
if (ec != 0) // always report errval, even though some
- ec->assign(errval, system_category); // errval values are not status_errors
+ ec->assign(errval, system_category()); // errval values are not status_errors
if (not_found_error(errval))
{
@@ -1257,7 +1255,7 @@
}
if (ec == 0)
BOOST_FILESYSTEM_THROW(filesystem_error("boost::filesystem::status",
- p, error_code(errval, system_category)));
+ p, error_code(errval, system_category())));
return file_status(status_error);
}
# endif
@@ -1271,7 +1269,7 @@
if (::stat(p.c_str(), &path_stat)!= 0)
{
if (ec != 0) // always report errno, even though some
- ec->assign(errno, system_category); // errno values are not status_errors
+ ec->assign(errno, system_category()); // errno values are not status_errors
if (not_found_error(errno))
{
@@ -1279,7 +1277,7 @@
}
if (ec == 0)
BOOST_FILESYSTEM_THROW(filesystem_error("boost::filesystem::status",
- p, error_code(errno, system_category)));
+ p, error_code(errno, system_category())));
return fs::file_status(fs::status_error);
}
if (ec != 0) ec->clear();;
@@ -1340,7 +1338,7 @@
if (::lstat(p.c_str(), &path_stat)!= 0)
{
if (ec != 0) // always report errno, even though some
- ec->assign(errno, system_category); // errno values are not status_errors
+ ec->assign(errno, system_category()); // errno values are not status_errors
if (errno == ENOENT || errno == ENOTDIR) // these are not errors
{
@@ -1348,7 +1346,7 @@
}
if (ec == 0)
BOOST_FILESYSTEM_THROW(filesystem_error("boost::filesystem::status",
- p, error_code(errno, system_category)));
+ p, error_code(errno, system_category())));
return fs::file_status(fs::status_error);
}
if (ec != 0) ec->clear();
@@ -1505,7 +1503,7 @@
{
if (errno == 0)// indeterminate
max = 4096; // guess
- else return error_code(errno, system_category);
+ else return error_code(errno, system_category());
}
else max = static_cast<std::size_t>(tmp + 1); // relative root
}
@@ -1518,7 +1516,7 @@
fs::file_status &, fs::file_status &)
{
if ((handle = ::opendir(dir))== 0)
- return error_code(errno, system_category);
+ return error_code(errno, system_category());
target = string("."); // string was static but caused trouble
// when iteration called from dtor, after
// static had already been destroyed
@@ -1541,7 +1539,8 @@
&& defined(_POSIX_THREAD_SAFE_FUNCTIONS)\
&& defined(_SC_THREAD_SAFE_FUNCTIONS)\
&& (_POSIX_THREAD_SAFE_FUNCTIONS+0 >= 0)\
- && (!defined(__hpux) || (defined(__hpux) && defined(_REENTRANT)))
+ && (!defined(__hpux) || defined(_REENTRANT)) \
+ && (!defined(_AIX) || defined(__THREAD_SAFE))
if (::sysconf(_SC_THREAD_SAFE_FUNCTIONS)>= 0)
{ return ::readdir_r(dirp, entry, result); }
# endif
@@ -1563,7 +1562,7 @@
dirent * result;
int return_code;
if ((return_code = readdir_r_simulator(static_cast<DIR*>(handle),
- entry, &result))!= 0)return error_code(errno, system_category);
+ entry, &result))!= 0)return error_code(errno, system_category());
if (result == 0)
return fs::detail::dir_itr_close(handle, buffer);
target = entry->d_name;
@@ -1614,7 +1613,7 @@
return error_code( (::GetLastError() == ERROR_FILE_NOT_FOUND
// Windows Mobile returns ERROR_NO_MORE_FILES; see ticket #3551
|| ::GetLastError() == ERROR_NO_MORE_FILES)
- ? 0 : ::GetLastError(), system_category );
+ ? 0 : ::GetLastError(), system_category() );
}
target = data.cFileName;
if (data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
@@ -1631,7 +1630,7 @@
{
int error = ::GetLastError();
fs::detail::dir_itr_close(handle);
- return error_code(error == ERROR_NO_MORE_FILES ? 0 : error, system_category);
+ return error_code(error == ERROR_NO_MORE_FILES ? 0 : error, system_category());
}
target = data.cFileName;
if (data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
@@ -1647,7 +1646,7 @@
# else
ENOENT
# endif
- , system_category);
+ , system_category());
} // unnamed namespace
@@ -1674,7 +1673,7 @@
if (handle == 0)return ok;
DIR * h(static_cast<DIR*>(handle));
handle = 0;
- return error_code(::closedir(h)== 0 ? 0 : errno, system_category);
+ return error_code(::closedir(h)== 0 ? 0 : errno, system_category());
# else
if (handle != 0)
@@ -1747,8 +1746,8 @@
BOOST_FILESYSTEM_THROW(
filesystem_error("boost::filesystem::directory_iterator::operator++",
it.m_imp->dir_entry.path().parent_path(),
- error_code(BOOST_ERRNO, system_category)));
- ec->assign(BOOST_ERRNO, system_category);
+ error_code(BOOST_ERRNO, system_category())));
+ ec->assign(BOOST_ERRNO, system_category());
return;
}
else if (ec != 0) ec->clear();
Modified: sandbox/filesystem-v3/libs/filesystem/src/unique_path.cpp
==============================================================================
--- sandbox/filesystem-v3/libs/filesystem/src/unique_path.cpp (original)
+++ sandbox/filesystem-v3/libs/filesystem/src/unique_path.cpp 2010-05-31 08:00:21 EDT (Mon, 31 May 2010)
@@ -29,10 +29,10 @@
{
if (ec == 0)
BOOST_FILESYSTEM_THROW( boost::system::system_error(err,
- boost::system::system_category,
+ boost::system::system_category(),
"boost::filesystem::unique_path"));
- ec->assign(err, boost::system::system_category);
+ ec->assign(err, boost::system::system_category());
return;
}
Modified: sandbox/filesystem-v3/libs/filesystem/test/Jamfile.v2
==============================================================================
--- sandbox/filesystem-v3/libs/filesystem/test/Jamfile.v2 (original)
+++ sandbox/filesystem-v3/libs/filesystem/test/Jamfile.v2 2010-05-31 08:00:21 EDT (Mon, 31 May 2010)
@@ -15,13 +15,13 @@
# to know if failures in shared library tests are related to sharing or not.
test-suite "filesystem" :
- [ run path_unit_test.cpp ]
+ [ run path_unit_test.cpp : : : <link>shared ]
[ run path_unit_test.cpp : : : <link>static : path_unit_test_static ]
- [ run path_test.cpp ]
+ [ run path_test.cpp : : : <link>shared ]
[ run path_test.cpp : : : <link>static : path_test_static ]
- [ run operations_unit_test.cpp ]
+ [ run operations_unit_test.cpp : : : <link>shared ]
[ run operations_unit_test.cpp : : : <link>static : operations_unit_test_static ]
- [ run operations_test.cpp ]
+ [ run operations_test.cpp : : : <link>shared ]
[ run operations_test.cpp : : : <link>static : operations_test_static ]
[ run fstream_test.cpp ]
[ run convenience_test.cpp ]
Modified: sandbox/filesystem-v3/libs/filesystem/test/operations_test.cpp
==============================================================================
--- sandbox/filesystem-v3/libs/filesystem/test/operations_test.cpp (original)
+++ sandbox/filesystem-v3/libs/filesystem/test/operations_test.cpp 2010-05-31 08:00:21 EDT (Mon, 31 May 2010)
@@ -66,7 +66,7 @@
std::ofstream f(ph.BOOST_FILESYSTEM_C_STR);
if (!f)
throw fs::filesystem_error("operations_test create_file",
- ph, error_code(errno, system_category));
+ ph, error_code(errno, system_category()));
if (!contents.empty()) f << contents;
}
@@ -75,7 +75,7 @@
std::ifstream f(ph.BOOST_FILESYSTEM_C_STR);
if (!f)
throw fs::filesystem_error("operations_test verify_file",
- ph, error_code(errno, system_category));
+ ph, error_code(errno, system_category()));
std::string contents;
f >> contents;
if (contents != expected)
@@ -822,7 +822,7 @@
BOOST_TEST(&ec.category() == &poison_category());
fs::file_status s = fs::status(".",ec);
BOOST_TEST(ec.value() == 0);
- BOOST_TEST(ec.category() == system_category);
+ BOOST_TEST(ec.category() == system_category());
BOOST_TEST(fs::exists(s));
BOOST_TEST(fs::is_directory(s));
@@ -831,7 +831,7 @@
ec.assign(-1,poison_category());
s = fs::status(p,ec);
BOOST_TEST(ec.value() != 0);
- BOOST_TEST(ec.category() == system_category);
+ BOOST_TEST(ec.category() == system_category());
BOOST_TEST(!fs::exists(s));
BOOST_TEST_EQ(s.type(), fs::file_not_found);
@@ -845,29 +845,29 @@
ec.assign(-1,poison_category());
BOOST_TEST(fs::exists(".", ec));
BOOST_TEST(ec.value() == 0);
- BOOST_TEST(ec.category() == system_category);
+ BOOST_TEST(ec.category() == system_category());
ec.assign(-1,poison_category());
BOOST_TEST(!fs::is_regular_file(".", ec));
BOOST_TEST(ec.value() == 0);
- BOOST_TEST(ec.category() == system_category);
+ BOOST_TEST(ec.category() == system_category());
ec.assign(-1,poison_category());
BOOST_TEST(fs::is_directory(".", ec));
BOOST_TEST(ec.value() == 0);
- BOOST_TEST(ec.category() == system_category);
+ BOOST_TEST(ec.category() == system_category());
// test queries, ec, for non-existing file
ec.assign(-1,poison_category());
BOOST_TEST(!fs::exists(p, ec));
BOOST_TEST(ec.value() != 0);
- BOOST_TEST(ec.category() == system_category);
+ BOOST_TEST(ec.category() == system_category());
ec.assign(-1,poison_category());
BOOST_TEST(!fs::is_regular_file(p, ec));
BOOST_TEST(ec.value() != 0);
- BOOST_TEST(ec.category() == system_category);
+ BOOST_TEST(ec.category() == system_category());
ec.assign(-1,poison_category());
BOOST_TEST(!fs::is_directory(p, ec));
BOOST_TEST(ec.value() != 0);
- BOOST_TEST(ec.category() == system_category);
+ BOOST_TEST(ec.category() == system_category());
}
// remove_tests --------------------------------------------------------------------//
@@ -1171,22 +1171,22 @@
{
// document state of critical macros
#ifdef BOOST_POSIX_API
- std::cout << "BOOST_POSIX_API\n";
+ std::cout << "BOOST_POSIX_API is defined\n";
#endif
#ifdef BOOST_WINDOWS_API
- std::cout << "BOOST_WINDOWS_API\n";
+ std::cout << "BOOST_WINDOWS_API is defined\n";
#endif
#ifdef BOOST_POSIX_PATH
- std::cout << "BOOST_POSIX_PATH\n";
+ std::cout << "BOOST_POSIX_PATH is defined\n";
#endif
#ifdef BOOST_WINDOWS_PATH
- std::cout << "BOOST_WINDOWS_PATH\n";
+ std::cout << "BOOST_WINDOWS_PATH is defined\n";
#endif
if (argc > 1 && *argv[1]=='-' && *(argv[1]+1)=='t') report_throws = true;
if (argc > 1 && *argv[1]=='-' && *(argv[1]+1)=='x') cleanup = false;
- // The choice of platform is make at runtime rather than compile-time
+ // The choice of platform to test is make at runtime rather than compile-time
// so that compile errors for all platforms will be detected even though
// only the current platform is runtime tested.
# if defined(BOOST_POSIX_API)
@@ -1199,9 +1199,7 @@
language_id = 0x0409; // Assume US English
# endif
# else
- platform = (platform == "Win32" || platform == "Win64" || platform == "Cygwin")
- ? "Windows"
- : "POSIX";
+# error neither BOOST_POSIX_API nor BOOST_WINDOWS_API is defined. See boost/system/api_config.hpp
# endif
std::cout << "API is " << platform << std::endl;
Modified: sandbox/filesystem-v3/libs/filesystem/test/operations_unit_test.cpp
==============================================================================
--- sandbox/filesystem-v3/libs/filesystem/test/operations_unit_test.cpp (original)
+++ sandbox/filesystem-v3/libs/filesystem/test/operations_unit_test.cpp 2010-05-31 08:00:21 EDT (Mon, 31 May 2010)
@@ -27,8 +27,6 @@
namespace
{
- std::string this_file;
-
void check(bool ok, const char* file, int line)
{
if (ok) return;
@@ -55,19 +53,19 @@
CHECK(is_directory("/"));
CHECK(!exists("no-such-file"));
- exists(this_file, ec);
+ exists("/", ec);
if (ec)
{
- std::cout << "ec non-zero: " << ec.value() << ", message: "<< ec.message() << std::endl;
- std::cout << " file: " << this_file << std::endl;
+ std::cout << "exists(\"/\", ec) resulted in non-zero ec.value()" << std::endl;
+ std::cout << "ec value: " << ec.value() << ", message: "<< ec.message() << std::endl;
}
CHECK(!ec);
- CHECK(exists(this_file));
- CHECK(!is_directory(this_file));
- CHECK(is_regular_file(this_file));
- CHECK(!boost::filesystem::is_empty(this_file));
- CHECK(!is_other(this_file));
+ CHECK(exists("/"));
+ CHECK(is_directory("/"));
+ CHECK(!is_regular_file("/"));
+ CHECK(!boost::filesystem::is_empty("/"));
+ CHECK(!is_other("/"));
}
// directory_iterator_test -----------------------------------------------//
@@ -161,6 +159,34 @@
path p(*it);
}
+ // error_handling_test -------------------------------------------------------------//
+
+ void error_handling_test()
+ {
+ std::cout << "error handling test..." << std::endl;
+
+ bool threw(false);
+ try
+ {
+ file_size("no-such-file");
+ }
+ catch (const boost::filesystem::filesystem_error & ex)
+ {
+ threw = true;
+ cout << "\nas expected, attempt to get size of non-existent file threw a filesystem_error\n"
+ "what() returns " << ex.what() << "\n";
+ }
+ catch (...)
+ {
+ cout << "\nunexpected exception type caught" << std::endl;
+ }
+
+ CHECK(threw);
+
+ error_code ec;
+ CHECK(!create_directory("/", ec));
+ }
+
} // unnamed namespace
//--------------------------------------------------------------------------------------//
@@ -169,54 +195,32 @@
// //
//--------------------------------------------------------------------------------------//
-int main(int, char* argv[])
+int main()
{
// document state of critical macros
#ifdef BOOST_POSIX_API
- cout << "BOOST_POSIX_API\n";
+ cout << "BOOST_POSIX_API is defined\n";
#endif
#ifdef BOOST_WINDOWS_API
- cout << "BOOST_WINDOWS_API\n";
+ cout << "BOOST_WINDOWS_API is defined\n";
#endif
#ifdef BOOST_POSIX_PATH
- cout << "BOOST_POSIX_PATH\n";
+ cout << "BOOST_POSIX_PATH is defined\n";
#endif
#ifdef BOOST_WINDOWS_PATH
- cout << "BOOST_WINDOWS_PATH\n";
+ cout << "BOOST_WINDOWS_PATH is defined\n";
#endif
+ cout << "BOOST_FILESYSTEM_DECL" << BOOST_STRINGIZE(=BOOST_FILESYSTEM_DECL) << "\n";
+ cout << "BOOST_SYMBOL_VISIBLE" << BOOST_STRINGIZE(=BOOST_SYMBOL_VISIBLE) << "\n";
- this_file = argv[0];
-
- cout << current_path().string() << std::endl;
-
- // error handling tests
-
- bool threw(false);
- try
- {
- file_size("no-such-file");
- }
- catch (const boost::filesystem::filesystem_error & ex)
- {
- threw = true;
- cout << "\nas expected, attempt to get size of non-existent file threw a filesystem_error\n"
- "what() returns " << ex.what() << "\n";
- }
- catch (...)
- {
- cout << "\nunexpected exception type caught" << std::endl;
- }
-
- CHECK(threw);
-
- error_code ec;
- CHECK(!create_directory("/", ec));
+ cout << "current_path() is " << current_path().string() << std::endl;
query_test();
directory_iterator_test();
operations_test();
directory_entry_test();
directory_entry_overload_test();
+ error_handling_test();
std::cout << unique_path() << std::endl;
std::cout << unique_path("foo-%%%%%-%%%%%-bar") << std::endl;
Modified: sandbox/filesystem-v3/libs/filesystem/test/path_test.cpp
==============================================================================
--- sandbox/filesystem-v3/libs/filesystem/test/path_test.cpp (original)
+++ sandbox/filesystem-v3/libs/filesystem/test/path_test.cpp 2010-05-31 08:00:21 EDT (Mon, 31 May 2010)
@@ -77,7 +77,7 @@
{
std::cout << "exception_tests..." << std::endl;
const std::string str_1("string-1");
- boost::system::error_code ec(12345, boost::system::system_category);
+ boost::system::error_code ec(12345, boost::system::system_category());
try { throw fs::filesystem_error(str_1, ec); }
catch (const fs::filesystem_error & ex)
{
Modified: sandbox/filesystem-v3/libs/filesystem/test/path_unit_test.cpp
==============================================================================
--- sandbox/filesystem-v3/libs/filesystem/test/path_unit_test.cpp (original)
+++ sandbox/filesystem-v3/libs/filesystem/test/path_unit_test.cpp 2010-05-31 08:00:21 EDT (Mon, 31 May 2010)
@@ -56,7 +56,7 @@
boost::system::error_code ec;
const boost::system::error_code ok;
- const boost::system::error_code ng(-1, boost::system::system_category);
+ const boost::system::error_code ng(-1, boost::system::system_category());
std::string platform(BOOST_PLATFORM);
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk