Print this page
11506 smatch resync

Split Close
Expand all
Collapse all
          --- old/usr/src/tools/smatch/src/smatch_modification_hooks.c
          +++ new/usr/src/tools/smatch/src/smatch_modification_hooks.c
↓ open down ↓ 44 lines elided ↑ open up ↑
  45   45  
  46   46  ALLOCATOR(modification_data, "modification data");
  47   47  
  48   48  static int my_id;
  49   49  static struct smatch_state *alloc_my_state(struct expression *expr, struct smatch_state *prev)
  50   50  {
  51   51          struct smatch_state *state;
  52   52          struct modification_data *data;
  53   53          char *name;
  54   54  
  55      -        state = __alloc_smatch_state(0);
  56   55          expr = strip_expr(expr);
  57   56          name = expr_to_str(expr);
       57 +        if (!name)
       58 +                return NULL;
       59 +
       60 +        state = __alloc_smatch_state(0);
  58   61          state->name = alloc_sname(name);
  59   62          free_string(name);
  60   63  
  61   64          data = __alloc_modification_data(0);
  62   65          data->prev = prev;
  63   66          data->cur = expr;
  64   67          state->data = data;
  65   68  
  66   69          return state;
  67   70  }
↓ open down ↓ 103 lines elided ↑ open up ↑
 171  174                  update_mtag_data(gen_expr);
 172  175  
 173  176          name = get_variable_from_key(arg, key, &sym);
 174  177          if (!name || !sym)
 175  178                  goto free;
 176  179  
 177  180          __in_fake_assign++;
 178  181          call_modification_hooks_name_sym(name, sym, expr, BOTH);
 179  182          __in_fake_assign--;
 180  183  
 181      -        other_name = map_long_to_short_name_sym(name, sym, &other_sym);
      184 +        other_name = get_other_name_sym(name, sym, &other_sym);
 182  185          if (other_name) {
 183  186                  __in_fake_assign++;
 184  187                  call_modification_hooks_name_sym(other_name, other_sym, expr, BOTH);
 185  188                  __in_fake_assign--;
 186  189                  free_string(other_name);
 187  190          }
 188  191  
 189  192  free:
 190  193          free_string(name);
 191  194  }
↓ open down ↓ 80 lines elided ↑ open up ↑
 272  275  
 273  276  struct smatch_state *get_modification_state(struct expression *expr)
 274  277  {
 275  278          return get_state_expr(my_id, expr);
 276  279  }
 277  280  
 278  281  void register_modification_hooks(int id)
 279  282  {
 280  283          my_id = id;
 281  284  
      285 +        set_dynamic_states(my_id);
      286 +
 282  287          hooks = malloc((num_checks + 1) * sizeof(*hooks));
 283  288          memset(hooks, 0, (num_checks + 1) * sizeof(*hooks));
 284  289          hooks_late = malloc((num_checks + 1) * sizeof(*hooks));
 285  290          memset(hooks_late, 0, (num_checks + 1) * sizeof(*hooks));
 286  291  
 287  292          add_hook(&match_assign_early, ASSIGNMENT_HOOK);
 288  293          add_hook(&unop_expr_early, OP_HOOK);
 289  294          add_hook(&asm_expr_early, ASM_HOOK);
 290  295  }
 291  296  
↓ open down ↓ 12 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX