Print this page
11462 enable smatch by default

Split Close
Expand all
Collapse all
          --- old/usr/src/tools/smatch/src/smatch.c
          +++ new/usr/src/tools/smatch/src/smatch.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  #include <stdio.h>
  19   21  #include <unistd.h>
  20   22  #include <libgen.h>
  21   23  #include "smatch.h"
  22   24  #include "check_list.h"
  23   25  
  24   26  char *option_debug_check = (char *)"";
  25   27  char *option_project_str = (char *)"smatch_generic";
↓ open down ↓ 10 lines elided ↑ open up ↑
  36   38  int option_no_db = 0;
  37   39  int option_enable = 0;
  38   40  int option_disable = 0;
  39   41  int option_debug_related;
  40   42  int option_file_output;
  41   43  int option_time;
  42   44  int option_mem;
  43   45  char *option_datadir_str;
  44   46  int option_fatal_checks;
  45   47  int option_succeed;
       48 +int option_timeout = 60;
  46   49  
  47   50  FILE *sm_outfd;
  48   51  FILE *sql_outfd;
  49   52  FILE *caller_info_fd;
  50   53  
  51   54  int sm_nr_errors;
  52   55  int sm_nr_checks;
  53   56  
  54   57  bool __silence_warnings_for_stmt;
  55   58  
↓ open down ↓ 110 lines elided ↑ open up ↑
 166  169                          *tmp = '-';
 167  170                  tmp++;
 168  171          }
 169  172          if (!strcmp(arg, str))
 170  173                  ret = 1;
 171  174          free(str);
 172  175          return ret;
 173  176  }
 174  177  
 175  178  #define OPTION(_x) do {                                 \
 176      -        if (match_option((*argvp)[1], #_x)) {           \
      179 +        if (match_option((*argvp)[i], #_x)) {           \
 177  180                  option_##_x = 1;                        \
 178  181          }                                               \
 179  182  } while (0)
 180  183  
 181  184  void parse_args(int *argcp, char ***argvp)
 182  185  {
 183  186          int i;
 184  187  
 185  188          for (i = 1 ; i < *argcp; i++) {
 186  189                  if (!strcmp((*argvp)[i], "--help"))
↓ open down ↓ 24 lines elided ↑ open up ↑
 211  214                          enable_disable_checks((*argvp)[i] + 9, 1);
 212  215                          option_enable = 1;
 213  216                  }
 214  217  
 215  218                  if (strncmp((*argvp)[i], "--disable=", 10) == 0) {
 216  219                          enable_disable_checks((*argvp)[i] + 10, 0);
 217  220                          option_enable = 1;
 218  221                          option_disable = 1;
 219  222                  }
 220  223  
      224 +                if (!strncmp((*argvp)[i], "--timeout=", 10)) {
      225 +                        if (sscanf((*argvp)[i] + 10, "%d",
      226 +                            &option_timeout) != 1)
      227 +                                sm_fatal("invalid option %s", (*argvp)[i]);
      228 +                }
      229 +
 221  230                  OPTION(fatal_checks);
 222  231                  OPTION(spammy);
 223  232                  OPTION(info);
 224  233                  OPTION(debug);
 225  234                  OPTION(debug_implied);
 226  235                  OPTION(debug_related);
 227  236                  OPTION(assume_loops);
 228  237                  OPTION(no_data);
 229  238                  OPTION(two_passes);
 230  239                  OPTION(full_path);
↓ open down ↓ 129 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX