LMMS
Loading...
Searching...
No Matches
juce_PlatformDefs.h
Go to the documentation of this file.
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
25namespace 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
170 #define jassertquiet(expression) JUCE_BLOCK_WITH_FORCED_SEMICOLON (if (! (expression)) jassertfalse;)
171
172#else
173 //==============================================================================
174 // If debugging is disabled, these dummy debug and assertion macros are used..
175
176 #define DBG(textToWrite)
177 #define jassertfalse JUCE_BLOCK_WITH_FORCED_SEMICOLON (JUCE_LOG_CURRENT_ASSERTION)
178
179 #if JUCE_LOG_ASSERTIONS
180 #define jassert(expression) JUCE_BLOCK_WITH_FORCED_SEMICOLON (if (! (expression)) jassertfalse;)
181 #define jassertquiet(expression) JUCE_BLOCK_WITH_FORCED_SEMICOLON (if (! (expression)) jassertfalse;)
182 #else
183 #define jassert(expression) JUCE_BLOCK_WITH_FORCED_SEMICOLON ( ; )
184 #define jassertquiet(expression) JUCE_BLOCK_WITH_FORCED_SEMICOLON (if (false) (void) (expression);)
185 #endif
186
187#endif
188
189//==============================================================================
190#ifndef DOXYGEN
191 #define JUCE_JOIN_MACRO_HELPER(a, b) a ## b
192 #define JUCE_STRINGIFY_MACRO_HELPER(a) #a
193#endif
194
199#define JUCE_JOIN_MACRO(item1, item2) JUCE_JOIN_MACRO_HELPER (item1, item2)
200
202#define JUCE_STRINGIFY(item) JUCE_STRINGIFY_MACRO_HELPER (item)
203
204//==============================================================================
230#define JUCE_DECLARE_NON_COPYABLE(className) \
231 className (const className&) = delete;\
232 className& operator= (const className&) = delete;
233
237#define JUCE_DECLARE_NON_MOVEABLE(className) \
238 className (className&&) = delete;\
239 className& operator= (className&&) = delete;
240
244#define JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(className) \
245 JUCE_DECLARE_NON_COPYABLE(className) \
246 JUCE_LEAK_DETECTOR(className)
247
251#define JUCE_PREVENT_HEAP_ALLOCATION \
252 private: \
253 static void* operator new (size_t) = delete; \
254 static void operator delete (void*) = delete;
255
256//==============================================================================
257#if JUCE_MSVC && ! defined (DOXYGEN)
258 #define JUCE_WARNING_HELPER(file, line, mess) message(file "(" JUCE_STRINGIFY (line) ") : Warning: " #mess)
259 #define JUCE_COMPILER_WARNING(message) __pragma(JUCE_WARNING_HELPER (__FILE__, __LINE__, message))
260#else
261 #ifndef DOXYGEN
262 #define JUCE_WARNING_HELPER(mess) message(#mess)
263 #endif
264
272 #define JUCE_COMPILER_WARNING(message) _Pragma(JUCE_STRINGIFY (JUCE_WARNING_HELPER (message)))
273#endif
274
275
276//==============================================================================
277#if JUCE_DEBUG || DOXYGEN
283 #define forcedinline inline
284#else
285 #if JUCE_MSVC
286 #define forcedinline __forceinline
287 #else
288 #define forcedinline inline __attribute__((always_inline))
289 #endif
290#endif
291
292#if JUCE_MSVC || DOXYGEN
295 #define JUCE_ALIGN(bytes) __declspec (align (bytes))
296#else
297 #define JUCE_ALIGN(bytes) __attribute__ ((aligned (bytes)))
298#endif
299
300//==============================================================================
301#if JUCE_ANDROID && ! defined (DOXYGEN)
302 #define JUCE_MODAL_LOOPS_PERMITTED 0
303#elif ! defined (JUCE_MODAL_LOOPS_PERMITTED)
306 #define JUCE_MODAL_LOOPS_PERMITTED 0
307#endif
308
309//==============================================================================
310#if JUCE_GCC || JUCE_CLANG
311 #define JUCE_PACKED __attribute__((packed))
312#elif ! defined (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
__attribute__((naked, target("arm")))
Definition asm-nseel-arm-gcc.c:66
Definition carla_juce.cpp:31