Skip to content

Commit

Permalink
Mark untestable code
Browse files Browse the repository at this point in the history
  • Loading branch information
d-frey committed Jan 15, 2021
1 parent 769d481 commit 1a2a015
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions include/tao/pegtl/internal/file_mapper_posix.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,15 @@ namespace TAO_PEGTL_NAMESPACE::internal
struct stat st;
errno = 0;
if( ::fstat( m_fd, &st ) < 0 ) {
// LCOV_EXCL_START
#if defined( __cpp_exceptions )
internal::error_code ec( errno, internal::system_category() );
throw internal::filesystem::filesystem_error( "fstat() failed", m_path, ec );
#else
std::perror( "fstat() failed" );
std::terminate();
#endif
// LCOV_EXCL_END
}
return std::size_t( st.st_size );
}
Expand Down Expand Up @@ -95,13 +97,15 @@ namespace TAO_PEGTL_NAMESPACE::internal
m_data( static_cast< const char* >( ::mmap( nullptr, m_size, PROT_READ, MAP_PRIVATE, reader.m_fd, 0 ) ) )
{
if( ( m_size != 0 ) && ( intptr_t( m_data ) == -1 ) ) {
// LCOV_EXCL_START
#if defined( __cpp_exceptions )
internal::error_code ec( errno, internal::system_category() );
throw internal::filesystem::filesystem_error( "mmap() failed", reader.m_path, ec );
#else
std::perror( "mmap() failed" );
std::terminate();
#endif
// LCOV_EXCL_END
}
}

Expand Down

0 comments on commit 1a2a015

Please sign in to comment.