Bug 1331792 - Stop using MOZ_MAKE_COMPILER_ASSUME_IS_UNREACHABLE in functions called from destructors to better work around VC++ compiler warnings. r=gfx?

MozReview-Commit-ID: Jh0OooS3ijl
This commit is contained in:
Kartikaya Gupta 2017-01-20 14:46:58 -05:00
Родитель 70fdf5ecb8
Коммит 4aa491b578
3 изменённых файлов: 14 добавлений и 22 удалений

Просмотреть файл

@ -39,13 +39,7 @@ RendererOGL::RendererOGL(RefPtr<RenderThread>&& aThread,
RendererOGL::~RendererOGL()
{
MOZ_COUNT_DTOR(RendererOGL);
#ifdef MOZ_ENABLE_WEBRENDER
// Need to wrap this in an ifdef otherwise VC++ emits a warning (treated as error)
// in the non-webrender targets.
// We should be able to remove this #ifdef if/when we remove the
// MOZ_MAKE_COMPILER_ASSUME_IS_UNREACHABLE annotations in webrender.h
wr_renderer_delete(mWrRenderer);
#endif
}
void

Просмотреть файл

@ -154,13 +154,7 @@ WebRenderAPI::~WebRenderAPI()
RunOnRenderThread(Move(event));
task.Wait();
#ifdef MOZ_ENABLE_WEBRENDER
// Need to wrap this in an ifdef otherwise VC++ emits a warning (treated as error)
// in the non-webrender targets.
// We should be able to remove this #ifdef if/when we remove the
// MOZ_MAKE_COMPILER_ASSUME_IS_UNREACHABLE annotations in webrender.h
wr_api_delete(mWrApi);
#endif
}
void
@ -262,12 +256,8 @@ WebRenderAPI::SetProfilerEnabled(bool aEnabled)
void
WebRenderAPI::RunOnRenderThread(UniquePtr<RendererEvent>&& aEvent)
{
#ifdef MOZ_ENABLE_WEBRENDER
// ifdef this out so that calling this function from a destructor does
// not break windows builds...
auto event = reinterpret_cast<uintptr_t>(aEvent.release());
wr_api_send_external_event(mWrApi, event);
#endif
}
DisplayListBuilder::DisplayListBuilder(const LayerIntSize& aSize, PipelineId aId)
@ -279,9 +269,7 @@ DisplayListBuilder::DisplayListBuilder(const LayerIntSize& aSize, PipelineId aId
DisplayListBuilder::~DisplayListBuilder()
{
MOZ_COUNT_DTOR(DisplayListBuilder);
#ifdef MOZ_ENABLE_WEBRENDER
wr_state_delete(mWrState);
#endif
}
void

Просмотреть файл

@ -266,12 +266,21 @@ struct WrExternalImageIdHandler
// Functions exposed by the webrender API
// -----
// Some useful defines to stub out webrender binding functions for when we
// build gecko without webrender. We try to tell the compiler these functions
// are unreachable in that case, but VC++ emits a warning if it finds any
// unreachable functions invoked from destructors. That warning gets turned into
// an error and causes the build to fail. So for wr_* functions called by
// destructors in C++ classes, use WR_DESTRUCTOR_SAFE_FUNC instead, which omits
// the unreachable annotation.
#ifdef MOZ_ENABLE_WEBRENDER
# define WR_INLINE
# define WR_FUNC
# define WR_DESTRUCTOR_SAFE_FUNC
#else
# define WR_INLINE inline
# define WR_FUNC { MOZ_MAKE_COMPILER_ASSUME_IS_UNREACHABLE("WebRender disabled"); }
# define WR_DESTRUCTOR_SAFE_FUNC {}
#endif
// Structs defined in Rust, but opaque to C++ code.
@ -299,7 +308,7 @@ WR_FUNC;
WR_INLINE void
wr_renderer_delete(WrRenderer* renderer)
WR_FUNC;
WR_DESTRUCTOR_SAFE_FUNC;
WR_INLINE void
wr_gl_init(void* aGLContext)
@ -316,7 +325,7 @@ WR_FUNC;
WR_INLINE void
wr_api_delete(WrAPI* api)
WR_FUNC;
WR_DESTRUCTOR_SAFE_FUNC;
WR_INLINE WrImageKey
wr_api_add_image(WrAPI* api, uint32_t width, uint32_t height,
@ -348,7 +357,7 @@ WR_FUNC;
WR_INLINE void
wr_api_send_external_event(WrAPI* api, uintptr_t evt)
WR_FUNC;
WR_DESTRUCTOR_SAFE_FUNC;
WR_INLINE void
wr_window_init_pipeline_epoch(WrWindowState* window, WrPipelineId pipeline, uint32_t width, uint32_t height)
@ -375,7 +384,7 @@ WR_FUNC;
WR_INLINE void
wr_state_delete(WrState* state)
WR_FUNC;
WR_DESTRUCTOR_SAFE_FUNC;
WR_INLINE void
wr_destroy(WrWindowState* wrWindow, WrState* WrState)
@ -485,6 +494,7 @@ wr_profiler_set_enabled(WrWindowState* wrWindow, bool enabled)
WR_FUNC;
#undef WR_FUNC
#undef WR_DESTRUCTOR_SAFE_FUNC
} // extern "C"
#endif // WR_h