Skip to content

Commit 35d16dc

Browse files
yfeldblummeta-codesync[bot]
authored andcommitted
FOLLY_ATTR_GNU_NOCLONE wrapping gnu::noclone
Reviewed By: mcfi Differential Revision: D84175753 fbshipit-source-id: 0fead2ce2c8c099b96381158fa10a4abe624655a
1 parent 642bb45 commit 35d16dc

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

third-party/folly/src/folly/CppAttributes.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,12 @@
177177
#define FOLLY_ATTR_GNU_RETAIN
178178
#endif
179179

180+
#if FOLLY_HAS_CPP_ATTRIBUTE(gnu::noclone)
181+
#define FOLLY_ATTR_GNU_NOCLONE gnu::noclone
182+
#else
183+
#define FOLLY_ATTR_GNU_NOCLONE
184+
#endif
185+
180186
#if FOLLY_HAS_CPP_ATTRIBUTE(clang::lifetimebound)
181187
#define FOLLY_ATTR_CLANG_LIFETIMEBOUND clang::lifetimebound
182188
#else

third-party/folly/src/folly/synchronization/test/SmallLocksBenchmark.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -436,8 +436,7 @@ struct VirtualImpl : VirtualBase {
436436
~VirtualImpl() override {}
437437
};
438438

439-
#ifndef __clang__
440-
__attribute__((noinline, noclone)) VirtualBase* makeVirtual() {
439+
FOLLY_NOINLINE [[FOLLY_ATTR_GNU_NOCLONE]] VirtualBase* makeVirtual() {
441440
return new VirtualImpl();
442441
}
443442

@@ -448,7 +447,6 @@ BENCHMARK(VirtualFunctionCall, iters) {
448447
}
449448
delete vb;
450449
}
451-
#endif
452450

453451
BENCHMARK_DRAW_LINE();
454452

0 commit comments

Comments
 (0)