Replace FOLLY_WARN_UNUSED_RESULT with FOLLY_NODISCARD everywhere
authorEric Niebler <eniebler@fb.com>
Thu, 25 May 2017 03:29:37 +0000 (20:29 -0700)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Thu, 25 May 2017 03:34:37 +0000 (20:34 -0700)
Summary: `[[nodiscard]]` is the future. Let's start now.

Reviewed By: yfeldblum

Differential Revision: D5108297

fbshipit-source-id: c98f44af9e282616af92f9171516b6ea18e68c6d

folly/Conv.h
folly/Portability.h

index 25cb26eb398c8c938f0e21d2e3fb9d73e7d9d8d3..22cc8ac470236dec1e48c3d7e6138142837920aa 100644 (file)
@@ -1165,7 +1165,7 @@ to(const char* b, const char* e) {
  * Parsing strings to numeric types.
  */
 template <typename Tgt>
-FOLLY_WARN_UNUSED_RESULT inline typename std::enable_if<
+FOLLY_NODISCARD inline typename std::enable_if<
     std::is_arithmetic<Tgt>::value,
     Expected<StringPiece, ConversionCode>>::type
 parseTo(StringPiece src, Tgt& out) {
@@ -1372,7 +1372,7 @@ typename std::enable_if<detail::IsArithToArith<Tgt, Src>::value, Tgt>::type to(
  * }
  ******************************************************************************/
 template <class T>
-FOLLY_WARN_UNUSED_RESULT typename std::enable_if<
+FOLLY_NODISCARD typename std::enable_if<
     std::is_enum<T>::value,
     Expected<StringPiece, ConversionCode>>::type
 parseTo(StringPiece in, T& out) noexcept {
@@ -1382,7 +1382,7 @@ parseTo(StringPiece in, T& out) noexcept {
   return restOrError;
 }
 
-FOLLY_WARN_UNUSED_RESULT
+FOLLY_NODISCARD
 inline Expected<StringPiece, ConversionCode> parseTo(
     StringPiece in,
     StringPiece& out) noexcept {
@@ -1390,7 +1390,7 @@ inline Expected<StringPiece, ConversionCode> parseTo(
   return StringPiece{in.end(), in.end()};
 }
 
-FOLLY_WARN_UNUSED_RESULT
+FOLLY_NODISCARD
 inline Expected<StringPiece, ConversionCode> parseTo(
     StringPiece in,
     std::string& out) {
@@ -1399,7 +1399,7 @@ inline Expected<StringPiece, ConversionCode> parseTo(
   return StringPiece{in.end(), in.end()};
 }
 
-FOLLY_WARN_UNUSED_RESULT
+FOLLY_NODISCARD
 inline Expected<StringPiece, ConversionCode> parseTo(
     StringPiece in,
     fbstring& out) {
index 49d48f071f8022628c8ebaa232b91c95371629b6..7b822cda2d60da1fe3849b32f4d7de09554d7ea8 100644 (file)
@@ -85,7 +85,6 @@ constexpr bool kHasUnalignedAccess = false;
 #define FOLLY_NODISCARD
 #endif
 #endif
-#define FOLLY_WARN_UNUSED_RESULT FOLLY_NODISCARD
 
 // target
 #ifdef _MSC_VER