• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2013 Google Inc.
3  *
4  * Use of this source code is governed by a BSD-style license that can be
5  * found in the LICENSE file.
6  */
7 
8 #ifndef GrProxyMove_DEFINED
9 #define GrProxyMove_DEFINED
10 
11 // In a few places below we rely on braced initialization order being defined by the C++ spec (left
12 // to right). We use operator-> on a sk_sp and then in a later argument std::move() the sk_sp. GCC
13 // 4.9.0 and earlier has a bug where the left to right order evaluation isn't implemented correctly.
14 //
15 // Clang has the same bug when targeting Windows (http://crbug.com/687259).
16 // TODO(hans): Remove work-around once Clang is fixed.
17 #if defined(__GNUC__) && !defined(__clang__)
18 #   define GCC_VERSION (__GNUC__ * 10000  + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
19 #   if (GCC_VERSION > 40900)
20 #       define GCC_EVAL_ORDER_BUG 0
21 #   else
22 #       define GCC_EVAL_ORDER_BUG 1
23 #   endif
24 #   undef GCC_VERSION
25 #elif defined(_MSC_VER) && defined(__clang__)
26 #   define GCC_EVAL_ORDER_BUG 1
27 #else
28 #   define GCC_EVAL_ORDER_BUG 0
29 #endif
30 
31 #if GCC_EVAL_ORDER_BUG
32 #   define GR_PROXY_MOVE(X) (X)
33 #else
34 #   define GR_PROXY_MOVE(X) (std::move(X))
35 #endif
36 
37 #undef GCC_EVAL_ORDER_BUG
38 
39 #endif
40