diff options
author | stuartmorgan@chromium.org <stuartmorgan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-04-05 10:45:08 +0000 |
---|---|---|
committer | stuartmorgan@chromium.org <stuartmorgan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-04-05 10:45:08 +0000 |
commit | 965bcb00895e398c725d79915ecb0e92321e8a66 (patch) | |
tree | 7402459776a02b3e08b3d7e2c62115bc476ff94d /base/mac | |
parent | 13f15cf324df8d47f2d1b7064586bfadbe9fa239 (diff) | |
download | chromium_src-965bcb00895e398c725d79915ecb0e92321e8a66.zip chromium_src-965bcb00895e398c725d79915ecb0e92321e8a66.tar.gz chromium_src-965bcb00895e398c725d79915ecb0e92321e8a66.tar.bz2 |
Forward-declare enums in a way that is compatible with NS_ENUM
Starting with the 10.8 SDK and the iOS 6.0 SDK, enums are declared
strongly typed in C++11 mode, which the old forward-declares weren't
compatible with. This creates a new macro for forward-declaring these
enums in a way that will match the SDK and compilation mode.
BUG=226494
Review URL: https://chromiumcodereview.appspot.com/13455004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@192543 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/mac')
-rw-r--r-- | base/mac/foundation_util.h | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/base/mac/foundation_util.h b/base/mac/foundation_util.h index 0d78c55..447f7bf 100644 --- a/base/mac/foundation_util.h +++ b/base/mac/foundation_util.h @@ -28,12 +28,22 @@ class NSString; #include <ApplicationServices/ApplicationServices.h> #endif +// Adapted from NSObjCRuntime.h NS_ENUM definition (used in Foundation starting +// with the OS X 10.8 SDK and the iOS 6.0 SDK). +#if __has_extension(cxx_strong_enums) && \ + (defined(OS_IOS) || (defined(MAC_OS_X_VERSION_10_8) && \ + MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_8)) +#define CR_FORWARD_ENUM(_type, _name) enum _name : _type _name +#else +#define CR_FORWARD_ENUM(_type, _name) _type _name +#endif + // Adapted from NSPathUtilities.h and NSObjCRuntime.h. #if __LP64__ || NS_BUILD_32_LIKE_64 -typedef unsigned long NSSearchPathDirectory; +typedef CR_FORWARD_ENUM(unsigned long, NSSearchPathDirectory); typedef unsigned long NSSearchPathDomainMask; #else -typedef unsigned int NSSearchPathDirectory; +typedef CR_FORWARD_ENUM(unsigned int, NSSearchPathDirectory); typedef unsigned int NSSearchPathDomainMask; #endif |