ソースを参照

emu_window: Mark Scoped constructor and Acquire() as nodiscard

Ensures that callers make use of the constructor, preventing bugs from
silently occurring.
Lioncash 6 年 前
コミット
a93f6e51d3
1 ファイル変更2 行追加2 行削除
  1. 2 2
      src/core/frontend/emu_window.h

+ 2 - 2
src/core/frontend/emu_window.h

@@ -39,7 +39,7 @@ public:
 
     class Scoped {
     public:
-        explicit Scoped(GraphicsContext& context_) : context(context_) {
+        [[nodiscard]] explicit Scoped(GraphicsContext& context_) : context(context_) {
             context.MakeCurrent();
         }
         ~Scoped() {
@@ -52,7 +52,7 @@ public:
 
     /// Calls MakeCurrent on the context and calls DoneCurrent when the scope for the returned value
     /// ends
-    Scoped Acquire() {
+    [[nodiscard]] Scoped Acquire() {
         return Scoped{*this};
     }
 };