Print this page
11462 enable smatch by default

Split Close
Expand all
Collapse all
          --- old/usr/src/tools/smatch/src/smatch_implied.c
          +++ new/usr/src/tools/smatch/src/smatch_implied.c
↓ open down ↓ 5 lines elided ↑ open up ↑
   6    6   * as published by the Free Software Foundation; either version 2
   7    7   * of the License, or (at your option) any later version.
   8    8   *
   9    9   * This program is distributed in the hope that it will be useful,
  10   10   * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11   11   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12   12   * GNU General Public License for more details.
  13   13   *
  14   14   * You should have received a copy of the GNU General Public License
  15   15   * along with this program; if not, see http://www.gnu.org/copyleft/gpl.txt
       16 + *
       17 + * Copyright 2019 Joyent, Inc.
  16   18   */
  17   19  
  18   20  /*
  19   21   * Imagine we have this code:
  20   22   * foo = 1;
  21   23   * if (bar)
  22   24   *         foo = 99;
  23   25   * else
  24   26   *         frob();
  25   27   *                   //  <-- point #1
↓ open down ↓ 364 lines elided ↑ open up ↑
 390  392          return 0;
 391  393  }
 392  394  
 393  395  static int taking_too_long(void)
 394  396  {
 395  397          static void *printed;
 396  398  
 397  399          if (out_of_memory())
 398  400                  return 1;
 399  401  
 400      -        if (time_parsing_function() < 60)
      402 +        if (time_parsing_function() < option_timeout)
 401  403                  return 0;
 402  404  
 403  405          if (!__inline_fn && printed != cur_func_sym) {
 404  406                  if (!is_skipped_function())
 405  407                          sm_perror("turning off implications after 60 seconds");
 406  408                  printed = cur_func_sym;
 407  409          }
 408  410          return 1;
 409  411  }
 410  412  
↓ open down ↓ 175 lines elided ↑ open up ↑
 586  588                  printf("These are the implied states for the true path: (%s %s %s)\n",
 587  589                         sm->name, show_special(comparison), show_rl(rl));
 588  590                  __print_stree(*true_states);
 589  591                  printf("These are the implied states for the false path: (%s %s %s)\n",
 590  592                         sm->name, show_special(comparison), show_rl(rl));
 591  593                  __print_stree(*false_states);
 592  594          }
 593  595  
 594  596          gettimeofday(&time_after, NULL);
 595  597          sec = time_after.tv_sec - time_before.tv_sec;
 596      -        if (sec > 20) {
      598 +        if (sec > option_timeout) {
 597  599                  sm->nr_children = 4000;
 598  600                  sm_perror("Function too hairy.  Ignoring implications after %d seconds.", sec);
 599  601          }
 600  602  }
 601  603  
 602  604  static struct expression *get_last_expr(struct statement *stmt)
 603  605  {
 604  606          struct statement *last;
 605  607  
 606  608          last = last_ptr_list((struct ptr_list *)stmt->stmts);
↓ open down ↓ 510 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX