Print this page
new smatch

Split Close
Expand all
Collapse all
          --- old/usr/src/tools/smatch/src/check_uninitialized.c
          +++ new/usr/src/tools/smatch/src/check_uninitialized.c
↓ open down ↓ 16 lines elided ↑ open up ↑
  17   17  
  18   18  #include "smatch.h"
  19   19  #include "smatch_slist.h"
  20   20  #include "smatch_extra.h"
  21   21  
  22   22  static int my_id;
  23   23  
  24   24  STATE(uninitialized);
  25   25  STATE(initialized);
  26   26  
  27      -static void pre_merge_hook(struct sm_state *sm)
       27 +static void pre_merge_hook(struct sm_state *cur, struct sm_state *other)
  28   28  {
  29   29          if (is_impossible_path())
  30      -                set_state(my_id, sm->name, sm->sym, &initialized);
       30 +                set_state(my_id, cur->name, cur->sym, &initialized);
  31   31  }
  32   32  
  33   33  static void mark_members_uninitialized(struct symbol *sym)
  34   34  {
  35   35          struct symbol *struct_type, *tmp, *base_type;
  36   36          char buf[256];
  37   37  
  38   38          struct_type = get_real_base_type(sym);
  39   39          FOR_EACH_PTR(struct_type->symbol_list, tmp) {
  40   40                  if (!tmp->ident)
↓ open down ↓ 65 lines elided ↑ open up ↑
 106  106           * consistently.  Ideally Smatch would know the return but often it
 107  107           * doesn't.
 108  108           *
 109  109           */
 110  110  
 111  111          if (option_project != PROJ_KERNEL)
 112  112                  return;
 113  113  
 114  114          if (expr->type != EXPR_COMPARE || expr->op != '<')
 115  115                  return;
 116      -        if (!is_zero(expr->right))
      116 +        if (!expr_is_zero(expr->right))
 117  117                  return;
 118  118          if (get_implied_max(expr->left, &max) && max.value == 0)
 119  119                  return;
 120  120  
 121  121          success = compare_expression(expr->left, SPECIAL_EQUAL, expr->right);
 122  122          if (!assume(success))
 123  123                  return;
 124  124  
 125  125          FOR_EACH_MY_SM(my_id, __get_cur_stree(), sm) {
 126  126                  if (sm->state == &initialized)
↓ open down ↓ 275 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX