| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #ifndef SkTypedEnum_DEFINED | 8 #ifndef SkTypedEnum_DEFINED |
| 9 #define SkTypedEnum_DEFINED | 9 #define SkTypedEnum_DEFINED |
| 10 | 10 |
| 11 #include "SkPreprocessorSeq.h" | 11 #include "SkPreprocessorSeq.h" |
| 12 | 12 |
| 13 //Compatibility with non-clang compilers. | 13 //Compatibility with non-clang compilers. |
| 14 #ifndef __has_feature | 14 #ifndef __has_feature |
| 15 #define __has_feature(x) 0 | 15 #define __has_feature(x) 0 |
| 16 #endif | 16 #endif |
| 17 #ifndef __has_extension | 17 #ifndef __has_extension |
| 18 #define __has_extension __has_feature | 18 #define __has_extension __has_feature |
| 19 #endif | 19 #endif |
| 20 | 20 |
| 21 //Detect if typed enums are supported. | 21 //Detect if typed enums are supported. |
| 22 #if defined(_MSC_VER) && _MSC_VER >= 1400 | 22 #if defined(_MSC_VER) |
| 23 #define SK_TYPED_ENUMS | 23 #define SK_TYPED_ENUMS |
| 24 | 24 |
| 25 #elif defined(__clang__) && __has_extension(cxx_strong_enums) | 25 #elif defined(__clang__) && __has_extension(cxx_strong_enums) |
| 26 #define SK_TYPED_ENUMS | 26 #define SK_TYPED_ENUMS |
| 27 | 27 |
| 28 // Scoped enums are buggy in GCC 4.4.0 through 4.5.1. | 28 // Scoped enums are buggy in GCC 4.4.0 through 4.5.1. |
| 29 // See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38064 | 29 // See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38064 |
| 30 // __cplusplus should actually be accurate now. | 30 // __cplusplus should actually be accurate now. |
| 31 // See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=1773 | 31 // See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=1773 |
| 32 #elif defined(__GNUC__) && (((__GNUC__*10000 + __GNUC_MINOR__*100 + __GNUC_PATCH
LEVEL__ >= 40501) && defined(__GXX_EXPERIMENTAL_CXX0X__)) || __cplusplus >= 2011
03L) | 32 #elif defined(__GNUC__) && (((__GNUC__*10000 + __GNUC_MINOR__*100 + __GNUC_PATCH
LEVEL__ >= 40501) && defined(__GXX_EXPERIMENTAL_CXX0X__)) || __cplusplus >= 2011
03L) |
| (...skipping 26 matching lines...) Expand all Loading... |
| 59 enumType elem; | 59 enumType elem; |
| 60 | 60 |
| 61 #define SK_TYPED_ENUM(enumName, enumType, enumSeq, idSeq) \ | 61 #define SK_TYPED_ENUM(enumName, enumType, enumSeq, idSeq) \ |
| 62 typedef enumType enumName; \ | 62 typedef enumType enumName; \ |
| 63 SK_SEQ_FOREACH(SK_TYPED_ENUM_VALUES, enumType, enumSeq) \ | 63 SK_SEQ_FOREACH(SK_TYPED_ENUM_VALUES, enumType, enumSeq) \ |
| 64 SK_SEQ_FOREACH(SK_TYPED_ENUM_IDS, enumType, idSeq) | 64 SK_SEQ_FOREACH(SK_TYPED_ENUM_IDS, enumType, idSeq) |
| 65 | 65 |
| 66 #endif | 66 #endif |
| 67 | 67 |
| 68 #endif | 68 #endif |
| OLD | NEW |