aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/yson_pull/detail/macros.h
blob: 7243f9cfe1398af1766dd31ef7c1bcef08a6bda8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#pragma once

#include <util/system/compiler.h>

#if defined(__GNUC__)
#define ATTRIBUTE(args...) __attribute__((args))
#else
#define ATTRIBUTE(...)
#endif

#if defined(__GNUC__) && !defined(__clang__)
#define COLD_BLOCK_BYVALUE [=]() ATTRIBUTE(noinline, cold) {
#define COLD_BLOCK_BYREF [&]() ATTRIBUTE(noinline, cold) {
#define COLD_BLOCK_END \
    }                  \
    ();
#else
// Clang does not support gnu-style attributes on lambda functions yet
#define COLD_BLOCK_BYVALUE [=]() {
#define COLD_BLOCK_BYREF [&]() {
#define COLD_BLOCK_END \
    }                  \
    ();
#endif