Commit a2962ba8 authored by Orvid King's avatar Orvid King Committed by facebook-github-bot-4

Explicit vtordisp for MSVC

Summary:Because sometimes things are just different.

MSVC warns about the `dynamic_cast` done against this class because the class's declaration doesn't show that it would need a vtordisp. While I don't believe the `dynamic_cast` in question is actually called in either the constructor or destructor paths for the class, better to be safe and force the disp to be created.

Reviewed By: yfeldblum

Differential Revision: D2887490

Pulled By: Orvid

fb-gh-sync-id: 821a6fc820087ac7120fffd9f8b95a26c2b4e71b
shipit-source-id: 821a6fc820087ac7120fffd9f8b95a26c2b4e71b
parent 914e877b
...@@ -61,6 +61,13 @@ namespace folly { ...@@ -61,6 +61,13 @@ namespace folly {
* responding and no further progress can be made sending the data. * responding and no further progress can be made sending the data.
*/ */
#ifdef _MSC_VER
// We do a dynamic_cast on this, in
// AsyncTransportWrapper::getUnderlyingTransport so be safe and
// force displacements for it. See:
// https://msdn.microsoft.com/en-us/library/7sf3txa8.aspx
#pragma vtordisp(push, 2)
#endif
class AsyncSocket : virtual public AsyncTransportWrapper { class AsyncSocket : virtual public AsyncTransportWrapper {
public: public:
typedef std::unique_ptr<AsyncSocket, Destructor> UniquePtr; typedef std::unique_ptr<AsyncSocket, Destructor> UniquePtr;
...@@ -818,6 +825,8 @@ class AsyncSocket : virtual public AsyncTransportWrapper { ...@@ -818,6 +825,8 @@ class AsyncSocket : virtual public AsyncTransportWrapper {
BufferCallback* bufferCallback_{nullptr}; BufferCallback* bufferCallback_{nullptr};
}; };
#ifdef _MSC_VER
#pragma vtordisp(pop)
#endif
} // folly } // folly
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment