diff options
author | John Levon <john.levon@joyent.com> | 2019-07-10 08:36:07 -0700 |
---|---|---|
committer | John Levon <john.levon@joyent.com> | 2019-07-18 01:43:04 -0700 |
commit | 7ae7577ce925f555e5e3410f14a3ccc896c842f2 (patch) | |
tree | 7d09fdc19462084b284850635b1c561227982bad | |
parent | 621caade37fe7b1fa94c61ab3f3ef03c38bbdc2e (diff) | |
download | illumos-joyent-7ae7577ce925f555e5e3410f14a3ccc896c842f2.tar.gz |
11462 enable smatch by default
Reviewed by: Robert Mustacchi <rm@joyent.com>
Approved by: Dan McDonald <danmcd@joyent.com>
-rw-r--r-- | usr/src/Makefile.smatch | 4 | ||||
-rw-r--r-- | usr/src/tools/env/illumos.sh | 4 | ||||
-rw-r--r-- | usr/src/tools/smatch/Makefile | 4 | ||||
-rw-r--r-- | usr/src/tools/smatch/src/smatch.c | 11 | ||||
-rw-r--r-- | usr/src/tools/smatch/src/smatch.h | 3 | ||||
-rw-r--r-- | usr/src/tools/smatch/src/smatch_implied.c | 6 |
6 files changed, 24 insertions, 8 deletions
diff --git a/usr/src/Makefile.smatch b/usr/src/Makefile.smatch index 028bbf9153..27f302cb47 100644 --- a/usr/src/Makefile.smatch +++ b/usr/src/Makefile.smatch @@ -8,7 +8,7 @@ # source. A copy of the CDDL is also available via the Internet at # http://www.illumos.org/license/CDDL. # -# Copyright (c) 2019, Joyent, Inc. +# Copyright 2019 Joyent, Inc. # # @@ -27,6 +27,8 @@ SMATCH_ARGS += -Wno-external-function-has-definition # we have lots of legacy "void foo();" in headers SMATCH_ARGS += -Wno-old-style-definition SMATCH_ARGS += -Wno-strict-prototypes +SMATCH_ARGS += --fatal-checks +SMATCH_ARGS += --timeout=120 CERRWARN += $(SMATCH_ARGS:%=-_smatch=%) diff --git a/usr/src/tools/env/illumos.sh b/usr/src/tools/env/illumos.sh index 41fe338c2c..bfe615a8b9 100644 --- a/usr/src/tools/env/illumos.sh +++ b/usr/src/tools/env/illumos.sh @@ -84,8 +84,8 @@ export PRIMARY_CCCS=gcc7,$GNUC_ROOT/bin/g++,gnu export SHADOW_CCS=gcc4,/opt/gcc/4.4.4/bin/gcc,gnu export SHADOW_CCCS=gcc4,/opt/gcc/4.4.4/bin/g++,gnu -# uncomment to enable smatch -#export ENABLE_SMATCH=1 +# comment to disable smatch +export ENABLE_SMATCH=1 # Comment this out to disable support for SMB printing, i.e. if you # don't want to bother providing the CUPS headers this needs. diff --git a/usr/src/tools/smatch/Makefile b/usr/src/tools/smatch/Makefile index 3fac59a066..075cb12458 100644 --- a/usr/src/tools/smatch/Makefile +++ b/usr/src/tools/smatch/Makefile @@ -13,14 +13,14 @@ # # The src/ sub-directory is un-modified copy of -# https://github.com/illumos/smatch/tree/0.5.1-il-1 +# https://github.com/illumos/smatch/tree/0.5.1-il-3 # # This Makefile installs just enough for us to be able to run smatch # locally. # PROG = smatch -SPARSE_VERSION = 0.5.1-il-1 +SPARSE_VERSION = 0.5.1-il-3 include ../Makefile.tools diff --git a/usr/src/tools/smatch/src/smatch.c b/usr/src/tools/smatch/src/smatch.c index 0675284796..450caeef40 100644 --- a/usr/src/tools/smatch/src/smatch.c +++ b/usr/src/tools/smatch/src/smatch.c @@ -13,6 +13,8 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, see http://www.gnu.org/copyleft/gpl.txt + * + * Copyright 2019 Joyent, Inc. */ #include <stdio.h> @@ -43,6 +45,7 @@ int option_mem; char *option_datadir_str; int option_fatal_checks; int option_succeed; +int option_timeout = 60; FILE *sm_outfd; FILE *sql_outfd; @@ -173,7 +176,7 @@ static int match_option(const char *arg, const char *option) } #define OPTION(_x) do { \ - if (match_option((*argvp)[1], #_x)) { \ + if (match_option((*argvp)[i], #_x)) { \ option_##_x = 1; \ } \ } while (0) @@ -218,6 +221,12 @@ void parse_args(int *argcp, char ***argvp) option_disable = 1; } + if (!strncmp((*argvp)[i], "--timeout=", 10)) { + if (sscanf((*argvp)[i] + 10, "%d", + &option_timeout) != 1) + sm_fatal("invalid option %s", (*argvp)[i]); + } + OPTION(fatal_checks); OPTION(spammy); OPTION(info); diff --git a/usr/src/tools/smatch/src/smatch.h b/usr/src/tools/smatch/src/smatch.h index b276ec125d..285321b039 100644 --- a/usr/src/tools/smatch/src/smatch.h +++ b/usr/src/tools/smatch/src/smatch.h @@ -13,6 +13,8 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, see http://www.gnu.org/copyleft/gpl.txt + * + * Copyright 2019 Joyent, Inc. */ #ifndef SMATCH_H_ @@ -200,6 +202,7 @@ extern int option_debug; extern int local_debug; extern int option_info; extern int option_spammy; +extern int option_timeout; extern char *trace_variable; extern struct stree *global_states; int is_skipped_function(void); diff --git a/usr/src/tools/smatch/src/smatch_implied.c b/usr/src/tools/smatch/src/smatch_implied.c index 441920c17d..ae5ff1dc4c 100644 --- a/usr/src/tools/smatch/src/smatch_implied.c +++ b/usr/src/tools/smatch/src/smatch_implied.c @@ -13,6 +13,8 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, see http://www.gnu.org/copyleft/gpl.txt + * + * Copyright 2019 Joyent, Inc. */ /* @@ -397,7 +399,7 @@ static int taking_too_long(void) if (out_of_memory()) return 1; - if (time_parsing_function() < 60) + if (time_parsing_function() < option_timeout) return 0; if (!__inline_fn && printed != cur_func_sym) { @@ -593,7 +595,7 @@ static void separate_and_filter(struct sm_state *sm, int comparison, struct rang gettimeofday(&time_after, NULL); sec = time_after.tv_sec - time_before.tv_sec; - if (sec > 20) { + if (sec > option_timeout) { sm->nr_children = 4000; sm_perror("Function too hairy. Ignoring implications after %d seconds.", sec); } |