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.
This commit is contained in:
Lioncash
2020-08-14 09:38:45 -04:00
parent 2b601e8636
commit df72480395
34 changed files with 343 additions and 358 deletions

View File

@ -19,7 +19,7 @@ namespace Common::Compression {
*
* @return the compressed data.
*/
std::vector<u8> CompressDataZSTD(std::span<const u8> source, s32 compression_level);
[[nodiscard]] std::vector<u8> CompressDataZSTD(std::span<const u8> source, s32 compression_level);
/**
* Compresses a source memory region with Zstandard with the default compression level and returns
@ -29,7 +29,7 @@ std::vector<u8> CompressDataZSTD(std::span<const u8> source, s32 compression_lev
*
* @return the compressed data.
*/
std::vector<u8> CompressDataZSTDDefault(std::span<const u8> source);
[[nodiscard]] std::vector<u8> CompressDataZSTDDefault(std::span<const u8> source);
/**
* Decompresses a source memory region with Zstandard and returns the uncompressed data in a vector.
@ -38,6 +38,6 @@ std::vector<u8> CompressDataZSTDDefault(std::span<const u8> source);
*
* @return the decompressed data.
*/
std::vector<u8> DecompressDataZSTD(const std::vector<u8>& compressed);
[[nodiscard]] std::vector<u8> DecompressDataZSTD(const std::vector<u8>& compressed);
} // namespace Common::Compression