Jolt Physics
A multi core friendly Game Physics Engine
Loading...
Searching...
No Matches
IssueReporting.h
Go to the documentation of this file.
1
// Jolt Physics Library (https://github.com/jrouwe/JoltPhysics)
2
// SPDX-FileCopyrightText: 2021 Jorrit Rouwe
3
// SPDX-License-Identifier: MIT
4
5
#pragma once
6
7
JPH_NAMESPACE_BEGIN
8
10
using
TraceFunction
=
void
(*)(
const
char
*
inFMT
, ...);
11
JPH_EXPORT
extern
TraceFunction
Trace
;
12
13
// Always turn on asserts in Debug mode
14
#if defined(_DEBUG) && !defined(JPH_ENABLE_ASSERTS)
15
#define JPH_ENABLE_ASSERTS
16
#endif
17
18
#ifdef JPH_ENABLE_ASSERTS
20
using
AssertFailedFunction
=
bool
(*)(
const
char
*
inExpression
,
const
char
*
inMessage
,
const
char
*
inFile
,
uint
inLine
);
21
JPH_EXPORT
extern
AssertFailedFunction
AssertFailed
;
22
23
// Helper functions to pass message on to failed function
24
struct
AssertLastParam
{ };
25
inline
bool
AssertFailedParamHelper
(
const
char
*
inExpression
,
const
char
*
inFile
,
uint
inLine
,
AssertLastParam
) {
return
AssertFailed
(
inExpression
,
nullptr
,
inFile
,
inLine
); }
26
inline
bool
AssertFailedParamHelper
(
const
char
*
inExpression
,
const
char
*
inFile
,
uint
inLine
,
const
char
*
inMessage
,
AssertLastParam
) {
return
AssertFailed
(
inExpression
,
inMessage
,
inFile
,
inLine
); }
27
29
#define JPH_ASSERT(inExpression, ...) do { if (!(inExpression) && AssertFailedParamHelper(#inExpression, __FILE__, JPH::uint(__LINE__), ##__VA_ARGS__, JPH::AssertLastParam())) JPH_BREAKPOINT; } while (false)
30
31
#define JPH_IF_ENABLE_ASSERTS(...) __VA_ARGS__
32
#else
33
#define JPH_ASSERT(...) ((void)0)
34
35
#define JPH_IF_ENABLE_ASSERTS(...)
36
#endif
// JPH_ENABLE_ASSERTS
37
38
JPH_NAMESPACE_END
JPH_EXPORT
#define JPH_EXPORT
Definition
Core.h:227
uint
unsigned int uint
Definition
Core.h:439
JPH_NAMESPACE_END
#define JPH_NAMESPACE_END
Definition
Core.h:367
JPH_NAMESPACE_BEGIN
#define JPH_NAMESPACE_BEGIN
Definition
Core.h:361
TraceFunction
void(*)(const char *inFMT,...) TraceFunction
Trace function, needs to be overridden by application. This should output a line of text to the log /...
Definition
IssueReporting.h:10
Trace
JPH_EXPORT TraceFunction Trace
Definition
IssueReporting.cpp:18
Allocate
AllocateFunction Allocate
Definition
Memory.cpp:59
Jolt
Core
IssueReporting.h
Generated by
1.10.0