openshot-audio  0.1.4
juce_CompilerSupport.h
Go to the documentation of this file.
1 /*
2  ==============================================================================
3 
4  This file is part of the juce_core module of the JUCE library.
5  Copyright (c) 2015 - ROLI Ltd.
6 
7  Permission to use, copy, modify, and/or distribute this software for any purpose with
8  or without fee is hereby granted, provided that the above copyright notice and this
9  permission notice appear in all copies.
10 
11  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD
12  TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN
13  NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
14  DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
15  IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
16  CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 
18  ------------------------------------------------------------------------------
19 
20  NOTE! This permissive ISC license applies ONLY to files within the juce_core module!
21  All other JUCE modules are covered by a dual GPL/commercial license, so if you are
22  using any other modules, be sure to check that you also comply with their license.
23 
24  For more details, visit www.juce.com
25 
26  ==============================================================================
27 */
28 
29 #ifndef JUCE_COMPILERSUPPORT_H_INCLUDED
30 #define JUCE_COMPILERSUPPORT_H_INCLUDED
31 
32 /* This file has some checks to see whether the compiler supports various C++11/14 features,
33  When these aren't available, the code defines a few workarounds, so that we can still use
34  some of the newer language features like nullptr and noexcept, even on old compilers.
35 */
36 
37 //==============================================================================
38 // GCC
39 #if (__cplusplus >= 201103L || defined (__GXX_EXPERIMENTAL_CXX0X__)) && (__GNUC__ * 100 + __GNUC_MINOR__) >= 405
40  #define JUCE_COMPILER_SUPPORTS_NOEXCEPT 1
41  #define JUCE_COMPILER_SUPPORTS_NULLPTR 1
42  #define JUCE_COMPILER_SUPPORTS_MOVE_SEMANTICS 1
43  #define JUCE_COMPILER_SUPPORTS_INITIALIZER_LISTS 1
44  #define JUCE_COMPILER_SUPPORTS_VARIADIC_TEMPLATES 1
45 
46  #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 407 && ! defined (JUCE_COMPILER_SUPPORTS_OVERRIDE_AND_FINAL)
47  #define JUCE_COMPILER_SUPPORTS_OVERRIDE_AND_FINAL 1
48  #endif
49 
50  #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 407 && ! defined (JUCE_DELETED_FUNCTION)
51  #define JUCE_DELETED_FUNCTION = delete
52  #endif
53 
54  #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 406 && ! defined (JUCE_COMPILER_SUPPORTS_LAMBDAS)
55  #define JUCE_COMPILER_SUPPORTS_LAMBDAS 1
56  #endif
57 #endif
58 
59 //==============================================================================
60 // Clang
61 #if JUCE_CLANG && defined (__has_feature)
62  #if __has_feature (cxx_nullptr)
63  #define JUCE_COMPILER_SUPPORTS_NULLPTR 1
64  #endif
65 
66  #if __has_feature (cxx_noexcept)
67  #define JUCE_COMPILER_SUPPORTS_NOEXCEPT 1
68  #endif
69 
70  #if __has_feature (cxx_rvalue_references)
71  #define JUCE_COMPILER_SUPPORTS_MOVE_SEMANTICS 1
72  #endif
73 
74  #if __has_feature (cxx_deleted_functions)
75  #define JUCE_DELETED_FUNCTION = delete
76  #endif
77 
78  #if __has_feature (cxx_lambdas) && (defined (_LIBCPP_VERSION) || ! (JUCE_MAC || JUCE_IOS))
79  #define JUCE_COMPILER_SUPPORTS_LAMBDAS 1
80  #endif
81 
82  #if __has_feature (cxx_generalized_initializers) && (defined (_LIBCPP_VERSION) || ! (JUCE_MAC || JUCE_IOS))
83  #define JUCE_COMPILER_SUPPORTS_INITIALIZER_LISTS 1
84  #endif
85 
86  #if __has_feature (cxx_variadic_templates)
87  #define JUCE_COMPILER_SUPPORTS_VARIADIC_TEMPLATES 1
88  #endif
89 
90  #ifndef JUCE_COMPILER_SUPPORTS_OVERRIDE_AND_FINAL
91  #define JUCE_COMPILER_SUPPORTS_OVERRIDE_AND_FINAL 1
92  #endif
93 
94  #ifndef JUCE_COMPILER_SUPPORTS_ARC
95  #define JUCE_COMPILER_SUPPORTS_ARC 1
96  #endif
97 
98 #endif
99 
100 //==============================================================================
101 // MSVC
102 #ifdef _MSC_VER
103  #if _MSC_VER >= 1600
104  #define JUCE_COMPILER_SUPPORTS_NULLPTR 1
105  #define JUCE_COMPILER_SUPPORTS_MOVE_SEMANTICS 1
106  #endif
107 
108  #if _MSC_VER >= 1700
109  #define JUCE_COMPILER_SUPPORTS_OVERRIDE_AND_FINAL 1
110  #define JUCE_COMPILER_SUPPORTS_LAMBDAS 1
111  #endif
112 
113  #if _MSC_VER >= 1800
114  #define JUCE_COMPILER_SUPPORTS_INITIALIZER_LISTS 1
115  #define JUCE_COMPILER_SUPPORTS_VARIADIC_TEMPLATES 1
116  #define JUCE_DELETED_FUNCTION = delete
117  #endif
118 
119  #if _MSC_VER >= 1900
120  #define JUCE_COMPILER_SUPPORTS_NOEXCEPT 1
121  #endif
122 #endif
123 
124 //==============================================================================
125 // Declare some fake versions of nullptr and noexcept, for older compilers:
126 
127 #ifndef JUCE_DELETED_FUNCTION
128 
133  #define JUCE_DELETED_FUNCTION
134 #endif
135 
136 #if ! DOXYGEN
137  #if ! JUCE_COMPILER_SUPPORTS_NOEXCEPT
138  #ifdef noexcept
139  #undef noexcept
140  #endif
141  #define noexcept throw()
142  #if defined (_MSC_VER) && _MSC_VER > 1600
143  #define _ALLOW_KEYWORD_MACROS 1 // (to stop VC2012 complaining)
144  #endif
145  #endif
146 
147  #if ! JUCE_COMPILER_SUPPORTS_NULLPTR
148  #ifdef nullptr
149  #undef nullptr
150  #endif
151  #define nullptr (0)
152  #endif
153 
154  #if ! JUCE_COMPILER_SUPPORTS_OVERRIDE_AND_FINAL
155  #undef override
156  #define override
157  #endif
158 #endif
159 
160 #endif // JUCE_COMPILERSUPPORT_H_INCLUDED