fix the build with gcc

Summary:
Unfortunately it looks like gcc won't support the [[nodiscard]] attribute until
the gcc-7.x release.  (The functionality is available in gcc-4.8 and later, but
using the name [[gnu::warn_unused_result]] instead.)

This changes the code to use the FOLLY_WARN_UNUSED_RESULT macro from
folly/Portability.h instead.  (This expands to older non-standard __attribute__
syntax for gcc and clang, and _Check_return_ on Windows.)

Reviewed By: bolinfest

Differential Revision: D4704184

fbshipit-source-id: d5c13630ea611a2f43080a501add42ce9fda6789
This commit is contained in:
Adam Simpkins 2017-03-14 14:28:26 -07:00 committed by Facebook Github Bot
parent bda49af5a3
commit 1add48d20b

View File

@ -9,6 +9,7 @@
*/
#pragma once
#include <folly/File.h>
#include <folly/Portability.h>
#include <folly/futures/Future.h>
#include <folly/io/IOBuf.h>
#include <mutex>
@ -98,7 +99,8 @@ class FileData {
* need to create an empty file in the overlay. Otherwise we
* need to go out to the LocalStore to obtain the backing data.
*/
[[nodiscard]] folly::Future<folly::Unit> materializeForWrite(int openFlags);
FOLLY_WARN_UNUSED_RESULT folly::Future<folly::Unit> materializeForWrite(
int openFlags);
/**
* Load the file data so it can be used for reading.
@ -107,7 +109,7 @@ class FileData {
* If the file is not materialized, this loads the Blob data from the
* ObjectStore.
*/
[[nodiscard]] folly::Future<folly::Unit> ensureDataLoaded();
FOLLY_WARN_UNUSED_RESULT folly::Future<folly::Unit> ensureDataLoaded();
private:
ObjectStore* getObjectStore() const;