mirror of
https://github.com/huderlem/porymap.git
synced 2026-08-23 00:56:47 -05:00
Add Q_ASSERT_RETURN and friends
Some checks failed
Build Porymap / build-linux (, 5.14.2) (push) Has been cancelled
Build Porymap / build-linux (, 6.8.*) (push) Has been cancelled
Build Porymap / build-linux (minimal, 5.14.2) (push) Has been cancelled
Build Porymap / build-macos (macos-15-intel) (push) Has been cancelled
Build Porymap / build-macos (macos-latest) (push) Has been cancelled
Build Porymap / build-static-windows (push) Has been cancelled
Some checks failed
Build Porymap / build-linux (, 5.14.2) (push) Has been cancelled
Build Porymap / build-linux (, 6.8.*) (push) Has been cancelled
Build Porymap / build-linux (minimal, 5.14.2) (push) Has been cancelled
Build Porymap / build-macos (macos-15-intel) (push) Has been cancelled
Build Porymap / build-macos (macos-latest) (push) Has been cancelled
Build Porymap / build-static-windows (push) Has been cancelled
This commit is contained in:
26
include/core/assert_return.h
Normal file
26
include/core/assert_return.h
Normal file
@@ -0,0 +1,26 @@
|
||||
#pragma once
|
||||
|
||||
#include <QtAssert>
|
||||
|
||||
// A series of wrappers around Qt assert macros,
|
||||
// with the addition that each will return if the test fails.
|
||||
// This makes it easy to raise asserts in situations where you
|
||||
// may want to do an early return even if debug is disabled.
|
||||
|
||||
#define Q_ASSERT_RETURN(test, ...) \
|
||||
do { \
|
||||
Q_ASSERT(test); \
|
||||
if (!test) return __VA_ARGS__; \
|
||||
} while (false);
|
||||
|
||||
#define Q_ASSERT_RETURN_X(test, where, what, ...) \
|
||||
do { \
|
||||
Q_ASSERT_X(test, where, what); \
|
||||
if (!test) return __VA_ARGS__; \
|
||||
} while (false);
|
||||
|
||||
#define Q_CHECK_PTR_RETURN(pointer, ...) \
|
||||
do { \
|
||||
Q_CHECK_PTR(pointer); \
|
||||
if (pointer == nullptr) return __VA_ARGS__; \
|
||||
} while (false);
|
||||
@@ -179,6 +179,7 @@ HEADERS += include/config/keyvalueconfigbase.h \
|
||||
include/config/projectconfig.h \
|
||||
include/config/shortcutsconfig.h \
|
||||
include/config/userconfig.h \
|
||||
include/core/assert_return.h \
|
||||
include/core/advancemapparser.h \
|
||||
include/core/block.h \
|
||||
include/core/bitpacker.h \
|
||||
|
||||
Reference in New Issue
Block a user