|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r74069 - in sandbox/mmap/boost/mmap: . detail handles mappble_objects/file mappble_objects/file/posix
From: dsaritz_at_[hidden]
Date: 2011-08-26 06:07:42
Author: psiha
Date: 2011-08-26 06:07:40 EDT (Fri, 26 Aug 2011)
New Revision: 74069
URL: http://svn.boost.org/trac/boost/changeset/74069
Log:
Fixed the preprocessor code in impl_selection.hpp header not to cause errors with Clang.
Fixed other Clang/POSIX implementation compiler errors.
Fixed the generic delete_file() forwarder functions.
Text files modified:
sandbox/mmap/boost/mmap/detail/impl_selection.hpp | 22 +++++++++++++---------
sandbox/mmap/boost/mmap/handles/handle.hpp | 4 ++--
sandbox/mmap/boost/mmap/handles/handle.inl | 2 +-
sandbox/mmap/boost/mmap/mappble_objects/file/file.hpp | 10 +++++-----
sandbox/mmap/boost/mmap/mappble_objects/file/flags.hpp | 2 +-
sandbox/mmap/boost/mmap/mappble_objects/file/posix/file.hpp | 10 +++++-----
sandbox/mmap/boost/mmap/mappble_objects/file/posix/file.inl | 14 ++++++++------
sandbox/mmap/boost/mmap/mapped_view.inl | 6 ++++--
8 files changed, 39 insertions(+), 31 deletions(-)
Modified: sandbox/mmap/boost/mmap/detail/impl_selection.hpp
==============================================================================
--- sandbox/mmap/boost/mmap/detail/impl_selection.hpp (original)
+++ sandbox/mmap/boost/mmap/detail/impl_selection.hpp 2011-08-26 06:07:40 EDT (Fri, 26 Aug 2011)
@@ -13,26 +13,30 @@
///
////////////////////////////////////////////////////////////////////////////////
//------------------------------------------------------------------------------
-#pragma once
#ifndef impl_selection_hpp__05AF14B5_B23B_4CB8_A253_FD2D07B37ECF
#define impl_selection_hpp__05AF14B5_B23B_4CB8_A253_FD2D07B37ECF
+#pragma once
//------------------------------------------------------------------------------
#include "boost/preprocessor/cat.hpp"
#include "boost/preprocessor/stringize.hpp"
+
+// Implementation note:
+// "Anti-pattern" forward includes to reduce the verbosity of files that
+// include this header.
+// (26.08.2011.) (Domagoj Saric)
+#include "boost/preprocessor/facilities/empty.hpp"
+#include "boost/preprocessor/facilities/identity.hpp"
//------------------------------------------------------------------------------
#if defined( _WIN32 )
- #define BOOST_MMAP_IMPL win32
+ #define BOOST_MMAP_IMPL() win32
#elif defined( _WIN32_WINNT )
- #define BOOST_MMAP_IMPL nt
+ #define BOOST_MMAP_IMPL() nt
#elif defined( BOOST_HAS_UNISTD_H )
- #define BOOST_MMAP_IMPL posix
+ #define BOOST_MMAP_IMPL() posix
#endif
-#define BOOST_MMAP_IMPL_INCLUDE( prefix_path, include ) \
- BOOST_PP_STRINGIZE \
- ( \
- BOOST_PP_CAT( BOOST_PP_CAT( prefix_path, BOOST_MMAP_IMPL ), include ) \
- )
+#define BOOST_MMAP_IMPL_INCLUDE( prefix_path, include ) \
+ BOOST_PP_STRINGIZE( prefix_path()BOOST_MMAP_IMPL()include() )
//------------------------------------------------------------------------------
#endif // impl_selection_hpp
Modified: sandbox/mmap/boost/mmap/handles/handle.hpp
==============================================================================
--- sandbox/mmap/boost/mmap/handles/handle.hpp (original)
+++ sandbox/mmap/boost/mmap/handles/handle.hpp 2011-08-26 06:07:40 EDT (Fri, 26 Aug 2011)
@@ -19,7 +19,7 @@
//------------------------------------------------------------------------------
#include "../detail/impl_selection.hpp"
-#include BOOST_MMAP_IMPL_INCLUDE( ./, /handle.hpp )
+#include BOOST_MMAP_IMPL_INCLUDE( BOOST_PP_EMPTY, BOOST_PP_IDENTITY( /handle.hpp ) )
//------------------------------------------------------------------------------
namespace boost
{
@@ -30,7 +30,7 @@
template <typename Impl> class handle;
-typedef handle<BOOST_MMAP_IMPL> native_handle;
+typedef handle<BOOST_MMAP_IMPL()> native_handle;
//------------------------------------------------------------------------------
} // namespace mmap
Modified: sandbox/mmap/boost/mmap/handles/handle.inl
==============================================================================
--- sandbox/mmap/boost/mmap/handles/handle.inl (original)
+++ sandbox/mmap/boost/mmap/handles/handle.inl 2011-08-26 06:07:40 EDT (Fri, 26 Aug 2011)
@@ -15,5 +15,5 @@
//------------------------------------------------------------------------------
#include "../detail/impl_selection.hpp"
-#include BOOST_MMAP_IMPL_INCLUDE( ./, /handle.inl )
+#include BOOST_MMAP_IMPL_INCLUDE( BOOST_PP_EMPTY, BOOST_PP_IDENTITY( /handle.inl ) )
//------------------------------------------------------------------------------
Modified: sandbox/mmap/boost/mmap/mappble_objects/file/file.hpp
==============================================================================
--- sandbox/mmap/boost/mmap/mappble_objects/file/file.hpp (original)
+++ sandbox/mmap/boost/mmap/mappble_objects/file/file.hpp 2011-08-26 06:07:40 EDT (Fri, 26 Aug 2011)
@@ -19,8 +19,8 @@
//------------------------------------------------------------------------------
#include "../../detail/impl_selection.hpp"
-#include BOOST_MMAP_IMPL_INCLUDE( ./, /file.hpp )
-#include BOOST_MMAP_IMPL_INCLUDE( ./, /flags.hpp )
+#include BOOST_MMAP_IMPL_INCLUDE( BOOST_PP_EMPTY, BOOST_PP_IDENTITY( /file.hpp ) )
+#include BOOST_MMAP_IMPL_INCLUDE( BOOST_PP_EMPTY, BOOST_PP_IDENTITY( /flags.hpp ) )
//------------------------------------------------------------------------------
namespace boost
{
@@ -29,10 +29,10 @@
{
//------------------------------------------------------------------------------
-typedef file_flags<BOOST_MMAP_IMPL> native_file_flags;
+typedef file_flags<BOOST_MMAP_IMPL()> native_file_flags;
-inline bool delete_file( char const * const file_name ) { delete_file( file_name, BOOST_MMAP_IMPL () ); }
-inline bool delete_file( wchar_t const * const file_name ) { delete_file( file_name, BOOST_MMAP_IMPL () ); }
+inline bool delete_file( char const * const file_name ) { return delete_file( file_name, BOOST_MMAP_IMPL() () ); }
+inline bool delete_file( wchar_t const * const file_name ) { return delete_file( file_name, BOOST_MMAP_IMPL() () ); }
//------------------------------------------------------------------------------
} // namespace mmap
Modified: sandbox/mmap/boost/mmap/mappble_objects/file/flags.hpp
==============================================================================
--- sandbox/mmap/boost/mmap/mappble_objects/file/flags.hpp (original)
+++ sandbox/mmap/boost/mmap/mappble_objects/file/flags.hpp 2011-08-26 06:07:40 EDT (Fri, 26 Aug 2011)
@@ -19,6 +19,6 @@
//------------------------------------------------------------------------------
#include "../../detail/impl_selection.hpp"
-#include BOOST_MMAP_IMPL_INCLUDE( ./, /flags.hpp )
+#include BOOST_MMAP_IMPL_INCLUDE( BOOST_PP_EMPTY, BOOST_PP_IDENTITY( /flags.hpp ) )
//------------------------------------------------------------------------------
#endif // flags_hpp
Modified: sandbox/mmap/boost/mmap/mappble_objects/file/posix/file.hpp
==============================================================================
--- sandbox/mmap/boost/mmap/mappble_objects/file/posix/file.hpp (original)
+++ sandbox/mmap/boost/mmap/mappble_objects/file/posix/file.hpp 2011-08-26 06:07:40 EDT (Fri, 26 Aug 2011)
@@ -17,8 +17,8 @@
#define file_hpp__1E2F9841_1C6C_40D9_9AA7_BAC0003CD909
#pragma once
//------------------------------------------------------------------------------
+#include "../handle.hpp"
#include "../../../implementations.hpp"
-#include "../../../handles/posix/handle.hpp"
#include <cstddef>
//------------------------------------------------------------------------------
@@ -39,9 +39,9 @@
#endif // BOOST_HAS_UNISTD_H
-handle<posix> create_file( char const * file_name, file_flags<posix> const & );
+file_handle<posix> create_file( char const * file_name, file_flags<posix> const & );
#ifdef BOOST_MSVC
-handle<posix> create_file( wchar_t const * file_name, file_flags<posix> const & );
+file_handle<posix> create_file( wchar_t const * file_name, file_flags<posix> const & );
#endif // BOOST_MSVC
bool delete_file( char const * file_name, posix );
@@ -49,9 +49,9 @@
#ifdef BOOST_HAS_UNISTD_H
-bool set_size( handle<posix>::reference, std::size_t desired_size );
+bool set_size( file_handle<posix>::reference, std::size_t desired_size );
#endif // BOOST_HAS_UNISTD_H
-std::size_t get_size( handle<posix>::reference );
+std::size_t get_size( file_handle<posix>::reference );
//------------------------------------------------------------------------------
} // namespace mmap
Modified: sandbox/mmap/boost/mmap/mappble_objects/file/posix/file.inl
==============================================================================
--- sandbox/mmap/boost/mmap/mappble_objects/file/posix/file.inl (original)
+++ sandbox/mmap/boost/mmap/mappble_objects/file/posix/file.inl 2011-08-26 06:07:40 EDT (Fri, 26 Aug 2011)
@@ -41,8 +41,10 @@
//------------------------------------------------------------------------------
BOOST_IMPL_INLINE
-handle<posix> create_file( char const * const file_name, file_flags<posix> const & flags )
+file_handle<posix> create_file( char const * const file_name, file_flags<posix> const & flags )
{
+ typedef file_handle<posix> posix_file_handle;
+
BOOST_ASSERT( file_name );
int const current_mask( ::umask( 0 ) );
@@ -50,12 +52,12 @@
//...zzz...investigate posix_fadvise, posix_madvise, fcntl for the system hints...
BOOST_VERIFY( ::umask( current_mask ) == 0 );
- return handle<posix>( file_handle );
+ return posix_file_handle( file_handle );
}
#ifdef BOOST_MSVC
BOOST_IMPL_INLINE
-handle<posix> create_file( wchar_t const * const file_name, file_flags<posix> const & flags )
+file_handle<posix> create_file( wchar_t const * const file_name, file_flags<posix> const & flags )
{
BOOST_ASSERT( file_name );
@@ -63,7 +65,7 @@
int const file_handle ( ::_wopen( file_name, flags.oflag, flags.pmode ) );
BOOST_VERIFY( ::umask( current_mask ) == 0 );
- return handle<posix>( file_handle );
+ return file_handle<posix>( file_handle );
}
#endif // BOOST_MSVC
@@ -85,7 +87,7 @@
#ifdef BOOST_HAS_UNISTD_H
BOOST_IMPL_INLINE
-bool set_size( handle_ref< handle<posix> > const file_handle, std::size_t const desired_size )
+bool set_size( file_handle<posix>::reference const file_handle, std::size_t const desired_size )
{
return ::ftruncate( file_handle, desired_size ) != -1;
}
@@ -93,7 +95,7 @@
BOOST_IMPL_INLINE
-std::size_t get_size( handle_ref< handle<posix> > const file_handle )
+std::size_t get_size( file_handle<posix>::reference const file_handle )
{
struct stat file_info;
BOOST_VERIFY( ::fstat( file_handle, &file_info ) == 0 );
Modified: sandbox/mmap/boost/mmap/mapped_view.inl
==============================================================================
--- sandbox/mmap/boost/mmap/mapped_view.inl (original)
+++ sandbox/mmap/boost/mmap/mapped_view.inl 2011-08-26 06:07:40 EDT (Fri, 26 Aug 2011)
@@ -16,6 +16,8 @@
#include "mapped_view.hpp"
#include "detail/impl_inline.hpp"
+#include "implementations.hpp"
+#include "mappble_objects/file/handle.hpp"
#include "boost/assert.hpp"
@@ -201,7 +203,7 @@
basic_mapped_view_ref map_file( char const * const file_name, std::size_t desired_size )
{
typedef native_file_flags file_flags;
- file_handle<BOOST_MMAP_IMPL> const file_handle
+ file_handle<BOOST_MMAP_IMPL()> const file_handle
(
create_file
(
@@ -241,7 +243,7 @@
basic_mapped_read_only_view_ref map_read_only_file( char const * const file_name )
{
typedef native_file_flags file_flags;
- file_handle<BOOST_MMAP_IMPL> const file_handle
+ file_handle<BOOST_MMAP_IMPL()> const file_handle
(
create_file
(
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