void const_skip_then_split_case() { auto foo = std::make_shared<lol>(); skip_const(foo); // Infer shouldn't havoc foo here since it's const... test_pointer(foo); /* ...so foo cannot be null here, even if there is an explicit null post... */ foo->f = 12; // no error }
void skip_then_split_case() { auto foo = std::make_shared<lol>(); skip_no_const(foo); // Infer havocs foo here since it's not const test_pointer( foo); // this call creates a case split, foo can be null in one branch foo->f = 12; // error }
int main() { test_integral(); test_floating_point(); test_nullptr_t(); test_pointer(); test_member_pointer(); test_enum(); test_class(); return boost::report_errors(); }
static void __init selftest(void) { alloced_buffer = kmalloc(BUF_SIZE + 2*PAD_SIZE, GFP_KERNEL); if (!alloced_buffer) return; test_buffer = alloced_buffer + PAD_SIZE; test_basic(); test_number(); test_string(); test_pointer(); kfree(alloced_buffer); }
// same as above but hide the type under a typedef void typedef_skip_then_split_case() { auto foo = std::make_shared<lol>(); skip_typedef(foo); test_pointer(foo); foo->f = 12; // no error }
// same as above but make sure infer pinpoints the correct const argument void const_skip2_then_split_case() { auto foo = std::make_shared<lol>(); skip_const2(0, foo, 0, 0); test_pointer(foo); foo->f = 12; // no error }