WARN_UNUSED_RESULT for windows

This commit is contained in:
Sebastian Messmer 2018-05-20 22:44:46 -07:00
parent 76dc5cbba8
commit e7110afe25
3 changed files with 13 additions and 4 deletions

View File

@ -21,7 +21,7 @@ namespace blockstore {
KnownBlockVersions(KnownBlockVersions &&rhs); // NOLINT (intentionally not noexcept)
~KnownBlockVersions();
__attribute__((warn_unused_result))
WARN_UNUSED_RESULT
bool checkAndUpdateVersion(uint32_t clientId, const BlockId &blockId, uint64_t version);
uint64_t incrementVersion(const BlockId &blockId);

View File

@ -19,12 +19,12 @@ public:
return BlockId::Random();
}
__attribute__((warn_unused_result))
WARN_UNUSED_RESULT
virtual bool tryCreate(const BlockId &blockId, const cpputils::Data &data) = 0;
__attribute__((warn_unused_result))
WARN_UNUSED_RESULT
virtual bool remove(const BlockId &blockId) = 0;
__attribute__((warn_unused_result))
WARN_UNUSED_RESULT
virtual boost::optional<cpputils::Data> load(const BlockId &blockId) const = 0;
// Store the block with the given blockId. If it doesn't exist, it is created.

View File

@ -17,4 +17,13 @@
*/
#define UNUSED(expr) (void)(expr)
/**
* Warn if function result is unused
*/
#if !defined(_MSC_VER)
#define WARN_UNUSED_RESULT __attribute__((warn_unused_result))
#else
#define WARN_UNUSED_RESULT _Check_return_
#endif
#endif