From 776285fdc5bb6bec869931d9b98b7dbad900f958 Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Sat, 26 Oct 2019 19:06:00 +0200 Subject: [PATCH] fixup! src: do not use `std::function` for `OnScopeLeave` --- src/util.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/util.h b/src/util.h index 1f60601f85f311..48d9555c04fd4f 100644 --- a/src/util.h +++ b/src/util.h @@ -42,6 +42,12 @@ #include #include +#ifdef __GNUC__ +#define MUST_USE_RESULT __attribute__((warn_unused_result)) +#else +#define MUST_USE_RESULT +#endif + namespace node { // Maybe remove kPathSeparator when cpp17 is ready @@ -505,7 +511,7 @@ struct OnScopeLeaveImpl { // // ... run some code ... // }); template -inline OnScopeLeaveImpl OnScopeLeave(Fn&& fn) { +inline MUST_USE_RESULT OnScopeLeaveImpl OnScopeLeave(Fn&& fn) { return OnScopeLeaveImpl{std::move(fn)}; } @@ -686,12 +692,6 @@ constexpr T RoundUp(T a, T b) { return a % b != 0 ? a + b - (a % b) : a; } -#ifdef __GNUC__ -#define MUST_USE_RESULT __attribute__((warn_unused_result)) -#else -#define MUST_USE_RESULT -#endif - class SlicedArguments : public MaybeStackBuffer> { public: inline explicit SlicedArguments(