Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r75932 - in sandbox/mmap/boost/mmap: detail mappble_objects/file mappble_objects/file/posix mapped_view/posix
From: dsaritz_at_[hidden]
Date: 2011-12-13 11:36:27


Author: psiha
Date: 2011-12-13 11:36:25 EST (Tue, 13 Dec 2011)
New Revision: 75932
URL: http://svn.boost.org/trac/boost/changeset/75932

Log:
Added nothrow function attributes.
Text files modified:
   sandbox/mmap/boost/mmap/detail/impl_selection.hpp | 10 ++++++++++
   sandbox/mmap/boost/mmap/mappble_objects/file/posix/file.inl | 14 +++++++-------
   sandbox/mmap/boost/mmap/mappble_objects/file/utility.inl | 8 ++++----
   sandbox/mmap/boost/mmap/mapped_view/posix/mapped_view.inl | 4 ++--
   4 files changed, 23 insertions(+), 13 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-12-13 11:36:25 EST (Tue, 13 Dec 2011)
@@ -39,5 +39,15 @@
 #define BOOST_MMAP_IMPL_INCLUDE( prefix_path, include ) \
     BOOST_PP_STRINGIZE( prefix_path()BOOST_MMAP_IMPL()include() )
 
+/// \todo Move to a separate header.
+/// (13.12.2011.) (Domagoj Saric)
+#if defined( _MSC_VER )
+ #define BOOST_NOTHROW __declspec( nothrow )
+#elif defined( __GNUC__ )
+ #define BOOST_NOTHROW __attribute__(( nothrow ))
+#else
+ #define BOOST_NOTHROW
+#endif
+
 //------------------------------------------------------------------------------
 #endif // impl_selection_hpp

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-12-13 11:36:25 EST (Tue, 13 Dec 2011)
@@ -39,7 +39,7 @@
 //------------------------------------------------------------------------------
 
 BOOST_IMPL_INLINE
-file_handle<posix> create_file( char const * const file_name, file_open_flags<posix> const & flags )
+file_handle<posix> BOOST_NOTHROW create_file( char const * const file_name, file_open_flags<posix> const & flags )
 {
     typedef file_handle<posix> posix_file_handle;
 
@@ -55,7 +55,7 @@
 
 #ifdef BOOST_MSVC
 BOOST_IMPL_INLINE
-file_handle<posix> create_file( wchar_t const * const file_name, file_open_flags<posix> const & flags )
+file_handle<posix> BOOST_NOTHROW create_file( wchar_t const * const file_name, file_open_flags<posix> const & flags )
 {
     BOOST_ASSERT( file_name );
 
@@ -69,14 +69,14 @@
 
 
 BOOST_IMPL_INLINE
-bool delete_file( char const * const file_name, posix )
+bool BOOST_NOTHROW delete_file( char const * const file_name, posix )
 {
     return ::unlink( file_name ) == 0;
 }
 
 #ifdef BOOST_MSVC
 BOOST_IMPL_INLINE
-bool delete_file( wchar_t const * const file_name, posix )
+bool BOOST_NOTHROW delete_file( wchar_t const * const file_name, posix )
 {
     return ::_wunlink( file_name ) == 0;
 }
@@ -85,7 +85,7 @@
 
 #ifdef BOOST_HAS_UNISTD_H
 BOOST_IMPL_INLINE
-bool set_size( file_handle<posix>::reference const file_handle, std::size_t const desired_size )
+bool BOOST_NOTHROW set_size( file_handle<posix>::reference const file_handle, std::size_t const desired_size )
 {
     return ::ftruncate( file_handle, desired_size ) != -1;
 }
@@ -93,7 +93,7 @@
 
 
 BOOST_IMPL_INLINE
-std::size_t get_size( file_handle<posix>::reference const file_handle )
+std::size_t BOOST_NOTHROW get_size( file_handle<posix>::reference const file_handle )
 {
     struct stat file_info;
     BOOST_VERIFY( ::fstat( file_handle, &file_info ) == 0 );
@@ -104,7 +104,7 @@
 #ifdef BOOST_HAS_UNISTD_H
 // Apple guidelines http://developer.apple.com/library/mac/#documentation/Performance/Conceptual/FileSystem/Articles/MappingFiles.html
 BOOST_IMPL_INLINE
-mapping<posix> create_mapping( file_handle<posix>::reference const file, file_mapping_flags<posix> const & flags )
+mapping<posix> BOOST_NOTHROW create_mapping( file_handle<posix>::reference const file, file_mapping_flags<posix> const & flags )
 {
     return mapping<posix>( file, flags );
 }

Modified: sandbox/mmap/boost/mmap/mappble_objects/file/utility.inl
==============================================================================
--- sandbox/mmap/boost/mmap/mappble_objects/file/utility.inl (original)
+++ sandbox/mmap/boost/mmap/mappble_objects/file/utility.inl 2011-12-13 11:36:25 EST (Tue, 13 Dec 2011)
@@ -56,7 +56,7 @@
     }
 
     BOOST_IMPL_INLINE
- basic_mapped_view_ref map_file( default_file_handle::reference const file_handle, std::size_t desired_size )
+ basic_mapped_view_ref BOOST_NOTHROW map_file( default_file_handle::reference const file_handle, std::size_t desired_size )
     {
         if ( desired_size )
             set_size( file_handle, desired_size );
@@ -82,7 +82,7 @@
 
 
     BOOST_IMPL_INLINE
- basic_mapped_read_only_view_ref map_read_only_file( default_file_handle::reference const file_handle )
+ basic_mapped_read_only_view_ref BOOST_NOTHROW map_read_only_file( default_file_handle::reference const file_handle )
     {
         typedef file_mapping_flags<BOOST_MMAP_IMPL()> mapping_flags;
         return basic_mapped_read_only_view_ref::map
@@ -103,13 +103,13 @@
 } // namespace detail
 
 BOOST_IMPL_INLINE
-basic_mapped_view_ref map_file( char const * const file_name, std::size_t const desired_size )
+basic_mapped_view_ref BOOST_NOTHROW map_file( char const * const file_name, std::size_t const desired_size )
 {
     return detail::map_file( create_file( file_name, detail::create_rw_file_flags() ), desired_size );
 }
 
 BOOST_IMPL_INLINE
-basic_mapped_read_only_view_ref map_read_only_file( char const * const file_name )
+basic_mapped_read_only_view_ref BOOST_NOTHROW map_read_only_file( char const * const file_name )
 {
     return detail::map_read_only_file( create_file( file_name, detail::create_r_file_flags() ) );
 }

Modified: sandbox/mmap/boost/mmap/mapped_view/posix/mapped_view.inl
==============================================================================
--- sandbox/mmap/boost/mmap/mapped_view/posix/mapped_view.inl (original)
+++ sandbox/mmap/boost/mmap/mapped_view/posix/mapped_view.inl 2011-12-13 11:36:25 EST (Tue, 13 Dec 2011)
@@ -29,7 +29,7 @@
     template <>
     struct mapper<char, posix>
     {
- static mapped_view_reference<char, posix> map
+ static mapped_view_reference<char, posix> BOOST_NOTHROW map
         (
             mapping<posix> const & source_mapping,
             boost::uint64_t offset ,
@@ -63,7 +63,7 @@
             );
         }
 
- static void unmap( mapped_view_reference<char, posix> const & view )
+ static void BOOST_NOTHROW unmap( mapped_view_reference<char, posix> const & view )
         {
             BOOST_VERIFY
             (


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