Parcourir la source

Nuke assert.h

Daniele Bartolini il y a 11 ans
Parent
commit
18f1a48da0

+ 0 - 18
engine/core/assert.h

@@ -1,18 +0,0 @@
-/*
- * Copyright (c) 2012-2015 Daniele Bartolini and individual contributors.
- * License: https://github.com/taylor001/crown/blob/master/LICENSE
- */
-
-#pragma once
-
-#include "error.h"
-
-#if defined(CROWN_DEBUG)
-	#define CE_ASSERT(condition, msg, ...) do { if (!(condition)) {\
-		crown::error::abort(__FILE__, __LINE__, "\nAssertion failed: %s\n\t" msg "\n", #condition, ##__VA_ARGS__); }} while (0)
-#else
-	#define CE_ASSERT(...) ((void)0)
-#endif
-
-#define CE_ASSERT_NOT_NULL(x) CE_ASSERT(x != NULL, #x "must be not null")
-#define CE_FATAL(msg) CE_ASSERT(false, msg)

+ 1 - 1
engine/core/containers/array.h

@@ -5,7 +5,7 @@
 
 #pragma once
 
-#include "assert.h"
+#include "error.h"
 #include "macros.h"
 #include "container_types.h"
 #include "allocator.h"

+ 1 - 1
engine/core/containers/blob.h

@@ -6,7 +6,7 @@
 #pragma once
 
 #include "types.h"
-#include "assert.h"
+#include "error.h"
 
 namespace crown
 {

+ 1 - 1
engine/core/containers/event_stream.h

@@ -5,7 +5,7 @@
 
 #pragma once
 
-#include "assert.h"
+#include "error.h"
 #include "array.h"
 
 namespace crown

+ 1 - 1
engine/core/containers/id_array.h

@@ -5,7 +5,7 @@
 
 #pragma once
 
-#include "assert.h"
+#include "error.h"
 #include "types.h"
 #include "container_types.h"
 

+ 1 - 1
engine/core/containers/id_table.h

@@ -5,7 +5,7 @@
 
 #pragma once
 
-#include "assert.h"
+#include "error.h"
 #include "allocator.h"
 #include "types.h"
 

+ 1 - 1
engine/core/containers/queue.h

@@ -7,7 +7,7 @@
 
 #include "container_types.h"
 #include "array.h"
-#include "assert.h"
+#include "error.h"
 #include <cstring> // memcpy
 
 namespace crown

+ 1 - 1
engine/core/containers/vector.h

@@ -7,7 +7,7 @@
 
 #include "container_types.h"
 #include "allocator.h"
-#include "assert.h"
+#include "error.h"
 #include "macros.h"
 
 namespace crown

+ 10 - 0
engine/core/error.h

@@ -14,3 +14,13 @@ namespace error
 	void abort(const char* file, int line, const char* message, ...);
 } // namespace error
 } // namespace crown
+
+#if defined(CROWN_DEBUG)
+	#define CE_ASSERT(condition, msg, ...) do { if (!(condition)) {\
+		crown::error::abort(__FILE__, __LINE__, "\nAssertion failed: %s\n\t" msg "\n", #condition, ##__VA_ARGS__); }} while (0)
+#else
+	#define CE_ASSERT(...) ((void)0)
+#endif
+
+#define CE_ASSERT_NOT_NULL(x) CE_ASSERT(x != NULL, #x " must be not null")
+#define CE_FATAL(msg) CE_ASSERT(false, msg)

+ 1 - 1
engine/core/filesystem/apk_file.cpp

@@ -8,7 +8,7 @@
 #if CROWN_PLATFORM_ANDROID
 
 #include "apk_file.h"
-#include "assert.h"
+#include "error.h"
 #include "macros.h"
 #include <stdio.h> // SEEK_SET, ...
 #include <android/asset_manager.h>

+ 1 - 1
engine/core/filesystem/disk_file.h

@@ -5,7 +5,7 @@
 
 #pragma once
 
-#include "assert.h"
+#include "error.h"
 #include "os_file.h"
 #include "file.h"
 

+ 1 - 1
engine/core/filesystem/network_file.h

@@ -5,7 +5,7 @@
 
 #pragma once
 
-#include "assert.h"
+#include "error.h"
 #include "socket.h"
 #include "os.h"
 #include "file.h"

+ 1 - 1
engine/core/filesystem/os_file.h

@@ -7,7 +7,7 @@
 
 #include "file.h" // FileOpenMode
 #include "types.h"
-#include "assert.h"
+#include "error.h"
 #include "macros.h"
 #include "config.h"
 

+ 1 - 1
engine/core/math/aabb.h

@@ -5,7 +5,7 @@
 
 #pragma once
 
-#include "assert.h"
+#include "error.h"
 #include "math_types.h"
 #include "matrix4x4.h"
 #include "sphere.h"

+ 1 - 1
engine/core/math/math_utils.h

@@ -5,7 +5,7 @@
 
 #pragma once
 
-#include "assert.h"
+#include "error.h"
 #include "types.h"
 #include <math.h>
 

+ 1 - 1
engine/core/math/matrix3x3.h

@@ -7,7 +7,7 @@
 
 #include "math_types.h"
 #include "vector3.h"
-#include "assert.h"
+#include "error.h"
 #include "quaternion.h"
 
 namespace crown

+ 1 - 1
engine/core/math/vector2.h

@@ -5,7 +5,7 @@
 
 #pragma once
 
-#include "assert.h"
+#include "error.h"
 #include "types.h"
 #include "math_utils.h"
 #include "math_types.h"

+ 1 - 1
engine/core/math/vector3.h

@@ -5,7 +5,7 @@
 
 #pragma once
 
-#include "assert.h"
+#include "error.h"
 #include "types.h"
 #include "math_utils.h"
 #include "vector2.h"

+ 1 - 1
engine/core/math/vector4.h

@@ -5,7 +5,7 @@
 
 #pragma once
 
-#include "assert.h"
+#include "error.h"
 #include "types.h"
 #include "math_utils.h"
 #include "vector3.h"

+ 1 - 1
engine/core/memory/memory.h

@@ -6,7 +6,7 @@
 #pragma once
 
 #include "types.h"
-#include "assert.h"
+#include "error.h"
 #include "allocator.h"
 #include "macros.h"
 #include <new>

+ 1 - 1
engine/core/memory/pool_allocator.cpp

@@ -4,7 +4,7 @@
  */
 
 #include "pool_allocator.h"
-#include "assert.h"
+#include "error.h"
 
 namespace crown
 {

+ 1 - 1
engine/core/memory/proxy_allocator.cpp

@@ -4,7 +4,7 @@
  */
 
 #include "proxy_allocator.h"
-#include "assert.h"
+#include "error.h"
 #include "profiler.h"
 
 namespace crown

+ 1 - 1
engine/core/network/socket.h

@@ -7,7 +7,7 @@
 
 #include "config.h"
 #include "types.h"
-#include "assert.h"
+#include "error.h"
 #include "macros.h"
 #include "net_address.h"
 

+ 1 - 1
engine/core/os.h

@@ -10,7 +10,7 @@
 #include "vector.h"
 #include "dynamic_string.h"
 #include "string_utils.h"
-#include "assert.h"
+#include "error.h"
 #include "temp_allocator.h"
 
 #if CROWN_PLATFORM_POSIX

+ 1 - 1
engine/core/os_window_android.cpp

@@ -8,7 +8,7 @@
 #if CROWN_PLATFORM_ANDROID
 
 #include "os_window_android.h"
-#include "assert.h"
+#include "error.h"
 #include "log.h"
 
 namespace crown

+ 1 - 1
engine/core/os_window_linux.cpp

@@ -7,7 +7,7 @@
 #if CROWN_PLATFORM_LINUX
 
 #include "os_window_linux.h"
-#include "assert.h"
+#include "error.h"
 #include "string_utils.h"
 #include "log.h"
 

+ 1 - 1
engine/core/strings/dynamic_string.h

@@ -5,7 +5,7 @@
 
 #pragma once
 
-#include "assert.h"
+#include "error.h"
 #include "memory.h"
 #include "string_utils.h"
 #include "array.h"

+ 1 - 1
engine/core/strings/string_utils.h

@@ -5,7 +5,7 @@
 
 #pragma once
 
-#include "assert.h"
+#include "error.h"
 #include "types.h"
 #include "config.h"
 #include "macros.h"

+ 1 - 1
engine/core/thread/mutex.h

@@ -7,7 +7,7 @@
 
 #include "config.h"
 #include "types.h"
-#include "assert.h"
+#include "error.h"
 #include "macros.h"
 
 #if CROWN_PLATFORM_POSIX

+ 1 - 1
engine/core/thread/semaphore.h

@@ -6,7 +6,7 @@
 #pragma once
 
 #include "config.h"
-#include "assert.h"
+#include "error.h"
 #include "mutex.h"
 
 #if CROWN_PLATFORM_POSIX

+ 1 - 1
engine/core/thread/thread.h

@@ -6,7 +6,7 @@
 #pragma once
 
 #include "config.h"
-#include "assert.h"
+#include "error.h"
 #include "types.h"
 #include "semaphore.h"
 

+ 1 - 1
engine/lua/lua_environment.cpp

@@ -5,7 +5,7 @@
 
 
 #include "config.h"
-#include "assert.h"
+#include "error.h"
 #include "lua_environment.h"
 #include "lua_stack.h"
 #include "lua_resource.h"

+ 1 - 1
engine/lua/lua_system.cpp

@@ -7,7 +7,7 @@
 #include "config.h"
 #include "lua_stack.h"
 #include "lua_assert.h"
-#include "assert.h"
+#include "error.h"
 #include "vector2.h"
 #include "vector3.h"
 #include "matrix4x4.h"

+ 1 - 1
engine/world/camera.cpp

@@ -9,7 +9,7 @@
 #include "quaternion.h"
 #include "unit.h"
 #include "scene_graph.h"
-#include "assert.h"
+#include "error.h"
 #include "vector4.h"
 #include "frustum.h"
 

+ 1 - 1
engine/world/world.cpp

@@ -4,7 +4,7 @@
  */
 
 #include "world.h"
-#include "assert.h"
+#include "error.h"
 #include "resource_manager.h"
 #include "debug_line.h"
 #include "actor.h"