proxygen
CppAttributes.h File Reference

Go to the source code of this file.

Macros

#define FOLLY_HAS_ATTRIBUTE(x)   0
 
#define FOLLY_HAS_CPP_ATTRIBUTE(x)   0
 
#define FOLLY_HAS_EXTENSION(x)   0
 
#define FOLLY_FALLTHROUGH
 
#define FOLLY_MAYBE_UNUSED
 
#define FOLLY_NULLABLE
 
#define FOLLY_NONNULL
 
#define FOLLY_COLD
 

Macro Definition Documentation

#define FOLLY_COLD

"Cold" indicates to the compiler that a function is only expected to be called from unlikely code paths. It can affect decisions made by the optimizer both when processing the function body and when analyzing call-sites.

Definition at line 120 of file CppAttributes.h.

Referenced by folly::InlineExecutor::add().

#define FOLLY_FALLTHROUGH

Fallthrough to indicate that break was left out on purpose in a switch statement, e.g.

switch (n) { case 22: case 33: // no warning: no statements between case labels f(); case 44: // warning: unannotated fall-through g(); FOLLY_FALLTHROUGH; // no warning: annotated fall-through }

Definition at line 63 of file CppAttributes.h.

Referenced by BENCHMARK(), folly::detail::function::execSmall(), folly::FormatValue< double >::formatHelper(), handwrittenAtoi(), proxygen::HTTPCommonHeadersInternal::hash(), folly::fbstring_core< Char >::initSmall(), iterSpotter(), folly::SocketAddress::prefixMatch(), folly::futures::detail::Core< T >::setProxy(), folly::futures::detail::Core< T >::setResult(), folly::hash::SpookyHashV1::Short(), folly::hash::SpookyHashV2::Short(), folly::uriUnescape(), and folly::futures::detail::Core< T >::~Core().

#define FOLLY_HAS_ATTRIBUTE (   x)    0

GCC compatible wrappers around clang attributes.

Author
Dominik Gabi

Definition at line 26 of file CppAttributes.h.

#define FOLLY_HAS_CPP_ATTRIBUTE (   x)    0

Definition at line 32 of file CppAttributes.h.

#define FOLLY_HAS_EXTENSION (   x)    0

Definition at line 38 of file CppAttributes.h.

#define FOLLY_MAYBE_UNUSED

Maybe_unused indicates that a function, variable or parameter might or might not be used, e.g.

int foo(FOLLY_MAYBE_UNUSED int x) { #ifdef USE_X return x; #else return 0; #endif }

Definition at line 83 of file CppAttributes.h.

#define FOLLY_NONNULL

Definition at line 108 of file CppAttributes.h.

Referenced by folly::initializeLoggerDB().

#define FOLLY_NULLABLE

Nullable indicates that a return value or a parameter may be a nullptr, e.g.

int* FOLLY_NULLABLE foo(int* a, int* FOLLY_NULLABLE b) { if (*a > 0) { // safe dereference return nullptr; } if (*b < 0) { // unsafe dereference return *a; } if (b != nullptr && *b == 1) { // safe checked dereference return new int(1); } return nullptr; }

Definition at line 107 of file CppAttributes.h.

Referenced by proxygen::HTTPSession::newPushedTransaction(), and folly::settings::detail::saveValueForOutstandingSnapshots().