@@ -289,7 +289,16 @@ void yt_reset(); // MUST BE DEFINED BY THE USER OF THIS HEADER FILE.
289289 YT__DEFINE_FUNC_BODY (YT__COUNT_ARGS (__VA_ARGS__), rt, f, __VA_ARGS__)
290290
291291// ----
292- #define YT__DEFINE_FUNC_STRUCT (f ) YT__STRUCT_TAG (f) YT__STRUCT_VAR (f) = { 0 }
292+
293+ // clang-format off
294+ #ifdef __cplusplus
295+ #define YT__ZEROED { }
296+ #else
297+ #define YT__ZEROED { 0 }
298+ #endif /* __cplusplus */
299+ // clang-format on
300+
301+ #define YT__DEFINE_FUNC_STRUCT (f ) YT__STRUCT_TAG (f) YT__STRUCT_VAR (f) = YT__ZEROED;
293302
294303#define YT__DEFINE_FUNC_BODY_VOID (n , f , ...) \
295304 void f (YT__FUNC_PARAMS_X (__VA_ARGS__)) \
@@ -380,7 +389,8 @@ static YT__TestRecord* YT__current_testrecord = NULL;
380389static uint32_t YT__total_test_count = 0 ;
381390static uint32_t YT__failed_test_count = 0 ;
382391
383- static YT__TestRecord * YT__create_testRecord (char * testname , size_t test_count , size_t test_number )
392+ static YT__TestRecord * YT__create_testRecord (const char * testname , size_t test_count ,
393+ size_t test_number )
384394{
385395 assert (testname != NULL );
386396
@@ -457,7 +467,7 @@ static void YT__free_testRecord (YT__TestRecord* trecord)
457467 #define YT__teardown () (void)0
458468 #define YT__ec_init () (void)0
459469 #else
460- #define YT_IN_SEQUENCE (n ) for (unsigned i = 0; i < (n); i++)
470+ #define YT_IN_SEQUENCE (n ) for (int i = 0; i < (n); i++)
461471
462472 #define YT_MUST_NEVER_CALL (f , ...) \
463473 do { \
@@ -916,11 +926,14 @@ static int YT__equal_string (const char* a, const char* b, int* i)
916926
917927static int YT__equal_mem (const void * a , const void * b , unsigned long size , int * i )
918928{
929+ uint8_t * ta = (uint8_t * )a ;
930+ uint8_t * tb = (uint8_t * )b ;
931+
919932 * i = 0 ;
920- while (size -- && * ( uint8_t * ) a ++ == * ( uint8_t * ) b ++ )
933+ while (size -- && * ta ++ == * tb ++ )
921934 (* i )++ ;
922935
923- return * ( uint8_t * ) -- a == * ( uint8_t * ) -- b ;
936+ return * -- ta == * -- tb ;
924937}
925938
926939 /*
0 commit comments