diff --git a/modules/juce_core/memory/juce_Atomic.h b/modules/juce_core/memory/juce_Atomic.h index 7bc4dd6468..757ab0201b 100644 --- a/modules/juce_core/memory/juce_Atomic.h +++ b/modules/juce_core/memory/juce_Atomic.h @@ -181,7 +181,7 @@ private: /* The following code is in the header so that the atomics can be inlined where possible... */ -#if JUCE_IOS || (JUCE_MAC && (JUCE_PPC || defined (__clang__) || __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 2))) +#if JUCE_IOS || (JUCE_MAC && (JUCE_PPC || JUCE_CLANG || __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 2))) #define JUCE_ATOMICS_MAC 1 // Older OSX builds using gcc4.1 or earlier #if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5 diff --git a/modules/juce_core/system/juce_PlatformDefs.h b/modules/juce_core/system/juce_PlatformDefs.h index 55900697d4..a4c1b06841 100644 --- a/modules/juce_core/system/juce_PlatformDefs.h +++ b/modules/juce_core/system/juce_PlatformDefs.h @@ -294,7 +294,7 @@ namespace juce #define JUCE_COMPILER_SUPPORTS_MOVE_SEMANTICS 1 #endif -#if defined (__clang__) && defined (__has_feature) +#if JUCE_CLANG && defined (__has_feature) #if __has_feature (cxx_nullptr) #define JUCE_COMPILER_SUPPORTS_NULLPTR 1 #endif diff --git a/modules/juce_core/system/juce_TargetPlatform.h b/modules/juce_core/system/juce_TargetPlatform.h index 135172296b..919621a9e0 100644 --- a/modules/juce_core/system/juce_TargetPlatform.h +++ b/modules/juce_core/system/juce_TargetPlatform.h @@ -185,5 +185,8 @@ #error unknown compiler #endif +#ifdef __clang__ + #define JUCE_CLANG 1 +#endif #endif // __JUCE_TARGETPLATFORM_JUCEHEADER__ diff --git a/modules/juce_core/threads/juce_ThreadLocalValue.h b/modules/juce_core/threads/juce_ThreadLocalValue.h index 7009d9e80e..84c45b96e8 100644 --- a/modules/juce_core/threads/juce_ThreadLocalValue.h +++ b/modules/juce_core/threads/juce_ThreadLocalValue.h @@ -28,7 +28,7 @@ // (NB: on win32, native thread-locals aren't possible in a dynamically loaded DLL in XP). #if ! ((JUCE_MSVC && (defined (_WIN64) || ! defined (JucePlugin_PluginCode))) \ - || (JUCE_MAC && defined (__clang__) && defined (MAC_OS_X_VERSION_10_7) \ + || (JUCE_MAC && JUCE_CLANG && defined (MAC_OS_X_VERSION_10_7) \ && MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_7)) #define JUCE_NO_COMPILER_THREAD_LOCAL 1 #endif diff --git a/modules/juce_graphics/colour/juce_PixelFormats.h b/modules/juce_graphics/colour/juce_PixelFormats.h index 2968c0d863..9b3a29b7cc 100644 --- a/modules/juce_graphics/colour/juce_PixelFormats.h +++ b/modules/juce_graphics/colour/juce_PixelFormats.h @@ -77,10 +77,18 @@ public: forcedinline uint8 getGreen() const noexcept { return components.g; } forcedinline uint8 getBlue() const noexcept { return components.b; } + #if JUCE_GCC && ! JUCE_CLANG + // NB these are here as a workaround because GCC refuses to bind to packed values. + forcedinline uint8& getAlpha() noexcept { return comps [indexA]; } + forcedinline uint8& getRed() noexcept { return comps [indexR]; } + forcedinline uint8& getGreen() noexcept { return comps [indexG]; } + forcedinline uint8& getBlue() noexcept { return comps [indexB]; } + #else forcedinline uint8& getAlpha() noexcept { return components.a; } forcedinline uint8& getRed() noexcept { return components.r; } forcedinline uint8& getGreen() noexcept { return components.g; } forcedinline uint8& getBlue() noexcept { return components.b; } + #endif /** Blends another pixel onto this one. @@ -279,6 +287,9 @@ private: { uint32 argb; Components components; + #if JUCE_GCC + uint8 comps[4]; + #endif }; } #ifndef DOXYGEN diff --git a/modules/juce_gui_basics/native/juce_mac_NSViewComponentPeer.mm b/modules/juce_gui_basics/native/juce_mac_NSViewComponentPeer.mm index b69b2570f2..a961ebb5f4 100644 --- a/modules/juce_gui_basics/native/juce_mac_NSViewComponentPeer.mm +++ b/modules/juce_gui_basics/native/juce_mac_NSViewComponentPeer.mm @@ -1788,8 +1788,10 @@ bool KeyPress::isKeyCurrentlyDown (const int keyCode) ModifierKeys ModifierKeys::getCurrentModifiersRealtime() noexcept { + #if defined (MAC_OS_X_VERSION_10_6) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6 if ([NSEvent respondsToSelector: @selector (modifierFlags)]) NSViewComponentPeer::updateModifiers ((NSUInteger) [NSEvent modifierFlags]); + #endif return NSViewComponentPeer::currentModifiers; } diff --git a/modules/juce_gui_basics/native/juce_mac_Windowing.mm b/modules/juce_gui_basics/native/juce_mac_Windowing.mm index 3229756c6d..3f98b87819 100644 --- a/modules/juce_gui_basics/native/juce_mac_Windowing.mm +++ b/modules/juce_gui_basics/native/juce_mac_Windowing.mm @@ -375,6 +375,10 @@ String SystemClipboard::getTextFromClipboard() void Process::setDockIconVisible (bool isVisible) { + #if defined (MAC_OS_X_VERSION_10_6) && (MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_6) [NSApp setActivationPolicy: isVisible ? NSApplicationActivationPolicyRegular : NSApplicationActivationPolicyProhibited]; + #else + jassertfalse; // sorry, not available in 10.5! + #endif }