From 04ef48c2005cbe4b967a3743f70199de78fbc43d Mon Sep 17 00:00:00 2001 From: Mike Klein Date: Wed, 15 Mar 2017 09:43:04 -0700 Subject: [PATCH] Fix warning in Clang 4.0 Mac build. ../src/views/mac/SkNSView.mm:18:31: note: expanded from macro 'RETINA_API_AVAILABLE' #define RETINA_API_AVAILABLE (defined(MAC_OS_X_VERSION_10_7) && \ ^ ../src/views/mac/SkNSView.mm:404:5: error: macro expansion producing 'defined' has undefined behavior [-Werror,-Wexpansion-to-defined] #if RETINA_API_AVAILABLE After this change, Clang 4.0 builds everything on Mac without warning. Change-Id: I9c8f63e009eaa69366ba9361a811df46a1204c24 Reviewed-on: https://skia-review.googlesource.com/9741 Reviewed-by: Ben Wagner Commit-Queue: Mike Klein --- src/views/mac/SkNSView.mm | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/views/mac/SkNSView.mm b/src/views/mac/SkNSView.mm index 7f4aacd4c9..64c02ca2a5 100644 --- a/src/views/mac/SkNSView.mm +++ b/src/views/mac/SkNSView.mm @@ -15,8 +15,12 @@ static_assert(SK_SUPPORT_GPU, "not_implemented_for_non_gpu_build"); //#define FORCE_REDRAW // Can be dropped when we no longer support 10.6. -#define RETINA_API_AVAILABLE (defined(MAC_OS_X_VERSION_10_7) && \ - MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7) +#if defined(MAC_OS_X_VERSION_10_7) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7 + #define RETINA_API_AVAILABLE 1 +#else + #define RETINA_API_AVAILABLE 0 +#endif + @implementation SkNSView @synthesize fWind, fTitle, fOptionsDelegate, fGLContext;