|
|
@@ -0,0 +1,25 @@
|
|
|
+module;
|
|
|
+
|
|
|
+export module Core.Assert;
|
|
|
+
|
|
|
+import Core.Std;
|
|
|
+import Core.Utility;
|
|
|
+import Core.Logger;
|
|
|
+
|
|
|
+export namespace Core {
|
|
|
+#ifdef NDEBUG
|
|
|
+ void inline assert(bool) {
|
|
|
+ }
|
|
|
+#else
|
|
|
+ void inline assert(
|
|
|
+ bool b,
|
|
|
+ const std::source_location& l = std::source_location::current()) {
|
|
|
+ if(!b) {
|
|
|
+ Core::logError(
|
|
|
+ FormatLocation("Assert in function #", l),
|
|
|
+ getShortFileName(l.file_name()), l.line(), l.function_name());
|
|
|
+ exitWithHandler(1, l);
|
|
|
+ }
|
|
|
+ }
|
|
|
+#endif
|
|
|
+}
|