aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/effects/GrProxyMove.h
blob: 87612f7e0f0524fc3975bf4cbfcca6f41973bc93 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/*
 * Copyright 2013 Google Inc.
 *
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

#ifndef GrProxyMove_DEFINED
#define GrProxyMove_DEFINED

// In a few places below we rely on braced initialization order being defined by the C++ spec (left
// to right). We use operator-> on a sk_sp and then in a later argument std::move() the sk_sp. GCC
// 4.9.0 and earlier has a bug where the left to right order evaluation isn't implemented correctly.
#if defined(__GNUC__) && !defined(__clang__)
#   define GCC_VERSION (__GNUC__ * 10000  + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
#   if (GCC_VERSION > 40900)
#       define GCC_EVAL_ORDER_BUG 0
#   else
#       define GCC_EVAL_ORDER_BUG 1
#   endif
#   undef GCC_VERSION
#else
#   define GCC_EVAL_ORDER_BUG 0
#endif

#if GCC_EVAL_ORDER_BUG
#   define GR_PROXY_MOVE(X) (X)
#else
#   define GR_PROXY_MOVE(X) (std::move(X))
#endif

#undef GCC_EVAL_ORDER_BUG

#endif