diff --git a/src/tests.c b/src/tests.c index 9fef1b67..4f7bc1bb 100644 --- a/src/tests.c +++ b/src/tests.c @@ -9,7 +9,7 @@ #include "unit_test.h" #define WARNING_FLAG(x) (1ULL << (x)) -static bool compile_without_errors(bool flow_analysis, bool nullchecks, const char* src) +static bool compile_without_errors_warnings(bool flow_analysis, bool nullchecks, const char* src) { struct options options = { .input = LANGUAGE_C99, .flow_analysis = flow_analysis, @@ -70,7 +70,7 @@ void char_constants() "static_assert(TYPE_IS(u'a', unsigned short));\n" "static_assert(TYPE_IS(U'a', unsigned int));"; - assert(compile_without_errors(false, false, source)); + assert(compile_without_errors_warnings(false, false, source)); } void array_item_type_test() @@ -79,7 +79,7 @@ void array_item_type_test() "#define _is_same(T1, T2) _Generic(T1, T2 : 1, default: 0)\n" "void (*pf[10])(void* val);\n" "static_assert(_is_same(typeof(pf[0]), void (*)(void* val)));\n"; - assert(compile_without_errors(false, false, src)); + assert(compile_without_errors_warnings(false, false, src)); } void take_address_type_test() @@ -89,7 +89,7 @@ void take_address_type_test() "{" " (*p)[0] = 'a';" "}"; - assert(compile_without_errors(false, false, src)); + assert(compile_without_errors_warnings(false, false, src)); } void parser_scope_test() @@ -108,7 +108,7 @@ void parser_tag_test() void string_concatenation_test() { const char* src = " const char* s = \"part1\" \"part2\";"; - assert(compile_without_errors(false, false, src)); + assert(compile_without_errors_warnings(false, false, src)); } void test_digit_separator() @@ -135,7 +135,7 @@ void type_test2() " static_assert(_is_same(typeof(&a) ,int (*)[10]));\n" ; - assert(compile_without_errors(false, false, src)); + assert(compile_without_errors_warnings(false, false, src)); } void type_test3() @@ -148,7 +148,7 @@ void type_test3() " static_assert(_is_same(typeof(&f), int (**)(void)));" ; - assert(compile_without_errors(false, false, src)); + assert(compile_without_errors_warnings(false, false, src)); } void crazy_decl() @@ -160,7 +160,7 @@ void crazy_decl() " return 0;\n" "}\n"; - assert(compile_without_errors(false, false, src)); + assert(compile_without_errors_warnings(false, false, src)); } void crazy_decl2() @@ -176,7 +176,7 @@ void crazy_decl2() " f(1);\n" "}\n"; - assert(compile_without_errors(false, false, src)); + assert(compile_without_errors_warnings(false, false, src)); } void crazy_decl4() @@ -188,17 +188,17 @@ void crazy_decl4() " PF(1, 2);\n" "}\n"; - assert(compile_without_errors(false, false, src)); + assert(compile_without_errors_warnings(false, false, src)); } void sizeof_not_evaluated() { - assert(compile_without_errors(false, false, "int i = sizeof(1/0);\n")); + assert(compile_without_errors_warnings(false, false, "int i = sizeof(1/0);\n")); } void sizeof_array_test() { - assert(compile_without_errors(false, + assert(compile_without_errors_warnings(false, false, "int main() {\n" "int a[] = { 1, 2, 3 };\n" @@ -226,7 +226,7 @@ void sizeof_test() "static_assert(sizeof(void (*pf)(int i)) == sizeof(void*));" ; - assert(compile_without_errors(false, false, src)); + assert(compile_without_errors_warnings(false, false, src)); } void alignof_test() @@ -237,7 +237,7 @@ void alignof_test() "static_assert(sizeof(struct X) == 24);" ; - assert(compile_without_errors(false, false, src)); + assert(compile_without_errors_warnings(false, false, src)); } void indirection_struct_size() @@ -250,7 +250,7 @@ void indirection_struct_size() "static_assert(sizeof(X) == sizeof(void*));" ; - assert(compile_without_errors(false, false, src)); + assert(compile_without_errors_warnings(false, false, src)); } void traits_test() @@ -265,7 +265,7 @@ void traits_test() "int((a2))[10];\n" "static_assert(_is_array(a2));" ; - assert(compile_without_errors(false, false, src)); + assert(compile_without_errors_warnings(false, false, src)); } void comp_error1() @@ -276,7 +276,7 @@ void comp_error1() " *z-- = '\\0';\n" "}\n"; - assert(compile_without_errors(false, false, src)); + assert(compile_without_errors_warnings(false, false, src)); } void array_size() @@ -289,7 +289,7 @@ void array_size() "}" ; - assert(compile_without_errors(false, false, src)); + assert(compile_without_errors_warnings(false, false, src)); } void expr_type() @@ -298,7 +298,7 @@ void expr_type() "#define _is_same(T1, T2) _Generic(T1, T2 : 1, default: 0)\n" "static_assert(_is_same(typeof(1 + 2.0), double));"; - assert(compile_without_errors(false, false, src)); + assert(compile_without_errors_warnings(false, false, src)); } void expand_test() @@ -310,7 +310,7 @@ void expand_test() "static_assert(_is_same(typeof(B), int (*[1])[2]));"; ; - assert(compile_without_errors(false, false, src)); + assert(compile_without_errors_warnings(false, false, src)); //https://godbolt.org/z/WbK9zP7zM } @@ -339,7 +339,7 @@ void expand_test2() ""; - assert(compile_without_errors(false, false, source)); + assert(compile_without_errors_warnings(false, false, source)); //https://godbolt.org/z/WbK9zP7zM } @@ -353,7 +353,7 @@ void expand_test3() "typedef T1(*f[3])(int); " "static_assert(_is_same(typeof(f), char* (* [3])(int)));"; - assert(compile_without_errors(false, false, src3)); + assert(compile_without_errors_warnings(false, false, src3)); //https://godbolt.org/z/WbK9zP7zM } @@ -432,7 +432,7 @@ void bigtest() "\n" "\n" ; - assert(compile_without_errors(false, false, str)); + assert(compile_without_errors_warnings(false, false, str)); } void literal_string_type() @@ -443,7 +443,7 @@ void literal_string_type() " static_assert(_is_same(typeof(\"AB\"), char [3]));\n" ; - assert(compile_without_errors(false, false, source)); + assert(compile_without_errors_warnings(false, false, source)); } void digit_separator_test() @@ -452,7 +452,7 @@ void digit_separator_test() "static_assert(1'00'00 == 10000);" ; - assert(compile_without_errors(false, false, source)); + assert(compile_without_errors_warnings(false, false, source)); } void numbers_test() @@ -463,7 +463,7 @@ void numbers_test() "#endif" ; - assert(compile_without_errors(false, false, source)); + assert(compile_without_errors_warnings(false, false, source)); } void binary_digits_test() @@ -474,7 +474,7 @@ void binary_digits_test() "_Static_assert(052 == 42);" ; - assert(compile_without_errors(false, false, source)); + assert(compile_without_errors_warnings(false, false, source)); } void type_suffix_test() @@ -518,7 +518,7 @@ void type_suffix_test() ; - assert(compile_without_errors(false, false, source)); + assert(compile_without_errors_warnings(false, false, source)); } void type_test() @@ -529,7 +529,7 @@ void type_test() "static_assert(_is_same( typeof( *(p + 1) ), int) );" ; - assert(compile_without_errors(false, false, source)); + assert(compile_without_errors_warnings(false, false, source)); } void is_pointer_test() @@ -564,7 +564,7 @@ void is_pointer_test() "\n" "}\n" ; - assert(compile_without_errors(false, false, source)); + assert(compile_without_errors_warnings(false, false, source)); } void params_test() @@ -582,7 +582,7 @@ void params_test() "}" ; - assert(compile_without_errors(false, false, source)); + assert(compile_without_errors_warnings(false, false, source)); } void test_compiler_constant_expression() @@ -597,7 +597,7 @@ void test_compiler_constant_expression() "}" ; - assert(compile_without_errors(false, false, source)); + assert(compile_without_errors_warnings(false, false, source)); } void zerodiv() @@ -611,7 +611,7 @@ void zerodiv() "}\n" ""; - assert(compile_without_errors(false, false, source)); + assert(compile_without_errors_warnings(false, false, source)); } void function_result_test() @@ -623,7 +623,7 @@ void function_result_test() "static_assert(_Generic(F2(), int (*)(int, int*) : 1));\n" ; - assert(compile_without_errors(false, false, source)); + assert(compile_without_errors_warnings(false, false, source)); } void type_normalization() @@ -643,7 +643,7 @@ void type_normalization() ; - assert(compile_without_errors(false, false, source)); + assert(compile_without_errors_warnings(false, false, source)); } void auto_test() @@ -665,7 +665,7 @@ void auto_test() " }\n" ; - assert(compile_without_errors(false, false, source)); + assert(compile_without_errors_warnings(false, false, source)); } @@ -688,7 +688,7 @@ void enum_scope() " enum E { B } e2; \n" " static_assert( (typeof(e2)), (enum E) ); \n" "}\n"; - assert(compile_without_errors(false, false, source)); + assert(compile_without_errors_warnings(false, false, source)); } void const_member() @@ -741,7 +741,7 @@ void address_of_const() "static_assert(_Generic(&p, const int * const * : 1 ));\n" ""; - assert(compile_without_errors(false, false, source)); + assert(compile_without_errors_warnings(false, false, source)); } void lvalue_test() @@ -825,7 +825,7 @@ void lvalue_test() ; - assert(compile_without_errors(false, false, source)); + assert(compile_without_errors_warnings(false, false, source)); } void simple_no_discard_test() @@ -960,7 +960,7 @@ void simple_move() " char * _Owner p = 0;\n" " return p; /*implicit move*/\n" "}"; - assert(compile_without_errors(true, false, source)); + assert(compile_without_errors_warnings(true, false, source)); } void simple_move_error() @@ -972,7 +972,7 @@ void simple_move_error() "#pragma cake diagnostic check \"-Wnon-owner-move\"\n" "}\n"; - assert(compile_without_errors(true, false, source)); + assert(compile_without_errors_warnings(true, false, source)); } void parameter_view() @@ -986,7 +986,7 @@ void parameter_view() " return parameter->owner_variable;\n" //ok to move from parameter "}\n"; - assert(compile_without_errors(true, false, source)); + assert(compile_without_errors_warnings(true, false, source)); } void move_from_extern() @@ -1000,7 +1000,7 @@ void move_from_extern() " return global.owner_variable;\n" /*makes a _View*/ "}\n"; - assert(compile_without_errors(true, false, source)); + assert(compile_without_errors_warnings(true, false, source)); } void owner_type_test() @@ -1047,7 +1047,7 @@ void owner_type_test() " static_assert(_is_owner(typeof(*p))); \n" "}\n"; - assert(compile_without_errors(true, false, source)); + assert(compile_without_errors_warnings(true, false, source)); } void correct_move_assigment() @@ -1074,7 +1074,7 @@ void correct_move_assigment() " x1 = x2; //ok\n" "\n" "}"; - assert(compile_without_errors(true, false, source)); + assert(compile_without_errors_warnings(true, false, source)); } void no_explicit_move_required() @@ -1090,7 +1090,7 @@ void no_explicit_move_required() "}\n" "\n" ""; - assert(compile_without_errors(true, false, source)); + assert(compile_without_errors_warnings(true, false, source)); } @@ -1106,7 +1106,7 @@ void no_explicit_move_with_function_result() " destroy(get());\n" "}\n"; - assert(compile_without_errors(true, false, source)); + assert(compile_without_errors_warnings(true, false, source)); } void cannot_ignore_owner_result() @@ -1145,7 +1145,7 @@ void can_ignore_owner_result() " f();\n" "}\n"; - assert(compile_without_errors(true, false, source)); + assert(compile_without_errors_warnings(true, false, source)); } void move_not_necessary_on_return() @@ -1162,7 +1162,7 @@ void move_not_necessary_on_return() " return f();\n" "}\n" ""; - assert(compile_without_errors(true, false, source)); + assert(compile_without_errors_warnings(true, false, source)); } void explicit_move_not_required() @@ -1179,7 +1179,7 @@ void explicit_move_not_required() " s = nullptr; \n" "}\n" ; - assert(compile_without_errors(true, false, source)); + assert(compile_without_errors_warnings(true, false, source)); } void error_using_temporary_owner() @@ -1196,7 +1196,7 @@ void error_using_temporary_owner() "#pragma cake diagnostic check \"-Wtemp-owner\"\n" ""; - assert(compile_without_errors(true, false, source)); + assert(compile_without_errors_warnings(true, false, source)); } void passing_view_to_owner() @@ -1213,7 +1213,7 @@ void passing_view_to_owner() "}\n" "\n" "#pragma cake diagnostic check \"-Wnon-owner-move\""; - assert(compile_without_errors(true, false, source)); + assert(compile_without_errors_warnings(true, false, source)); } void obj_owner_cannot_be_used_in_non_pointer() @@ -1239,7 +1239,7 @@ void ownership_flow_test_null_ptr_at_end_of_scope() " _Owner int * p = 0;\n" "}\n" " "; - assert(compile_without_errors(true, false, source)); + assert(compile_without_errors_warnings(true, false, source)); } void ownership_flow_test_pointer_must_be_deleted() @@ -1265,7 +1265,7 @@ void ownership_flow_test_pointer_must_be_deleted() ""; - assert(compile_without_errors(true, false, source)); + assert(compile_without_errors_warnings(true, false, source)); } void ownership_flow_test_basic_pointer_check() @@ -1284,7 +1284,7 @@ void ownership_flow_test_basic_pointer_check() "}\n" ""; - assert(compile_without_errors(true, false, source)); + assert(compile_without_errors_warnings(true, false, source)); } void ownership_flow_test_struct_member_missing_free() @@ -1314,7 +1314,7 @@ void ownership_flow_test_struct_member_missing_free() "\n" ""; - assert(compile_without_errors(true, false, source)); + assert(compile_without_errors_warnings(true, false, source)); } @@ -1337,7 +1337,7 @@ void ownership_flow_test_struct_member_free() " free(x.text);\n" "}\n" ""; - assert(compile_without_errors(true, false, source)); + assert(compile_without_errors_warnings(true, false, source)); } @@ -1364,7 +1364,7 @@ void ownership_flow_test_move_inside_if() "#pragma cake diagnostic check \"-Wmissing-destructor\"\n" ""; - assert(compile_without_errors(true, false, source)); + assert(compile_without_errors_warnings(true, false, source)); } void ownership_flow_test_goto_same_scope() @@ -1384,7 +1384,7 @@ void ownership_flow_test_goto_same_scope() " free(p);\n" "}\n" ""; - assert(compile_without_errors(true, false, source)); + assert(compile_without_errors_warnings(true, false, source)); } void ownership_flow_test_jump_labels() @@ -1430,7 +1430,7 @@ void ownership_flow_test_owner_if_pattern_1() "}\n" "\n" ""; - assert(compile_without_errors(true, false, source)); + assert(compile_without_errors_warnings(true, false, source)); } void ownership_flow_test_owner_if_pattern_2() @@ -1451,7 +1451,7 @@ void ownership_flow_test_owner_if_pattern_2() "}\n" "\n" ""; - assert(compile_without_errors(true, false, source)); + assert(compile_without_errors_warnings(true, false, source)); } void ownership_flow_test_missing_destructor() @@ -1473,7 +1473,7 @@ void ownership_flow_test_missing_destructor() "#pragma cake diagnostic check \"-Wmissing-destructor\"\n" "\n" ""; - assert(compile_without_errors(true, false, source)); + assert(compile_without_errors_warnings(true, false, source)); } @@ -1494,7 +1494,7 @@ void ownership_flow_test_no_warning() " }\n" "}\n" ""; - assert(compile_without_errors(true, false, source)); + assert(compile_without_errors_warnings(true, false, source)); } void ownership_flow_test_moved_if_not_null() @@ -1517,7 +1517,7 @@ void ownership_flow_test_moved_if_not_null() "}\n" "\n" ""; - assert(compile_without_errors(true, false, source)); + assert(compile_without_errors_warnings(true, false, source)); } void ownership_flow_test_struct_moved() @@ -1540,7 +1540,7 @@ void ownership_flow_test_struct_moved() " x_destroy(&p->x);\n" "}\n" ; - assert(compile_without_errors(true, false, source)); + assert(compile_without_errors_warnings(true, false, source)); } void ownership_flow_test_scope_error() @@ -1567,7 +1567,7 @@ void ownership_flow_test_scope_error() " {\n" " }\n" "}"; - assert(compile_without_errors(true, false, source)); + assert(compile_without_errors_warnings(true, false, source)); } @@ -1589,7 +1589,7 @@ void ownership_flow_test_void_destroy() "} \n" ; - assert(compile_without_errors(true, false, source)); + assert(compile_without_errors_warnings(true, false, source)); } void ownership_flow_test_void_destroy_ok() @@ -1611,7 +1611,7 @@ void ownership_flow_test_void_destroy_ok() " free(p); \n" "} \n" ; - assert(compile_without_errors(true, false, source)); + assert(compile_without_errors_warnings(true, false, source)); } void ownership_flow_test_moving_owner_pointer() @@ -1646,7 +1646,7 @@ void ownership_flow_test_moving_owner_pointer() "#pragma cake diagnostic check \"-Wmaybe-uninitialized\"\n" "\n" ""; - assert(compile_without_errors(true, false, source)); + assert(compile_without_errors_warnings(true, false, source)); } @@ -1677,7 +1677,7 @@ void ownership_flow_test_moving_owner_pointer_missing() "\n" ""; - assert(compile_without_errors(true, false, source)); + assert(compile_without_errors_warnings(true, false, source)); } void ownership_flow_test_error() @@ -1700,7 +1700,7 @@ void ownership_flow_test_error() "void dummy() {}\n" "#pragma cake diagnostic check \"-Wmissing-destructor\""; - assert(compile_without_errors(true, false, source)); + assert(compile_without_errors_warnings(true, false, source)); } void ownership_flow_test_setting_owner_pointer_to_null() @@ -1723,7 +1723,7 @@ void ownership_flow_test_setting_owner_pointer_to_null() "void dummy() {}\n" "#pragma cake diagnostic check \"-Wmissing-destructor\""; - assert(compile_without_errors(true, false, source)); + assert(compile_without_errors_warnings(true, false, source)); } void ownership_flow_test_while_not_null() @@ -1750,7 +1750,7 @@ void ownership_flow_test_while_not_null() " p = next;\n" " } \n" "}"; - assert(compile_without_errors(true, false, source)); + assert(compile_without_errors_warnings(true, false, source)); } void ownership_flow_test_if_state() @@ -1782,7 +1782,7 @@ void ownership_flow_test_if_state() "\n" ""; - assert(compile_without_errors(true, false, source)); + assert(compile_without_errors_warnings(true, false, source)); } void ownership_types_test_error_owner() @@ -1799,7 +1799,7 @@ void ownership_types_test_error_owner() "void dummy() {}\n" "#pragma cake diagnostic check \"-Wmissing-destructor\""; - assert(compile_without_errors(true, false, source)); + assert(compile_without_errors_warnings(true, false, source)); } void ownership_flow_test_if_variant() @@ -1819,7 +1819,7 @@ void ownership_flow_test_if_variant() "void dummy() {}\n" "#pragma cake diagnostic check \"-Wmissing-destructor\""; - assert(compile_without_errors(true, false, source)); + assert(compile_without_errors_warnings(true, false, source)); } void check_leaks_on_else_block() @@ -1838,7 +1838,7 @@ void check_leaks_on_else_block() "void dummy() {}\n" "#pragma cake diagnostic check \"-Wmissing-destructor\""; - assert(compile_without_errors(true, false, source)); + assert(compile_without_errors_warnings(true, false, source)); } void ownership_flow_test_two_ifs() @@ -1867,7 +1867,7 @@ void ownership_flow_test_two_ifs() "}\n" "\n" ""; - assert(compile_without_errors(true, false, source)); + assert(compile_without_errors_warnings(true, false, source)); } @@ -1879,7 +1879,7 @@ void ownership_no_name_parameter() "void dummy() {}\n" "#pragma cake diagnostic check \"-Wmissing-destructor\""; - assert(compile_without_errors(true, false, source)); + assert(compile_without_errors_warnings(true, false, source)); } void ownership_flow_switch_case() @@ -1912,7 +1912,7 @@ void ownership_flow_switch_case() " break;\n" " } \n" "}"; - assert(compile_without_errors(true, false, source)); + assert(compile_without_errors_warnings(true, false, source)); } void state_inner_objects_preserved() @@ -1940,7 +1940,7 @@ void state_inner_objects_preserved() " free(p->name);\n" " free(p);\n" "}"; - assert(compile_without_errors(true, false, source)); + assert(compile_without_errors_warnings(true, false, source)); } //TODO make test with @@ -1949,7 +1949,7 @@ void state_inner_objects_preserved() void owner_parameter_must_be_ignored() { const char* source = "void f(void (*pf)(void* _Owner p)){}"; - assert(compile_without_errors(true, false, source)); + assert(compile_without_errors_warnings(true, false, source)); } void taking_address() @@ -1993,7 +1993,7 @@ void taking_address_const() " f(&x);\n" "}\n" ""; - assert(compile_without_errors(true, false, source)); + assert(compile_without_errors_warnings(true, false, source)); } void pointer_argument() @@ -2036,7 +2036,7 @@ void do_while() " while(0); \n" "}\n" ""; - assert(compile_without_errors(true, false, source)); + assert(compile_without_errors_warnings(true, false, source)); } void switch_cases_state() @@ -2060,7 +2060,7 @@ void switch_cases_state() " return p;\n" "}\n" ""; - assert(compile_without_errors(true, false, source)); + assert(compile_without_errors_warnings(true, false, source)); } void switch_break() @@ -2077,7 +2077,7 @@ void switch_break() " }\n" " return p;\n" "}"; - assert(compile_without_errors(true, false, source)); + assert(compile_without_errors_warnings(true, false, source)); } void passing_non_owner() @@ -2096,7 +2096,7 @@ void passing_non_owner() "#pragma cake diagnostic check \"-Wmust-use-address-of\"\n" ""; - assert(compile_without_errors(true, false, source)); + assert(compile_without_errors_warnings(true, false, source)); } void flow_analysis_else() @@ -2125,7 +2125,7 @@ void flow_analysis_else() "}"; - assert(compile_without_errors(true, false, source)); + assert(compile_without_errors_warnings(true, false, source)); } void moving_content_of_owner() { @@ -2145,7 +2145,7 @@ void moving_content_of_owner() " y->x = *p;\n" "}\n" ; - assert(compile_without_errors(true, false, source)); + assert(compile_without_errors_warnings(true, false, source)); } void switch_scope() @@ -2181,7 +2181,7 @@ void switch_scope() " return p1;\n" "}\n" ""; - assert(compile_without_errors(true, false, source)); + assert(compile_without_errors_warnings(true, false, source)); } void swith_and_while() @@ -2219,7 +2219,7 @@ void swith_and_while() " return p1;\n" "}\n" ""; - assert(compile_without_errors(true, false, source)); + assert(compile_without_errors_warnings(true, false, source)); } void owner_to_non_owner() @@ -2238,7 +2238,7 @@ void owner_to_non_owner() "#pragma cake diagnostic check \"-Wmissing-destructor\"\n" ""; - assert(compile_without_errors(true, false, source)); + assert(compile_without_errors_warnings(true, false, source)); } void owner_to_non_owner_zero() @@ -2252,7 +2252,7 @@ void owner_to_non_owner_zero() " void * _Owner p = 0;\n" "}"; - assert(compile_without_errors(true, false, source)); + assert(compile_without_errors_warnings(true, false, source)); } void incomplete_struct() @@ -2268,7 +2268,7 @@ void incomplete_struct() " struct X x = 1 ? f() : f(); \n" " free(x.p);\n" "}"; - assert(compile_without_errors(true, false, source)); + assert(compile_without_errors_warnings(true, false, source)); } @@ -2305,7 +2305,7 @@ void switch_pop_problem() " \n" "}\n" ""; - assert(compile_without_errors(true, false, source)); + assert(compile_without_errors_warnings(true, false, source)); } void switch_pop2() @@ -2337,7 +2337,7 @@ void switch_pop2() "\n" "}\n" ""; - assert(compile_without_errors(true, false, source)); + assert(compile_without_errors_warnings(true, false, source)); } void scopes_pop() @@ -2369,7 +2369,7 @@ void scopes_pop() " }\n" "}\n" ""; - assert(compile_without_errors(true, false, source)); + assert(compile_without_errors_warnings(true, false, source)); } void owner_moved() { @@ -2392,7 +2392,7 @@ void owner_moved() " free(p);\n" " }\n" "}"; - assert(compile_without_errors(true, false, source)); + assert(compile_without_errors_warnings(true, false, source)); } @@ -2464,7 +2464,7 @@ void use_after_destroy() "\n" ""; - assert(compile_without_errors(true, false, source)); + assert(compile_without_errors_warnings(true, false, source)); } void obj_owner_must_be_from_addressof() @@ -2508,7 +2508,7 @@ void obj_owner_must_be_from_addressof() "\n" ""; - assert(compile_without_errors(true, false, source)); + assert(compile_without_errors_warnings(true, false, source)); } void discarding_owner() @@ -2536,7 +2536,7 @@ void discarding_owner() "\n" ""; - assert(compile_without_errors(true, false, source)); + assert(compile_without_errors_warnings(true, false, source)); } void using_uninitialized() @@ -2566,7 +2566,7 @@ void using_uninitialized() "#pragma cake diagnostic check \"-Wmaybe-uninitialized\"\n" "\n" ""; - assert(compile_without_errors(true, false, source)); + assert(compile_without_errors_warnings(true, false, source)); } void using_uninitialized_struct() @@ -2596,7 +2596,7 @@ void using_uninitialized_struct() ""; - assert(compile_without_errors(true, false, source)); + assert(compile_without_errors_warnings(true, false, source)); } void zero_initialized() @@ -2628,7 +2628,7 @@ void zero_initialized() "}\n" "\n" ""; - assert(compile_without_errors(true, false, source)); + assert(compile_without_errors_warnings(true, false, source)); } @@ -2661,7 +2661,7 @@ void empty_initialized() "}\n" "\n" ""; - assert(compile_without_errors(true, false, source)); + assert(compile_without_errors_warnings(true, false, source)); } void calloc_state() @@ -2699,7 +2699,7 @@ void calloc_state() "}\n" "\n" ""; - assert(compile_without_errors(true, false, source)); + assert(compile_without_errors_warnings(true, false, source)); } void malloc_initialization() @@ -2737,7 +2737,7 @@ void malloc_initialization() "}\n" "\n" ""; - assert(compile_without_errors(true, false, source)); + assert(compile_without_errors_warnings(true, false, source)); } void valid_but_unkown_result() @@ -2777,7 +2777,7 @@ void valid_but_unkown_result() "}\n" "\n" ""; - assert(compile_without_errors(true, false, source)); + assert(compile_without_errors_warnings(true, false, source)); } void calling_non_const_func() @@ -2819,7 +2819,7 @@ void calling_non_const_func() "}\n" "\n" ""; - assert(compile_without_errors(true, false, source)); + assert(compile_without_errors_warnings(true, false, source)); } void calling_const_func() { @@ -2859,7 +2859,7 @@ void calling_const_func() "}\n" "\n" ""; - assert(compile_without_errors(true, false, source)); + assert(compile_without_errors_warnings(true, false, source)); } void pointer_to_owner() { @@ -2889,7 +2889,7 @@ void pointer_to_owner() "\n" "\n" ""; - assert(compile_without_errors(true, false, source)); + assert(compile_without_errors_warnings(true, false, source)); } void socket_sample() @@ -2913,7 +2913,7 @@ void socket_sample() "}\n" "\n" ""; - assert(compile_without_errors(true, false, source)); + assert(compile_without_errors_warnings(true, false, source)); } void return_object() @@ -2934,7 +2934,7 @@ void return_object() " return x;\n" "}\n" ""; - assert(compile_without_errors(true, false, source)); + assert(compile_without_errors_warnings(true, false, source)); } void return_bad_object() { @@ -2972,7 +2972,7 @@ void null_to_owner() " f((void *) 0);\n" " f(nullptr);\n" "}\n"; - assert(compile_without_errors(true, false, source)); + assert(compile_without_errors_warnings(true, false, source)); } void return_true_branch() @@ -2995,7 +2995,7 @@ void return_true_branch() " static_state(p, \"null\"); \n" "}\n" ""; - assert(compile_without_errors(true, false, source)); + assert(compile_without_errors_warnings(true, false, source)); } void flow_tests() { @@ -3086,7 +3086,7 @@ void flow_tests() "}\n" "\n" ""; - assert(compile_without_errors(true, false, source)); + assert(compile_without_errors_warnings(true, false, source)); } void member() @@ -3107,7 +3107,7 @@ void member() " t.u.view.pSelect = 0;\n" "}\n" ""; - assert(compile_without_errors(true, false, source)); + assert(compile_without_errors_warnings(true, false, source)); } void loop_leak() { @@ -3153,7 +3153,7 @@ void out_parameter() "#pragma cake diagnostic check \"-Wmaybe-uninitialized\""; - assert(compile_without_errors(true, false, source)); + assert(compile_without_errors_warnings(true, false, source)); } void lvalue_required_1() @@ -3218,7 +3218,7 @@ void null_check_1() " static_state(p, \"not-null\");\n" "}\n" ""; - assert(compile_without_errors(true, true, source)); + assert(compile_without_errors_warnings(true, true, source)); } void null_check_2() @@ -3230,7 +3230,7 @@ void null_check_2() " static_state(p, \"maybe-null\");\n" "}\n" ""; - assert(compile_without_errors(true, false /*nullcheck disabled*/, source)); + assert(compile_without_errors_warnings(true, false /*nullcheck disabled*/, source)); } void compound_literal_object() @@ -3244,7 +3244,7 @@ void compound_literal_object() " static_state(x.i, \"zero\");\n" " static_state(x.p, \"null\");\n" "}"; - assert(compile_without_errors(true, false /*nullcheck disabled*/, source)); + assert(compile_without_errors_warnings(true, false /*nullcheck disabled*/, source)); } void bounds_check1() @@ -3257,7 +3257,7 @@ void bounds_check1() "}\n" "#pragma cake diagnostic check \"-Wout-of-bounds\""; - assert(compile_without_errors(true, false /*nullcheck disabled*/, source)); + assert(compile_without_errors_warnings(true, false /*nullcheck disabled*/, source)); } void bounds_check2() @@ -3269,7 +3269,7 @@ void bounds_check2() " int i = array[5];\n" "}\n" "#pragma cake diagnostic check \"-Wout-of-bounds\"\n"; - assert(compile_without_errors(true, false /*nullcheck disabled*/, source)); + assert(compile_without_errors_warnings(true, false /*nullcheck disabled*/, source)); } void uninitialized_objects_passed_to_variadic_function() @@ -3292,7 +3292,7 @@ void uninitialized_objects_passed_to_variadic_function() "\n" ""; - assert(compile_without_errors(true, false, source)); + assert(compile_without_errors_warnings(true, false, source)); } void nullderef() @@ -3316,7 +3316,7 @@ void nullderef() - assert(compile_without_errors(true, false, source)); + assert(compile_without_errors_warnings(true, false, source)); } void for_loop_visit() @@ -3330,7 +3330,7 @@ void for_loop_visit() " for (j = 0; j <10; j++) {}\n" " return j;\n" "}"; - assert(compile_without_errors(true, false /*nullcheck disabled*/, source)); + assert(compile_without_errors_warnings(true, false /*nullcheck disabled*/, source)); } void uninitialized_object() @@ -3367,7 +3367,7 @@ void calloc_builtin_semantics() "}\n" ""; - assert(compile_without_errors(true, false /*nullcheck disabled*/, source)); + assert(compile_without_errors_warnings(true, false /*nullcheck disabled*/, source)); } void malloc_builtin_semantics() { @@ -3387,7 +3387,7 @@ void malloc_builtin_semantics() "}\n" ""; - assert(compile_without_errors(true, false /*nullcheck disabled*/, source)); + assert(compile_without_errors_warnings(true, false /*nullcheck disabled*/, source)); } void discard_qualifier_test() { @@ -3402,7 +3402,7 @@ void discard_qualifier_test() " f(&x);\n" "}\n" "#pragma cake diagnostic check \"-Wdiscarded-qualifiers\""; - assert(compile_without_errors(true, false /*nullcheck disabled*/, source)); + assert(compile_without_errors_warnings(true, false /*nullcheck disabled*/, source)); } void keywords_inside_attr() { @@ -3410,7 +3410,7 @@ void keywords_inside_attr() = "[[gnu::const, gnu::hot, nodiscard]]\n" "int f(void); "; - assert(compile_without_errors(true, false /*nullcheck disabled*/, source)); + assert(compile_without_errors_warnings(true, false /*nullcheck disabled*/, source)); } void assertbuiltin() @@ -3428,7 +3428,7 @@ void assertbuiltin() "}\n" ""; - assert(compile_without_errors(true, false /*nullcheck disabled*/, source)); + assert(compile_without_errors_warnings(true, false /*nullcheck disabled*/, source)); } #endif