diff options
| author | 2020-08-14 09:38:45 -0400 | |
|---|---|---|
| committer | 2020-08-15 17:17:52 -0400 | |
| commit | df7248039553b3ebd338380c3ef0428b0e046e79 (patch) | |
| tree | eca7153300e311ac7954f5c085fdada0c7295699 /src/common/virtual_buffer.h | |
| parent | Merge pull request #4526 from lioncash/core-semi (diff) | |
| download | yuzu-df7248039553b3ebd338380c3ef0428b0e046e79.tar.gz yuzu-df7248039553b3ebd338380c3ef0428b0e046e79.tar.xz yuzu-df7248039553b3ebd338380c3ef0428b0e046e79.zip | |
common: Make use of [[nodiscard]] where applicable
Now that clang-format makes [[nodiscard]] attributes format sensibly, we
can apply them to several functions within the common library to allow
the compiler to complain about any misuses of the functions.
Diffstat (limited to '')
| -rw-r--r-- | src/common/virtual_buffer.h | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/common/virtual_buffer.h b/src/common/virtual_buffer.h index da064e59e..125cb42f0 100644 --- a/src/common/virtual_buffer.h +++ b/src/common/virtual_buffer.h | |||
| @@ -30,23 +30,23 @@ public: | |||
| 30 | base_ptr = reinterpret_cast<T*>(AllocateMemoryPages(alloc_size)); | 30 | base_ptr = reinterpret_cast<T*>(AllocateMemoryPages(alloc_size)); |
| 31 | } | 31 | } |
| 32 | 32 | ||
| 33 | constexpr const T& operator[](std::size_t index) const { | 33 | [[nodiscard]] constexpr const T& operator[](std::size_t index) const { |
| 34 | return base_ptr[index]; | 34 | return base_ptr[index]; |
| 35 | } | 35 | } |
| 36 | 36 | ||
| 37 | constexpr T& operator[](std::size_t index) { | 37 | [[nodiscard]] constexpr T& operator[](std::size_t index) { |
| 38 | return base_ptr[index]; | 38 | return base_ptr[index]; |
| 39 | } | 39 | } |
| 40 | 40 | ||
| 41 | constexpr T* data() { | 41 | [[nodiscard]] constexpr T* data() { |
| 42 | return base_ptr; | 42 | return base_ptr; |
| 43 | } | 43 | } |
| 44 | 44 | ||
| 45 | constexpr const T* data() const { | 45 | [[nodiscard]] constexpr const T* data() const { |
| 46 | return base_ptr; | 46 | return base_ptr; |
| 47 | } | 47 | } |
| 48 | 48 | ||
| 49 | constexpr std::size_t size() const { | 49 | [[nodiscard]] constexpr std::size_t size() const { |
| 50 | return alloc_size / sizeof(T); | 50 | return alloc_size / sizeof(T); |
| 51 | } | 51 | } |
| 52 | 52 | ||