Browse Source

make macros require a trailing semicolon

Michele Caini 6 năm trước cách đây
mục cha
commit
39e3a5a708

+ 1 - 1
TODO

@@ -34,5 +34,5 @@
 * use [[nodiscard]] consistently for safety purposes
 * static reflection, hint: template<> meta_type_t<Type>: meta_descriptor<name, func..., props..., etc...>
 * null support for entt::component
-* make macros require a trailing ;
 * named_type_traits<Type>::value -> named_type_traits_v<Type>
+* extend to_integer to &, |, and so on...

+ 3 - 2
src/entt/core/type_traits.hpp

@@ -224,7 +224,8 @@ constexpr auto is_named_type_v = is_named_type<Type>::value;
     enum class clazz: type {};\
     constexpr auto to_integer(const clazz id) ENTT_NOEXCEPT {\
         return std::underlying_type_t<clazz>(id);\
-    }
+    }\
+    static_assert(true)
 
 
 }
@@ -264,7 +265,7 @@ constexpr auto is_named_type_v = is_named_type<Type>::value;
     {\
         static_assert(std::is_same_v<std::remove_cv_t<type>, type>);\
         static_assert(std::is_object_v<type>);\
-    };
+    }
 
 
 /**

+ 2 - 2
src/entt/entity/fwd.hpp

@@ -45,10 +45,10 @@ template<typename>
 class basic_continuous_loader;
 
 /*! @brief Alias declaration for the most common use case. */
-ENTT_OPAQUE_TYPE(entity, ENTT_ID_TYPE)
+ENTT_OPAQUE_TYPE(entity, ENTT_ID_TYPE);
 
 /*! @brief Alias declaration for the most common use case. */
-ENTT_OPAQUE_TYPE(component, ENTT_ID_TYPE)
+ENTT_OPAQUE_TYPE(component, ENTT_ID_TYPE);
 
 /*! @brief Alias declaration for the most common use case. */
 using registry = basic_registry<entity>;

+ 2 - 2
test/entt/core/type_traits.cpp

@@ -2,8 +2,8 @@
 #include <entt/core/type_traits.hpp>
 
 ENTT_NAMED_TYPE(int);
-ENTT_NAMED_STRUCT(named_struct, {})
-ENTT_NAMED_CLASS(named_class, {})
+ENTT_NAMED_STRUCT(named_struct, {});
+ENTT_NAMED_CLASS(named_class, {});
 
 TEST(Choice, Functionalities) {
     ASSERT_TRUE((std::is_base_of_v<entt::choice_t<0>, entt::choice_t<1>>));

+ 1 - 1
test/entt/entity/registry.cpp

@@ -9,7 +9,7 @@
 #include <entt/entity/registry.hpp>
 #include <entt/entity/entity.hpp>
 
-ENTT_NAMED_TYPE(int)
+ENTT_NAMED_TYPE(int);
 
 struct empty_type {};
 

+ 1 - 1
test/entt/signal/dispatcher.cpp

@@ -7,7 +7,7 @@ struct an_event {};
 struct another_event {};
 struct one_more_event {};
 
-ENTT_NAMED_TYPE(an_event)
+ENTT_NAMED_TYPE(an_event);
 
 struct receiver {
     static void forward(entt::dispatcher &dispatcher, const an_event &event) {

+ 1 - 1
test/entt/signal/emitter.cpp

@@ -8,7 +8,7 @@ struct foo_event { int i; char c; };
 struct bar_event {};
 struct quux_event {};
 
-ENTT_NAMED_TYPE(foo_event)
+ENTT_NAMED_TYPE(foo_event);
 
 TEST(Emitter, Clear) {
     test_emitter emitter;

+ 6 - 6
test/lib/types.h

@@ -8,18 +8,18 @@ struct test_emitter
 ENTT_NAMED_STRUCT(position, {
     int x;
     int y;
-})
+});
 
 ENTT_NAMED_STRUCT(velocity, {
     int dx;
     int dy;
-})
+});
 
 ENTT_NAMED_STRUCT(an_event, {
     int payload;
-})
+});
 
-ENTT_NAMED_STRUCT(another_event, {})
+ENTT_NAMED_STRUCT(another_event, {});
 
-ENTT_NAMED_TYPE(int)
-ENTT_NAMED_TYPE(char)
+ENTT_NAMED_TYPE(int);
+ENTT_NAMED_TYPE(char);