Print this page
12724 update smatch to 0.6.1-rc1-il-5

Split Close
Expand all
Collapse all
          --- old/usr/src/tools/smatch/src/smatch_estate.c
          +++ new/usr/src/tools/smatch/src/smatch_estate.c
↓ open down ↓ 48 lines elided ↑ open up ↑
  49   49                  estate_set_hard_max(tmp);
  50   50  
  51   51          estate_set_fuzzy_max(tmp, sval_max(estate_get_fuzzy_max(s1), estate_get_fuzzy_max(s2)));
  52   52  
  53   53          if (estate_capped(s1) && estate_capped(s2))
  54   54                  estate_set_capped(tmp);
  55   55  
  56   56          if (estate_treat_untagged(s1) && estate_treat_untagged(s2))
  57   57                  estate_set_treat_untagged(tmp);
  58   58  
       59 +        if (estate_new(s1) || estate_new(s2))
       60 +                estate_set_new(tmp);
       61 +
  59   62          return tmp;
  60   63  }
  61   64  
  62   65  struct data_info *get_dinfo(struct smatch_state *state)
  63   66  {
  64   67          if (!state)
  65   68                  return NULL;
  66   69          return (struct data_info *)state->data;
  67   70  }
  68   71  
↓ open down ↓ 50 lines elided ↑ open up ↑
 119  122  
 120  123  int estate_has_hard_max(struct smatch_state *state)
 121  124  {
 122  125          if (!state || !estate_rl(state))
 123  126                  return 0;
 124  127          return get_dinfo(state)->hard_max;
 125  128  }
 126  129  
 127  130  void estate_set_hard_max(struct smatch_state *state)
 128  131  {
      132 +        /* pointers don't have a hard max */
      133 +        if (is_ptr_type(estate_type(state)))
      134 +                return;
 129  135          get_dinfo(state)->hard_max = 1;
 130  136  }
 131  137  
 132  138  void estate_clear_hard_max(struct smatch_state *state)
 133  139  {
 134  140          get_dinfo(state)->hard_max = 0;
 135  141  }
 136  142  
 137  143  int estate_get_hard_max(struct smatch_state *state, sval_t *sval)
 138  144  {
↓ open down ↓ 28 lines elided ↑ open up ↑
 167  173                  return true;
 168  174  
 169  175          return get_dinfo(state)->treat_untagged;
 170  176  }
 171  177  
 172  178  void estate_set_treat_untagged(struct smatch_state *state)
 173  179  {
 174  180          get_dinfo(state)->treat_untagged = true;
 175  181  }
 176  182  
      183 +bool estate_new(struct smatch_state *state)
      184 +{
      185 +        if (!estate_rl(state))
      186 +                return false;
      187 +        return get_dinfo(state)->set;
      188 +}
      189 +
      190 +void estate_set_new(struct smatch_state *state)
      191 +{
      192 +        get_dinfo(state)->set = true;
      193 +}
      194 +
 177  195  sval_t estate_min(struct smatch_state *state)
 178  196  {
 179  197          return rl_min(estate_rl(state));
 180  198  }
 181  199  
 182  200  sval_t estate_max(struct smatch_state *state)
 183  201  {
 184  202          return rl_max(estate_rl(state));
 185  203  }
 186  204  
↓ open down ↓ 32 lines elided ↑ open up ↑
 219  237          if (!one || !two)
 220  238                  return 0;
 221  239          if (one == two)
 222  240                  return 1;
 223  241          if (!rlists_equiv(estate_related(one), estate_related(two)))
 224  242                  return 0;
 225  243          if (estate_capped(one) != estate_capped(two))
 226  244                  return 0;
 227  245          if (estate_treat_untagged(one) != estate_treat_untagged(two))
 228  246                  return 0;
      247 +        if (estate_has_hard_max(one) != estate_has_hard_max(two))
      248 +                return 0;
      249 +        if (estate_new(one) != estate_new(two))
      250 +                return 0;
 229  251          if (strcmp(one->name, two->name) == 0)
 230  252                  return 1;
 231  253          return 0;
 232  254  }
 233  255  
 234  256  int estate_is_whole(struct smatch_state *state)
 235  257  {
 236  258          return is_whole_rl(estate_rl(state));
 237  259  }
 238  260  
↓ open down ↓ 222 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX