| @@ -4,6 +4,27 @@ JUCE breaking changes | |||
| Develop | |||
| ======= | |||
| Change | |||
| ------ | |||
| JUCE no longer supports OS X deployment targets earlier than 10.7. | |||
| Possible Issues | |||
| --------------- | |||
| If you were previously targeting OS X 10.5 or 10.6 you will no longer be able | |||
| to build JUCE-based products compatible with those platforms. | |||
| Workaround | |||
| ---------- | |||
| None. With the appropriate JUCE licence you may be able to backport new JUCE | |||
| features, but there will be no official support for this. | |||
| Rationale | |||
| --------- | |||
| Increasing the minimum supported OS X version allows the JUCE codebase to make | |||
| use of the more modern C++ features found in the 10.7 standard library, which | |||
| in turn will increase thread and memory safety. | |||
| Version 5.3.0 | |||
| ============= | |||
| @@ -75,8 +96,8 @@ InAppPurchases object yourself. | |||
| Possible Issues | |||
| --------------- | |||
| Any code using InAppPurchases needs to be updated to retrieve a singleton pointer | |||
| to InAppPurchases. | |||
| Any code using InAppPurchases needs to be updated to retrieve a singleton | |||
| pointer to InAppPurchases. | |||
| Workaround | |||
| ---------- | |||
| @@ -214,6 +214,7 @@ | |||
| BFDAF16175D03695EEB466BC, ); name = Source; sourceTree = "<group>"; }; | |||
| B18D059E5616FA729F764229 = {isa = XCBuildConfiguration; buildSettings = { | |||
| CLANG_CXX_LANGUAGE_STANDARD = "c++14"; | |||
| CLANG_CXX_LIBRARY = "libc++"; | |||
| CLANG_LINK_OBJC_RUNTIME = NO; | |||
| COMBINE_HIDPI_IMAGES = YES; | |||
| CONFIGURATION_BUILD_DIR = "$(PROJECT_DIR)/build/$(CONFIGURATION)"; | |||
| @@ -248,6 +249,7 @@ | |||
| USE_HEADERMAP = NO; }; name = Debug; }; | |||
| 69330F27DD2C71609336C7D2 = {isa = XCBuildConfiguration; buildSettings = { | |||
| CLANG_CXX_LANGUAGE_STANDARD = "c++14"; | |||
| CLANG_CXX_LIBRARY = "libc++"; | |||
| CLANG_LINK_OBJC_RUNTIME = NO; | |||
| COMBINE_HIDPI_IMAGES = YES; | |||
| CONFIGURATION_BUILD_DIR = "$(PROJECT_DIR)/build/$(CONFIGURATION)"; | |||
| @@ -227,6 +227,7 @@ | |||
| ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; | |||
| ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; | |||
| CLANG_CXX_LANGUAGE_STANDARD = "c++14"; | |||
| CLANG_CXX_LIBRARY = "libc++"; | |||
| CLANG_LINK_OBJC_RUNTIME = NO; | |||
| CODE_SIGN_ENTITLEMENTS = "DemoRunner.entitlements"; | |||
| COMBINE_HIDPI_IMAGES = YES; | |||
| @@ -260,6 +261,7 @@ | |||
| ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; | |||
| ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; | |||
| CLANG_CXX_LANGUAGE_STANDARD = "c++14"; | |||
| CLANG_CXX_LIBRARY = "libc++"; | |||
| CLANG_LINK_OBJC_RUNTIME = NO; | |||
| CODE_SIGN_ENTITLEMENTS = "DemoRunner.entitlements"; | |||
| COMBINE_HIDPI_IMAGES = YES; | |||
| @@ -42,7 +42,7 @@ | |||
| #include "../../../Audio/MPEDemo.h" | |||
| #include "../../../Audio/PluckedStringsDemo.h" | |||
| #if (defined (JUCE_STDLIB_HAS_STD_FUNCTION_SUPPORT)) && (defined (JUCE_HAS_CONSTEXPR)) | |||
| #if JUCE_HAS_CONSTEXPR | |||
| #include "../../../Audio/SimpleFFTDemo.h" | |||
| #include "../../../BLOCKS/BlocksDrawingDemo.h" | |||
| #include "../../../BLOCKS/BlocksMonitorDemo.h" | |||
| @@ -71,9 +71,7 @@ | |||
| #include "../../../Utilities/LiveConstantDemo.h" | |||
| #include "../../../Utilities/MultithreadingDemo.h" | |||
| #include "../../../Utilities/NetworkingDemo.h" | |||
| #if defined (JUCE_STDLIB_HAS_STD_FUNCTION_SUPPORT) | |||
| #include "../../../Utilities/OSCDemo.h" | |||
| #endif | |||
| #include "../../../Utilities/OSCDemo.h" | |||
| #include "../../../Utilities/SystemInfoDemo.h" | |||
| #include "../../../Utilities/TimersAndEventsDemo.h" | |||
| #include "../../../Utilities/UnitTestsDemo.h" | |||
| @@ -92,7 +90,7 @@ void registerDemos_One() noexcept | |||
| REGISTER_DEMO (MPEDemo, Audio, false) | |||
| REGISTER_DEMO (PluckedStringsDemo, Audio, false) | |||
| #if (defined (JUCE_STDLIB_HAS_STD_FUNCTION_SUPPORT)) && (defined (JUCE_HAS_CONSTEXPR)) | |||
| #if JUCE_HAS_CONSTEXPR | |||
| REGISTER_DEMO (SimpleFFTDemo, Audio, false) | |||
| REGISTER_DEMO (BlocksDrawingDemo, BLOCKS, false) | |||
| REGISTER_DEMO (BlocksMonitorDemo, BLOCKS, false) | |||
| @@ -120,9 +118,7 @@ void registerDemos_One() noexcept | |||
| REGISTER_DEMO (LiveConstantDemo, Utilities, false) | |||
| REGISTER_DEMO (MultithreadingDemo, Utilities, false) | |||
| REGISTER_DEMO (NetworkingDemo, Utilities, false) | |||
| #if defined (JUCE_STDLIB_HAS_STD_FUNCTION_SUPPORT) | |||
| REGISTER_DEMO (OSCDemo, Utilities, false) | |||
| #endif | |||
| REGISTER_DEMO (SystemInfoDemo, Utilities, false) | |||
| REGISTER_DEMO (TimersAndEventsDemo, Utilities, false) | |||
| REGISTER_DEMO_WITH_FILENAME (UnitTestClasses::UnitTestsDemo, Utilities, UnitTestsDemo, false) | |||
| @@ -43,12 +43,10 @@ | |||
| #include "../../../GUI/ComponentDemo.h" | |||
| #include "../../../GUI/ComponentTransformsDemo.h" | |||
| #include "../../../GUI/DialogsDemo.h" | |||
| #if JUCE_COMPILER_SUPPORTS_INITIALIZER_LISTS | |||
| #include "../../../GUI/FlexBoxDemo.h" | |||
| #endif | |||
| #include "../../../GUI/FlexBoxDemo.h" | |||
| #include "../../../GUI/FontsDemo.h" | |||
| #include "../../../GUI/GraphicsDemo.h" | |||
| #if JUCE_COMPILER_SUPPORTS_INITIALIZER_LISTS && JUCE_HAS_CONSTEXPR | |||
| #if JUCE_HAS_CONSTEXPR | |||
| #include "../../../GUI/GridDemo.h" | |||
| #endif | |||
| #include "../../../GUI/ImagesDemo.h" | |||
| @@ -84,12 +82,10 @@ void registerDemos_Two() noexcept | |||
| REGISTER_DEMO (ComponentDemo, GUI, false) | |||
| REGISTER_DEMO (ComponentTransformsDemo, GUI, false) | |||
| REGISTER_DEMO (DialogsDemo, GUI, false) | |||
| #if JUCE_COMPILER_SUPPORTS_INITIALIZER_LISTS | |||
| REGISTER_DEMO (FlexBoxDemo, GUI, false) | |||
| #endif | |||
| REGISTER_DEMO (FontsDemo, GUI, false) | |||
| REGISTER_DEMO (GraphicsDemo, GUI, false) | |||
| #if JUCE_COMPILER_SUPPORTS_INITIALIZER_LISTS && JUCE_HAS_CONSTEXPR | |||
| #if JUCE_HAS_CONSTEXPR | |||
| REGISTER_DEMO (GridDemo, GUI, false) | |||
| #endif | |||
| REGISTER_DEMO (ImagesDemo, GUI, false) | |||
| @@ -125,6 +125,7 @@ | |||
| 1DFEAF972822E305E013CC06, ); name = Source; sourceTree = "<group>"; }; | |||
| 19B7C16D592FB25D09022191 = {isa = XCBuildConfiguration; buildSettings = { | |||
| CLANG_CXX_LANGUAGE_STANDARD = "c++14"; | |||
| CLANG_CXX_LIBRARY = "libc++"; | |||
| CLANG_LINK_OBJC_RUNTIME = NO; | |||
| COMBINE_HIDPI_IMAGES = YES; | |||
| CONFIGURATION_BUILD_DIR = "$(PROJECT_DIR)/build/$(CONFIGURATION)"; | |||
| @@ -156,6 +157,7 @@ | |||
| USE_HEADERMAP = NO; }; name = Debug; }; | |||
| B7A6988E30C0A68B01EDC53B = {isa = XCBuildConfiguration; buildSettings = { | |||
| CLANG_CXX_LANGUAGE_STANDARD = "c++14"; | |||
| CLANG_CXX_LIBRARY = "libc++"; | |||
| CLANG_LINK_OBJC_RUNTIME = NO; | |||
| COMBINE_HIDPI_IMAGES = YES; | |||
| CONFIGURATION_BUILD_DIR = "$(PROJECT_DIR)/build/$(CONFIGURATION)"; | |||
| @@ -136,6 +136,7 @@ | |||
| ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; | |||
| ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; | |||
| CLANG_CXX_LANGUAGE_STANDARD = "c++14"; | |||
| CLANG_CXX_LIBRARY = "libc++"; | |||
| CLANG_LINK_OBJC_RUNTIME = NO; | |||
| COMBINE_HIDPI_IMAGES = YES; | |||
| CONFIGURATION_BUILD_DIR = "$(PROJECT_DIR)/build/$(CONFIGURATION)"; | |||
| @@ -166,6 +167,7 @@ | |||
| ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; | |||
| ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; | |||
| CLANG_CXX_LANGUAGE_STANDARD = "c++14"; | |||
| CLANG_CXX_LIBRARY = "libc++"; | |||
| CLANG_LINK_OBJC_RUNTIME = NO; | |||
| COMBINE_HIDPI_IMAGES = YES; | |||
| CONFIGURATION_BUILD_DIR = "$(PROJECT_DIR)/build/$(CONFIGURATION)"; | |||
| @@ -197,6 +197,7 @@ | |||
| D85C0D11EE4F6C73B9EB5BCD, ); name = Source; sourceTree = "<group>"; }; | |||
| C8B793AC1BEFBE7A99BE8352 = {isa = XCBuildConfiguration; buildSettings = { | |||
| CLANG_CXX_LANGUAGE_STANDARD = "c++14"; | |||
| CLANG_CXX_LIBRARY = "libc++"; | |||
| CLANG_LINK_OBJC_RUNTIME = NO; | |||
| COMBINE_HIDPI_IMAGES = YES; | |||
| CONFIGURATION_BUILD_DIR = "$(PROJECT_DIR)/build/$(CONFIGURATION)"; | |||
| @@ -229,6 +230,7 @@ | |||
| USE_HEADERMAP = NO; }; name = Debug; }; | |||
| 49453CC5AD9F08D2738464AC = {isa = XCBuildConfiguration; buildSettings = { | |||
| CLANG_CXX_LANGUAGE_STANDARD = "c++14"; | |||
| CLANG_CXX_LIBRARY = "libc++"; | |||
| CLANG_LINK_OBJC_RUNTIME = NO; | |||
| COMBINE_HIDPI_IMAGES = YES; | |||
| CONFIGURATION_BUILD_DIR = "$(PROJECT_DIR)/build/$(CONFIGURATION)"; | |||
| @@ -199,6 +199,7 @@ | |||
| ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; | |||
| ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; | |||
| CLANG_CXX_LANGUAGE_STANDARD = "c++14"; | |||
| CLANG_CXX_LIBRARY = "libc++"; | |||
| CLANG_LINK_OBJC_RUNTIME = NO; | |||
| COMBINE_HIDPI_IMAGES = YES; | |||
| CONFIGURATION_BUILD_DIR = "$(PROJECT_DIR)/build/$(CONFIGURATION)"; | |||
| @@ -229,6 +230,7 @@ | |||
| ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; | |||
| ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; | |||
| CLANG_CXX_LANGUAGE_STANDARD = "c++14"; | |||
| CLANG_CXX_LIBRARY = "libc++"; | |||
| CLANG_LINK_OBJC_RUNTIME = NO; | |||
| COMBINE_HIDPI_IMAGES = YES; | |||
| CONFIGURATION_BUILD_DIR = "$(PROJECT_DIR)/build/$(CONFIGURATION)"; | |||
| @@ -47,6 +47,7 @@ | |||
| 70A875922C34E55D4F48A196, ); name = Source; sourceTree = "<group>"; }; | |||
| 00F18709927DE6070FBA7BD0 = {isa = XCBuildConfiguration; buildSettings = { | |||
| CLANG_CXX_LANGUAGE_STANDARD = "c++14"; | |||
| CLANG_CXX_LIBRARY = "libc++"; | |||
| CLANG_LINK_OBJC_RUNTIME = NO; | |||
| COMBINE_HIDPI_IMAGES = YES; | |||
| CONFIGURATION_BUILD_DIR = "$(PROJECT_DIR)/build/$(CONFIGURATION)"; | |||
| @@ -76,6 +77,7 @@ | |||
| USE_HEADERMAP = NO; }; name = Debug; }; | |||
| 8A190EF24B99F557190320DA = {isa = XCBuildConfiguration; buildSettings = { | |||
| CLANG_CXX_LANGUAGE_STANDARD = "c++14"; | |||
| CLANG_CXX_LIBRARY = "libc++"; | |||
| CLANG_LINK_OBJC_RUNTIME = NO; | |||
| COMBINE_HIDPI_IMAGES = YES; | |||
| CONFIGURATION_BUILD_DIR = "$(PROJECT_DIR)/build/$(CONFIGURATION)"; | |||
| @@ -159,6 +159,7 @@ | |||
| 8B59A884C62D960EE9DFEF47, ); name = Source; sourceTree = "<group>"; }; | |||
| EE7498599191DDC73ECB55B0 = {isa = XCBuildConfiguration; buildSettings = { | |||
| CLANG_CXX_LANGUAGE_STANDARD = "c++14"; | |||
| CLANG_CXX_LIBRARY = "libc++"; | |||
| CLANG_LINK_OBJC_RUNTIME = NO; | |||
| COMBINE_HIDPI_IMAGES = YES; | |||
| CONFIGURATION_BUILD_DIR = "$(PROJECT_DIR)/build/$(CONFIGURATION)"; | |||
| @@ -190,6 +191,7 @@ | |||
| USE_HEADERMAP = NO; }; name = Debug; }; | |||
| 2E06386CE7CCA5FF76819BFF = {isa = XCBuildConfiguration; buildSettings = { | |||
| CLANG_CXX_LANGUAGE_STANDARD = "c++14"; | |||
| CLANG_CXX_LIBRARY = "libc++"; | |||
| CLANG_LINK_OBJC_RUNTIME = NO; | |||
| COMBINE_HIDPI_IMAGES = YES; | |||
| CONFIGURATION_BUILD_DIR = "$(PROJECT_DIR)/build/$(CONFIGURATION)"; | |||
| @@ -170,6 +170,7 @@ | |||
| ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; | |||
| ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; | |||
| CLANG_CXX_LANGUAGE_STANDARD = "c++14"; | |||
| CLANG_CXX_LIBRARY = "libc++"; | |||
| CLANG_LINK_OBJC_RUNTIME = NO; | |||
| COMBINE_HIDPI_IMAGES = YES; | |||
| CONFIGURATION_BUILD_DIR = "$(PROJECT_DIR)/build/$(CONFIGURATION)"; | |||
| @@ -200,6 +201,7 @@ | |||
| ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; | |||
| ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; | |||
| CLANG_CXX_LANGUAGE_STANDARD = "c++14"; | |||
| CLANG_CXX_LIBRARY = "libc++"; | |||
| CLANG_LINK_OBJC_RUNTIME = NO; | |||
| COMBINE_HIDPI_IMAGES = YES; | |||
| CONFIGURATION_BUILD_DIR = "$(PROJECT_DIR)/build/$(CONFIGURATION)"; | |||
| @@ -33,7 +33,7 @@ namespace | |||
| const char* const osxVersionDefault = "10.11"; | |||
| const char* const iosVersionDefault = "9.3"; | |||
| const int oldestSDKVersion = 5; | |||
| const int oldestSDKVersion = 7; | |||
| const int currentSDKVersion = 13; | |||
| const int minimumAUv3SDKVersion = 11; | |||
| @@ -421,7 +421,6 @@ protected: | |||
| osxArchitecture (config, Ids::osxArchitecture, getUndoManager(), osxArch_Default), | |||
| customXcodeFlags (config, Ids::customXcodeFlags, getUndoManager()), | |||
| plistPreprocessorDefinitions (config, Ids::plistPreprocessorDefinitions, getUndoManager()), | |||
| cppStandardLibrary (config, Ids::cppLibType, getUndoManager()), | |||
| codeSignIdentity (config, Ids::codeSigningIdentity, getUndoManager(), iOS ? "iPhone Developer" : "Mac Developer"), | |||
| fastMathEnabled (config, Ids::fastMath, getUndoManager()), | |||
| stripLocalSymbolsEnabled (config, Ids::stripLocalSymbols, getUndoManager()), | |||
| @@ -487,11 +486,6 @@ protected: | |||
| props.add (new TextPropertyComponent (plistPreprocessorDefinitions, "PList Preprocessor Definitions", 2048, true), | |||
| "Preprocessor definitions used during PList preprocessing (see PList Preprocess)."); | |||
| props.add (new ChoicePropertyComponent (cppStandardLibrary, "C++ Library", | |||
| { "LLVM libc++", "GNU libstdc++" }, | |||
| { "libc++", "libstdc++" }), | |||
| "The type of C++ std lib that will be linked."); | |||
| props.add (new TextPropertyComponent (codeSignIdentity, "Code-Signing Identity", 1024, false), | |||
| "The name of a code-signing identity for Xcode to apply."); | |||
| @@ -514,8 +508,6 @@ protected: | |||
| bool isFastMathEnabled() const { return fastMathEnabled.get(); } | |||
| String getCPPStandardLibraryString() const { return cppStandardLibrary.get(); } | |||
| bool isStripLocalSymbolsEnabled() const { return stripLocalSymbolsEnabled.get(); } | |||
| String getCustomXcodeFlagsString() const { return customXcodeFlags.get(); } | |||
| @@ -540,7 +532,7 @@ protected: | |||
| bool iOS; | |||
| ValueWithDefault osxSDKVersion, osxDeploymentTarget, iosDeploymentTarget, osxArchitecture, | |||
| customXcodeFlags, plistPreprocessorDefinitions, cppStandardLibrary, codeSignIdentity, | |||
| customXcodeFlags, plistPreprocessorDefinitions, codeSignIdentity, | |||
| fastMathEnabled, stripLocalSymbolsEnabled, pluginBinaryCopyStepEnabled, | |||
| vstBinaryLocation, vst3BinaryLocation, auBinaryLocation, rtasBinaryLocation, aaxBinaryLocation; | |||
| @@ -1129,8 +1121,7 @@ public: | |||
| : "c++") + cppStandard).quoted()); | |||
| } | |||
| if (config.getCPPStandardLibraryString().isNotEmpty()) | |||
| s.set ("CLANG_CXX_LIBRARY", config.getCPPStandardLibraryString().quoted()); | |||
| s.set ("CLANG_CXX_LIBRARY", "\"libc++\""); | |||
| s.set ("COMBINE_HIDPI_IMAGES", "YES"); | |||
| @@ -1577,8 +1568,8 @@ public: | |||
| = RelativePath (owner.getAAXPathValue().toString(), RelativePath::projectFolder) | |||
| .getChildFile ("Libs"); | |||
| String libraryPath (config.isDebug() ? "Debug/libAAXLibrary" : "Release/libAAXLibrary"); | |||
| libraryPath += (isUsingClangCppLibrary (config) ? "_libcpp.a" : ".a"); | |||
| String libraryPath (config.isDebug() ? "Debug" : "Release"); | |||
| libraryPath += "/libAAXLibrary_libcpp.a"; | |||
| extraLibs.add (aaxLibsFolder.getChildFile (libraryPath)); | |||
| } | |||
| @@ -1639,25 +1630,6 @@ public: | |||
| return targetExtraSearchPaths; | |||
| } | |||
| bool isUsingClangCppLibrary (const BuildConfiguration& config) const | |||
| { | |||
| if (auto xcodeConfig = dynamic_cast<const XcodeBuildConfiguration*> (&config)) | |||
| { | |||
| auto configValue = xcodeConfig->getCPPStandardLibraryString(); | |||
| if (configValue.isNotEmpty()) | |||
| return (configValue == "libc++"); | |||
| auto minorOSXDeploymentTarget = getOSXDeploymentTarget (*xcodeConfig) | |||
| .fromLastOccurrenceOf (".", false, false) | |||
| .getIntValue(); | |||
| return (minorOSXDeploymentTarget > 8); | |||
| } | |||
| return false; | |||
| } | |||
| String getOSXDeploymentTarget (const XcodeBuildConfiguration& config, String* sdkRoot = nullptr) const | |||
| { | |||
| auto sdk = config.getOSXSDKVersionString(); | |||
| @@ -173,6 +173,7 @@ | |||
| 6D697538ADDCFBB6C79AC6C6, ); name = Source; sourceTree = "<group>"; }; | |||
| A81C9C5D3696F83D5E8CFE11 = {isa = XCBuildConfiguration; buildSettings = { | |||
| CLANG_CXX_LANGUAGE_STANDARD = "c++14"; | |||
| CLANG_CXX_LIBRARY = "libc++"; | |||
| CLANG_LINK_OBJC_RUNTIME = NO; | |||
| COMBINE_HIDPI_IMAGES = YES; | |||
| CONFIGURATION_BUILD_DIR = "$(PROJECT_DIR)/build/$(CONFIGURATION)"; | |||
| @@ -204,6 +205,7 @@ | |||
| USE_HEADERMAP = NO; }; name = Debug; }; | |||
| 962CC7E0A536C3F56DBE1F8F = {isa = XCBuildConfiguration; buildSettings = { | |||
| CLANG_CXX_LANGUAGE_STANDARD = "c++14"; | |||
| CLANG_CXX_LIBRARY = "libc++"; | |||
| CLANG_LINK_OBJC_RUNTIME = NO; | |||
| COMBINE_HIDPI_IMAGES = YES; | |||
| CONFIGURATION_BUILD_DIR = "$(PROJECT_DIR)/build/$(CONFIGURATION)"; | |||
| @@ -66,18 +66,10 @@ protected: | |||
| /** Constructor for AudioProcessors which use layout maps | |||
| If your AudioProcessor uses layout maps then use this constructor. | |||
| */ | |||
| #if JUCE_COMPILER_SUPPORTS_INITIALIZER_LISTS | |||
| AudioProcessor (const std::initializer_list<const short[2]>& channelLayoutList) | |||
| : AudioProcessor (busesPropertiesFromLayoutArray (layoutListToArray (channelLayoutList))) | |||
| { | |||
| } | |||
| #else | |||
| template <int numLayouts> | |||
| AudioProcessor (const short (&channelLayoutList) [numLayouts][2]) | |||
| : AudioProcessor (busesPropertiesFromLayoutArray (layoutListToArray (channelLayoutList))) | |||
| { | |||
| } | |||
| #endif | |||
| public: | |||
| //============================================================================== | |||
| @@ -766,12 +758,10 @@ public: | |||
| } | |||
| @endcode | |||
| */ | |||
| #if JUCE_COMPILER_SUPPORTS_INITIALIZER_LISTS | |||
| static bool containsLayout (const BusesLayout& layouts, const std::initializer_list<const short[2]>& channelLayoutList) | |||
| { | |||
| return containsLayout (layouts, layoutListToArray (channelLayoutList)); | |||
| } | |||
| #endif | |||
| template <int numLayouts> | |||
| static bool containsLayout (const BusesLayout& layouts, const short (&channelLayoutList) [numLayouts][2]) | |||
| @@ -1590,7 +1580,6 @@ private: | |||
| return layouts; | |||
| } | |||
| #if JUCE_COMPILER_SUPPORTS_INITIALIZER_LISTS | |||
| static Array<InOutChannelPair> layoutListToArray (const std::initializer_list<const short[2]>& configuration) | |||
| { | |||
| Array<InOutChannelPair> layouts; | |||
| @@ -1600,7 +1589,6 @@ private: | |||
| return layouts; | |||
| } | |||
| #endif | |||
| //============================================================================== | |||
| static BusesProperties busesPropertiesFromLayoutArray (const Array<InOutChannelPair>&); | |||
| @@ -22,9 +22,9 @@ | |||
| #include "juce_blocks_basics.h" | |||
| #if (! defined (JUCE_STDLIB_HAS_STD_FUNCTION_SUPPORT)) || (! defined (JUCE_HAS_CONSTEXPR)) | |||
| #if ! JUCE_HAS_CONSTEXPR | |||
| #ifndef JUCE_DEMO_RUNNER | |||
| #error "juce_blocks_basics module requires your compiler to have a newer version of the standard library" | |||
| #error "The juce_blocks_basics module requires a compiler that supports constexpr" | |||
| #endif | |||
| #else | |||
| @@ -50,9 +50,9 @@ | |||
| #include <juce_events/juce_events.h> | |||
| #include <juce_audio_devices/juce_audio_devices.h> | |||
| #if (! defined (JUCE_STDLIB_HAS_STD_FUNCTION_SUPPORT)) || (! defined (JUCE_HAS_CONSTEXPR)) | |||
| #if ! JUCE_HAS_CONSTEXPR | |||
| #ifndef JUCE_DEMO_RUNNER | |||
| #error "juce_blocks_basics module requires your compiler to have a newer version of the standard library" | |||
| #error "The juce_blocks_basics module requires a compiler that supports constexpr" | |||
| #endif | |||
| #else | |||
| @@ -135,13 +135,11 @@ public: | |||
| addAssumingCapacityIsReady (static_cast<ElementType&&> (firstNewElement), otherElements...); | |||
| } | |||
| #if JUCE_COMPILER_SUPPORTS_INITIALIZER_LISTS | |||
| template <typename TypeToCreateFrom> | |||
| Array (const std::initializer_list<TypeToCreateFrom>& items) | |||
| { | |||
| addArray (items); | |||
| } | |||
| #endif | |||
| /** Destructor. */ | |||
| ~Array() | |||
| @@ -658,7 +656,6 @@ public: | |||
| } | |||
| } | |||
| #if JUCE_COMPILER_SUPPORTS_INITIALIZER_LISTS | |||
| template <typename TypeToCreateFrom> | |||
| void addArray (const std::initializer_list<TypeToCreateFrom>& items) | |||
| { | |||
| @@ -671,7 +668,6 @@ public: | |||
| ++numUsed; | |||
| } | |||
| } | |||
| #endif | |||
| /** Adds elements from a null-terminated array of pointers to the end of this array. | |||
| @@ -66,7 +66,7 @@ public: | |||
| deleteAllObjects(); | |||
| } | |||
| /** Move constructor */ | |||
| /** Move constructor. */ | |||
| OwnedArray (OwnedArray&& other) noexcept | |||
| : data (static_cast<ArrayAllocationBase <ObjectClass*, TypeOfCriticalSectionToUse>&&> (other.data)), | |||
| numUsed (other.numUsed) | |||
| @@ -74,14 +74,13 @@ public: | |||
| other.numUsed = 0; | |||
| } | |||
| #if JUCE_COMPILER_SUPPORTS_INITIALIZER_LISTS | |||
| /** Creates an array from a list of objects. */ | |||
| OwnedArray (const std::initializer_list<ObjectClass*>& items) | |||
| { | |||
| addArray (items); | |||
| } | |||
| #endif | |||
| /** Move assignment operator */ | |||
| /** Move assignment operator. */ | |||
| OwnedArray& operator= (OwnedArray&& other) noexcept | |||
| { | |||
| const ScopedLockType lock (getLock()); | |||
| @@ -478,7 +477,7 @@ public: | |||
| } | |||
| } | |||
| #if JUCE_COMPILER_SUPPORTS_INITIALIZER_LISTS | |||
| /** Adds elements from another array to the end of this array. */ | |||
| template <typename OtherArrayType> | |||
| void addArray (const std::initializer_list<OtherArrayType>& items) | |||
| { | |||
| @@ -491,7 +490,6 @@ public: | |||
| ++numUsed; | |||
| } | |||
| } | |||
| #endif | |||
| /** Adds copies of the elements in another array to the end of this array. | |||
| @@ -31,401 +31,116 @@ namespace juce | |||
| } | |||
| #endif | |||
| #if JUCE_ATOMIC_AVAILABLE | |||
| //============================================================================== | |||
| /** | |||
| A simple wrapper around std::atomic. | |||
| @tags{Core} | |||
| */ | |||
| template <typename Type> | |||
| struct Atomic final | |||
| { | |||
| typedef typename AtomicHelpers::DiffTypeHelper<Type>::Type DiffType; | |||
| /** Creates a new value, initialised to zero. */ | |||
| Atomic() noexcept : value (0) {} | |||
| /** Creates a new value, with a given initial value. */ | |||
| Atomic (Type initialValue) noexcept : value (initialValue) {} | |||
| /** Copies another value (atomically). */ | |||
| Atomic (const Atomic& other) noexcept : value (other.get()) {} | |||
| /** Destructor. */ | |||
| ~Atomic() noexcept | |||
| { | |||
| #if __cpp_lib_atomic_is_always_lock_free | |||
| static_assert (std::atomic<Type>::is_always_lock_free, | |||
| "This class can only be used for lock-free types"); | |||
| #endif | |||
| } | |||
| /** Atomically reads and returns the current value. */ | |||
| Type get() const noexcept { return value.load(); } | |||
| /** Atomically sets the current value. */ | |||
| void set (Type newValue) noexcept { value = newValue; } | |||
| /** Atomically sets the current value, returning the value that was replaced. */ | |||
| Type exchange (Type newValue) noexcept { return value.exchange (newValue); } | |||
| /** Atomically compares this value with a target value, and if it is equal, sets | |||
| this to be equal to a new value. | |||
| This operation is the atomic equivalent of doing this: | |||
| @code | |||
| bool compareAndSetBool (Type newValue, Type valueToCompare) | |||
| { | |||
| if (get() == valueToCompare) | |||
| { | |||
| set (newValue); | |||
| return true; | |||
| } | |||
| return false; | |||
| } | |||
| @endcode | |||
| Internally, this method calls std::atomic::compare_exchange_strong with | |||
| memory_order_seq_cst (the strictest std::memory_order). | |||
| @returns true if the comparison was true and the value was replaced; false if | |||
| the comparison failed and the value was left unchanged. | |||
| @see compareAndSetValue | |||
| */ | |||
| bool compareAndSetBool (Type newValue, Type valueToCompare) noexcept | |||
| { | |||
| return value.compare_exchange_strong (valueToCompare, newValue); | |||
| } | |||
| /** Copies another value into this one (atomically). */ | |||
| Atomic<Type>& operator= (const Atomic& other) noexcept | |||
| { | |||
| value = other.value.load(); | |||
| return *this; | |||
| } | |||
| /** Copies another value into this one (atomically). */ | |||
| Atomic<Type>& operator= (Type newValue) noexcept | |||
| { | |||
| value = newValue; | |||
| return *this; | |||
| } | |||
| /** Atomically adds a number to this value, returning the new value. */ | |||
| Type operator+= (DiffType amountToAdd) noexcept { return value += amountToAdd; } | |||
| /** Atomically subtracts a number from this value, returning the new value. */ | |||
| Type operator-= (DiffType amountToSubtract) noexcept { return value -= amountToSubtract; } | |||
| /** Atomically increments this value, returning the new value. */ | |||
| Type operator++() noexcept { return ++value; } | |||
| /** Atomically decrements this value, returning the new value. */ | |||
| Type operator--() noexcept { return --value; } | |||
| /** Implements a memory read/write barrier. | |||
| Internally this calls std::atomic_thread_fence with | |||
| memory_order_seq_cst (the strictest std::memory_order). | |||
| */ | |||
| void memoryBarrier() noexcept { atomic_thread_fence (std::memory_order_seq_cst); } | |||
| /** The std::atomic object that this class operates on. */ | |||
| std::atomic<Type> value; | |||
| //============================================================================== | |||
| #ifndef DOXYGEN | |||
| /* This method has been deprecated as there is no equivalent method in | |||
| std::atomic. Use compareAndSetBool instead. | |||
| */ | |||
| JUCE_DEPRECATED (Type compareAndSetValue (Type, Type) noexcept); | |||
| #endif | |||
| }; | |||
| #else | |||
| #if JUCE_MSVC | |||
| JUCE_COMPILER_WARNING ("You must use a version of MSVC which supports std::atomic") | |||
| #endif | |||
| #if JUCE_IOS || JUCE_ANDROID // (64-bit ops will compile but not link) | |||
| #define JUCE_64BIT_ATOMICS_UNAVAILABLE 1 | |||
| #endif | |||
| #ifndef DOXYGEN | |||
| template <typename Type> class AtomicBase; | |||
| #endif | |||
| //============================================================================== | |||
| /** | |||
| Simple class to hold a primitive value and perform atomic operations on it. | |||
| The type used must be a 32 or 64 bit primitive, like an int, pointer, etc. | |||
| There are methods to perform most of the basic atomic operations. | |||
| @tags{Core} | |||
| */ | |||
| template <typename Type> | |||
| class Atomic final : public AtomicBase<Type> | |||
| { | |||
| public: | |||
| /** Resulting type when subtracting the underlying Type. */ | |||
| typedef typename AtomicBase<Type>::DiffType DiffType; | |||
| /** Creates a new value, initialised to zero. */ | |||
| inline Atomic() noexcept {} | |||
| /** Creates a new value, with a given initial value. */ | |||
| inline explicit Atomic (const Type initialValue) noexcept : AtomicBase<Type> (initialValue) {} | |||
| /** Copies another value (atomically). */ | |||
| inline Atomic (const Atomic& other) noexcept : AtomicBase<Type> (other) {} | |||
| /** Destructor. */ | |||
| inline ~Atomic() noexcept | |||
| { | |||
| static_assert (sizeof (Type) == 4 || sizeof (Type) == 8, | |||
| "Atomic can only be used for types which are 32 or 64 bits in size"); | |||
| } | |||
| /** Atomically reads and returns the current value. */ | |||
| inline Type get() const noexcept { return AtomicBase<Type>::get(); } | |||
| /** Copies another value into this one (atomically). */ | |||
| inline Atomic& operator= (const Atomic& other) noexcept { AtomicBase<Type>::operator= (other); return *this; } | |||
| /** Copies another value into this one (atomically). */ | |||
| inline Atomic& operator= (const Type newValue) noexcept { AtomicBase<Type>::operator= (newValue); return *this; } | |||
| /** Atomically sets the current value. */ | |||
| inline void set (Type newValue) noexcept { exchange (newValue); } | |||
| /** Atomically sets the current value, returning the value that was replaced. */ | |||
| inline Type exchange (Type v) noexcept { return AtomicBase<Type>::exchange (v); } | |||
| /** Atomically adds a number to this value, returning the new value. */ | |||
| Type operator+= (DiffType amountToAdd) noexcept; | |||
| /** Atomically subtracts a number from this value, returning the new value. */ | |||
| Type operator-= (DiffType amountToSubtract) noexcept; | |||
| /** Atomically increments this value, returning the new value. */ | |||
| Type operator++() noexcept; | |||
| /** Atomically decrements this value, returning the new value. */ | |||
| Type operator--() noexcept; | |||
| /** Atomically compares this value with a target value, and if it is equal, sets | |||
| this to be equal to a new value. | |||
| This operation is the atomic equivalent of doing this: | |||
| @code | |||
| bool compareAndSetBool (Type newValue, Type valueToCompare) | |||
| { | |||
| if (get() == valueToCompare) | |||
| { | |||
| set (newValue); | |||
| return true; | |||
| } | |||
| return false; | |||
| } | |||
| @endcode | |||
| @returns true if the comparison was true and the value was replaced; false if | |||
| the comparison failed and the value was left unchanged. | |||
| @see compareAndSetValue | |||
| */ | |||
| inline bool compareAndSetBool (Type newValue, Type valueToCompare) noexcept { return AtomicBase<Type>::compareAndSetBool (newValue, valueToCompare); } | |||
| /** Atomically compares this value with a target value, and if it is equal, sets | |||
| this to be equal to a new value. | |||
| This operation is the atomic equivalent of doing this: | |||
| @code | |||
| Type compareAndSetValue (Type newValue, Type valueToCompare) | |||
| { | |||
| Type oldValue = get(); | |||
| if (oldValue == valueToCompare) | |||
| set (newValue); | |||
| return oldValue; | |||
| } | |||
| @endcode | |||
| @returns the old value before it was changed. | |||
| @see compareAndSetBool | |||
| */ | |||
| inline Type compareAndSetValue (Type newValue, Type valueToCompare) noexcept { return AtomicBase<Type>::compareAndSetValue (newValue, valueToCompare); } | |||
| /** Implements a memory read/write barrier. */ | |||
| static inline void memoryBarrier() noexcept { AtomicBase<Type>::memoryBarrier(); } | |||
| }; | |||
| #if ! DOXYGEN | |||
| //============================================================================== | |||
| /** | |||
| A simple wrapper around std::atomic. | |||
| //============================================================================== | |||
| // Internal implementation follows | |||
| //============================================================================== | |||
| template <typename Type> | |||
| class AtomicBase | |||
| { | |||
| public: | |||
| typedef typename AtomicHelpers::DiffTypeHelper<Type>::Type DiffType; | |||
| inline AtomicBase() noexcept : value (0) {} | |||
| inline explicit AtomicBase (const Type v) noexcept : value (v) {} | |||
| inline AtomicBase (const AtomicBase& other) noexcept : value (other.get()) {} | |||
| Type get() const noexcept; | |||
| inline AtomicBase& operator= (const AtomicBase<Type>& other) noexcept { exchange (other.get()); return *this; } | |||
| inline AtomicBase& operator= (const Type newValue) noexcept { exchange (newValue); return *this; } | |||
| void set (Type newValue) noexcept { exchange (newValue); } | |||
| Type exchange (Type) noexcept; | |||
| bool compareAndSetBool (Type, Type) noexcept; | |||
| Type compareAndSetValue (Type, Type) noexcept; | |||
| static void memoryBarrier() noexcept; | |||
| //============================================================================== | |||
| #if JUCE_64BIT | |||
| JUCE_ALIGN (8) | |||
| #else | |||
| JUCE_ALIGN (4) | |||
| #endif | |||
| /** The raw value that this class operates on. | |||
| This is exposed publicly in case you need to manipulate it directly | |||
| for performance reasons. | |||
| @tags{Core} | |||
| */ | |||
| template <typename Type> | |||
| struct Atomic final | |||
| { | |||
| typedef typename AtomicHelpers::DiffTypeHelper<Type>::Type DiffType; | |||
| /** Creates a new value, initialised to zero. */ | |||
| Atomic() noexcept : value (0) {} | |||
| /** Creates a new value, with a given initial value. */ | |||
| Atomic (Type initialValue) noexcept : value (initialValue) {} | |||
| /** Copies another value (atomically). */ | |||
| Atomic (const Atomic& other) noexcept : value (other.get()) {} | |||
| /** Destructor. */ | |||
| ~Atomic() noexcept | |||
| { | |||
| #if __cpp_lib_atomic_is_always_lock_free | |||
| static_assert (std::atomic<Type>::is_always_lock_free, | |||
| "This class can only be used for lock-free types"); | |||
| #endif | |||
| } | |||
| /** Atomically reads and returns the current value. */ | |||
| Type get() const noexcept { return value.load(); } | |||
| /** Atomically sets the current value. */ | |||
| void set (Type newValue) noexcept { value = newValue; } | |||
| /** Atomically sets the current value, returning the value that was replaced. */ | |||
| Type exchange (Type newValue) noexcept { return value.exchange (newValue); } | |||
| /** Atomically compares this value with a target value, and if it is equal, sets | |||
| this to be equal to a new value. | |||
| This operation is the atomic equivalent of doing this: | |||
| @code | |||
| bool compareAndSetBool (Type newValue, Type valueToCompare) | |||
| { | |||
| if (get() == valueToCompare) | |||
| { | |||
| set (newValue); | |||
| return true; | |||
| } | |||
| return false; | |||
| } | |||
| @endcode | |||
| Internally, this method calls std::atomic::compare_exchange_strong with | |||
| memory_order_seq_cst (the strictest std::memory_order). | |||
| @returns true if the comparison was true and the value was replaced; false if | |||
| the comparison failed and the value was left unchanged. | |||
| @see compareAndSetValue | |||
| */ | |||
| bool compareAndSetBool (Type newValue, Type valueToCompare) noexcept | |||
| { | |||
| return value.compare_exchange_strong (valueToCompare, newValue); | |||
| } | |||
| /** Copies another value into this one (atomically). */ | |||
| Atomic<Type>& operator= (const Atomic& other) noexcept | |||
| { | |||
| value = other.value.load(); | |||
| return *this; | |||
| } | |||
| /** Copies another value into this one (atomically). */ | |||
| Atomic<Type>& operator= (Type newValue) noexcept | |||
| { | |||
| value = newValue; | |||
| return *this; | |||
| } | |||
| /** Atomically adds a number to this value, returning the new value. */ | |||
| Type operator+= (DiffType amountToAdd) noexcept { return value += amountToAdd; } | |||
| /** Atomically subtracts a number from this value, returning the new value. */ | |||
| Type operator-= (DiffType amountToSubtract) noexcept { return value -= amountToSubtract; } | |||
| /** Atomically increments this value, returning the new value. */ | |||
| Type operator++() noexcept { return ++value; } | |||
| /** Atomically decrements this value, returning the new value. */ | |||
| Type operator--() noexcept { return --value; } | |||
| /** Implements a memory read/write barrier. | |||
| Internally this calls std::atomic_thread_fence with | |||
| memory_order_seq_cst (the strictest std::memory_order). | |||
| */ | |||
| volatile Type value; | |||
| protected: | |||
| template <typename Dest, typename Source> | |||
| static inline Dest castTo (Source value) noexcept { union { Dest d; Source s; } u; u.s = value; return u.d; } | |||
| static inline Type castFrom32Bit (int32 value) noexcept { return castTo <Type, int32> (value); } | |||
| static inline Type castFrom64Bit (int64 value) noexcept { return castTo <Type, int64> (value); } | |||
| static inline int32 castTo32Bit (Type value) noexcept { return castTo <int32, Type> (value); } | |||
| static inline int64 castTo64Bit (Type value) noexcept { return castTo <int64, Type> (value); } | |||
| Type operator++ (int); // better to just use pre-increment with atomics.. | |||
| Type operator-- (int); | |||
| /** This templated negate function will negate pointers as well as integers */ | |||
| template <typename ValueType> | |||
| inline ValueType negateValue (ValueType n) noexcept | |||
| { | |||
| return sizeof (ValueType) == 1 ? (ValueType) -(signed char) n | |||
| : (sizeof (ValueType) == 2 ? (ValueType) -(short) n | |||
| : (sizeof (ValueType) == 4 ? (ValueType) -(int) n | |||
| : ((ValueType) -(int64) n))); | |||
| } | |||
| /** This templated negate function will negate pointers as well as integers */ | |||
| template <typename PointerType> | |||
| inline PointerType* negateValue (PointerType* n) noexcept | |||
| { | |||
| return reinterpret_cast<PointerType*> (-reinterpret_cast<pointer_sized_int> (n)); | |||
| } | |||
| }; | |||
| //============================================================================== | |||
| // Specialisation for void* which does not include the pointer arithmetic | |||
| template <> | |||
| class Atomic<void*> : public AtomicBase<void*> | |||
| { | |||
| public: | |||
| inline Atomic() noexcept {} | |||
| inline explicit Atomic (void* const initialValue) noexcept : AtomicBase<void*> (initialValue) {} | |||
| inline Atomic (const Atomic<void*>& other) noexcept : AtomicBase<void*> (other) {} | |||
| inline void* get() const noexcept { return AtomicBase<void*>::get(); } | |||
| inline Atomic& operator= (const Atomic& other) noexcept { AtomicBase<void*>::operator= (other); return *this; } | |||
| inline Atomic& operator= (void* const newValue) noexcept { AtomicBase<void*>::operator= (newValue); return *this; } | |||
| inline void set (void* newValue) noexcept { exchange (newValue); } | |||
| inline void* exchange (void* v) noexcept { return AtomicBase<void*>::exchange (v); } | |||
| inline bool compareAndSetBool (void* newValue, void* valueToCompare) noexcept { return AtomicBase<void*>::compareAndSetBool (newValue, valueToCompare); } | |||
| inline void* compareAndSetValue (void* newValue, void* valueToCompare) noexcept { return AtomicBase<void*>::compareAndSetValue (newValue, valueToCompare); } | |||
| static inline void memoryBarrier() noexcept { AtomicBase<void*>::memoryBarrier(); } | |||
| }; | |||
| template <typename Type> | |||
| struct AtomicIncrementDecrement | |||
| { | |||
| static inline Type inc (AtomicBase<Type>& a) noexcept | |||
| { | |||
| return sizeof (Type) == 4 ? (Type) __sync_add_and_fetch (& (a.value), (Type) 1) | |||
| : (Type) __sync_add_and_fetch ((int64_t*) & (a.value), 1); | |||
| } | |||
| static inline Type dec (AtomicBase<Type>& a) noexcept | |||
| { | |||
| return sizeof (Type) == 4 ? (Type) __sync_add_and_fetch (& (a.value), (Type) -1) | |||
| : (Type) __sync_add_and_fetch ((int64_t*) & (a.value), -1); | |||
| } | |||
| }; | |||
| template <typename Type> | |||
| struct AtomicIncrementDecrement<Type*> | |||
| { | |||
| static inline Type* inc (Atomic<Type*>& a) noexcept { return a.operator+= (1); } | |||
| static inline Type* dec (Atomic<Type*>& a) noexcept { return a.operator-= (1); } | |||
| }; | |||
| //============================================================================== | |||
| template <typename Type> | |||
| inline Type AtomicBase<Type>::get() const noexcept | |||
| { | |||
| return sizeof (Type) == 4 ? castFrom32Bit ((int32) __sync_add_and_fetch ((volatile int32*) &value, 0)) | |||
| : castFrom64Bit ((int64) __sync_add_and_fetch ((volatile int64*) &value, 0)); | |||
| } | |||
| template <typename Type> | |||
| inline Type AtomicBase<Type>::exchange (const Type newValue) noexcept | |||
| { | |||
| Type currentVal = get(); | |||
| while (! compareAndSetBool (newValue, currentVal)) { currentVal = get(); } | |||
| return currentVal; | |||
| } | |||
| template <typename Type> | |||
| inline Type Atomic<Type>::operator+= (const DiffType amountToAdd) noexcept | |||
| { | |||
| Type amount = (Type() + amountToAdd); | |||
| return (Type) __sync_add_and_fetch (& (AtomicBase<Type>::value), amount); | |||
| } | |||
| template <typename Type> | |||
| inline Type Atomic<Type>::operator-= (const DiffType amountToSubtract) noexcept | |||
| { | |||
| return operator+= (AtomicBase<Type>::negateValue (amountToSubtract)); | |||
| } | |||
| template <typename Type> | |||
| inline Type Atomic<Type>::operator++() noexcept { return AtomicIncrementDecrement<Type>::inc (*this); } | |||
| template <typename Type> | |||
| inline Type Atomic<Type>::operator--() noexcept { return AtomicIncrementDecrement<Type>::dec (*this); } | |||
| template <typename Type> | |||
| inline bool AtomicBase<Type>::compareAndSetBool (const Type newValue, const Type valueToCompare) noexcept | |||
| { | |||
| return sizeof (Type) == 4 ? __sync_bool_compare_and_swap ((volatile int32*) &value, castTo32Bit (valueToCompare), castTo32Bit (newValue)) | |||
| : __sync_bool_compare_and_swap ((volatile int64*) &value, castTo64Bit (valueToCompare), castTo64Bit (newValue)); | |||
| } | |||
| template <typename Type> | |||
| inline Type AtomicBase<Type>::compareAndSetValue (const Type newValue, const Type valueToCompare) noexcept | |||
| { | |||
| return sizeof (Type) == 4 ? castFrom32Bit ((int32) __sync_val_compare_and_swap ((volatile int32*) &value, castTo32Bit (valueToCompare), castTo32Bit (newValue))) | |||
| : castFrom64Bit ((int64) __sync_val_compare_and_swap ((volatile int64*) &value, castTo64Bit (valueToCompare), castTo64Bit (newValue))); | |||
| } | |||
| template <typename Type> | |||
| inline void AtomicBase<Type>::memoryBarrier() noexcept { __sync_synchronize(); } | |||
| #endif // ! DOXYGEN | |||
| #endif | |||
| void memoryBarrier() noexcept { atomic_thread_fence (std::memory_order_seq_cst); } | |||
| /** The std::atomic object that this class operates on. */ | |||
| std::atomic<Type> value; | |||
| //============================================================================== | |||
| #ifndef DOXYGEN | |||
| /* This method has been deprecated as there is no equivalent method in | |||
| std::atomic. Use compareAndSetBool instead. | |||
| */ | |||
| JUCE_DEPRECATED (Type compareAndSetValue (Type, Type) noexcept); | |||
| #endif | |||
| }; | |||
| } // namespace juce | |||
| @@ -39,8 +39,6 @@ | |||
| #endif | |||
| #define JUCE_COMPILER_SUPPORTS_NOEXCEPT 1 | |||
| #define JUCE_COMPILER_SUPPORTS_INITIALIZER_LISTS 1 | |||
| #define JUCE_STDLIB_HAS_STD_FUNCTION_SUPPORT 1 | |||
| #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 500 | |||
| #define JUCE_HAS_CONSTEXPR 1 | |||
| @@ -68,11 +66,6 @@ | |||
| #define JUCE_COMPILER_SUPPORTS_NOEXCEPT 1 | |||
| #define JUCE_HAS_CONSTEXPR 1 | |||
| #if defined (_LIBCPP_VERSION) || ! (JUCE_MAC || JUCE_IOS) | |||
| #define JUCE_STDLIB_HAS_STD_FUNCTION_SUPPORT 1 | |||
| #define JUCE_COMPILER_SUPPORTS_INITIALIZER_LISTS 1 | |||
| #endif | |||
| #ifndef JUCE_COMPILER_SUPPORTS_ARC | |||
| #define JUCE_COMPILER_SUPPORTS_ARC 1 | |||
| #endif | |||
| @@ -96,9 +89,6 @@ | |||
| #error "JUCE requires Visual Studio 2013 or later" | |||
| #endif | |||
| #define JUCE_COMPILER_SUPPORTS_INITIALIZER_LISTS 1 | |||
| #define JUCE_STDLIB_HAS_STD_FUNCTION_SUPPORT 1 | |||
| #if _MSC_VER >= 1900 // VS2015 | |||
| #define JUCE_COMPILER_SUPPORTS_NOEXCEPT 1 | |||
| #define JUCE_HAS_CONSTEXPR 1 | |||
| @@ -118,6 +108,12 @@ | |||
| #define JUCE_CXX17_IS_AVAILABLE (_MSVC_LANG >= 201703L) | |||
| #endif | |||
| //============================================================================== | |||
| // C++ library | |||
| #if (defined (__GLIBCXX__) && __GLIBCXX__ < 20130322) || (defined(_LIBCPP_VERSION) && (_LIBCPP_VERSION < 3700)) | |||
| #error "JUCE requires a C++ library containing std::atomic" | |||
| #endif | |||
| //============================================================================== | |||
| #if JUCE_HAS_CONSTEXPR | |||
| #define JUCE_CONSTEXPR constexpr | |||
| @@ -129,18 +125,6 @@ | |||
| // These are old flags that are now supported on all compatible build targets | |||
| #define JUCE_COMPILER_SUPPORTS_OVERRIDE_AND_FINAL 1 | |||
| #define JUCE_COMPILER_SUPPORTS_VARIADIC_TEMPLATES 1 | |||
| #define JUCE_COMPILER_SUPPORTS_INITIALIZER_LISTS 1 | |||
| #define JUCE_DELETED_FUNCTION = delete | |||
| #endif | |||
| //============================================================================== | |||
| #if JUCE_ANDROID | |||
| #define JUCE_ATOMIC_AVAILABLE 1 | |||
| #elif defined(_LIBCPP_VERSION) | |||
| #define JUCE_ATOMIC_AVAILABLE (_LIBCPP_VERSION >= 3700) | |||
| #elif defined (__GLIBCXX__) | |||
| #define JUCE_ATOMIC_AVAILABLE (__GLIBCXX__ >= 20130322) // GCC versions 4.8 and later | |||
| #elif defined (_MSC_VER) | |||
| #define JUCE_ATOMIC_AVAILABLE 1 // Visual Studio 2013 and later | |||
| #else | |||
| #define JUCE_ATOMIC_AVAILABLE 0 | |||
| #endif | |||
| @@ -50,6 +50,7 @@ | |||
| #include <functional> | |||
| #include <algorithm> | |||
| #include <limits> | |||
| #include <atomic> | |||
| //============================================================================== | |||
| #include "juce_CompilerSupport.h" | |||
| @@ -108,17 +109,11 @@ | |||
| #undef minor | |||
| #undef KeyPress | |||
| // Include a replacement for std::function on older platforms and the live | |||
| // build | |||
| #if JUCE_PROJUCER_LIVE_BUILD || ! defined (JUCE_STDLIB_HAS_STD_FUNCTION_SUPPORT) | |||
| // Include a replacement for std::function | |||
| #if JUCE_PROJUCER_LIVE_BUILD | |||
| #include "../misc/juce_StdFunctionCompat.h" | |||
| #endif | |||
| // Include std::atomic if it's supported by the compiler | |||
| #if JUCE_ATOMIC_AVAILABLE | |||
| #include <atomic> | |||
| #endif | |||
| //============================================================================== | |||
| // DLL building settings on Windows | |||
| #if JUCE_MSVC | |||
| @@ -1417,7 +1417,7 @@ JUCE_API OutputStream& JUCE_CALLTYPE operator<< (OutputStream& stream, StringRef | |||
| } // namespace juce | |||
| #if JUCE_COMPILER_SUPPORTS_INITIALIZER_LISTS && ! DOXYGEN // just used to avoid compiling this under compilers that lack libc++ | |||
| #if ! DOXYGEN | |||
| namespace std | |||
| { | |||
| template <> struct hash<juce::String> | |||
| @@ -67,12 +67,10 @@ StringArray::StringArray (const wchar_t* const* initialStrings, int numberOfStri | |||
| strings.addArray (initialStrings, numberOfStrings); | |||
| } | |||
| #if JUCE_COMPILER_SUPPORTS_INITIALIZER_LISTS | |||
| StringArray::StringArray (const std::initializer_list<const char*>& stringList) | |||
| { | |||
| strings.addArray (stringList); | |||
| } | |||
| #endif | |||
| StringArray& StringArray::operator= (const StringArray& other) | |||
| { | |||
| @@ -51,9 +51,8 @@ public: | |||
| template <typename... OtherElements> | |||
| StringArray (StringRef firstValue, OtherElements... otherValues) : strings (firstValue, otherValues...) {} | |||
| #if JUCE_COMPILER_SUPPORTS_INITIALIZER_LISTS | |||
| /** Creates an array containing a list of strings. */ | |||
| StringArray (const std::initializer_list<const char*>& strings); | |||
| #endif | |||
| /** Creates an array from a raw array of strings. | |||
| @param strings an array of strings to add | |||
| @@ -588,7 +588,6 @@ ValueTree::ValueTree (const Identifier& type) : object (new ValueTree::SharedOb | |||
| jassert (type.toString().isNotEmpty()); // All objects must be given a sensible type name! | |||
| } | |||
| #if JUCE_COMPILER_SUPPORTS_INITIALIZER_LISTS | |||
| ValueTree::ValueTree (const Identifier& type, | |||
| std::initializer_list<std::pair<Identifier, var>> properties, | |||
| std::initializer_list<ValueTree> subTrees) | |||
| @@ -600,7 +599,6 @@ ValueTree::ValueTree (const Identifier& type, | |||
| for (auto& tree : subTrees) | |||
| addChild (tree, -1, nullptr); | |||
| } | |||
| #endif | |||
| ValueTree::ValueTree (SharedObject* so) noexcept : object (so) | |||
| { | |||
| @@ -88,7 +88,6 @@ public: | |||
| */ | |||
| explicit ValueTree (const Identifier& type); | |||
| #if JUCE_COMPILER_SUPPORTS_INITIALIZER_LISTS | |||
| /** Creates a value tree from nested lists of properties and ValueTrees. | |||
| This code, | |||
| @@ -131,7 +130,6 @@ public: | |||
| ValueTree (const Identifier& type, | |||
| std::initializer_list<std::pair<Identifier, var>> properties, | |||
| std::initializer_list<ValueTree> subTrees = {}); | |||
| #endif | |||
| /** Creates a reference to another ValueTree. */ | |||
| ValueTree (const ValueTree&) noexcept; | |||
| @@ -35,9 +35,9 @@ | |||
| #include "juce_dsp.h" | |||
| #if (! defined (JUCE_STDLIB_HAS_STD_FUNCTION_SUPPORT)) || (! defined (JUCE_HAS_CONSTEXPR)) | |||
| #if ! JUCE_HAS_CONSTEXPR | |||
| #ifndef JUCE_DEMO_RUNNER | |||
| #error "juce_dsp module requires your compiler to have a newer version of the standard library" | |||
| #error "The juce_dsp module requires a compiler that supports constexpr" | |||
| #endif | |||
| #else | |||
| @@ -59,9 +59,9 @@ | |||
| #include <juce_audio_basics/juce_audio_basics.h> | |||
| #include <juce_audio_formats/juce_audio_formats.h> | |||
| #if (! defined (JUCE_STDLIB_HAS_STD_FUNCTION_SUPPORT)) || (! defined (JUCE_HAS_CONSTEXPR)) | |||
| #if ! JUCE_HAS_CONSTEXPR | |||
| #ifndef JUCE_DEMO_RUNNER | |||
| #error "juce_dsp module requires your compiler to have a newer version of the standard library" | |||
| #error "The juce_dsp module requires a compiler that supports constexpr" | |||
| #endif | |||
| #else | |||
| @@ -267,15 +267,12 @@ namespace juce | |||
| #include "misc/juce_DropShadower.cpp" | |||
| #include "misc/juce_JUCESplashScreen.cpp" | |||
| // these classes are C++11-only | |||
| #if JUCE_COMPILER_SUPPORTS_INITIALIZER_LISTS | |||
| #include "layout/juce_FlexBox.cpp" | |||
| #if JUCE_HAS_CONSTEXPR | |||
| #include "layout/juce_GridItem.cpp" | |||
| #include "layout/juce_Grid.cpp" | |||
| #if JUCE_UNIT_TESTS | |||
| #include "layout/juce_GridUnitTests.cpp" | |||
| #endif | |||
| #include "layout/juce_FlexBox.cpp" | |||
| #if JUCE_HAS_CONSTEXPR | |||
| #include "layout/juce_GridItem.cpp" | |||
| #include "layout/juce_Grid.cpp" | |||
| #if JUCE_UNIT_TESTS | |||
| #include "layout/juce_GridUnitTests.cpp" | |||
| #endif | |||
| #endif | |||
| @@ -149,12 +149,10 @@ namespace juce | |||
| class ApplicationCommandManagerListener; | |||
| class DrawableButton; | |||
| #if JUCE_COMPILER_SUPPORTS_INITIALIZER_LISTS | |||
| class FlexBox; | |||
| #if JUCE_HAS_CONSTEXPR | |||
| class Grid; | |||
| #endif | |||
| #endif | |||
| } | |||
| #include "mouse/juce_MouseCursor.h" | |||
| @@ -294,13 +292,10 @@ namespace juce | |||
| #include "native/juce_linux_X11.h" | |||
| #endif | |||
| // these classes are C++11-only | |||
| #if JUCE_COMPILER_SUPPORTS_INITIALIZER_LISTS | |||
| #include "layout/juce_FlexItem.h" | |||
| #include "layout/juce_FlexBox.h" | |||
| #include "layout/juce_FlexItem.h" | |||
| #include "layout/juce_FlexBox.h" | |||
| #if JUCE_HAS_CONSTEXPR | |||
| #include "layout/juce_GridItem.h" | |||
| #include "layout/juce_Grid.h" | |||
| #endif | |||
| #if JUCE_HAS_CONSTEXPR | |||
| #include "layout/juce_GridItem.h" | |||
| #include "layout/juce_Grid.h" | |||
| #endif | |||
| @@ -35,12 +35,6 @@ | |||
| #include "juce_osc.h" | |||
| #ifndef JUCE_STDLIB_HAS_STD_FUNCTION_SUPPORT | |||
| #ifndef JUCE_DEMO_RUNNER | |||
| #error "juce_osc module requires your compiler to have a newer version of the standard library" | |||
| #endif | |||
| #else | |||
| #include "osc/juce_OSCTypes.cpp" | |||
| #include "osc/juce_OSCTimeTag.cpp" | |||
| #include "osc/juce_OSCArgument.cpp" | |||
| @@ -49,5 +43,3 @@ | |||
| #include "osc/juce_OSCBundle.cpp" | |||
| #include "osc/juce_OSCReceiver.cpp" | |||
| #include "osc/juce_OSCSender.cpp" | |||
| #endif | |||
| @@ -54,12 +54,6 @@ | |||
| #include <juce_core/juce_core.h> | |||
| #include <juce_events/juce_events.h> | |||
| #ifndef JUCE_STDLIB_HAS_STD_FUNCTION_SUPPORT | |||
| #ifndef JUCE_DEMO_RUNNER | |||
| #error "juce_osc module requires your compiler to have a newer version of the standard library" | |||
| #endif | |||
| #else | |||
| //============================================================================== | |||
| #include "osc/juce_OSCTypes.h" | |||
| #include "osc/juce_OSCTimeTag.h" | |||
| @@ -69,5 +63,3 @@ | |||
| #include "osc/juce_OSCBundle.h" | |||
| #include "osc/juce_OSCReceiver.h" | |||
| #include "osc/juce_OSCSender.h" | |||
| #endif | |||