Răsfoiți Sursa

build system: trigger more warnings (at least with MSVC) and suppress as many as possible (close #420, close #394)

Michele Caini 6 ani în urmă
părinte
comite
3c39cfe645

+ 3 - 3
src/entt/entity/registry.hpp

@@ -1359,9 +1359,9 @@ public:
             group_data candidate = {
                 size,
                 { new handler_type{}, [](void *instance) { delete static_cast<handler_type *>(instance); } },
-                [](const ENTT_ID_TYPE ctype) ENTT_NOEXCEPT { return ((ctype == type_info<std::decay_t<Owned>>::id()) || ...); },
-                [](const ENTT_ID_TYPE ctype) ENTT_NOEXCEPT { return ((ctype == type_info<std::decay_t<Get>>::id()) || ...); },
-                [](const ENTT_ID_TYPE ctype) ENTT_NOEXCEPT { return ((ctype == type_info<Exclude>::id()) || ...); },
+                []([[maybe_unused]] const ENTT_ID_TYPE ctype) ENTT_NOEXCEPT { return ((ctype == type_info<std::decay_t<Owned>>::id()) || ...); },
+                []([[maybe_unused]] const ENTT_ID_TYPE ctype) ENTT_NOEXCEPT { return ((ctype == type_info<std::decay_t<Get>>::id()) || ...); },
+                []([[maybe_unused]] const ENTT_ID_TYPE ctype) ENTT_NOEXCEPT { return ((ctype == type_info<Exclude>::id()) || ...); },
             };
 
             handler = static_cast<handler_type *>(candidate.group.get());

+ 1 - 1
src/entt/entity/snapshot.hpp

@@ -388,7 +388,7 @@ class basic_continuous_loader {
     }
 
     template<typename Other, typename Type, typename Member>
-    void update(Other &instance, Member Type:: *member) {
+    void update([[maybe_unused]] Other &instance, [[maybe_unused]] Member Type:: *member) {
         if constexpr(!std::is_same_v<Other, Type>) {
             return;
         } else if constexpr(std::is_same_v<Member, Entity>) {

+ 1 - 1
src/entt/meta/factory.hpp

@@ -156,7 +156,7 @@ template<typename Type, auto Data, typename Policy>
 meta_any getter([[maybe_unused]] meta_any instance, [[maybe_unused]] meta_any index) {
     auto dispatch = [](auto &&value) {
         if constexpr(std::is_same_v<Policy, as_void_t>) {
-            return meta_any{std::in_place_type<void>};
+            return meta_any{std::in_place_type<void>, std::forward<decltype(value)>(value)};
         } else if constexpr(std::is_same_v<Policy, as_alias_t>) {
             return meta_any{std::ref(std::forward<decltype(value)>(value))};
         } else {

+ 10 - 9
src/entt/meta/meta.hpp

@@ -533,8 +533,9 @@ public:
         bool valid = (node && node->type_id == internal::meta_info<Type>::resolve()->type_id);
 
         if(!valid) {
-            if(auto any = std::as_const(*this).convert<Type>(); (valid = static_cast<bool>(any))) {
+            if(auto any = std::as_const(*this).convert<Type>(); any) {
                 swap(any, *this);
+                valid = true;
             }
         }
 
@@ -566,7 +567,7 @@ public:
      * @return False if the container is empty, true otherwise.
      */
     explicit operator bool() const ENTT_NOEXCEPT {
-        return node;
+        return !(node == nullptr);
     }
 
     /**
@@ -696,7 +697,7 @@ struct meta_prop {
      * @return True if the meta object is valid, false otherwise.
      */
     explicit operator bool() const ENTT_NOEXCEPT {
-        return node;
+        return !(node == nullptr);
     }
 
 private:
@@ -734,7 +735,7 @@ struct meta_base {
      * @return True if the meta object is valid, false otherwise.
      */
     explicit operator bool() const ENTT_NOEXCEPT {
-        return node;
+        return !(node == nullptr);
     }
 
 private:
@@ -769,7 +770,7 @@ struct meta_conv {
      * @return True if the meta object is valid, false otherwise.
      */
     explicit operator bool() const ENTT_NOEXCEPT {
-        return node;
+        return !(node == nullptr);
     }
 
 private:
@@ -853,7 +854,7 @@ struct meta_ctor {
      * @return True if the meta object is valid, false otherwise.
      */
     explicit operator bool() const ENTT_NOEXCEPT {
-        return node;
+        return !(node == nullptr);
     }
 
 private:
@@ -996,7 +997,7 @@ struct meta_data {
      * @return True if the meta object is valid, false otherwise.
      */
     explicit operator bool() const ENTT_NOEXCEPT {
-        return node;
+        return !(node == nullptr);
     }
 
 private:
@@ -1113,7 +1114,7 @@ struct meta_func {
      * @return True if the meta object is valid, false otherwise.
      */
     explicit operator bool() const ENTT_NOEXCEPT {
-        return node;
+        return !(node == nullptr);
     }
 
 private:
@@ -1476,7 +1477,7 @@ public:
      * @return True if the meta object is valid, false otherwise.
      */
     explicit operator bool() const ENTT_NOEXCEPT {
-        return node;
+        return !(node == nullptr);
     }
 
     /**

+ 1 - 1
src/entt/signal/delegate.hpp

@@ -273,7 +273,7 @@ public:
      */
     explicit operator bool() const ENTT_NOEXCEPT {
         // no need to test also data
-        return fn;
+        return !(fn == nullptr);
     }
 
     /**

+ 1 - 1
test/CMakeLists.txt

@@ -44,7 +44,7 @@ function(SETUP_TARGET TARGET_NAME)
         ${TARGET_NAME}
         PRIVATE
             $<$<NOT:$<PLATFORM_ID:Windows>>:-pedantic -fvisibility=hidden -Wall -Wshadow -Wno-deprecated-declarations>
-            $<$<PLATFORM_ID:Windows>:/EHsc /W1 /wd4996>
+            $<$<PLATFORM_ID:Windows>:/EHsc /W1 /wd4996 /w14800>
     )
 
     target_compile_options(

+ 4 - 4
test/lib/meta/types.h

@@ -2,13 +2,13 @@
 #define ENTT_LIB_META_TYPES_H
 
 struct position {
-    int x{};
-    int y{};
+    int x;
+    int y;
 };
 
 struct velocity {
-    double dx{};
-    double dy{};
+    double dx;
+    double dy;
 };
 
 #endif

+ 4 - 4
test/lib/meta_plugin/types.h

@@ -4,13 +4,13 @@
 #include <entt/meta/meta.hpp>
 
 struct position {
-    int x{};
-    int y{};
+    int x;
+    int y;
 };
 
 struct velocity {
-    double dx{};
-    double dy{};
+    double dx;
+    double dy;
 };
 
 struct userdata {

+ 4 - 4
test/lib/meta_plugin_std/types.h

@@ -23,13 +23,13 @@ struct entt::type_info<Type> {
 };
 
 struct position {
-    int x{};
-    int y{};
+    int x;
+    int y;
 };
 
 struct velocity {
-    double dx{};
-    double dy{};
+    double dx;
+    double dy;
 };
 
 struct userdata {

+ 4 - 4
test/lib/meta_std/types.h

@@ -2,13 +2,13 @@
 #define ENTT_LIB_META_STD_TYPES_H
 
 struct position {
-    int x{};
-    int y{};
+    int x;
+    int y;
 };
 
 struct velocity {
-    double dx{};
-    double dy{};
+    double dx;
+    double dy;
 };
 
 #endif