Skip to content

Commit

Permalink
fixup! src: do not use std::function for OnScopeLeave
Browse files Browse the repository at this point in the history
  • Loading branch information
addaleax committed Nov 6, 2019
1 parent 206f134 commit 776285f
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/util.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,12 @@
#include <unordered_map>
#include <utility>

#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
Expand Down Expand Up @@ -505,7 +511,7 @@ struct OnScopeLeaveImpl {
// // ... run some code ...
// });
template <typename Fn>
inline OnScopeLeaveImpl<Fn> OnScopeLeave(Fn&& fn) {
inline MUST_USE_RESULT OnScopeLeaveImpl<Fn> OnScopeLeave(Fn&& fn) {
return OnScopeLeaveImpl<Fn>{std::move(fn)};
}

Expand Down Expand Up @@ -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<v8::Local<v8::Value>> {
public:
inline explicit SlicedArguments(
Expand Down

0 comments on commit 776285f

Please sign in to comment.