openshot-audio
0.1.7
JuceLibraryCode
modules
juce_core
system
juce_PlatformDefs.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_PLATFORMDEFS_H_INCLUDED
30
#define JUCE_PLATFORMDEFS_H_INCLUDED
31
32
//==============================================================================
33
/* This file defines miscellaneous macros for debugging, assertions, etc.
34
*/
35
36
//==============================================================================
37
#ifdef JUCE_FORCE_DEBUG
38
#undef JUCE_DEBUG
39
40
#if JUCE_FORCE_DEBUG
41
#define JUCE_DEBUG 1
42
#endif
43
#endif
44
46
#if JUCE_MSVC
47
#define JUCE_CALLTYPE __stdcall
48
#define JUCE_CDECL __cdecl
49
#else
50
#define JUCE_CALLTYPE
51
#define JUCE_CDECL
52
#endif
53
54
//==============================================================================
55
// Debugging and assertion macros
56
57
#if JUCE_LOG_ASSERTIONS || JUCE_DEBUG
58
#define juce_LogCurrentAssertion juce::logAssertion (__FILE__, __LINE__);
59
#else
60
#define juce_LogCurrentAssertion
61
#endif
62
63
//==============================================================================
64
#if JUCE_IOS || JUCE_LINUX || JUCE_ANDROID || JUCE_PPC
65
70
#define juce_breakDebugger { ::kill (0, SIGTRAP); }
71
#elif JUCE_USE_MSVC_INTRINSICS
72
#ifndef __INTEL_COMPILER
73
#pragma intrinsic (__debugbreak)
74
#endif
75
#define juce_breakDebugger { __debugbreak(); }
76
#elif JUCE_GCC || JUCE_MAC
77
#if JUCE_NO_INLINE_ASM
78
#define juce_breakDebugger { }
79
#else
80
#define juce_breakDebugger { asm ("int $3"); }
81
#endif
82
#else
83
#define juce_breakDebugger { __asm int 3 }
84
#endif
85
86
#if JUCE_CLANG && defined (__has_feature) && ! defined (JUCE_ANALYZER_NORETURN)
87
#if __has_feature (attribute_analyzer_noreturn)
88
inline
void
__attribute__((analyzer_noreturn)) juce_assert_noreturn() {}
89
#define JUCE_ANALYZER_NORETURN juce_assert_noreturn();
90
#endif
91
#endif
92
93
#ifndef JUCE_ANALYZER_NORETURN
94
#define JUCE_ANALYZER_NORETURN
95
#endif
96
97
//==============================================================================
98
#if JUCE_MSVC && ! DOXYGEN
99
#define MACRO_WITH_FORCED_SEMICOLON(x) \
100
__pragma(warning(push)) \
101
__pragma(warning(disable:4127)) \
102
do { x } while (false) \
103
__pragma(warning(pop))
104
#else
105
108
#define MACRO_WITH_FORCED_SEMICOLON(x) do { x } while (false)
109
#endif
110
111
//==============================================================================
112
#if JUCE_DEBUG || DOXYGEN
113
117
#define DBG(dbgtext) MACRO_WITH_FORCED_SEMICOLON (juce::String tempDbgBuf; tempDbgBuf << dbgtext; juce::Logger::outputDebugString (tempDbgBuf);)
118
119
//==============================================================================
124
#define jassertfalse MACRO_WITH_FORCED_SEMICOLON (juce_LogCurrentAssertion; if (juce::juce_isRunningUnderDebugger()) juce_breakDebugger; JUCE_ANALYZER_NORETURN)
125
126
//==============================================================================
134
#define jassert(expression) MACRO_WITH_FORCED_SEMICOLON (if (! (expression)) jassertfalse;)
135
136
#else
137
//==============================================================================
138
// If debugging is disabled, these dummy debug and assertion macros are used..
139
140
#define DBG(dbgtext)
141
#define jassertfalse MACRO_WITH_FORCED_SEMICOLON (juce_LogCurrentAssertion)
142
143
#if JUCE_LOG_ASSERTIONS
144
#define jassert(expression) MACRO_WITH_FORCED_SEMICOLON (if (! (expression)) jassertfalse;)
145
#else
146
#define jassert(a) MACRO_WITH_FORCED_SEMICOLON ( ; )
147
#endif
148
149
#endif
150
151
//==============================================================================
152
#ifndef DOXYGEN
153
namespace
juce
154
{
155
template
<
bool
b>
struct
JuceStaticAssert
;
156
template
<>
struct
JuceStaticAssert
<true> {
static
void
dummy
() {} };
157
}
158
#endif
159
165
#define static_jassert(expression) juce::JuceStaticAssert<expression>::dummy();
166
191
#define JUCE_DECLARE_NON_COPYABLE(className) \
192
className (const className&) JUCE_DELETED_FUNCTION;\
193
className& operator= (const className&) JUCE_DELETED_FUNCTION;
194
198
#define JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(className) \
199
JUCE_DECLARE_NON_COPYABLE(className) \
200
JUCE_LEAK_DETECTOR(className)
201
205
#define JUCE_PREVENT_HEAP_ALLOCATION \
206
private: \
207
static void* operator new (size_t) JUCE_DELETED_FUNCTION; \
208
static void operator delete (void*) JUCE_DELETED_FUNCTION;
209
210
211
//==============================================================================
212
#if ! DOXYGEN
213
#define JUCE_JOIN_MACRO_HELPER(a, b) a ## b
214
#define JUCE_STRINGIFY_MACRO_HELPER(a) #a
215
#endif
216
221
#define JUCE_JOIN_MACRO(item1, item2) JUCE_JOIN_MACRO_HELPER (item1, item2)
222
225
#define JUCE_STRINGIFY(item) JUCE_STRINGIFY_MACRO_HELPER (item)
226
227
228
//==============================================================================
229
#if JUCE_MSVC && ! defined (DOXYGEN)
230
#define JUCE_WARNING_HELPER(file, line, mess) message(file "(" JUCE_STRINGIFY (line) ") : Warning: " #mess)
231
#define JUCE_COMPILER_WARNING(message) __pragma(JUCE_WARNING_HELPER (__FILE__, __LINE__, message));
232
#else
233
#ifndef DOXYGEN
234
#define JUCE_WARNING_HELPER(mess) message(#mess)
235
#endif
236
244
#define JUCE_COMPILER_WARNING(message) _Pragma(JUCE_STRINGIFY (JUCE_WARNING_HELPER (message)));
245
#endif
246
247
248
//==============================================================================
249
#if JUCE_CATCH_UNHANDLED_EXCEPTIONS
250
251
#define JUCE_TRY try
252
253
#define JUCE_CATCH_ALL catch (...) {}
254
#define JUCE_CATCH_ALL_ASSERT catch (...) { jassertfalse; }
255
256
#if ! JUCE_MODULE_AVAILABLE_juce_gui_basics
257
#define JUCE_CATCH_EXCEPTION JUCE_CATCH_ALL
258
#else
259
262
#define JUCE_CATCH_EXCEPTION \
263
catch (const std::exception& e) \
264
{ \
265
juce::JUCEApplicationBase::sendUnhandledException (&e, __FILE__, __LINE__); \
266
} \
267
catch (...) \
268
{ \
269
juce::JUCEApplicationBase::sendUnhandledException (nullptr, __FILE__, __LINE__); \
270
}
271
#endif
272
273
#else
274
275
#define JUCE_TRY
276
#define JUCE_CATCH_EXCEPTION
277
#define JUCE_CATCH_ALL
278
#define JUCE_CATCH_ALL_ASSERT
279
280
#endif
281
282
//==============================================================================
283
#if JUCE_DEBUG || DOXYGEN
284
289
#define forcedinline inline
290
#else
291
#if JUCE_MSVC
292
#define forcedinline __forceinline
293
#else
294
#define forcedinline inline __attribute__((always_inline))
295
#endif
296
#endif
297
298
#if JUCE_MSVC || DOXYGEN
299
301
#define JUCE_ALIGN(bytes) __declspec (align (bytes))
302
#else
303
#define JUCE_ALIGN(bytes) __attribute__ ((aligned (bytes)))
304
#endif
305
306
//==============================================================================
307
// Cross-compiler deprecation macros..
308
#ifdef DOXYGEN
309
310
#define JUCE_DEPRECATED(functionDef)
311
#define JUCE_DEPRECATED_WITH_BODY(functionDef, body)
312
#elif JUCE_MSVC && ! JUCE_NO_DEPRECATION_WARNINGS
313
#define JUCE_DEPRECATED(functionDef) __declspec(deprecated) functionDef
314
#define JUCE_DEPRECATED_WITH_BODY(functionDef, body) __declspec(deprecated) functionDef body
315
#elif JUCE_GCC && ! JUCE_NO_DEPRECATION_WARNINGS
316
#define JUCE_DEPRECATED(functionDef) functionDef __attribute__ ((deprecated))
317
#define JUCE_DEPRECATED_WITH_BODY(functionDef, body) functionDef __attribute__ ((deprecated)) body
318
#else
319
#define JUCE_DEPRECATED(functionDef) functionDef
320
#define JUCE_DEPRECATED_WITH_BODY(functionDef, body) functionDef body
321
#endif
322
323
//==============================================================================
324
#if JUCE_ANDROID && ! DOXYGEN
325
#define JUCE_MODAL_LOOPS_PERMITTED 0
326
#elif ! defined (JUCE_MODAL_LOOPS_PERMITTED)
327
329
#define JUCE_MODAL_LOOPS_PERMITTED 1
330
#endif
331
332
//==============================================================================
333
#if JUCE_GCC
334
#define JUCE_PACKED __attribute__((packed))
335
#elif ! DOXYGEN
336
#define JUCE_PACKED
337
#endif
338
339
#endif // JUCE_PLATFORMDEFS_H_INCLUDED
juce
Definition:
juce_audio_basics.cpp:75
juce::JuceStaticAssert
Definition:
juce_PlatformDefs.h:155
juce::JuceStaticAssert< true >::dummy
static void dummy()
Definition:
juce_PlatformDefs.h:156
Generated by
1.8.17