From 6cd3912a51e2c49d3ec7b9a52ff6f754537dd3ea Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Fri, 18 Jan 2019 02:43:32 +0100 Subject: [PATCH 1/3] clang/"null pointer dereference": expand_wildcards This invariant is explained in aa39fc56f68e. --- src/nvim/path.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/nvim/path.c b/src/nvim/path.c index 03de914e4f..7903e3f4f4 100644 --- a/src/nvim/path.c +++ b/src/nvim/path.c @@ -2039,6 +2039,7 @@ int expand_wildcards(int num_pat, char_u **pat, int *num_files, char_u ***files, char_u *ffname; // check all files in (*files)[] + assert(*num_files == 0 || *files != NULL); for (i = 0; i < *num_files; i++) { ffname = (char_u *)FullName_save((char *)(*files)[i], false); assert((*files)[i] != NULL); @@ -2056,16 +2057,16 @@ int expand_wildcards(int num_pat, char_u **pat, int *num_files, char_u ***files, } } - /* - * Move the names where 'suffixes' match to the end. - */ + // + // Move the names where 'suffixes' match to the end. + // + assert(*num_files == 0 || *files != NULL); if (*num_files > 1) { non_suf_match = 0; for (i = 0; i < *num_files; i++) { if (!match_suffix((*files)[i])) { // - // Move the name without matching suffix to the front - // of the list. + // Move the name without matching suffix to the front of the list. // p = (*files)[i]; for (j = i; j > non_suf_match; j--) { From ce6a5fb94bdc62f00c50ffa1bfaf291da01b4a6e Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Fri, 18 Jan 2019 02:43:38 +0100 Subject: [PATCH 2/3] PVS/V560: expression is always true This macro serves as a sanity-check / documentation. --- src/nvim/regexp.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/nvim/regexp.c b/src/nvim/regexp.c index 0b9e1cfdec..a70b150e9b 100644 --- a/src/nvim/regexp.c +++ b/src/nvim/regexp.c @@ -230,6 +230,7 @@ #define UPPER 47 /* Match uppercase char */ #define NUPPER 48 /* Match non-uppercase char */ #define LAST_NL NUPPER + ADD_NL +// -V:WITH_NL:560 #define WITH_NL(op) ((op) >= FIRST_NL && (op) <= LAST_NL) #define MOPEN 80 // -89 Mark this point in input as start of From e8137d263ee167a148d92ef7368933ee5824c103 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Fri, 18 Jan 2019 02:43:42 +0100 Subject: [PATCH 3/3] pvscheck.sh: ignore stddef.h This system header should be ignored by PVS. See also: https://stackoverflow.com/q/44906903 --- scripts/pvscheck.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/pvscheck.sh b/scripts/pvscheck.sh index 371af7c7e5..e3c6681f7a 100755 --- a/scripts/pvscheck.sh +++ b/scripts/pvscheck.sh @@ -374,7 +374,7 @@ run_analysis() {( --sourcetree-root . || true rm -rf PVS-studio.{xml,err,tsk,html.d} - local plog_args="PVS-studio.log --srcRoot . --excludedCodes V011" + local plog_args="PVS-studio.log --srcRoot . --excludedCodes V011 --exclude-path stddef.h --exclude-path stdarg.h" plog-converter $plog_args --renderTypes xml --output PVS-studio.xml plog-converter $plog_args --renderTypes errorfile --output PVS-studio.err plog-converter $plog_args --renderTypes tasklist --output PVS-studio.tsk