OLD | NEW |
1 C++11 in Skia | 1 C++11 in Skia |
2 ============= | 2 ============= |
3 | 3 |
4 Skia is exploring the use of C++11. As a library, we are technically limited | 4 Skia uses C++11. But as a library, we are technically limited by what our |
5 by what our clients support and what our build bots support. | 5 clients support and what our build bots support. |
6 | 6 |
7 Skia may also be limited by restrictions we choose put on ourselves. This | 7 Skia may also be limited by restrictions we choose put on ourselves. This |
8 document is not concerned with C++11 policy in Skia, only its technical | 8 document is not concerned with C++11 policy in Skia, only its technical |
9 feasibility. This is about what we can use, a superset of what we may use. | 9 feasibility. This is about what we can use, a superset of what we may use. |
10 | 10 |
11 The gist: | 11 The gist: |
12 | 12 |
13 - C++11 the language as supported by GCC 4.4 or later is probably usable. | 13 - C++11 the language as supported by GCC 4.7 or later is probably usable. |
14 - If you break a bot, that feature is not usable. | 14 - If you break a bot, that feature is not usable. |
15 - The C++11 standard library can't generally be used. | 15 - The C++11 standard library can't generally be used. |
16 - Local statics are not thread safe. | 16 - Local statics are not thread safe. |
17 | 17 |
18 | 18 |
19 Clients | 19 Clients |
20 ------- | 20 ------- |
21 | 21 |
22 The clients we pay most attention to are Chrome, Android, Mozilla, and a few | 22 The clients we pay most attention to are Chrome, Android, Mozilla, and a few |
23 internal Google projects. | 23 internal Google projects. |
24 | 24 |
25 Chrome builds with a recent Clang on Mac and Linux and with a recent MSVC on | 25 Chrome builds with a recent Clang on Mac and Linux and with a recent MSVC on |
26 Windows. These toolchains are new enough to not be the weak link to use any | 26 Windows. These toolchains are new enough to not be the weak link to use any |
27 C++11 language feature. But Chrome still supports Mac OS X 10.6, which does | 27 C++11 language feature. But Chrome still supports Mac OS X 10.6, which does |
28 not ship with a C++11 standard library. So [Chrome has banned the use of the | 28 not ship with a C++11 standard library. So [Chrome has banned the use of the |
29 C++11 standard library](http://chromium-cpp.appspot.com/). Some header-only | 29 C++11 standard library](http://chromium-cpp.appspot.com/). Some header-only |
30 features are probably technically fine, but the Mac toolchain will prevent us | 30 features are probably technically fine, but the Mac toolchain will prevent us |
31 from even trying at compile time as long as we target 10.6 as our minimum API | 31 from even trying at compile time as long as we target 10.6 as our minimum API |
32 level. | 32 level. |
33 | 33 |
34 Chrome intentionally disables thread-safe initialization of static variables, | 34 Chrome intentionally disables thread-safe initialization of static variables, |
35 and MSVC doesn't support it at all, so we cannot rely on that. | 35 and MSVC doesn't support it at all, so we cannot rely on that. |
36 | 36 |
37 Android builds with either a recent GCC or a recent Clang. They're generally | 37 Android builds with either a recent GCC or a recent Clang. They're generally |
38 not a weak link for C++11 language features. Android's C++ standard library | 38 not a weak link for C++11 language features. Android's C++ standard library |
39 has always been a pain, but since we can't use it anyway (see Chrome), don't | 39 has always been a pain, but since we can't use it anyway (see Chrome), don't |
40 worry about it. | 40 worry about it. |
41 | 41 |
42 Mozilla's current weak link is a minimum requirement of GCC 4.6. Most features | 42 Mozilla's current weak link is a minimum requirement of GCC 4.7. Most features |
43 marked in red on Mozilla's C++11 [feature | 43 marked in red on Mozilla's C++11 [feature |
44 matrix](https://developer.mozilla.org/en-US/docs/Using_CXX_in_Mozilla_code) are | 44 matrix](https://developer.mozilla.org/en-US/docs/Using_CXX_in_Mozilla_code) are |
45 marked that way because they arrived in GCC 4.7 or GCC 4.8. Their | 45 marked that way because they arrived in GCC 4.8. Their minimum-supported Clang |
46 minimum-supported Clang and MSVC toolchains are great. They also appear to ban | 46 and MSVC toolchains are great. They also appear to ban the C++ standard |
47 the C++ standard library. | 47 library. |
48 | 48 |
49 Internal Google projects tend to support C++11 completely, including the | 49 Internal Google projects tend to support C++11 completely, including the |
50 full C++11 standard library. | 50 full C++11 standard library. |
51 | 51 |
52 | 52 |
53 Bots | 53 Bots |
54 ---- | 54 ---- |
55 | 55 |
56 Most of our bots are pretty up-to-date: the Windows bots use MSVC 2013, the Mac | 56 Most of our bots are pretty up-to-date: the Windows bots use MSVC 2013, the Mac |
57 bots a recent Clang, and the Linux bots GCC 4.8 or a recent Clang. Our Android | 57 bots a recent Clang, and the Linux bots GCC 4.8 or a recent Clang. Our Android |
58 bots use a recent toolchain from Android (see above), and our Chrome bots use | 58 bots use a recent toolchain from Android (see above), and our Chrome bots use |
59 Chrome's toolchains (see above). I'm not exactly sure what our Chrome OS bots | 59 Chrome's toolchains (see above). I'm not exactly sure what our Chrome OS bots |
60 are using, but they've never been a problem. | 60 are using, but they've never been a problem. |
61 | 61 |
62 A few miscellaneous compile-only bots are actually our current overall weak link
: | 62 I believe our bots' ability to use C++11 matches Mozilla's list nearly identical
ly. |
63 | |
64 - Our iOS builds are driven from a Mac 10.7 machine using some unknown old Cla
ng. | |
65 Who knows how old that is or what it supports? It's probably due for an upd
ate. | |
66 | |
67 If we were to eliminate the problems of iOS bots, our ability to | |
68 use C++11 would match Mozilla's list nearly identically. | |
OLD | NEW |