folly: avoid compile warning/failure due to lvalue-to-rvalue conversion
[folly.git] / folly / CppAttributes.h
index 7a13f61517cd1220666f6c5b4c5e551e718e03bd..466aab91a81144527e968415207f666674d52d46 100644 (file)
 #define FOLLY_NULLABLE
 #define FOLLY_NONNULL
 #endif
+
+/**
+ * "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.
+ */
+#if __GNUC__
+#define FOLLY_COLD __attribute__((__cold__))
+#else
+#define FOLLY_COLD
+#endif