From 5e7bc2a187cf606db598898794da9cb39113b63c Mon Sep 17 00:00:00 2001 From: jules Date: Wed, 31 Jul 2013 22:15:58 +0100 Subject: [PATCH] Added a JUCE_DELETED_FUNCTION macro. --- modules/juce_core/system/juce_PlatformDefs.h | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/modules/juce_core/system/juce_PlatformDefs.h b/modules/juce_core/system/juce_PlatformDefs.h index b082f8ba7e..0608acbca0 100644 --- a/modules/juce_core/system/juce_PlatformDefs.h +++ b/modules/juce_core/system/juce_PlatformDefs.h @@ -175,8 +175,8 @@ namespace juce };@endcode */ #define JUCE_DECLARE_NON_COPYABLE(className) \ - className (const className&);\ - className& operator= (const className&); + className (const className&) JUCE_DELETED_FUNCTION;\ + className& operator= (const className&) JUCE_DELETED_FUNCTION; /** This is a shorthand way of writing both a JUCE_DECLARE_NON_COPYABLE and JUCE_LEAK_DETECTOR macro for a class. @@ -190,8 +190,8 @@ namespace juce */ #define JUCE_PREVENT_HEAP_ALLOCATION \ private: \ - static void* operator new (size_t); \ - static void operator delete (void*); + static void* operator new (size_t) JUCE_DELETED_FUNCTION; \ + static void operator delete (void*) JUCE_DELETED_FUNCTION; //============================================================================== @@ -313,6 +313,10 @@ namespace juce #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 407 && ! defined (JUCE_COMPILER_SUPPORTS_OVERRIDE_AND_FINAL) #define JUCE_COMPILER_SUPPORTS_OVERRIDE_AND_FINAL 1 #endif + + #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 407 && ! defined (JUCE_DELETED_FUNCTION) + #define JUCE_DELETED_FUNCTION = delete + #endif #endif #if JUCE_CLANG && defined (__has_feature) @@ -328,6 +332,10 @@ namespace juce #define JUCE_COMPILER_SUPPORTS_MOVE_SEMANTICS 1 #endif + #if __has_feature (cxx_deleted_functions) + #define JUCE_DELETED_FUNCTION = delete + #endif + #ifndef JUCE_COMPILER_SUPPORTS_OVERRIDE_AND_FINAL #define JUCE_COMPILER_SUPPORTS_OVERRIDE_AND_FINAL 1 #endif @@ -346,6 +354,10 @@ namespace juce #define JUCE_COMPILER_SUPPORTS_OVERRIDE_AND_FINAL 1 #endif +#ifndef JUCE_DELETED_FUNCTION + #define JUCE_DELETED_FUNCTION +#endif + //============================================================================== // Declare some fake versions of nullptr and noexcept, for older compilers: #if ! (DOXYGEN || JUCE_COMPILER_SUPPORTS_NOEXCEPT)