Print this page
11972 resync smatch

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 ↓ 45 lines elided ↑ open up ↑
  46   46  
  47   47          if ((estate_has_hard_max(s1) && (!estate_rl(s2) || estate_has_hard_max(s2))) ||
  48   48              (estate_has_hard_max(s2) && (!estate_rl(s1) || estate_has_hard_max(s1))))
  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 +        if (estate_treat_untagged(s1) && estate_treat_untagged(s2))
       57 +                estate_set_treat_untagged(tmp);
       58 +
  56   59          return tmp;
  57   60  }
  58   61  
  59   62  struct data_info *get_dinfo(struct smatch_state *state)
  60   63  {
  61   64          if (!state)
  62   65                  return NULL;
  63   66          return (struct data_info *)state->data;
  64   67  }
  65   68  
↓ open down ↓ 43 lines elided ↑ open up ↑
 109  112  
 110  113  void estate_clear_fuzzy_max(struct smatch_state *state)
 111  114  {
 112  115          sval_t empty = {};
 113  116  
 114  117          get_dinfo(state)->fuzzy_max = empty;
 115  118  }
 116  119  
 117  120  int estate_has_hard_max(struct smatch_state *state)
 118  121  {
 119      -        if (!state)
      122 +        if (!state || !estate_rl(state))
 120  123                  return 0;
 121  124          return get_dinfo(state)->hard_max;
 122  125  }
 123  126  
 124  127  void estate_set_hard_max(struct smatch_state *state)
 125  128  {
 126  129          get_dinfo(state)->hard_max = 1;
 127  130  }
 128  131  
 129  132  void estate_clear_hard_max(struct smatch_state *state)
↓ open down ↓ 17 lines elided ↑ open up ↑
 147  150          if (!estate_rl(state))
 148  151                  return true;
 149  152          return get_dinfo(state)->capped;
 150  153  }
 151  154  
 152  155  void estate_set_capped(struct smatch_state *state)
 153  156  {
 154  157          get_dinfo(state)->capped = true;
 155  158  }
 156  159  
      160 +bool estate_treat_untagged(struct smatch_state *state)
      161 +{
      162 +        if (!state)
      163 +                return false;
      164 +
      165 +        /* impossible states are capped */
      166 +        if (!estate_rl(state))
      167 +                return true;
      168 +
      169 +        return get_dinfo(state)->treat_untagged;
      170 +}
      171 +
      172 +void estate_set_treat_untagged(struct smatch_state *state)
      173 +{
      174 +        get_dinfo(state)->treat_untagged = true;
      175 +}
      176 +
 157  177  sval_t estate_min(struct smatch_state *state)
 158  178  {
 159  179          return rl_min(estate_rl(state));
 160  180  }
 161  181  
 162  182  sval_t estate_max(struct smatch_state *state)
 163  183  {
 164  184          return rl_max(estate_rl(state));
 165  185  }
 166  186  
↓ open down ↓ 30 lines elided ↑ open up ↑
 197  217  int estates_equiv(struct smatch_state *one, struct smatch_state *two)
 198  218  {
 199  219          if (!one || !two)
 200  220                  return 0;
 201  221          if (one == two)
 202  222                  return 1;
 203  223          if (!rlists_equiv(estate_related(one), estate_related(two)))
 204  224                  return 0;
 205  225          if (estate_capped(one) != estate_capped(two))
 206  226                  return 0;
      227 +        if (estate_treat_untagged(one) != estate_treat_untagged(two))
      228 +                return 0;
 207  229          if (strcmp(one->name, two->name) == 0)
 208  230                  return 1;
 209  231          return 0;
 210  232  }
 211  233  
 212  234  int estate_is_whole(struct smatch_state *state)
 213  235  {
 214  236          return is_whole_rl(estate_rl(state));
 215  237  }
 216  238  
↓ open down ↓ 10 lines elided ↑ open up ↑
 227  249                  return 0;
 228  250          if (estate_has_fuzzy_max(state))
 229  251                  return 0;
 230  252          return 1;
 231  253  }
 232  254  
 233  255  int estate_get_single_value(struct smatch_state *state, sval_t *sval)
 234  256  {
 235  257          sval_t min, max;
 236  258  
      259 +        if (!estate_rl(state))
      260 +                return 0;
 237  261          min = rl_min(estate_rl(state));
 238  262          max = rl_max(estate_rl(state));
 239  263          if (sval_cmp(min, max) != 0)
 240  264                  return 0;
 241  265          *sval = min;
 242  266          return 1;
 243  267  }
 244  268  
 245  269  static struct data_info *alloc_dinfo(void)
 246  270  {
↓ open down ↓ 190 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX