Support default __stdcall calling convention on tests as well

This commit is contained in:
Zach Hindes 2018-09-12 15:32:30 -05:00
parent ad2cb5b7ea
commit f25b8448e4
18 changed files with 21 additions and 19 deletions

View File

@ -49,6 +49,8 @@ if (ENABLE_CUSTOM_COMPILER_FLAGS)
-Wswitch-enum -Wswitch-enum
) )
elseif("${CMAKE_C_COMPILER_ID}" STREQUAL "MSVC") elseif("${CMAKE_C_COMPILER_ID}" STREQUAL "MSVC")
# Disable warning c4001 - nonstandard extension 'single line comment' was used
# Define _CRT_SECURE_NO_WARNINGS to disable deprecation warnings for "insecure" C library functions
list(APPEND custom_compiler_flags list(APPEND custom_compiler_flags
/GS /GS
/Za /Za

View File

@ -28,7 +28,7 @@
#include "unity/src/unity.h" #include "unity/src/unity.h"
#include "common.h" #include "common.h"
static void *failing_malloc(size_t size) static void * CJSON_CDECL failing_malloc(size_t size)
{ {
(void)size; (void)size;
return NULL; return NULL;
@ -378,7 +378,7 @@ static void cjson_add_array_should_fail_on_allocation_failure(void)
cJSON_Delete(root); cJSON_Delete(root);
} }
int main(void) int CJSON_CDECL main(void)
{ {
UNITY_BEGIN(); UNITY_BEGIN();

View File

@ -186,7 +186,7 @@ static void cjson_compare_should_compare_objects(void)
false)) false))
} }
int main(void) int CJSON_CDECL main(void)
{ {
UNITY_BEGIN(); UNITY_BEGIN();

View File

@ -410,7 +410,7 @@ static void cjson_functions_shouldnt_crash_with_null_pointers(void)
cJSON_Delete(item); cJSON_Delete(item);
} }
static void *failing_realloc(void *pointer, size_t size) static void * CJSON_CDECL failing_realloc(void *pointer, size_t size)
{ {
(void)size; (void)size;
(void)pointer; (void)pointer;
@ -527,7 +527,7 @@ static void cjson_add_item_to_object_should_not_use_after_free_when_string_is_al
cJSON_Delete(object); cJSON_Delete(object);
} }
int main(void) int CJSON_CDECL main(void)
{ {
UNITY_BEGIN(); UNITY_BEGIN();

View File

@ -152,7 +152,7 @@ static void parse_array_should_not_parse_non_arrays(void)
assert_not_array("\"[]hello world!\n\""); assert_not_array("\"[]hello world!\n\"");
} }
int main(void) int CJSON_CDECL main(void)
{ {
/* initialize cJSON item */ /* initialize cJSON item */
memset(item, 0, sizeof(cJSON)); memset(item, 0, sizeof(cJSON));

View File

@ -195,7 +195,7 @@ static void test12_should_not_be_parsed(void)
} }
} }
int main(void) int CJSON_CDECL main(void)
{ {
UNITY_BEGIN(); UNITY_BEGIN();
RUN_TEST(file_test1_should_be_parsed_and_printed); RUN_TEST(file_test1_should_be_parsed_and_printed);

View File

@ -64,7 +64,7 @@ static void parse_hex4_should_parse_mixed_case(void)
TEST_ASSERT_EQUAL_INT(0xBEEF, parse_hex4((const unsigned char*)"BEEF")); TEST_ASSERT_EQUAL_INT(0xBEEF, parse_hex4((const unsigned char*)"BEEF"));
} }
int main(void) int CJSON_CDECL main(void)
{ {
UNITY_BEGIN(); UNITY_BEGIN();
RUN_TEST(parse_hex4_should_parse_all_combinations); RUN_TEST(parse_hex4_should_parse_all_combinations);

View File

@ -96,7 +96,7 @@ static void parse_number_should_parse_negative_reals(void)
assert_parse_number("-123e-128", 0, -123e-128); assert_parse_number("-123e-128", 0, -123e-128);
} }
int main(void) int CJSON_CDECL main(void)
{ {
/* initialize cJSON item */ /* initialize cJSON item */
memset(item, 0, sizeof(cJSON)); memset(item, 0, sizeof(cJSON));

View File

@ -162,7 +162,7 @@ static void parse_object_should_not_parse_non_objects(void)
assert_not_object("\"{}hello world!\n\""); assert_not_object("\"{}hello world!\n\"");
} }
int main(void) int CJSON_CDECL main(void)
{ {
/* initialize cJSON item */ /* initialize cJSON item */
memset(item, 0, sizeof(cJSON)); memset(item, 0, sizeof(cJSON));

View File

@ -119,7 +119,7 @@ static void parse_string_should_parse_bug_94(void)
reset(item); reset(item);
} }
int main(void) int CJSON_CDECL main(void)
{ {
/* initialize cJSON item and error pointer */ /* initialize cJSON item and error pointer */
memset(item, 0, sizeof(cJSON)); memset(item, 0, sizeof(cJSON));

View File

@ -96,7 +96,7 @@ static void parse_value_should_parse_object(void)
reset(item); reset(item);
} }
int main(void) int CJSON_CDECL main(void)
{ {
/* initialize cJSON item */ /* initialize cJSON item */
memset(item, 0, sizeof(cJSON)); memset(item, 0, sizeof(cJSON));

View File

@ -97,7 +97,7 @@ static void parse_with_opts_should_parse_utf8_bom(void)
cJSON_Delete(without_bom); cJSON_Delete(without_bom);
} }
int main(void) int CJSON_CDECL main(void)
{ {
UNITY_BEGIN(); UNITY_BEGIN();

View File

@ -87,7 +87,7 @@ static void print_array_should_print_arrays_with_multiple_elements(void)
assert_print_array("[1, null, true, false, [], \"hello\", {\n\t}]", "[1,null,true,false,[],\"hello\",{}]"); assert_print_array("[1, null, true, false, [], \"hello\", {\n\t}]", "[1,null,true,false,[],\"hello\",{}]");
} }
int main(void) int CJSON_CDECL main(void)
{ {
/* initialize cJSON item */ /* initialize cJSON item */
UNITY_BEGIN(); UNITY_BEGIN();

View File

@ -89,7 +89,7 @@ static void print_number_should_print_non_number(void)
/* assert_print_number("null", -INFTY); */ /* assert_print_number("null", -INFTY); */
} }
int main(void) int CJSON_CDECL main(void)
{ {
/* initialize cJSON item */ /* initialize cJSON item */
UNITY_BEGIN(); UNITY_BEGIN();

View File

@ -88,7 +88,7 @@ static void print_object_should_print_objects_with_multiple_elements(void)
assert_print_object("{\n\t\"one\":\t1,\n\t\"NULL\":\tnull,\n\t\"TRUE\":\ttrue,\n\t\"FALSE\":\tfalse,\n\t\"array\":\t[],\n\t\"world\":\t\"hello\",\n\t\"object\":\t{\n\t}\n}", "{\"one\":1,\"NULL\":null,\"TRUE\":true,\"FALSE\":false,\"array\":[],\"world\":\"hello\",\"object\":{}}"); assert_print_object("{\n\t\"one\":\t1,\n\t\"NULL\":\tnull,\n\t\"TRUE\":\ttrue,\n\t\"FALSE\":\tfalse,\n\t\"array\":\t[],\n\t\"world\":\t\"hello\",\n\t\"object\":\t{\n\t}\n}", "{\"one\":1,\"NULL\":null,\"TRUE\":true,\"FALSE\":false,\"array\":[],\"world\":\"hello\",\"object\":{}}");
} }
int main(void) int CJSON_CDECL main(void)
{ {
/* initialize cJSON item */ /* initialize cJSON item */
UNITY_BEGIN(); UNITY_BEGIN();

View File

@ -65,7 +65,7 @@ static void print_string_should_print_utf8(void)
assert_print_string("\"ü猫慕\"", "ü猫慕"); assert_print_string("\"ü猫慕\"", "ü猫慕");
} }
int main(void) int CJSON_CDECL main(void)
{ {
/* initialize cJSON item */ /* initialize cJSON item */
UNITY_BEGIN(); UNITY_BEGIN();

View File

@ -90,7 +90,7 @@ static void print_value_should_print_object(void)
assert_print_value("{}"); assert_print_value("{}");
} }
int main(void) int CJSON_CDECL main(void)
{ {
/* initialize cJSON item */ /* initialize cJSON item */
UNITY_BEGIN(); UNITY_BEGIN();

View File

@ -246,7 +246,7 @@ static void supports_full_hd_should_check_for_full_hd_support(void)
TEST_ASSERT_FALSE(supports_full_hd(monitor_without_hd)); TEST_ASSERT_FALSE(supports_full_hd(monitor_without_hd));
} }
int main(void) int CJSON_CDECL main(void)
{ {
UNITY_BEGIN(); UNITY_BEGIN();