57
58 if (strcmp(func, "fprintf") == 0 || strcmp(func, "vfprintf")) {
59 const char *arg0 = expr_to_str(get_argument_from_call_expr(expr->args, 0));
60
61 if (arg0 != NULL &&
62 (strcmp(arg0, "(&__iob[1])") == 0 ||
63 strcmp(arg0, "(&__iob[2])") == 0))
64 return;
65 }
66
67 /*
68 * Either we got the return type already (direct call),
69 * or we need to go one further (function pointer call)
70 */
71 if (sym == &void_ctype || (sym->type == SYM_FN &&
72 get_real_base_type(sym) == &void_ctype))
73 return;
74
75 stmt = last_ptr_list((struct ptr_list *)big_statement_stack);
76
77 if (stmt->type == STMT_EXPRESSION && stmt->expression == expr)
78 sm_error("unchecked function return '%s'", expr_to_str(expr->fn));
79 }
80
81 void check_all_func_returns(int id)
82 {
83 if (option_project != PROJ_ILLUMOS_KERNEL &&
84 option_project != PROJ_ILLUMOS_USER)
85 return;
86
87 add_hook(&check_func_return, FUNCTION_CALL_HOOK);
88 }
|
57
58 if (strcmp(func, "fprintf") == 0 || strcmp(func, "vfprintf")) {
59 const char *arg0 = expr_to_str(get_argument_from_call_expr(expr->args, 0));
60
61 if (arg0 != NULL &&
62 (strcmp(arg0, "(&__iob[1])") == 0 ||
63 strcmp(arg0, "(&__iob[2])") == 0))
64 return;
65 }
66
67 /*
68 * Either we got the return type already (direct call),
69 * or we need to go one further (function pointer call)
70 */
71 if (sym == &void_ctype || (sym->type == SYM_FN &&
72 get_real_base_type(sym) == &void_ctype))
73 return;
74
75 stmt = last_ptr_list((struct ptr_list *)big_statement_stack);
76
77 if (stmt && stmt->type == STMT_EXPRESSION && stmt->expression == expr)
78 sm_error("unchecked function return '%s'", expr_to_str(expr->fn));
79 }
80
81 void check_all_func_returns(int id)
82 {
83 if (option_project != PROJ_ILLUMOS_KERNEL &&
84 option_project != PROJ_ILLUMOS_USER)
85 return;
86
87 add_hook(&check_func_return, FUNCTION_CALL_HOOK);
88 }
|