/illumos-gate/usr/src/tools/smatch/src/ |
H A D | inline.c | 46 static struct statement * dup_statement(struct statement *stmt) in dup_statement() argument 48 struct statement *dup = alloc_statement(stmt->pos, stmt->type); in dup_statement() 49 *dup = *stmt; in dup_statement() 197 struct statement *stmt = alloc_statement(expr->pos, STMT_COMPOUND); in copy_expression() local 198 copy_statement(expr->statement, stmt); in copy_expression() 200 expr->statement = stmt; in copy_expression() 325 static struct statement *copy_one_statement(struct statement *stmt) in copy_one_statement() argument 327 if (!stmt) in copy_one_statement() 329 switch(stmt->type) { in copy_one_statement() 334 struct statement *newstmt = dup_statement(stmt); in copy_one_statement() [all …]
|
H A D | check_unreachable.c | 26 static int empty_statement(struct statement *stmt) in empty_statement() argument 28 if (!stmt) in empty_statement() 30 if (stmt->type == STMT_EXPRESSION && !stmt->expression) in empty_statement() 38 struct statement *stmt; in is_last_stmt() local 42 stmt = fn->stmt; in is_last_stmt() 43 if (!stmt) in is_last_stmt() 44 stmt = fn->inline_stmt; in is_last_stmt() 45 if (!stmt || stmt->type != STMT_COMPOUND) in is_last_stmt() 47 stmt = last_ptr_list((struct ptr_list *)stmt->stmts); in is_last_stmt() 48 if (stmt == cur_stmt) in is_last_stmt() [all …]
|
H A D | check_indenting.c | 24 static int in_ignored_macro(struct statement *stmt) in in_ignored_macro() argument 29 macro = get_macro_name(stmt->pos); in in_ignored_macro() 40 static int missing_curly_braces(struct statement *stmt) in missing_curly_braces() argument 44 if (stmt->pos.pos == __prev_stmt->pos.pos) in missing_curly_braces() 61 if (stmt->pos.pos != inside_pos) in missing_curly_braces() 68 static int prev_lines_say_endif(struct statement *stmt) in prev_lines_say_endif() argument 71 struct position pos = stmt->pos; in prev_lines_say_endif() 87 static int is_pre_or_post_statement(struct statement *stmt) in is_pre_or_post_statement() argument 89 if (!stmt->parent) in is_pre_or_post_statement() 91 if (stmt->parent->type != STMT_ITERATOR) in is_pre_or_post_statement() [all …]
|
H A D | check_continue_vs_break.c | 35 static int is_do_while_zero(struct statement *stmt) in is_do_while_zero() argument 37 if (!stmt->iterator_post_condition) in is_do_while_zero() 39 if (!expr_is_zero(stmt->iterator_post_condition)) in is_do_while_zero() 44 static void push_statement(struct statement_list **stack, struct statement *stmt) in push_statement() argument 46 add_ptr_list(stack, stmt); in push_statement() 56 struct statement *stmt; in inside_do_while_zero() local 58 stmt = last_ptr_list((struct ptr_list *)iterator_stack); in inside_do_while_zero() 59 return !!stmt; in inside_do_while_zero() 64 struct statement *stmt; in loop_is_macro() local 66 stmt = last_ptr_list((struct ptr_list *)iterator_stack); in loop_is_macro() [all …]
|
H A D | smatch_flow.c | 201 if (sym->stmt && sym->stmt->type == STMT_COMPOUND) { in inlinable() 202 if (ptr_list_size((struct ptr_list *)sym->stmt->stmts) > 10) in inlinable() 204 if (sym->stmt->type != STMT_COMPOUND) in inlinable() 206 last_stmt = last_ptr_list((struct ptr_list *)sym->stmt->stmts); in inlinable() 579 static int is_forever_loop(struct statement *stmt) in is_forever_loop() argument 584 expr = strip_expr(stmt->iterator_pre_condition); in is_forever_loop() 586 expr = stmt->iterator_post_condition; in is_forever_loop() 611 static void handle_pre_loop(struct statement *stmt) in handle_pre_loop() argument 623 __split_stmt(stmt->iterator_pre_statement); in handle_pre_loop() 624 __prev_stmt = stmt->iterator_pre_statement; in handle_pre_loop() [all …]
|
H A D | smatch_scope.c | 22 static int end_of_function(struct statement *stmt) in end_of_function() argument 29 if (stmt == fn->stmt || stmt == fn->inline_stmt) in end_of_function() 39 static void match_end_of_block(struct statement *stmt) in match_end_of_block() argument 44 if (end_of_function(stmt)) in match_end_of_block() 47 FOR_EACH_PTR(stmt->stmts, tmp) { in match_end_of_block() 59 static int is_outer_stmt(struct statement *stmt) in is_outer_stmt() argument 72 if (!stmt->parent) in is_outer_stmt() 74 if (stmt->parent == fn->stmt || in is_outer_stmt() 75 stmt->parent == fn->inline_stmt) in is_outer_stmt() 80 static void match_stmt(struct statement *stmt) in match_stmt() argument [all …]
|
H A D | ast-inspect.c | 45 struct statement *stmt = node->ptr; in inspect_statement() local 46 node->text = g_strdup_printf("%s %s:", node->text, statement_type_name(stmt->type)); in inspect_statement() 47 switch (stmt->type) { in inspect_statement() 49 ast_append_child(node, "stmts:", stmt->stmts, inspect_statement_list); in inspect_statement() 52 ast_append_child(node, "expression:", stmt->expression, inspect_expression); in inspect_statement() 55 ast_append_child(node, "conditional:", stmt->if_conditional, inspect_expression); in inspect_statement() 56 ast_append_child(node, "if_true:", stmt->if_true, inspect_statement); in inspect_statement() 57 ast_append_child(node, "if_false:", stmt->if_false, inspect_statement); in inspect_statement() 60 ast_append_child(node, "break:", stmt->iterator_break, inspect_symbol); in inspect_statement() 61 ast_append_child(node, "continue:", stmt->iterator_continue, inspect_symbol); in inspect_statement() [all …]
|
H A D | check_no_if_block.c | 22 static void match_if_stmt(struct statement *stmt) in match_if_stmt() argument 26 if (stmt->type != STMT_IF) in match_if_stmt() 28 if (stmt->if_true->type == STMT_COMPOUND) in match_if_stmt() 30 if (get_macro_name(stmt->pos)) in match_if_stmt() 32 if (stmt->pos.pos != stmt->if_true->pos.pos) in match_if_stmt() 37 static void match_for_stmt(struct statement *stmt) in match_for_stmt() argument 41 if (stmt->type != STMT_ITERATOR) in match_for_stmt() 43 if (stmt->iterator_statement->type == STMT_COMPOUND) in match_for_stmt() 45 if (get_macro_name(stmt->pos)) in match_for_stmt() 47 if (stmt->pos.pos != stmt->iterator_statement->pos.pos) in match_for_stmt()
|
H A D | show-parse.c | 485 struct statement *stmt = type->stmt; in show_symbol() local 487 if (stmt) { in show_symbol() 489 val = show_statement(stmt); in show_symbol() 491 printf("\tmov.%d\t\tretval,%d\n", stmt->ret->bit_size, val); in show_symbol() 522 static void show_switch_statement(struct statement *stmt) in show_switch_statement() argument 524 int val = show_expression(stmt->switch_expression); in show_switch_statement() 537 FOR_EACH_PTR(stmt->switch_case->symbol_list, sym) { in show_switch_statement() 538 struct statement *case_stmt = sym->stmt; in show_switch_statement() 561 show_statement(stmt->switch_statement); in show_switch_statement() 563 if (stmt->switch_break->used) in show_switch_statement() [all …]
|
H A D | check_bogus_loop.c | 32 static struct expression *get_iterator_set(struct statement *stmt) in get_iterator_set() argument 36 if (!stmt) in get_iterator_set() 38 if (stmt->type != STMT_EXPRESSION) in get_iterator_set() 40 expr = stmt->expression; in get_iterator_set() 59 static void match_loop(struct statement *stmt) in match_loop() argument 65 if (get_macro_name(stmt->pos)) in match_loop() 68 iterator = get_iterator_set(stmt->iterator_pre_statement); in match_loop() 70 iterator = get_iterator_tested(stmt->iterator_pre_condition); in match_loop() 80 if (right_side_changes(stmt->iterator_pre_condition)) in match_loop() 83 if (implied_condition_false(stmt->iterator_pre_condition)) in match_loop()
|
H A D | parse.c | 64 static struct token *parse_if_statement(struct token *token, struct statement *stmt); 65 static struct token *parse_return_statement(struct token *token, struct statement *stmt); 66 static struct token *parse_loop_iterator(struct token *token, struct statement *stmt); 67 static struct token *parse_default_statement(struct token *token, struct statement *stmt); 68 static struct token *parse_case_statement(struct token *token, struct statement *stmt); 69 static struct token *parse_switch_statement(struct token *token, struct statement *stmt); 70 static struct token *parse_for_statement(struct token *token, struct statement *stmt); 71 static struct token *parse_while_statement(struct token *token, struct statement *stmt); 72 static struct token *parse_do_statement(struct token *token, struct statement *stmt); 73 static struct token *parse_goto_statement(struct token *token, struct statement *stmt); [all …]
|
H A D | check_spectre.c | 35 struct statement *stmt; in is_read() local 58 stmt = expr_get_parent_stmt(last_parent); in is_read() 59 if (stmt && stmt->type == STMT_RETURN) in is_read() 68 struct statement *stmt; in is_harmless() local 80 stmt = expr_get_parent_stmt(parent); in is_harmless() 81 if (!stmt) in is_harmless() 83 if (stmt->type == STMT_IF && stmt->if_conditional == parent) in is_harmless() 85 if (stmt->type == STMT_ITERATOR && in is_harmless() 86 (stmt->iterator_pre_condition == parent || in is_harmless() 87 stmt->iterator_post_condition == parent)) in is_harmless()
|
H A D | dissect.c | 63 *do_statement(usage_t mode, struct statement *stmt); 462 static struct symbol *do_statement(usage_t mode, struct statement *stmt) in do_statement() argument 466 if (stmt) switch (stmt->type) { in do_statement() 468 warning(stmt->pos, "bad stmt->type: %d", stmt->type); in do_statement() 475 do_sym_list(stmt->declaration); in do_statement() 478 ret = do_expression(mode, stmt->expression); in do_statement() 481 do_expression(u_lval(return_type), stmt->expression); in do_statement() 484 do_expression(U_R_VAL, stmt->asm_string); in do_statement() 485 do_asm_xputs(U_W_VAL, stmt->asm_outputs); in do_statement() 486 do_asm_xputs(U_R_VAL, stmt->asm_inputs); in do_statement() [all …]
|
H A D | expand.c | 1064 struct statement *stmt = expr->statement; in expand_expression() local 1065 int cost = expand_statement(stmt); in expand_expression() 1067 if (stmt->type == STMT_EXPRESSION && stmt->expression) in expand_expression() 1068 *expr = *stmt->expression; in expand_expression() 1128 if (base_type->stmt) in expand_symbol() 1129 expand_statement(base_type->stmt); in expand_symbol() 1134 static void expand_return_expression(struct statement *stmt) in expand_return_expression() argument 1136 expand_expression(stmt->expression); in expand_return_expression() 1139 static int expand_if_statement(struct statement *stmt) in expand_if_statement() argument 1141 struct expression *expr = stmt->if_conditional; in expand_if_statement() [all …]
|
H A D | check_passes_sizeof.c | 28 struct statement *stmt; in get_returned_expr() local 30 stmt = last_ptr_list((struct ptr_list *)big_statement_stack); in get_returned_expr() 31 if (!stmt || stmt->type != STMT_EXPRESSION || !stmt->expression) in get_returned_expr() 33 if (stmt->expression->type != EXPR_ASSIGNMENT) in get_returned_expr() 35 if (stmt->expression->right != expr) in get_returned_expr() 37 return stmt->expression->left; in get_returned_expr()
|
H A D | linearize.c | 26 static pseudo_t linearize_statement(struct entrypoint *ep, struct statement *stmt); 1975 static pseudo_t linearize_compound_statement(struct entrypoint *ep, struct statement *stmt) in linearize_compound_statement() argument 1981 FOR_EACH_PTR(stmt->stmts, s) { in linearize_compound_statement() 2003 static pseudo_t linearize_fn_statement(struct entrypoint *ep, struct statement *stmt) in linearize_fn_statement() argument 2009 pseudo = linearize_compound_statement(ep, stmt); in linearize_fn_statement() 2010 if (!is_void_type(stmt->ret)) { // non-void function in linearize_fn_statement() 2014 bb_ret = get_bound_block(ep, stmt->ret); in linearize_fn_statement() 2015 add_return(ep, bb_ret, stmt->ret, undef_pseudo()); in linearize_fn_statement() 2018 bb = add_label(ep, stmt->ret); in linearize_fn_statement() 2025 static pseudo_t linearize_inlined_call(struct entrypoint *ep, struct statement *stmt) in linearize_inlined_call() argument [all …]
|
H A D | smatch_real_absolute.c | 79 struct statement *stmt; in in_iterator_pre_statement() local 87 stmt = last_ptr_list((struct ptr_list *)big_statement_stack); in in_iterator_pre_statement() 89 if (!stmt || !stmt->parent) in in_iterator_pre_statement() 91 if (stmt->parent->type != STMT_ITERATOR) in in_iterator_pre_statement() 93 if (stmt->parent->iterator_pre_statement != stmt) in in_iterator_pre_statement()
|
H A D | smatch_conditions.c | 128 static void handle_compound_stmt(struct statement *stmt) in handle_compound_stmt() argument 134 last = last_ptr_list((struct ptr_list *)stmt->stmts); in handle_compound_stmt() 147 FOR_EACH_PTR(stmt->stmts, s) { in handle_compound_stmt() 158 struct statement *stmt; in handle_preop() local 165 stmt = get_expression_statement(expr); in handle_preop() 166 if (stmt) { in handle_preop() 167 handle_compound_stmt(stmt); in handle_preop() 681 static struct statement *split_then_return_last(struct statement *stmt) in split_then_return_last() argument 686 last_stmt = last_ptr_list((struct ptr_list *)stmt->stmts); in split_then_return_last() 691 FOR_EACH_PTR(stmt->stmts, tmp) { in split_then_return_last() [all …]
|
H A D | check_nospec.c | 176 static int is_nospec_asm(struct statement *stmt) in is_nospec_asm() argument 180 if (!stmt || stmt->type != STMT_ASM) in is_nospec_asm() 182 if (!stmt->asm_string) in is_nospec_asm() 184 macro = get_macro_name(stmt->asm_string->pos); in is_nospec_asm() 190 static void match_asm(struct statement *stmt) in match_asm() argument 192 if (is_nospec_asm(stmt)) in match_asm() 196 static void match_after_nospec_asm(struct statement *stmt) in match_after_nospec_asm() argument 221 static void match_barrier(struct statement *stmt) in match_barrier() argument 225 macro = get_macro_name(stmt->pos); in match_barrier()
|
H A D | check_all_func_returns.c | 30 struct statement *stmt; in check_func_return() local 75 stmt = last_ptr_list((struct ptr_list *)big_statement_stack); in check_func_return() 77 if (stmt && stmt->type == STMT_EXPRESSION && stmt->expression == expr) in check_func_return()
|
H A D | check_double_checking.c | 129 struct statement *stmt; in previous_statement_was_synchronize() local 145 FOR_EACH_PTR_REVERSE(big_statement_stack, stmt) { in previous_statement_was_synchronize() 146 if (stmt->pos.line < prev_pos.line) in previous_statement_was_synchronize() 148 pos = stmt->pos; in previous_statement_was_synchronize() 163 } END_FOR_EACH_PTR_REVERSE(stmt); in previous_statement_was_synchronize() 237 static void after_loop(struct statement *stmt) in after_loop() argument 241 if (!stmt || stmt->type != STMT_ITERATOR) in after_loop()
|
H A D | check_readl_infinite_loops.c | 123 static void before_loop(struct statement *stmt) in before_loop() argument 127 if (!stmt || stmt->type != STMT_ITERATOR) in before_loop() 135 static void after_loop(struct statement *stmt) in after_loop() argument 139 if (!stmt || stmt->type != STMT_ITERATOR) in after_loop()
|
H A D | check_missing_break.c | 129 static void match_stmt(struct statement *stmt) in match_stmt() argument 131 if (stmt->type == STMT_CASE) in match_stmt() 137 static void match_switch(struct statement *stmt) in match_switch() argument 139 if (stmt->type != STMT_SWITCH) in match_switch() 161 static void match_switch_end(struct statement *stmt) in match_switch_end() argument 164 if (stmt->type != STMT_SWITCH) in match_switch_end()
|
/illumos-gate/usr/src/cmd/fm/modules/common/eversholt/ |
H A D | eft_mdb.c | 464 (void) eft_node((uintptr_t)node.u.stmt.np, DCMD_ADDRSPEC, 0, in eft_node() 466 if (node.u.stmt.nvpairs) { in eft_node() 468 (void) eft_node((uintptr_t)node.u.stmt.nvpairs, in eft_node() 475 (void) eft_node((uintptr_t)node.u.stmt.np, DCMD_ADDRSPEC, 0, in eft_node() 477 if (node.u.stmt.nvpairs) { in eft_node() 479 (void) eft_node((uintptr_t)node.u.stmt.nvpairs, in eft_node() 712 (void) eft_node((uintptr_t)node.u.stmt.np, DCMD_ADDRSPEC, 0, in eft_node() 714 if (node.u.stmt.nvpairs) { in eft_node() 716 (void) eft_node((uintptr_t)node.u.stmt.nvpairs, in eft_node() 723 (void) eft_node((uintptr_t)node.u.stmt.np, DCMD_ADDRSPEC, 0, in eft_node() [all …]
|
/illumos-gate/usr/src/lib/libdtrace/common/ |
H A D | dt_sugar.c | 315 dt_node_t *stmt = dt_node_statement(dt_node_op2(DT_TOK_ASGN, in dt_sugar_new_clearerror_clause() local 317 return (dt_node_clause(dp->dtsp_pdescs, NULL, stmt)); in dt_sugar_new_clearerror_clause() 392 dt_node_t *stmt; in dt_sugar_visit_stmts() local 397 for (stmt = stmts; stmt != NULL; stmt = next_stmt) { in dt_sugar_visit_stmts() 398 next_stmt = stmt->dn_list; in dt_sugar_visit_stmts() 400 if (stmt->dn_kind != DT_NODE_IF) { in dt_sugar_visit_stmts() 402 first_stmt_in_basic_block = stmt; in dt_sugar_visit_stmts() 403 prev_stmt = stmt; in dt_sugar_visit_stmts() 422 dt_sugar_do_if(dp, stmt, precondition); in dt_sugar_visit_stmts() 426 prev_stmt = stmt; in dt_sugar_visit_stmts()
|