skypjack před 1 týdnem
rodič
revize
f8781364f5

+ 1 - 0
CMakeLists.txt

@@ -200,6 +200,7 @@ if(ENTT_INCLUDE_HEADERS)
         stl/array.hpp
         stl/array.hpp
         stl/atomic.hpp
         stl/atomic.hpp
         stl/bit.hpp
         stl/bit.hpp
+        stl/cassert.hpp
         stl/compare.hpp
         stl/compare.hpp
         stl/concepts.hpp
         stl/concepts.hpp
         stl/cstddef.hpp
         stl/cstddef.hpp

+ 1 - 1
src/entt/config/config.h

@@ -56,7 +56,7 @@
 #    undef ENTT_ASSERT
 #    undef ENTT_ASSERT
 #    define ENTT_ASSERT(condition, msg) (void(0))
 #    define ENTT_ASSERT(condition, msg) (void(0))
 #elif !defined ENTT_ASSERT
 #elif !defined ENTT_ASSERT
-#    include <cassert>
+#    include "../stl/cassert.hpp"
 #    define ENTT_ASSERT(condition, msg) assert(((condition) && (msg)))
 #    define ENTT_ASSERT(condition, msg) assert(((condition) && (msg)))
 #endif
 #endif
 
 

+ 15 - 0
src/entt/stl/cassert.hpp

@@ -0,0 +1,15 @@
+#ifndef ENTT_STL_CASSERT_HPP
+#define ENTT_STL_CASSERT_HPP
+
+/*! @cond ENTT_INTERNAL */
+#if __has_include(<entt/ext/stl/cassert.hpp>)
+#    include <entt/ext/stl/cassert.hpp>
+#else
+#    include <cassert>
+
+namespace entt::stl {
+} // namespace entt::stl
+#endif
+/*! @endcond */
+
+#endif

+ 1 - 0
test/CMakeLists.txt

@@ -397,6 +397,7 @@ SETUP_BASIC_TEST(
         entt/stl_ext/array.cpp
         entt/stl_ext/array.cpp
         entt/stl_ext/atomic.cpp
         entt/stl_ext/atomic.cpp
         entt/stl_ext/bit.cpp
         entt/stl_ext/bit.cpp
+        entt/stl_ext/cassert.cpp
         entt/stl_ext/compare.cpp
         entt/stl_ext/compare.cpp
         entt/stl_ext/concepts.cpp
         entt/stl_ext/concepts.cpp
         entt/stl_ext/cstddef.cpp
         entt/stl_ext/cstddef.cpp

+ 6 - 0
test/entt/stl_ext/cassert.cpp

@@ -0,0 +1,6 @@
+#include <gtest/gtest.h>
+#include <entt/stl/cassert.hpp>
+
+TEST(CAssert, HasInclude) {
+    static_assert(entt::stl::entt_ext_cassert, "Header not properly included");
+}

+ 13 - 0
test/include/entt/ext/stl/cassert.hpp

@@ -0,0 +1,13 @@
+#ifndef ENTT_EXT_STL_CASSERT_HPP
+#define ENTT_EXT_STL_CASSERT_HPP
+
+/*! @cond ENTT_INTERNAL */
+#include <cassert>
+
+namespace entt::stl {
+using namespace std;
+inline constexpr auto entt_ext_cassert = true;
+} // namespace entt::stl
+/*! @endcond */
+
+#endif