From 597c10eb124737897c52056a5dd9e5e830076d50 Mon Sep 17 00:00:00 2001 From: Chinmay Garde Date: Thu, 10 Mar 2022 15:34:46 -0800 Subject: [PATCH] Fix diagnostic on iOS simulators. (#71) --- impeller/renderer/backend/metal/surface_mtl.h | 7 +++++++ impeller/renderer/backend/metal/surface_mtl.mm | 4 ++++ 2 files changed, 11 insertions(+) diff --git a/impeller/renderer/backend/metal/surface_mtl.h b/impeller/renderer/backend/metal/surface_mtl.h index 44f2c49410991..ae6cd8da0a32a 100644 --- a/impeller/renderer/backend/metal/surface_mtl.h +++ b/impeller/renderer/backend/metal/surface_mtl.h @@ -14,6 +14,12 @@ namespace impeller { class SurfaceMTL final : public Surface { public: +#pragma GCC diagnostic push + // Disable the diagnostic for iOS Simulators. Metal without emulation isn't + // available prior to iOS 13 and that's what the simulator headers say when + // support for CAMetalLayer begins. CAMetalLayer is available on iOS 8.0 and + // above which is well below Flutters support level. +#pragma GCC diagnostic ignored "-Wunguarded-availability-new" //---------------------------------------------------------------------------- /// @brief Wraps the current drawable of the given Metal layer to create /// a surface Impeller can render to. The surface must be created @@ -29,6 +35,7 @@ class SurfaceMTL final : public Surface { static std::unique_ptr WrapCurrentMetalLayerDrawable( std::shared_ptr context, CAMetalLayer* layer); +#pragma GCC diagnostic pop // |Surface| ~SurfaceMTL() override; diff --git a/impeller/renderer/backend/metal/surface_mtl.mm b/impeller/renderer/backend/metal/surface_mtl.mm index 3dbd602ab0ad2..42826b1b9e54b 100644 --- a/impeller/renderer/backend/metal/surface_mtl.mm +++ b/impeller/renderer/backend/metal/surface_mtl.mm @@ -12,6 +12,9 @@ namespace impeller { +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunguarded-availability-new" + std::unique_ptr SurfaceMTL::WrapCurrentMetalLayerDrawable( std::shared_ptr context, CAMetalLayer* layer) { @@ -114,5 +117,6 @@ [drawable_ present]; return true; } +#pragma GCC diagnostic pop } // namespace impeller