From aaec85df9eb671ebb867ec579fdbed5cf4636ea2 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Tue, 20 Nov 2018 17:58:57 -0500 Subject: common/assert: Make the UNIMPLEMENTED macro properly assert Currently, this was only performing a logging call, which doesn't actually invoke any assertion behavior. This is unlike UNIMPLEMENTED_MSG, which *does* assert. This makes the expected behavior uniform across both macros. --- src/common/assert.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/common/assert.h b/src/common/assert.h index 0d4eddc19..8ec597914 100644 --- a/src/common/assert.h +++ b/src/common/assert.h @@ -52,5 +52,5 @@ __declspec(noinline, noreturn) #define DEBUG_ASSERT_MSG(_a_, _desc_, ...) #endif -#define UNIMPLEMENTED() LOG_CRITICAL(Debug, "Unimplemented code!") +#define UNIMPLEMENTED() ASSERT_MSG(false, "Unimplemented code!") #define UNIMPLEMENTED_MSG(...) ASSERT_MSG(false, __VA_ARGS__) -- cgit v1.2.3 From 9dcc229dfeee5061b69bce200d3256ed8fa9304e Mon Sep 17 00:00:00 2001 From: Lioncash Date: Tue, 20 Nov 2018 18:03:00 -0500 Subject: common/assert: Add UNIMPLEMENTED_IF and UNIMPLEMENTED_IF_MSG for conditional assertions Currently, there's no way to specify if an assertion should conditionally occur due to unimplemented behavior. This is useful when something is only partially implemented (e.g. due to ongoing RE work). In particular, this would be useful within the graphics code. The rationale behind this is it allows a dev to disable unimplemented feature assertions (which can occur in an unrelated work area), while still enabling regular assertions, which act as behavior guards for conditions or states which must not occur. Previously, the only way a dev could temporarily disable asserts, was to disable the regular assertion macros, which has the downside of also disabling, well, the regular assertions which hold more sanitizing value, as opposed to unimplemented feature assertions. --- src/common/assert.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src') diff --git a/src/common/assert.h b/src/common/assert.h index 8ec597914..6002f7ab1 100644 --- a/src/common/assert.h +++ b/src/common/assert.h @@ -54,3 +54,6 @@ __declspec(noinline, noreturn) #define UNIMPLEMENTED() ASSERT_MSG(false, "Unimplemented code!") #define UNIMPLEMENTED_MSG(...) ASSERT_MSG(false, __VA_ARGS__) + +#define UNIMPLEMENTED_IF(cond) ASSERT_MSG(!(cond), "Unimplemented code!") +#define UNIMPLEMENTED_IF_MSG(cond, ...) ASSERT_MSG(!(cond), __VA_ARGS__) -- cgit v1.2.3