diff --git a/erpc_c/port/erpc_config_internal.h b/erpc_c/port/erpc_config_internal.h index 1f67fe3e1..f96346661 100644 --- a/erpc_c/port/erpc_config_internal.h +++ b/erpc_c/port/erpc_config_internal.h @@ -70,15 +70,12 @@ #if ERPC_ALLOCATION_POLICY == ERPC_ALLOCATION_POLICY_STATIC #if !defined(ERPC_CODEC_COUNT) #define ERPC_CODEC_COUNT (2U) -#warning "ERPC_CODEC_COUNT is not defined. Default is used." #endif #if !defined(ERPC_MESSAGE_LOGGERS_COUNT) #define ERPC_MESSAGE_LOGGERS_COUNT (0U) -#warning "ERPC_MESSAGE_LOGGERS_COUNT is not defined. Default is used." #endif #if !defined(ERPC_CLIENTS_THREADS_AMOUNT) #define ERPC_CLIENTS_THREADS_AMOUNT (1U) -#warning "ERPC_CLIENTS_THREADS_AMOUNT is not defined. Default is used." #endif #endif diff --git a/erpcgen/src/templates/c_server_header.template b/erpcgen/src/templates/c_server_header.template index bd5772f6d..0391ca38b 100644 --- a/erpcgen/src/templates/c_server_header.template +++ b/erpcgen/src/templates/c_server_header.template @@ -51,7 +51,7 @@ typedef void * erpc_service_t; erpc_service_t create_{$iface.serviceClassName}(void); #if ERPC_ALLOCATION_POLICY == ERPC_ALLOCATION_POLICY_DYNAMIC -void destroy_{$iface.serviceClassName}(erpc_service_t *service); +void destroy_{$iface.serviceClassName}(erpc_service_t service); #elif ERPC_ALLOCATION_POLICY == ERPC_ALLOCATION_POLICY_STATIC void destroy_{$iface.serviceClassName}(void); #else diff --git a/erpcgen/src/templates/c_server_source.template b/erpcgen/src/templates/c_server_source.template index 7ea1cfb26..bbe2a131d 100644 --- a/erpcgen/src/templates/c_server_source.template +++ b/erpcgen/src/templates/c_server_source.template @@ -250,11 +250,11 @@ erpc_service_t create_{$iface.serviceClassName}() return new (nothrow) {$iface.serviceClassName}(); } -void destroy_{$iface.serviceClassName}(erpc_service_t *service) +void destroy_{$iface.serviceClassName}(erpc_service_t service) { - if (*service) + if (service) { - delete service; + delete ({$iface.serviceClassName} *)service; } } #elif ERPC_ALLOCATION_POLICY == ERPC_ALLOCATION_POLICY_STATIC diff --git a/erpcgen/test/test_dynamic_ann_c.yml b/erpcgen/test/test_dynamic_ann_c.yml deleted file mode 100644 index 50b86acd2..000000000 --- a/erpcgen/test/test_dynamic_ann_c.yml +++ /dev/null @@ -1,17 +0,0 @@ ---- -name: static -desc: dynamic annotation is not used. -idl: | - program test - - interface ErrorTest{ - oneway f() - } - -test_server.cpp: - - ERPC_MANUALLY_CONSTRUCTED_STATIC(ErrorTest_service, s_ErrorTest_service); - - erpc_service_t create_ErrorTest_service() - - "{" - - s_ErrorTest_service.construct(); - - return s_ErrorTest_service.get(); - - "}" diff --git a/erpcgen/test/test_service_c.yml b/erpcgen/test/test_service_c.yml new file mode 100644 index 000000000..95df90a17 --- /dev/null +++ b/erpcgen/test/test_service_c.yml @@ -0,0 +1,48 @@ +--- +name: static +desc: dynamic annotation is not used. +idl: | + program test + + interface ErrorTest{ + oneway f() + } + +test_server.h: + - erpc_service_t create_ErrorTest_service(void); + + - "#if ERPC_ALLOCATION_POLICY == ERPC_ALLOCATION_POLICY_DYNAMIC" + - void destroy_ErrorTest_service(erpc_service_t service); + - "#elif ERPC_ALLOCATION_POLICY == ERPC_ALLOCATION_POLICY_STATIC" + - void destroy_ErrorTest_service(void); + - "#else" + - "#warning \"Unknown eRPC allocation policy!\"" + - "#endif" + +test_server.cpp: + - ERPC_MANUALLY_CONSTRUCTED_STATIC(ErrorTest_service, s_ErrorTest_service); + - "#if ERPC_ALLOCATION_POLICY == ERPC_ALLOCATION_POLICY_DYNAMIC" + - erpc_service_t create_ErrorTest_service() + - "{" + - return new (nothrow) ErrorTest_service(); + - "}" + - void destroy_ErrorTest_service(erpc_service_t service) + - "{" + - if (service) + - "{" + - delete (ErrorTest_service *)service; + - "}" + - "}" + - "#elif ERPC_ALLOCATION_POLICY == ERPC_ALLOCATION_POLICY_STATIC" + - erpc_service_t create_ErrorTest_service() + - "{" + - s_ErrorTest_service.construct(); + - return s_ErrorTest_service.get(); + - "}" + - void destroy_ErrorTest_service() + - "{" + - s_ErrorTest_service.destroy(); + - "}" + - "#else" + - "#warning \"Unknown eRPC allocation policy!\"" + - "#endif" diff --git a/test/common/config/erpc_config.h b/test/common/config/erpc_config.h index 55a0608de..97d5cb9d2 100644 --- a/test/common/config/erpc_config.h +++ b/test/common/config/erpc_config.h @@ -146,7 +146,7 @@ //! ERPC_MESSAGE_LOGGING_DISABLED. //! //! Uncomment for using logging feature. -#define ERPC_MESSAGE_LOGGING (ERPC_MESSAGE_LOGGING_ENABLED) +// #define ERPC_MESSAGE_LOGGING (ERPC_MESSAGE_LOGGING_ENABLED) //! @def ERPC_TRANSPORT_MU_USE_MCMGR //! diff --git a/test/test_arbitrator/config/erpc_config.h b/test/test_arbitrator/config/erpc_config.h index 13020e834..abac75886 100644 --- a/test/test_arbitrator/config/erpc_config.h +++ b/test/test_arbitrator/config/erpc_config.h @@ -145,7 +145,7 @@ //! ERPC_MESSAGE_LOGGING_DISABLED. //! //! Uncomment for using logging feature. -#define ERPC_MESSAGE_LOGGING (ERPC_MESSAGE_LOGGING_ENABLED) +// #define ERPC_MESSAGE_LOGGING (ERPC_MESSAGE_LOGGING_ENABLED) //! @def ERPC_TRANSPORT_MU_USE_MCMGR //! diff --git a/test/test_arrays/test_arrays_server_impl.cpp b/test/test_arrays/test_arrays_server_impl.cpp index 7bf018ab3..4e661297a 100644 --- a/test/test_arrays/test_arrays_server_impl.cpp +++ b/test/test_arrays/test_arrays_server_impl.cpp @@ -417,7 +417,7 @@ void remove_services_from_server() { erpc_remove_service_from_server(service_test); #if ERPC_ALLOCATION_POLICY == ERPC_ALLOCATION_POLICY_DYNAMIC - destroy_PointersService_service((erpc_service_t *)service_test); + destroy_PointersService_service(service_test); #elif ERPC_ALLOCATION_POLICY == ERPC_ALLOCATION_POLICY_STATIC destroy_PointersService_service(); #endif @@ -427,7 +427,7 @@ void remove_common_services_from_server(erpc_service_t service) { erpc_remove_service_from_server(service); #if ERPC_ALLOCATION_POLICY == ERPC_ALLOCATION_POLICY_DYNAMIC - destroy_Common_service((erpc_service_t *)service); + destroy_Common_service(service); #elif ERPC_ALLOCATION_POLICY == ERPC_ALLOCATION_POLICY_STATIC destroy_Common_service(); #endif diff --git a/test/test_binary/test_binary_server_impl.cpp b/test/test_binary/test_binary_server_impl.cpp index eef523ee8..b05794ff1 100644 --- a/test/test_binary/test_binary_server_impl.cpp +++ b/test/test_binary/test_binary_server_impl.cpp @@ -117,7 +117,7 @@ void remove_services_from_server() { erpc_remove_service_from_server(service_test); #if ERPC_ALLOCATION_POLICY == ERPC_ALLOCATION_POLICY_DYNAMIC - destroy_Binary_service((erpc_service_t *)service_test); + destroy_Binary_service(service_test); #elif ERPC_ALLOCATION_POLICY == ERPC_ALLOCATION_POLICY_STATIC destroy_Binary_service(); #endif @@ -127,7 +127,7 @@ void remove_common_services_from_server(erpc_service_t service) { erpc_remove_service_from_server(service); #if ERPC_ALLOCATION_POLICY == ERPC_ALLOCATION_POLICY_DYNAMIC - destroy_Common_service((erpc_service_t *)service); + destroy_Common_service(service); #elif ERPC_ALLOCATION_POLICY == ERPC_ALLOCATION_POLICY_STATIC destroy_Common_service(); #endif diff --git a/test/test_builtin/test_builtin_server_impl.cpp b/test/test_builtin/test_builtin_server_impl.cpp index 374a3ed86..67a15c821 100644 --- a/test/test_builtin/test_builtin_server_impl.cpp +++ b/test/test_builtin/test_builtin_server_impl.cpp @@ -193,7 +193,7 @@ void remove_services_from_server() { erpc_remove_service_from_server(service_test); #if ERPC_ALLOCATION_POLICY == ERPC_ALLOCATION_POLICY_DYNAMIC - destroy_BuiltinServices_service((erpc_service_t *)service_test); + destroy_BuiltinServices_service(service_test); #elif ERPC_ALLOCATION_POLICY == ERPC_ALLOCATION_POLICY_STATIC destroy_BuiltinServices_service(); #endif @@ -203,7 +203,7 @@ void remove_common_services_from_server(erpc_service_t service) { erpc_remove_service_from_server(service); #if ERPC_ALLOCATION_POLICY == ERPC_ALLOCATION_POLICY_DYNAMIC - destroy_Common_service((erpc_service_t *)service); + destroy_Common_service(service); #elif ERPC_ALLOCATION_POLICY == ERPC_ALLOCATION_POLICY_STATIC destroy_Common_service(); #endif diff --git a/test/test_callbacks/test_callbacks_server_impl.cpp b/test/test_callbacks/test_callbacks_server_impl.cpp index 9774aac11..94de5acd4 100644 --- a/test/test_callbacks/test_callbacks_server_impl.cpp +++ b/test/test_callbacks/test_callbacks_server_impl.cpp @@ -126,7 +126,7 @@ void remove_services_from_server() { erpc_remove_service_from_server(service_test); #if ERPC_ALLOCATION_POLICY == ERPC_ALLOCATION_POLICY_DYNAMIC - destroy_ClientCore0Services_service((erpc_service_t *)service_test); + destroy_ClientCore0Services_service(service_test); #elif ERPC_ALLOCATION_POLICY == ERPC_ALLOCATION_POLICY_STATIC destroy_ClientCore0Services_service(); #endif @@ -136,7 +136,7 @@ void remove_common_services_from_server(erpc_service_t service) { erpc_remove_service_from_server(service); #if ERPC_ALLOCATION_POLICY == ERPC_ALLOCATION_POLICY_DYNAMIC - destroy_Common_service((erpc_service_t *)service); + destroy_Common_service(service); #elif ERPC_ALLOCATION_POLICY == ERPC_ALLOCATION_POLICY_STATIC destroy_Common_service(); #endif diff --git a/test/test_const/test_const_server_impl.cpp b/test/test_const/test_const_server_impl.cpp index 079b79901..10eab35a2 100644 --- a/test/test_const/test_const_server_impl.cpp +++ b/test/test_const/test_const_server_impl.cpp @@ -58,7 +58,7 @@ void remove_common_services_from_server(erpc_service_t service) { erpc_remove_service_from_server(service); #if ERPC_ALLOCATION_POLICY == ERPC_ALLOCATION_POLICY_DYNAMIC - destroy_Common_service((erpc_service_t *)service); + destroy_Common_service(service); #elif ERPC_ALLOCATION_POLICY == ERPC_ALLOCATION_POLICY_STATIC destroy_Common_service(); #endif diff --git a/test/test_enums/test_enums_server_impl.cpp b/test/test_enums/test_enums_server_impl.cpp index c5fe90ab4..67555be9a 100644 --- a/test/test_enums/test_enums_server_impl.cpp +++ b/test/test_enums/test_enums_server_impl.cpp @@ -118,7 +118,7 @@ void remove_services_from_server() { erpc_remove_service_from_server(service_test); #if ERPC_ALLOCATION_POLICY == ERPC_ALLOCATION_POLICY_DYNAMIC - destroy_EnumsService_service((erpc_service_t *)service_test); + destroy_EnumsService_service(service_test); #elif ERPC_ALLOCATION_POLICY == ERPC_ALLOCATION_POLICY_STATIC destroy_EnumsService_service(); #endif @@ -128,7 +128,7 @@ void remove_common_services_from_server(erpc_service_t service) { erpc_remove_service_from_server(service); #if ERPC_ALLOCATION_POLICY == ERPC_ALLOCATION_POLICY_DYNAMIC - destroy_Common_service((erpc_service_t *)service); + destroy_Common_service(service); #elif ERPC_ALLOCATION_POLICY == ERPC_ALLOCATION_POLICY_STATIC destroy_Common_service(); #endif diff --git a/test/test_lists/test_lists_server_impl.cpp b/test/test_lists/test_lists_server_impl.cpp index c9b856413..aea95f66d 100644 --- a/test/test_lists/test_lists_server_impl.cpp +++ b/test/test_lists/test_lists_server_impl.cpp @@ -352,7 +352,7 @@ void remove_services_from_server() { erpc_remove_service_from_server(service_test); #if ERPC_ALLOCATION_POLICY == ERPC_ALLOCATION_POLICY_DYNAMIC - destroy_PointersService_service((erpc_service_t *)service_test); + destroy_PointersService_service(service_test); #elif ERPC_ALLOCATION_POLICY == ERPC_ALLOCATION_POLICY_STATIC destroy_PointersService_service(); #endif @@ -362,7 +362,7 @@ void remove_common_services_from_server(erpc_service_t service) { erpc_remove_service_from_server(service); #if ERPC_ALLOCATION_POLICY == ERPC_ALLOCATION_POLICY_DYNAMIC - destroy_Common_service((erpc_service_t *)service); + destroy_Common_service(service); #elif ERPC_ALLOCATION_POLICY == ERPC_ALLOCATION_POLICY_STATIC destroy_Common_service(); #endif diff --git a/test/test_shared/test_shared_server_impl.cpp b/test/test_shared/test_shared_server_impl.cpp index c46714d98..deb609a08 100644 --- a/test/test_shared/test_shared_server_impl.cpp +++ b/test/test_shared/test_shared_server_impl.cpp @@ -72,7 +72,7 @@ void remove_services_from_server() { erpc_remove_service_from_server(service_test); #if ERPC_ALLOCATION_POLICY == ERPC_ALLOCATION_POLICY_DYNAMIC - destroy_SharedService_service((erpc_service_t *)service_test); + destroy_SharedService_service(service_test); #elif ERPC_ALLOCATION_POLICY == ERPC_ALLOCATION_POLICY_STATIC destroy_SharedService_service(); #endif @@ -82,7 +82,7 @@ void remove_common_services_from_server(erpc_service_t service) { erpc_remove_service_from_server(service); #if ERPC_ALLOCATION_POLICY == ERPC_ALLOCATION_POLICY_DYNAMIC - destroy_Common_service((erpc_service_t *)service); + destroy_Common_service(service); #elif ERPC_ALLOCATION_POLICY == ERPC_ALLOCATION_POLICY_STATIC destroy_Common_service(); #endif diff --git a/test/test_struct/test_struct_server_impl.cpp b/test/test_struct/test_struct_server_impl.cpp index a7e78df34..9b559cf7d 100644 --- a/test/test_struct/test_struct_server_impl.cpp +++ b/test/test_struct/test_struct_server_impl.cpp @@ -230,8 +230,8 @@ void remove_services_from_server() erpc_remove_service_from_server(service1); erpc_remove_service_from_server(service2); #if ERPC_ALLOCATION_POLICY == ERPC_ALLOCATION_POLICY_DYNAMIC - destroy_ArithmeticService1_service((erpc_service_t *)service1); - destroy_ArithmeticService2_service((erpc_service_t *)service2); + destroy_ArithmeticService1_service(service1); + destroy_ArithmeticService2_service(service2); #elif ERPC_ALLOCATION_POLICY == ERPC_ALLOCATION_POLICY_STATIC destroy_ArithmeticService1_service(); destroy_ArithmeticService2_service(); @@ -242,7 +242,7 @@ void remove_common_services_from_server(erpc_service_t service) { erpc_remove_service_from_server(service); #if ERPC_ALLOCATION_POLICY == ERPC_ALLOCATION_POLICY_DYNAMIC - destroy_Common_service((erpc_service_t *)service); + destroy_Common_service(service); #elif ERPC_ALLOCATION_POLICY == ERPC_ALLOCATION_POLICY_STATIC destroy_Common_service(); #endif diff --git a/test/test_typedef/test_typedef_server_impl.cpp b/test/test_typedef/test_typedef_server_impl.cpp index 1b9f20a78..48b6d9f0c 100644 --- a/test/test_typedef/test_typedef_server_impl.cpp +++ b/test/test_typedef/test_typedef_server_impl.cpp @@ -172,7 +172,7 @@ void remove_services_from_server() { erpc_remove_service_from_server(service_test); #if ERPC_ALLOCATION_POLICY == ERPC_ALLOCATION_POLICY_DYNAMIC - destroy_TypedefService_service((erpc_service_t *)service_test); + destroy_TypedefService_service(service_test); #elif ERPC_ALLOCATION_POLICY == ERPC_ALLOCATION_POLICY_STATIC destroy_TypedefService_service(); #endif @@ -182,7 +182,7 @@ void remove_common_services_from_server(erpc_service_t service) { erpc_remove_service_from_server(service); #if ERPC_ALLOCATION_POLICY == ERPC_ALLOCATION_POLICY_DYNAMIC - destroy_Common_service((erpc_service_t *)service); + destroy_Common_service(service); #elif ERPC_ALLOCATION_POLICY == ERPC_ALLOCATION_POLICY_STATIC destroy_Common_service(); #endif diff --git a/test/test_unions/test_unions_server_impl.cpp b/test/test_unions/test_unions_server_impl.cpp index 9f28bfcf1..0ef034018 100644 --- a/test/test_unions/test_unions_server_impl.cpp +++ b/test/test_unions/test_unions_server_impl.cpp @@ -250,7 +250,7 @@ void remove_services_from_server() { erpc_remove_service_from_server(service_test); #if ERPC_ALLOCATION_POLICY == ERPC_ALLOCATION_POLICY_DYNAMIC - destroy_ArithmeticService_service((erpc_service_t *)service_test); + destroy_ArithmeticService_service(service_test); #elif ERPC_ALLOCATION_POLICY == ERPC_ALLOCATION_POLICY_STATIC destroy_ArithmeticService_service(); #endif @@ -260,7 +260,7 @@ void remove_common_services_from_server(erpc_service_t service) { erpc_remove_service_from_server(service); #if ERPC_ALLOCATION_POLICY == ERPC_ALLOCATION_POLICY_DYNAMIC - destroy_Common_service((erpc_service_t *)service); + destroy_Common_service(service); #elif ERPC_ALLOCATION_POLICY == ERPC_ALLOCATION_POLICY_STATIC destroy_Common_service(); #endif