OpenShot Audio Library | OpenShotAudio
0.4.0
Loading...
Searching...
No Matches
juce_PlatformDefs.h
1
/*
2
==============================================================================
3
4
This file is part of the JUCE library.
5
Copyright (c) 2022 - Raw Material Software Limited
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
23
#pragma once
24
25
namespace
juce
26
{
27
28
//==============================================================================
29
/* This file defines miscellaneous macros for debugging, assertions, etc.
30
*/
31
32
//==============================================================================
33
#ifdef JUCE_FORCE_DEBUG
34
#undef JUCE_DEBUG
35
36
#if JUCE_FORCE_DEBUG
37
#define JUCE_DEBUG 1
38
#endif
39
#endif
40
42
#if JUCE_WINDOWS
43
#define JUCE_CALLTYPE __stdcall
44
#define JUCE_CDECL __cdecl
45
#else
46
#define JUCE_CALLTYPE
47
#define JUCE_CDECL
48
#endif
49
50
//==============================================================================
51
// Debugging and assertion macros
52
53
#ifndef JUCE_LOG_CURRENT_ASSERTION
54
#if JUCE_LOG_ASSERTIONS || JUCE_DEBUG
55
#define JUCE_LOG_CURRENT_ASSERTION juce::logAssertion (__FILE__, __LINE__);
56
#else
57
#define JUCE_LOG_CURRENT_ASSERTION
58
#endif
59
#endif
60
61
//==============================================================================
62
#if JUCE_IOS || JUCE_LINUX || JUCE_BSD
68
#define JUCE_BREAK_IN_DEBUGGER { ::kill (0, SIGTRAP); }
69
#elif JUCE_MSVC
70
#ifndef __INTEL_COMPILER
71
#pragma intrinsic (__debugbreak)
72
#endif
73
#define JUCE_BREAK_IN_DEBUGGER { __debugbreak(); }
74
#elif JUCE_INTEL && (JUCE_GCC || JUCE_CLANG || JUCE_MAC)
75
#if JUCE_NO_INLINE_ASM
76
#define JUCE_BREAK_IN_DEBUGGER { }
77
#else
78
#define JUCE_BREAK_IN_DEBUGGER { asm ("int $3"); }
79
#endif
80
#elif JUCE_ARM && JUCE_MAC
81
#define JUCE_BREAK_IN_DEBUGGER { __builtin_debugtrap(); }
82
#elif JUCE_ANDROID
83
#define JUCE_BREAK_IN_DEBUGGER { __builtin_trap(); }
84
#else
85
#define JUCE_BREAK_IN_DEBUGGER { __asm int 3 }
86
#endif
87
88
#if JUCE_CLANG && defined (__has_feature) && ! defined (JUCE_ANALYZER_NORETURN)
89
#if __has_feature (attribute_analyzer_noreturn)
90
inline
void
__attribute__ ((analyzer_noreturn)) juce_assert_noreturn() {}
91
#define JUCE_ANALYZER_NORETURN juce::juce_assert_noreturn();
92
#endif
93
#endif
94
95
#ifndef JUCE_ANALYZER_NORETURN
96
#define JUCE_ANALYZER_NORETURN
97
#endif
98
103
#if JUCE_CLANG
104
#if __has_cpp_attribute(clang::fallthrough)
105
#define JUCE_FALLTHROUGH [[clang::fallthrough]];
106
#else
107
#define JUCE_FALLTHROUGH
108
#endif
109
#elif JUCE_GCC
110
#if __GNUC__ >= 7
111
#define JUCE_FALLTHROUGH [[gnu::fallthrough]];
112
#else
113
#define JUCE_FALLTHROUGH
114
#endif
115
#else
116
#define JUCE_FALLTHROUGH
117
#endif
118
119
//==============================================================================
120
#if JUCE_MSVC && ! defined (DOXYGEN)
121
#define JUCE_BLOCK_WITH_FORCED_SEMICOLON(x) \
122
__pragma(warning(push)) \
123
__pragma(warning(disable:4127)) \
124
do { x } while (false) \
125
__pragma(warning(pop))
126
#else
130
#define JUCE_BLOCK_WITH_FORCED_SEMICOLON(x) do { x } while (false)
131
#endif
132
133
//==============================================================================
134
#if (JUCE_DEBUG && ! JUCE_DISABLE_ASSERTIONS) || DOXYGEN
145
#define DBG(textToWrite) JUCE_BLOCK_WITH_FORCED_SEMICOLON (juce::String tempDbgBuf; tempDbgBuf << textToWrite; juce::Logger::outputDebugString (tempDbgBuf);)
146
147
//==============================================================================
152
#define jassertfalse JUCE_BLOCK_WITH_FORCED_SEMICOLON (JUCE_LOG_CURRENT_ASSERTION; if (juce::juce_isRunningUnderDebugger()) JUCE_BREAK_IN_DEBUGGER; JUCE_ANALYZER_NORETURN)
153
154
//==============================================================================
162
#define jassert(expression) JUCE_BLOCK_WITH_FORCED_SEMICOLON (if (! (expression)) jassertfalse;)
163
168
#define jassertquiet(expression) JUCE_BLOCK_WITH_FORCED_SEMICOLON (if (! (expression)) jassertfalse;)
169
170
#else
171
//==============================================================================
172
// If debugging is disabled, these dummy debug and assertion macros are used..
173
174
#define DBG(textToWrite)
175
#define jassertfalse JUCE_BLOCK_WITH_FORCED_SEMICOLON (JUCE_LOG_CURRENT_ASSERTION;)
176
177
#if JUCE_LOG_ASSERTIONS
178
#define jassert(expression) JUCE_BLOCK_WITH_FORCED_SEMICOLON (if (! (expression)) jassertfalse;)
179
#define jassertquiet(expression) JUCE_BLOCK_WITH_FORCED_SEMICOLON (if (! (expression)) jassertfalse;)
180
#else
181
#define jassert(expression) JUCE_BLOCK_WITH_FORCED_SEMICOLON ( ; )
182
#define jassertquiet(expression) JUCE_BLOCK_WITH_FORCED_SEMICOLON (if (false) (void) (expression);)
183
#endif
184
185
#endif
186
187
//==============================================================================
188
#ifndef DOXYGEN
189
#define JUCE_JOIN_MACRO_HELPER(a, b) a ## b
190
#define JUCE_STRINGIFY_MACRO_HELPER(a) #a
191
#endif
192
197
#define JUCE_JOIN_MACRO(item1, item2) JUCE_JOIN_MACRO_HELPER (item1, item2)
198
200
#define JUCE_STRINGIFY(item) JUCE_STRINGIFY_MACRO_HELPER (item)
201
202
//==============================================================================
228
#define JUCE_DECLARE_NON_COPYABLE(className) \
229
className (const className&) = delete;\
230
className& operator= (const className&) = delete;
231
235
#define JUCE_DECLARE_NON_MOVEABLE(className) \
236
className (className&&) = delete;\
237
className& operator= (className&&) = delete;
238
242
#define JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(className) \
243
JUCE_DECLARE_NON_COPYABLE(className) \
244
JUCE_LEAK_DETECTOR(className)
245
249
#define JUCE_PREVENT_HEAP_ALLOCATION \
250
private: \
251
static void* operator new (size_t) = delete; \
252
static void operator delete (void*) = delete;
253
254
//==============================================================================
255
#if JUCE_MSVC && ! defined (DOXYGEN)
256
#define JUCE_WARNING_HELPER(file, line, mess) message(file "(" JUCE_STRINGIFY (line) ") : Warning: " #mess)
257
#define JUCE_COMPILER_WARNING(message) __pragma(JUCE_WARNING_HELPER (__FILE__, __LINE__, message))
258
#else
259
#ifndef DOXYGEN
260
#define JUCE_WARNING_HELPER(mess) message(#mess)
261
#endif
262
270
#define JUCE_COMPILER_WARNING(message) _Pragma(JUCE_STRINGIFY (JUCE_WARNING_HELPER (message)))
271
#endif
272
273
274
//==============================================================================
275
#if JUCE_DEBUG || DOXYGEN
281
#define forcedinline inline
282
#else
283
#if JUCE_MSVC
284
#define forcedinline __forceinline
285
#else
286
#define forcedinline inline __attribute__ ((always_inline))
287
#endif
288
#endif
289
290
#if JUCE_MSVC || DOXYGEN
293
#define JUCE_ALIGN(bytes) __declspec (align (bytes))
294
#else
295
#define JUCE_ALIGN(bytes) __attribute__ ((aligned (bytes)))
296
#endif
297
298
//==============================================================================
299
#if JUCE_ANDROID && ! defined (DOXYGEN)
300
#define JUCE_MODAL_LOOPS_PERMITTED 0
301
#elif ! defined (JUCE_MODAL_LOOPS_PERMITTED)
304
#define JUCE_MODAL_LOOPS_PERMITTED 0
305
#endif
306
307
//==============================================================================
308
#if JUCE_GCC || JUCE_CLANG
309
#define JUCE_PACKED __attribute__ ((packed))
310
#elif ! defined (DOXYGEN)
311
#define JUCE_PACKED
312
#endif
313
314
//==============================================================================
315
#if JUCE_GCC || DOXYGEN
318
#define JUCE_NO_ASSOCIATIVE_MATH_OPTIMISATIONS __attribute__ ((__optimize__ ("no-associative-math")))
319
#else
320
#define JUCE_NO_ASSOCIATIVE_MATH_OPTIMISATIONS
321
#endif
322
323
}
// namespace juce
libopenshot-audio-0.4.0
JuceLibraryCode
modules
juce_core
system
juce_PlatformDefs.h
Generated by
1.12.0