yuzu-emu
/
yuzu
Archived
1
0
Fork 0

emu_window: Mark Scoped constructor and Acquire() as nodiscard

Ensures that callers make use of the constructor, preventing bugs from
silently occurring.
This commit is contained in:
Lioncash 2020-08-02 20:17:42 -04:00
parent f808258ed9
commit a93f6e51d3
1 changed files with 2 additions and 2 deletions

View File

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