Commit graph

27 commits

Author SHA1 Message Date
Liam
846f266199 common/assert: rework ASSERT handling to avoid std::function usage 2022-06-13 20:09:32 -04:00
Liam
d2af4f8142 common: Don't test ASSERT conditions inline 2022-06-13 20:09:00 -04:00
Liam
c1771c98f3 common: Change semantics of UNREACHABLE to unconditionally crash 2022-06-13 20:09:00 -04:00
Andrea Pappacoda
b2eb103829 chore: add missing SPDX tags
Follow-up to 2b87305d31
2022-04-28 18:24:11 +02:00
yzct12345
dd9e7378dc assert: Verify formatting 2021-08-05 17:46:22 +00:00
yzct12345
3239e923cc assert: Avoid empty macros 2021-08-05 17:21:56 +00:00
Markus Wick
0372a0e723 common: Move assert failure handling into a cpp file.
Advantage: Altering the handler does not need a full recompilation.
Disadvantage: noreturn is droped, so the caller is a bit slower.

We quite often run yuzu with a YOLO assertion handler. In fact, only very few
games run at all with asserts. This patch allows developers to patch the handler
without recompiling everything. The overhead of the missing "noreturn" attribute
shoul be negletable.
2021-04-04 21:19:33 +02:00
Lioncash
4861eb64aa common/assert: Make use of C++ attribute syntax
Normalizes the syntax used for attributes
2020-08-24 04:15:10 -04:00
Weiyi Wang
9a19c4bbd5 fix clang-format and lambda capture 2019-11-23 01:30:06 +01:00
Weiyi Wang
e20e161c5c unfold UNREACHABLE implementation for dumb compilers
We relies on UNREACHABLE's noreturn attribute to eliminate parent's "no return value" warning. However, this was wrapped in a `if(!false)` block, which compilers may not unfold to recognize the noreturn nature.
2019-11-23 01:30:06 +01:00
Fernando Sahmkow
a576cd4a8c Permit a Null Shader in case of a bad host_ptr. 2019-04-07 07:52:01 -04:00
Lioncash
dd8172d440 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.
2018-11-20 18:15:37 -05:00
Lioncash
6567d76590 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.
2018-11-20 17:59:00 -05:00
fearlessTobi
8f74246cb1 Port #3474 from Citra 2018-07-07 14:17:44 +02:00
James Rowe
d74d2a77cb Update clang format 2018-07-02 21:45:47 -04:00
James Rowe
e159c550d8 Rename logging macro back to LOG_* 2018-07-02 21:45:47 -04:00
Lioncash
324ee31fc3 general: Convert assertion macros over to be fmt-compatible 2018-04-27 10:04:02 -04:00
MerryMage
66a015fe9a fix macos build 2018-01-08 19:20:10 -05:00
Emmanuel Gil Peyrot
1138ec0d49 Remove empty newlines in #include blocks.
This makes clang-format useful on those.

Also add a bunch of forgotten transitive includes, which otherwise
prevented compilation.
2016-09-21 11:15:47 +09:00
Emmanuel Gil Peyrot
628ed4376a Sources: Run clang-format on everything. 2016-09-18 09:38:01 +09:00
Sam Spilsbury
329e5e3437 assert: Allow UNREACHABLE_MSG to have just one argument 2016-04-24 23:40:14 +08:00
Sam Spilsbury
54a7cb0611 assert: Add _MSG variations for UNREACHABLE and UNIMPLEMENTED 2016-04-23 11:54:02 +08:00
Emmanuel Gil Peyrot
3a771a13dc Common: Cleanup profiler includes. 2015-06-28 00:36:53 +01:00
Yuri Kunde Schlesner
c8eae338a8 Common: Use the log system to print assert messages 2015-05-12 02:52:31 -03:00
Yuri Kunde Schlesner
c0eaa662d4 Clean-up includes 2015-05-06 23:45:06 -03:00
Yuri Kunde Schlesner
714d507938 Asserts: Use lambdas to keep assertion code away from the main code path 2015-02-18 02:19:30 -02:00
archshift
ef24e72b26 Asserts: break/crash program, fit to style guide; log.h->assert.h
Involves making asserts use printf instead of the log functions (log functions are asynchronous and, as such, the log won't be printed in time)
As such, the log type argument was removed (printf obviously can't use it, and it's made obsolete by the file and line printing)

Also removed some GEKKO cruft.
2015-02-10 18:30:31 -08:00