diff --git a/CMakeLists.txt b/CMakeLists.txt index c9d2db9dcd70b33a95145272d72a15bdf484fd21..00bf7711c6b597595d6ce598086e0f74e969a638 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -49,6 +49,8 @@ if (ENABLE_CUSTOM_COMPILER_FLAGS) -Wswitch-enum ) 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 /GS /Za diff --git a/tests/cjson_add.c b/tests/cjson_add.c index eb9def20a1e07a3f77a011af29dada22c5e5d2aa..00ffc349fa18a17677bec90820ee5d77d329b210 100644 --- a/tests/cjson_add.c +++ b/tests/cjson_add.c @@ -28,7 +28,7 @@ #include "unity/src/unity.h" #include "common.h" -static void *failing_malloc(size_t size) +static void * CJSON_CDECL failing_malloc(size_t size) { (void)size; return NULL; @@ -378,7 +378,7 @@ static void cjson_add_array_should_fail_on_allocation_failure(void) cJSON_Delete(root); } -int main(void) +int CJSON_CDECL main(void) { UNITY_BEGIN(); diff --git a/tests/compare_tests.c b/tests/compare_tests.c index 63b6d4a0bd4fc67d2c025ddbdd91374aa07ebb6c..307d0e828ec93e25a4d781df721235c757ddc5f9 100644 --- a/tests/compare_tests.c +++ b/tests/compare_tests.c @@ -186,7 +186,7 @@ static void cjson_compare_should_compare_objects(void) false)) } -int main(void) +int CJSON_CDECL main(void) { UNITY_BEGIN(); diff --git a/tests/misc_tests.c b/tests/misc_tests.c index a0b4f7eba7acc08407520416d3f2a766f796238f..f42772a7ff78cab8dc4be664ec1a1bba40dfd86b 100644 --- a/tests/misc_tests.c +++ b/tests/misc_tests.c @@ -410,7 +410,7 @@ static void cjson_functions_shouldnt_crash_with_null_pointers(void) 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)pointer; @@ -527,7 +527,7 @@ static void cjson_add_item_to_object_should_not_use_after_free_when_string_is_al cJSON_Delete(object); } -int main(void) +int CJSON_CDECL main(void) { UNITY_BEGIN(); diff --git a/tests/parse_array.c b/tests/parse_array.c index 69e0f41148129ae9db3da98b69b4d02f38b3ef54..dfaae29be6338ede2751aef9732504c5a64ebe4d 100644 --- a/tests/parse_array.c +++ b/tests/parse_array.c @@ -152,7 +152,7 @@ static void parse_array_should_not_parse_non_arrays(void) assert_not_array("\"[]hello world!\n\""); } -int main(void) +int CJSON_CDECL main(void) { /* initialize cJSON item */ memset(item, 0, sizeof(cJSON)); diff --git a/tests/parse_examples.c b/tests/parse_examples.c index 76215bbc967bf4d266c0ba6268731f4bf3bfd922..3aab77fe9a0ca3df0a86d0acccd1c4df49552b90 100644 --- a/tests/parse_examples.c +++ b/tests/parse_examples.c @@ -195,7 +195,7 @@ static void test12_should_not_be_parsed(void) } } -int main(void) +int CJSON_CDECL main(void) { UNITY_BEGIN(); RUN_TEST(file_test1_should_be_parsed_and_printed); diff --git a/tests/parse_hex4.c b/tests/parse_hex4.c index 7115cbae97b6c103d32070362d4badf00c8ba596..83cbe658e1edb4a0ec2de01a8864e052887c4c4b 100644 --- a/tests/parse_hex4.c +++ b/tests/parse_hex4.c @@ -64,7 +64,7 @@ static void parse_hex4_should_parse_mixed_case(void) TEST_ASSERT_EQUAL_INT(0xBEEF, parse_hex4((const unsigned char*)"BEEF")); } -int main(void) +int CJSON_CDECL main(void) { UNITY_BEGIN(); RUN_TEST(parse_hex4_should_parse_all_combinations); diff --git a/tests/parse_number.c b/tests/parse_number.c index f499ab651fa96be3aa83f148b462e37f3d4226ac..4cb72ec229505d82f0cf117a24ba3c66fb3b0ea9 100644 --- a/tests/parse_number.c +++ b/tests/parse_number.c @@ -96,7 +96,7 @@ static void parse_number_should_parse_negative_reals(void) assert_parse_number("-123e-128", 0, -123e-128); } -int main(void) +int CJSON_CDECL main(void) { /* initialize cJSON item */ memset(item, 0, sizeof(cJSON)); diff --git a/tests/parse_object.c b/tests/parse_object.c index 09858455afd752fa0c1b198e763ba48615731fba..5f8e7cf1dd5429aeb835bf694ce2da87b245d7f3 100644 --- a/tests/parse_object.c +++ b/tests/parse_object.c @@ -162,7 +162,7 @@ static void parse_object_should_not_parse_non_objects(void) assert_not_object("\"{}hello world!\n\""); } -int main(void) +int CJSON_CDECL main(void) { /* initialize cJSON item */ memset(item, 0, sizeof(cJSON)); diff --git a/tests/parse_string.c b/tests/parse_string.c index ceb1a8960b59e60238ec017b415a2e9e62b0c19c..ce1c138edf2a79d8014c3d4696fa60affaeaabf5 100644 --- a/tests/parse_string.c +++ b/tests/parse_string.c @@ -119,7 +119,7 @@ static void parse_string_should_parse_bug_94(void) reset(item); } -int main(void) +int CJSON_CDECL main(void) { /* initialize cJSON item and error pointer */ memset(item, 0, sizeof(cJSON)); diff --git a/tests/parse_value.c b/tests/parse_value.c index 08ec3e7a27e6606a0681fb56ebd2519687a53564..6b6b09556d94f06d7c76a94f12c99e01ed36ca18 100644 --- a/tests/parse_value.c +++ b/tests/parse_value.c @@ -96,7 +96,7 @@ static void parse_value_should_parse_object(void) reset(item); } -int main(void) +int CJSON_CDECL main(void) { /* initialize cJSON item */ memset(item, 0, sizeof(cJSON)); diff --git a/tests/parse_with_opts.c b/tests/parse_with_opts.c index 84b69cfc925521edae8e080ca38e507ee57829f5..e390b92de877cd7ca06d88465f678e51f06401af 100644 --- a/tests/parse_with_opts.c +++ b/tests/parse_with_opts.c @@ -97,7 +97,7 @@ static void parse_with_opts_should_parse_utf8_bom(void) cJSON_Delete(without_bom); } -int main(void) +int CJSON_CDECL main(void) { UNITY_BEGIN(); diff --git a/tests/print_array.c b/tests/print_array.c index 4bee17f96d22019ff99fdaccefb0a272524c8510..7d40f2e2200c1ad9556b81e51db11281a6d682ad 100644 --- a/tests/print_array.c +++ b/tests/print_array.c @@ -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\",{}]"); } -int main(void) +int CJSON_CDECL main(void) { /* initialize cJSON item */ UNITY_BEGIN(); diff --git a/tests/print_number.c b/tests/print_number.c index 5ebb34897b09eb6e8419c35ab80739437d41255b..f2385f3bd264aa842d9d5675ff3b4791daa7d847 100644 --- a/tests/print_number.c +++ b/tests/print_number.c @@ -89,7 +89,7 @@ static void print_number_should_print_non_number(void) /* assert_print_number("null", -INFTY); */ } -int main(void) +int CJSON_CDECL main(void) { /* initialize cJSON item */ UNITY_BEGIN(); diff --git a/tests/print_object.c b/tests/print_object.c index 70bbb43ce1c1e2b1b2e56bd9e8bc50c1d280dd43..3ed0bfed4846ed1db7598c518ced9623c3f57fd5 100644 --- a/tests/print_object.c +++ b/tests/print_object.c @@ -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\":{}}"); } -int main(void) +int CJSON_CDECL main(void) { /* initialize cJSON item */ UNITY_BEGIN(); diff --git a/tests/print_string.c b/tests/print_string.c index 83de1e7a59b02e2e8e53bc8e32af929036474ae0..e6f5b92dc641a3d7f1df89f6bae6c1daa4ecd99b 100644 --- a/tests/print_string.c +++ b/tests/print_string.c @@ -65,7 +65,7 @@ static void print_string_should_print_utf8(void) assert_print_string("\"ü猫慕\"", "ü猫慕"); } -int main(void) +int CJSON_CDECL main(void) { /* initialize cJSON item */ UNITY_BEGIN(); diff --git a/tests/print_value.c b/tests/print_value.c index d5908232c37c787e88edd33acb74d61bc4b587c5..b54db5b142c97aeb2805046580b491c2dd032a96 100644 --- a/tests/print_value.c +++ b/tests/print_value.c @@ -90,7 +90,7 @@ static void print_value_should_print_object(void) assert_print_value("{}"); } -int main(void) +int CJSON_CDECL main(void) { /* initialize cJSON item */ UNITY_BEGIN(); diff --git a/tests/readme_examples.c b/tests/readme_examples.c index f3fa443818a819d7afec9942a254b1d90852969e..1ab1b13916680c4e2f93a83deec1574bb8285451 100644 --- a/tests/readme_examples.c +++ b/tests/readme_examples.c @@ -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)); } -int main(void) +int CJSON_CDECL main(void) { UNITY_BEGIN();