diff --git a/distr/flecs.h b/distr/flecs.h index 901a6b5f8..73248b381 100644 --- a/distr/flecs.h +++ b/distr/flecs.h @@ -3543,29 +3543,29 @@ struct ecs_observer_t { */ /* Flags that can be used to check which hooks a type has set */ -#define ECS_TYPE_HOOK_CTOR ((ecs_flags32_t)(1 << 0)) -#define ECS_TYPE_HOOK_DTOR ((ecs_flags32_t)(1 << 1)) -#define ECS_TYPE_HOOK_COPY ((ecs_flags32_t)(1 << 2)) -#define ECS_TYPE_HOOK_MOVE ((ecs_flags32_t)(1 << 3)) -#define ECS_TYPE_HOOK_COPY_CTOR ((ecs_flags32_t)(1 << 4)) -#define ECS_TYPE_HOOK_MOVE_CTOR ((ecs_flags32_t)(1 << 5)) -#define ECS_TYPE_HOOK_CTOR_MOVE_DTOR ((ecs_flags32_t)(1 << 6)) -#define ECS_TYPE_HOOK_MOVE_DTOR ((ecs_flags32_t)(1 << 7)) -#define ECS_TYPE_HOOK_CMP ((ecs_flags32_t)(1 << 8)) -#define ECS_TYPE_HOOK_EQUALS ((ecs_flags32_t)(1 << 9)) +#define ECS_TYPE_HOOK_CTOR ECS_CAST(ecs_flags32_t, 1 << 0) +#define ECS_TYPE_HOOK_DTOR ECS_CAST(ecs_flags32_t, 1 << 1) +#define ECS_TYPE_HOOK_COPY ECS_CAST(ecs_flags32_t, 1 << 2) +#define ECS_TYPE_HOOK_MOVE ECS_CAST(ecs_flags32_t, 1 << 3) +#define ECS_TYPE_HOOK_COPY_CTOR ECS_CAST(ecs_flags32_t, 1 << 4) +#define ECS_TYPE_HOOK_MOVE_CTOR ECS_CAST(ecs_flags32_t, 1 << 5) +#define ECS_TYPE_HOOK_CTOR_MOVE_DTOR ECS_CAST(ecs_flags32_t, 1 << 6) +#define ECS_TYPE_HOOK_MOVE_DTOR ECS_CAST(ecs_flags32_t, 1 << 7) +#define ECS_TYPE_HOOK_CMP ECS_CAST(ecs_flags32_t, 1 << 8) +#define ECS_TYPE_HOOK_EQUALS ECS_CAST(ecs_flags32_t, 1 << 9) /* Flags that can be used to set/check which hooks of a type are invalid */ -#define ECS_TYPE_HOOK_CTOR_ILLEGAL ((ecs_flags32_t)(1 << 10)) -#define ECS_TYPE_HOOK_DTOR_ILLEGAL ((ecs_flags32_t)(1 << 12)) -#define ECS_TYPE_HOOK_COPY_ILLEGAL ((ecs_flags32_t)(1 << 13)) -#define ECS_TYPE_HOOK_MOVE_ILLEGAL ((ecs_flags32_t)(1 << 14)) -#define ECS_TYPE_HOOK_COPY_CTOR_ILLEGAL ((ecs_flags32_t)(1 << 15)) -#define ECS_TYPE_HOOK_MOVE_CTOR_ILLEGAL ((ecs_flags32_t)(1 << 16)) -#define ECS_TYPE_HOOK_CTOR_MOVE_DTOR_ILLEGAL ((ecs_flags32_t)(1 << 17)) -#define ECS_TYPE_HOOK_MOVE_DTOR_ILLEGAL ((ecs_flags32_t)(1 << 18)) -#define ECS_TYPE_HOOK_CMP_ILLEGAL ((ecs_flags32_t)(1 << 19)) -#define ECS_TYPE_HOOK_EQUALS_ILLEGAL ((ecs_flags32_t)(1 << 20)) +#define ECS_TYPE_HOOK_CTOR_ILLEGAL ECS_CAST(ecs_flags32_t, 1 << 10) +#define ECS_TYPE_HOOK_DTOR_ILLEGAL ECS_CAST(ecs_flags32_t, 1 << 12) +#define ECS_TYPE_HOOK_COPY_ILLEGAL ECS_CAST(ecs_flags32_t, 1 << 13) +#define ECS_TYPE_HOOK_MOVE_ILLEGAL ECS_CAST(ecs_flags32_t, 1 << 14) +#define ECS_TYPE_HOOK_COPY_CTOR_ILLEGAL ECS_CAST(ecs_flags32_t, 1 << 15) +#define ECS_TYPE_HOOK_MOVE_CTOR_ILLEGAL ECS_CAST(ecs_flags32_t, 1 << 16) +#define ECS_TYPE_HOOK_CTOR_MOVE_DTOR_ILLEGAL ECS_CAST(ecs_flags32_t, 1 << 17) +#define ECS_TYPE_HOOK_MOVE_DTOR_ILLEGAL ECS_CAST(ecs_flags32_t, 1 << 18) +#define ECS_TYPE_HOOK_CMP_ILLEGAL ECS_CAST(ecs_flags32_t, 1 << 19) +#define ECS_TYPE_HOOK_EQUALS_ILLEGAL ECS_CAST(ecs_flags32_t, 1 << 20) /* All valid hook flags */ @@ -27003,9 +27003,7 @@ template <> inline const char* symbol_name() { template::value == true >* = nullptr> -void register_lifecycle_actions( - ecs_world_t*, - ecs_entity_t) {} +void register_lifecycle_actions(ecs_world_t*, ecs_entity_t) { } // If the component is non-trivial, register component lifecycle actions. // Depending on the type not all callbacks may be available. @@ -27294,7 +27292,7 @@ untyped_component& op_compare( h.cmp = compare_callback; h.flags &= ~ECS_TYPE_HOOK_CMP_ILLEGAL; if(h.flags & ECS_TYPE_HOOK_EQUALS_ILLEGAL) { - h.flags &= ~(ECS_TYPE_HOOK_EQUALS_ILLEGAL); + h.flags &= ~ECS_TYPE_HOOK_EQUALS_ILLEGAL; h.equals = NULL; } set_hooks(h); @@ -27667,12 +27665,6 @@ untyped_component& metric( * * @ingroup cpp_components */ - -template -int ttest() { - return 7; -} - template struct component : untyped_component { /** Register a component. diff --git a/include/flecs.h b/include/flecs.h index 2dc226685..39af32973 100644 --- a/include/flecs.h +++ b/include/flecs.h @@ -875,29 +875,29 @@ struct ecs_observer_t { */ /* Flags that can be used to check which hooks a type has set */ -#define ECS_TYPE_HOOK_CTOR ((ecs_flags32_t)(1 << 0)) -#define ECS_TYPE_HOOK_DTOR ((ecs_flags32_t)(1 << 1)) -#define ECS_TYPE_HOOK_COPY ((ecs_flags32_t)(1 << 2)) -#define ECS_TYPE_HOOK_MOVE ((ecs_flags32_t)(1 << 3)) -#define ECS_TYPE_HOOK_COPY_CTOR ((ecs_flags32_t)(1 << 4)) -#define ECS_TYPE_HOOK_MOVE_CTOR ((ecs_flags32_t)(1 << 5)) -#define ECS_TYPE_HOOK_CTOR_MOVE_DTOR ((ecs_flags32_t)(1 << 6)) -#define ECS_TYPE_HOOK_MOVE_DTOR ((ecs_flags32_t)(1 << 7)) -#define ECS_TYPE_HOOK_CMP ((ecs_flags32_t)(1 << 8)) -#define ECS_TYPE_HOOK_EQUALS ((ecs_flags32_t)(1 << 9)) +#define ECS_TYPE_HOOK_CTOR ECS_CAST(ecs_flags32_t, 1 << 0) +#define ECS_TYPE_HOOK_DTOR ECS_CAST(ecs_flags32_t, 1 << 1) +#define ECS_TYPE_HOOK_COPY ECS_CAST(ecs_flags32_t, 1 << 2) +#define ECS_TYPE_HOOK_MOVE ECS_CAST(ecs_flags32_t, 1 << 3) +#define ECS_TYPE_HOOK_COPY_CTOR ECS_CAST(ecs_flags32_t, 1 << 4) +#define ECS_TYPE_HOOK_MOVE_CTOR ECS_CAST(ecs_flags32_t, 1 << 5) +#define ECS_TYPE_HOOK_CTOR_MOVE_DTOR ECS_CAST(ecs_flags32_t, 1 << 6) +#define ECS_TYPE_HOOK_MOVE_DTOR ECS_CAST(ecs_flags32_t, 1 << 7) +#define ECS_TYPE_HOOK_CMP ECS_CAST(ecs_flags32_t, 1 << 8) +#define ECS_TYPE_HOOK_EQUALS ECS_CAST(ecs_flags32_t, 1 << 9) /* Flags that can be used to set/check which hooks of a type are invalid */ -#define ECS_TYPE_HOOK_CTOR_ILLEGAL ((ecs_flags32_t)(1 << 10)) -#define ECS_TYPE_HOOK_DTOR_ILLEGAL ((ecs_flags32_t)(1 << 12)) -#define ECS_TYPE_HOOK_COPY_ILLEGAL ((ecs_flags32_t)(1 << 13)) -#define ECS_TYPE_HOOK_MOVE_ILLEGAL ((ecs_flags32_t)(1 << 14)) -#define ECS_TYPE_HOOK_COPY_CTOR_ILLEGAL ((ecs_flags32_t)(1 << 15)) -#define ECS_TYPE_HOOK_MOVE_CTOR_ILLEGAL ((ecs_flags32_t)(1 << 16)) -#define ECS_TYPE_HOOK_CTOR_MOVE_DTOR_ILLEGAL ((ecs_flags32_t)(1 << 17)) -#define ECS_TYPE_HOOK_MOVE_DTOR_ILLEGAL ((ecs_flags32_t)(1 << 18)) -#define ECS_TYPE_HOOK_CMP_ILLEGAL ((ecs_flags32_t)(1 << 19)) -#define ECS_TYPE_HOOK_EQUALS_ILLEGAL ((ecs_flags32_t)(1 << 20)) +#define ECS_TYPE_HOOK_CTOR_ILLEGAL ECS_CAST(ecs_flags32_t, 1 << 10) +#define ECS_TYPE_HOOK_DTOR_ILLEGAL ECS_CAST(ecs_flags32_t, 1 << 12) +#define ECS_TYPE_HOOK_COPY_ILLEGAL ECS_CAST(ecs_flags32_t, 1 << 13) +#define ECS_TYPE_HOOK_MOVE_ILLEGAL ECS_CAST(ecs_flags32_t, 1 << 14) +#define ECS_TYPE_HOOK_COPY_CTOR_ILLEGAL ECS_CAST(ecs_flags32_t, 1 << 15) +#define ECS_TYPE_HOOK_MOVE_CTOR_ILLEGAL ECS_CAST(ecs_flags32_t, 1 << 16) +#define ECS_TYPE_HOOK_CTOR_MOVE_DTOR_ILLEGAL ECS_CAST(ecs_flags32_t, 1 << 17) +#define ECS_TYPE_HOOK_MOVE_DTOR_ILLEGAL ECS_CAST(ecs_flags32_t, 1 << 18) +#define ECS_TYPE_HOOK_CMP_ILLEGAL ECS_CAST(ecs_flags32_t, 1 << 19) +#define ECS_TYPE_HOOK_EQUALS_ILLEGAL ECS_CAST(ecs_flags32_t, 1 << 20) /* All valid hook flags */ diff --git a/include/flecs/addons/cpp/component.hpp b/include/flecs/addons/cpp/component.hpp index 1ecf630ab..cef10bac4 100644 --- a/include/flecs/addons/cpp/component.hpp +++ b/include/flecs/addons/cpp/component.hpp @@ -89,9 +89,7 @@ template <> inline const char* symbol_name() { template::value == true >* = nullptr> -void register_lifecycle_actions( - ecs_world_t*, - ecs_entity_t) {} +void register_lifecycle_actions(ecs_world_t*, ecs_entity_t) { } // If the component is non-trivial, register component lifecycle actions. // Depending on the type not all callbacks may be available. @@ -380,7 +378,7 @@ untyped_component& op_compare( h.cmp = compare_callback; h.flags &= ~ECS_TYPE_HOOK_CMP_ILLEGAL; if(h.flags & ECS_TYPE_HOOK_EQUALS_ILLEGAL) { - h.flags &= ~(ECS_TYPE_HOOK_EQUALS_ILLEGAL); + h.flags &= ~ECS_TYPE_HOOK_EQUALS_ILLEGAL; h.equals = NULL; } set_hooks(h); @@ -411,12 +409,6 @@ untyped_component& op_equals( * * @ingroup cpp_components */ - -template -int ttest() { - return 7; -} - template struct component : untyped_component { /** Register a component. diff --git a/src/world.c b/src/world.c index c82b2491e..f5ea84207 100644 --- a/src/world.c +++ b/src/world.c @@ -3,7 +3,6 @@ * @brief World-level API. */ -#include "flecs.h" #include "private_api.h" /* Id flags */