OpenShot Audio Library | OpenShotAudio: juce_PlatformDefs.h Source File

OpenShot Audio Library | OpenShotAudio 0.3.2

Loading...
Searching...
No Matches
juce_PlatformDefs.h
1/*
2 ==============================================================================
3
4 This file is part of the JUCE library.
5 Copyright (c) 2017 - ROLI Ltd.
6
7 JUCE is an open source library subject to commercial or open-source
8 licensing.
9
10 The code included in this file is provided under the terms of the ISC license
11 http://www.isc.org/downloads/software-support-policy/isc-license. Permission
12 To use, copy, modify, and/or distribute this software for any purpose with or
13 without fee is hereby granted provided that the above copyright notice and
14 this permission notice appear in all copies.
15
16 JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
17 EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
18 DISCLAIMED.
19
20 ==============================================================================
21*/
22
23namespace juce
24{
25
26//==============================================================================
27/* This file defines miscellaneous macros for debugging, assertions, etc.
28*/
29
30//==============================================================================
31#ifdef JUCE_FORCE_DEBUG
32 #undef JUCE_DEBUG
33
34 #if JUCE_FORCE_DEBUG
35 #define JUCE_DEBUG 1
36 #endif
37#endif
38
40#if JUCE_MSVC
41 #define JUCE_CALLTYPE __stdcall
42 #define JUCE_CDECL __cdecl
43#else
44 #define JUCE_CALLTYPE
45 #define JUCE_CDECL
46#endif
47
48//==============================================================================
49// Debugging and assertion macros
50
51#ifndef JUCE_LOG_CURRENT_ASSERTION
52 #if JUCE_LOG_ASSERTIONS || JUCE_DEBUG
53 #define JUCE_LOG_CURRENT_ASSERTION juce::logAssertion (__FILE__, __LINE__);
54 #else
55 #define JUCE_LOG_CURRENT_ASSERTION
56 #endif
57#endif
58
59//==============================================================================
60#if JUCE_IOS || JUCE_LINUX
66 #define JUCE_BREAK_IN_DEBUGGER { ::kill (0, SIGTRAP); }
67#elif JUCE_MSVC
68 #ifndef __INTEL_COMPILER
69 #pragma intrinsic (__debugbreak)
70 #endif
71 #define JUCE_BREAK_IN_DEBUGGER { __debugbreak(); }
72#elif JUCE_GCC || JUCE_MAC
73 #if JUCE_NO_INLINE_ASM
74 #define JUCE_BREAK_IN_DEBUGGER { }
75 #else
76 #define JUCE_BREAK_IN_DEBUGGER { asm ("int $3"); }
77 #endif
78#elif JUCE_ANDROID
79 #define JUCE_BREAK_IN_DEBUGGER { __builtin_trap(); }
80#else
81 #define JUCE_BREAK_IN_DEBUGGER { __asm int 3 }
82#endif
83
84#if JUCE_CLANG && defined (__has_feature) && ! defined (JUCE_ANALYZER_NORETURN)
85 #if __has_feature (attribute_analyzer_noreturn)
86 inline void __attribute__((analyzer_noreturn)) juce_assert_noreturn() {}
87 #define JUCE_ANALYZER_NORETURN juce::juce_assert_noreturn();
88 #endif
89#endif
90
91#ifndef JUCE_ANALYZER_NORETURN
92 #define JUCE_ANALYZER_NORETURN
93#endif
94
95//==============================================================================
96#if JUCE_MSVC && ! DOXYGEN
97 #define JUCE_BLOCK_WITH_FORCED_SEMICOLON(x) \
98 __pragma(warning(push)) \
99 __pragma(warning(disable:4127)) \
100 do { x } while (false) \
101 __pragma(warning(pop))
102#else
106 #define JUCE_BLOCK_WITH_FORCED_SEMICOLON(x) do { x } while (false)
107#endif
108
109//==============================================================================
110#if (JUCE_DEBUG && ! JUCE_DISABLE_ASSERTIONS) || DOXYGEN
121 #define DBG(textToWrite) JUCE_BLOCK_WITH_FORCED_SEMICOLON (juce::String tempDbgBuf; tempDbgBuf << textToWrite; juce::Logger::outputDebugString (tempDbgBuf);)
122
123 //==============================================================================
128 #define jassertfalse JUCE_BLOCK_WITH_FORCED_SEMICOLON (JUCE_LOG_CURRENT_ASSERTION; if (juce::juce_isRunningUnderDebugger()) JUCE_BREAK_IN_DEBUGGER; JUCE_ANALYZER_NORETURN)
129
130 //==============================================================================
138 #define jassert(expression) JUCE_BLOCK_WITH_FORCED_SEMICOLON (if (! (expression)) jassertfalse;)
139
140#else
141 //==============================================================================
142 // If debugging is disabled, these dummy debug and assertion macros are used..
143
144 #define DBG(textToWrite)
145 #define jassertfalse JUCE_BLOCK_WITH_FORCED_SEMICOLON (JUCE_LOG_CURRENT_ASSERTION)
146
147 #if JUCE_LOG_ASSERTIONS
148 #define jassert(expression) JUCE_BLOCK_WITH_FORCED_SEMICOLON (if (! (expression)) jassertfalse;)
149 #else
150 #define jassert(expression) JUCE_BLOCK_WITH_FORCED_SEMICOLON ( ; )
151 #endif
152
153#endif
154
155//==============================================================================
156#if ! DOXYGEN
157 #define JUCE_JOIN_MACRO_HELPER(a, b) a ## b
158 #define JUCE_STRINGIFY_MACRO_HELPER(a) #a
159#endif
160
165#define JUCE_JOIN_MACRO(item1, item2) JUCE_JOIN_MACRO_HELPER (item1, item2)
166
168#define JUCE_STRINGIFY(item) JUCE_STRINGIFY_MACRO_HELPER (item)
169
170//==============================================================================
195#define JUCE_DECLARE_NON_COPYABLE(className) \
196 className (const className&) = delete;\
197 className& operator= (const className&) = delete;
198
202#define JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(className) \
203 JUCE_DECLARE_NON_COPYABLE(className) \
204 JUCE_LEAK_DETECTOR(className)
205
209#define JUCE_PREVENT_HEAP_ALLOCATION \
210 private: \
211 static void* operator new (size_t) = delete; \
212 static void operator delete (void*) = delete;
213
214//==============================================================================
215#if JUCE_MSVC && ! defined (DOXYGEN)
216 #define JUCE_WARNING_HELPER(file, line, mess) message(file "(" JUCE_STRINGIFY (line) ") : Warning: " #mess)
217 #define JUCE_COMPILER_WARNING(message) __pragma(JUCE_WARNING_HELPER (__FILE__, __LINE__, message))
218#else
219 #ifndef DOXYGEN
220 #define JUCE_WARNING_HELPER(mess) message(#mess)
221 #endif
222
230 #define JUCE_COMPILER_WARNING(message) _Pragma(JUCE_STRINGIFY (JUCE_WARNING_HELPER (message)))
231#endif
232
233
234//==============================================================================
235#if JUCE_DEBUG || DOXYGEN
241 #define forcedinline inline
242#else
243 #if JUCE_MSVC
244 #define forcedinline __forceinline
245 #else
246 #define forcedinline inline __attribute__((always_inline))
247 #endif
248#endif
249
250#if JUCE_MSVC || DOXYGEN
253 #define JUCE_ALIGN(bytes) __declspec (align (bytes))
254#else
255 #define JUCE_ALIGN(bytes) __attribute__ ((aligned (bytes)))
256#endif
257
258//==============================================================================
259// Cross-compiler deprecation macros..
260#ifdef DOXYGEN
262 #define JUCE_DEPRECATED(functionDef)
263 #define JUCE_DEPRECATED_WITH_BODY(functionDef, body)
264#elif JUCE_MSVC && ! JUCE_NO_DEPRECATION_WARNINGS
265 #define JUCE_DEPRECATED_ATTRIBUTE __declspec(deprecated)
266 #define JUCE_DEPRECATED(functionDef) JUCE_DEPRECATED_ATTRIBUTE functionDef
267 #define JUCE_DEPRECATED_WITH_BODY(functionDef, body) JUCE_DEPRECATED_ATTRIBUTE functionDef body
268#elif (JUCE_GCC || JUCE_CLANG) && ! JUCE_NO_DEPRECATION_WARNINGS
269 #define JUCE_DEPRECATED_ATTRIBUTE __attribute__ ((deprecated))
270 #define JUCE_DEPRECATED(functionDef) functionDef JUCE_DEPRECATED_ATTRIBUTE
271 #define JUCE_DEPRECATED_WITH_BODY(functionDef, body) functionDef JUCE_DEPRECATED_ATTRIBUTE body
272#else
273 #define JUCE_DEPRECATED_ATTRIBUTE
274 #define JUCE_DEPRECATED(functionDef) functionDef
275 #define JUCE_DEPRECATED_WITH_BODY(functionDef, body) functionDef body
276#endif
277
278#if JUCE_ALLOW_STATIC_NULL_VARIABLES
279 #if ! (defined (DOXYGEN) || defined (JUCE_GCC) || (JUCE_MSVC && _MSC_VER <= 1900))
280 #define JUCE_DEPRECATED_STATIC(valueDef) JUCE_DEPRECATED_ATTRIBUTE valueDef
281
282 #if JUCE_MSVC
283 #define JUCE_DECLARE_DEPRECATED_STATIC(valueDef) \
284 __pragma(warning(push)) \
285 __pragma(warning(disable:4996)) \
286 valueDef \
287 __pragma(warning(pop))
288 #else
289 #define JUCE_DECLARE_DEPRECATED_STATIC(valueDef) valueDef
290 #endif
291 #else
292 #define JUCE_DEPRECATED_STATIC(valueDef) valueDef
293 #define JUCE_DECLARE_DEPRECATED_STATIC(valueDef) valueDef
294 #endif
295#else
296 #define JUCE_DEPRECATED_STATIC(valueDef)
297 #define JUCE_DECLARE_DEPRECATED_STATIC(valueDef)
298#endif
299
300//==============================================================================
301#if JUCE_ANDROID && ! DOXYGEN
302 #define JUCE_MODAL_LOOPS_PERMITTED 0
303#elif ! defined (JUCE_MODAL_LOOPS_PERMITTED)
306 #define JUCE_MODAL_LOOPS_PERMITTED 1
307#endif
308
309//==============================================================================
310#if JUCE_GCC || JUCE_CLANG
311 #define JUCE_PACKED __attribute__((packed))
312#elif ! DOXYGEN
313 #define JUCE_PACKED
314#endif
315
316//==============================================================================
317#if JUCE_GCC || DOXYGEN
320 #define JUCE_NO_ASSOCIATIVE_MATH_OPTIMISATIONS __attribute__((__optimize__("no-associative-math")))
321#else
322 #define JUCE_NO_ASSOCIATIVE_MATH_OPTIMISATIONS
323#endif
324
325} // namespace juce