Disable global optimisations with MSVC6 to work around the optimiser bug
of totally eliding some member template function calls, and remove the previous hack which didn't always work.
This commit is contained in:
parent
78b418b87b
commit
1ebe13a1f9
@ -19,6 +19,14 @@
|
||||
# pragma warning (push)
|
||||
# pragma warning (disable:4355)
|
||||
# pragma pack (push, 8)
|
||||
// Note that if the /Og optimisation flag is enabled with MSVC6, the compiler
|
||||
// has a tendency to incorrectly optimise away some calls to member template
|
||||
// functions, even though those functions contain code that should not be
|
||||
// optimised away! Therefore we will always disable this optimisation option
|
||||
// for the MSVC6 compiler.
|
||||
# if (_MSC_VER < 1300)
|
||||
# pragma optimize ("g", off)
|
||||
# endif
|
||||
#elif defined (__BORLANDC__)
|
||||
# pragma option push -a8 -b -Ve- -Vx-
|
||||
# pragma nopushoptwarn
|
||||
|
@ -259,10 +259,6 @@ size_t recv_n(Stream& s, void* data, size_t length,
|
||||
|
||||
namespace detail
|
||||
{
|
||||
#if defined(_MSC_VER)
|
||||
static void recv_n_optimiser_bug_workaround() {}
|
||||
#endif // _MSC_VER
|
||||
|
||||
template <typename Stream, typename Handler, typename Completion_Context>
|
||||
class recv_n_handler
|
||||
{
|
||||
@ -284,13 +280,6 @@ namespace detail
|
||||
total_recvd_ += bytes_recvd;
|
||||
if (e || bytes_recvd == 0 || total_recvd_ == length_)
|
||||
{
|
||||
#if defined(_MSC_VER)
|
||||
// Unless we put this function call here, the MSVC6 optimiser totally
|
||||
// removes this function (incorrectly of course) and async_recv_n calls
|
||||
// may not work correctly.
|
||||
recv_n_optimiser_bug_workaround();
|
||||
#endif // _MSC_VER
|
||||
|
||||
stream_.demuxer().operation_immediate(detail::bind_handler(handler_, e,
|
||||
total_recvd_, bytes_recvd), context_, true);
|
||||
}
|
||||
@ -521,10 +510,6 @@ size_t recv_decode(Buffered_Stream& s, Decoder decoder,
|
||||
|
||||
namespace detail
|
||||
{
|
||||
#if defined(_MSC_VER)
|
||||
static void recv_decode_optimiser_bug_workaround() {}
|
||||
#endif // _MSC_VER
|
||||
|
||||
template <typename Buffered_Stream, typename Decoder, typename Handler,
|
||||
typename Completion_Context>
|
||||
class recv_decode_handler
|
||||
@ -545,13 +530,6 @@ namespace detail
|
||||
{
|
||||
if (e || bytes_recvd == 0)
|
||||
{
|
||||
#if defined(_MSC_VER)
|
||||
// Unless we put this function call here, the MSVC6 optimiser totally
|
||||
// removes this function (incorrectly of course) and async_recv calls
|
||||
// may not work correctly.
|
||||
recv_decode_optimiser_bug_workaround();
|
||||
#endif // _MSC_VER
|
||||
|
||||
stream_.demuxer().operation_immediate(detail::bind_handler(handler_, e,
|
||||
total_recvd_, bytes_recvd), context_, true);
|
||||
}
|
||||
|
@ -250,10 +250,6 @@ size_t send_n(Stream& s, const void* data, size_t length,
|
||||
|
||||
namespace detail
|
||||
{
|
||||
#if defined(_MSC_VER)
|
||||
static void send_n_optimiser_bug_workaround() {}
|
||||
#endif // _MSC_VER
|
||||
|
||||
template <typename Stream, typename Handler, typename Completion_Context>
|
||||
class send_n_handler
|
||||
{
|
||||
@ -275,13 +271,6 @@ namespace detail
|
||||
total_sent_ += bytes_sent;
|
||||
if (e || bytes_sent == 0 || total_sent_ == length_)
|
||||
{
|
||||
#if defined(_MSC_VER)
|
||||
// Unless we put this function call here, the MSVC6 optimiser totally
|
||||
// removes this function (incorrectly of course) and async_send_n calls
|
||||
// may not work correctly.
|
||||
send_n_optimiser_bug_workaround();
|
||||
#endif // _MSC_VER
|
||||
|
||||
stream_.demuxer().operation_immediate(detail::bind_handler(handler_, e,
|
||||
total_sent_, bytes_sent), context_, true);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user