build: remove PVS

We already have an extensive suite of static analysis tools we use,
which causes a fair bit of redundancy as we get duplicate warnings. PVS
is also prone to give false warnings which creates a lot of work to
identify and disable.
This commit is contained in:
dundargoc 2023-11-12 13:13:58 +01:00 committed by dundargoc
parent 2a57613b9b
commit 353a4be7e8
198 changed files with 99 additions and 1222 deletions

View File

@ -8,8 +8,7 @@ If you want to help but don't know where to start, here are some
low-risk/isolated tasks:
- Try a [complexity:low] issue.
- Fix bugs found by [Clang](#clang-scan-build), [PVS](#pvs-studio) or
[Coverity](#coverity).
- Fix bugs found by [Clang](#clang-scan-build) or [Coverity](#coverity).
- [Merge a Vim patch] (requires strong familiarity with Vim)
- NOTE: read the above link before sending improvements to "runtime files" (anything in `runtime/`).
- Vimscript and documentation files are (mostly) maintained by [Vim](https://github.com/vim/vim), not Nvim.
@ -147,21 +146,6 @@ View the [Clang report] to see potential bugs found by the Clang
scan-build --use-analyzer=/usr/bin/clang make
```
### PVS-Studio
View the [PVS report](https://neovim.io/doc/reports/pvs/PVS-studio.html.d/) to
see potential bugs found by [PVS Studio](https://www.viva64.com/en/pvs-studio/).
- Use this format for commit messages (where `{id}` is the PVS warning-id)):
```
fix(PVS/V{id}): {description}
```
- Search the Neovim commit history to find examples:
```bash
git log --oneline --no-merges --grep PVS
```
- Try `./scripts/pvscheck.sh` to run PVS locally.
### Coverity
[Coverity](https://scan.coverity.com/projects/neovim-neovim) runs against the

View File

@ -7,7 +7,6 @@
[![Coverity Scan analysis](https://scan.coverity.com/projects/2227/badge.svg)](https://scan.coverity.com/projects/2227)
[![Clang analysis](https://neovim.io/doc/reports/clang/badge.svg)](https://neovim.io/doc/reports/clang)
[![PVS-Studio analysis](https://neovim.io/doc/reports/pvs/badge.svg)](https://neovim.io/doc/reports/pvs/PVS-studio.html.d)
[![Packages](https://repology.org/badge/tiny-repos/neovim.svg)](https://repology.org/metapackage/neovim)
[![Debian CI](https://badges.debian.net/badges/debian/testing/neovim/version.svg)](https://buildd.debian.org/neovim)
[![Downloads](https://img.shields.io/github/downloads/neovim/neovim/total.svg?maxAge=2592001)](https://github.com/neovim/neovim/releases/)

View File

@ -1,5 +1,3 @@
// This is an open source non-commercial project. Dear PVS-Studio, please check
// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
#include "${PROJECT_SOURCE_DIR}/src/nvim/vim.h"
char *default_vim_dir = "${CMAKE_INSTALL_FULL_DATAROOTDIR}/nvim";
char *default_vimruntime_dir = "";

View File

@ -1,498 +0,0 @@
#!/bin/sh
# Assume that "local" is available.
# shellcheck disable=SC2039
set -e
# Note: -u causes problems with posh, it barks at “undefined” $@ when no
# arguments provided.
test -z "$POSH_VERSION" && set -u
log_info() {
>&2 printf "pvscheck.sh: %s\n" "$@"
}
get_jobs_num() {
if [ -n "${TRAVIS:-}" ] ; then
# HACK: /proc/cpuinfo on Travis CI is misleading, so hardcode 1.
echo 1
else
echo $(( $(grep -c "^processor" /proc/cpuinfo) + 1 ))
fi
}
help() {
echo 'Usage:'
echo ' pvscheck.sh [--pvs URL] [--deps] [--environment-cc]'
echo ' [target-directory [branch]]'
echo ' pvscheck.sh [--pvs URL] [--recheck] [--environment-cc] [--update]'
echo ' [target-directory]'
echo ' pvscheck.sh [--pvs URL] --only-analyse [target-directory]'
echo ' pvscheck.sh [--pvs URL] --pvs-install {target-directory}'
echo ' pvscheck.sh --patch [--only-build]'
echo
echo ' --pvs: Fetch pvs-studio from URL.'
echo
echo ' --pvs detect: Auto-detect latest version (by scraping viva64.com).'
echo
echo ' --deps: (for regular run) Use top-level Makefile and build deps.'
echo ' Without this it assumes all dependencies are already'
echo ' installed.'
echo
echo ' --environment-cc: (for regular run and --recheck) Do not export'
echo ' CC=clang. Build is still run with CFLAGS=-O0.'
echo
echo ' --only-build: (for --patch) Only patch files in ./build directory.'
echo
echo ' --pvs-install: Only install PVS-studio to the specified location.'
echo
echo ' --patch: patch sources in the current directory.'
echo ' Does not patch already patched files.'
echo ' Does not run analysis.'
echo
echo ' --recheck: run analysis on a prepared target directory.'
echo
echo ' --update: when rechecking first do a pull.'
echo
echo ' --only-analyse: run analysis on a prepared target directory '
echo ' without building Neovim.'
echo
echo ' target-directory: Directory where build should occur.'
echo ' Default: ../neovim-pvs'
echo
echo ' branch: Branch to check.'
echo ' Default: master.'
}
getopts_error() {
local msg="$1" ; shift
local do_help=
if test "$msg" = "--help" ; then
msg="$1" ; shift
do_help=1
fi
printf '%s\n' "$msg" >&2
if test -n "$do_help" ; then
printf '\n' >&2
help >&2
fi
echo 'return 1'
return 1
}
# Usage `eval "$(getopts_long long_defs -- positionals_defs -- "$@")"`
#
# long_defs: list of pairs of arguments like `longopt action`.
# positionals_defs: list of arguments like `action`.
#
# `action` is a space-separated commands:
#
# store_const [const] [varname] [default]
# Store constant [const] (default 1) (note: evaled) if argument is present
# (long options only). Assumes long option accepts no arguments.
# store [varname] [default]
# Store value. Assumes long option needs an argument.
# run {func} [varname] [default]
# Run function {func} and store its output to the [varname]. Assumes no
# arguments accepted (long options only).
# modify {func} [varname] [default]
# Like run, but assumes a single argument, passed to function {func} as $1.
#
# All actions stores empty value if neither [varname] nor [default] are
# present. [default] is evaled by top-level `eval`, so be careful. Also note
# that no arguments may contain spaces, including [default] and [const].
getopts_long() {
local positional=
local opt_bases=""
while test $# -gt 0 ; do
local arg="$1" ; shift
local opt_base=
local act=
local opt_name=
if test -z "$positional" ; then
if test "$arg" = "--" ; then
positional=0
continue
fi
act="$1" ; shift
opt_name="$(echo "$arg" | tr '-' '_')"
opt_base="longopt_$opt_name"
else
if test "$arg" = "--" ; then
break
fi
: $(( positional+=1 ))
act="$arg"
opt_name="arg_$positional"
opt_base="positional_$positional"
fi
opt_bases="$opt_bases $opt_base"
eval "local varname_$opt_base=$opt_name"
local i=0
for act_subarg in $act ; do
eval "local act_$(( i+=1 ))_$opt_base=\"\$act_subarg\""
done
done
# Process options
local positional=0
local force_positional=
while test $# -gt 0 ; do
local argument="$1" ; shift
local opt_base=
local has_equal=
local equal_arg=
local is_positional=
if test "$argument" = "--" ; then
force_positional=1
continue
elif test -z "$force_positional" && test "${argument#--}" != "$argument"
then
local opt_name="${argument#--}"
local opt_name_striparg="${opt_name%%=*}"
if test "$opt_name" = "$opt_name_striparg" ; then
has_equal=0
else
has_equal=1
equal_arg="${argument#*=}"
opt_name="$opt_name_striparg"
fi
# Use trailing x to prevent stripping newlines
opt_name="$(printf '%sx' "$opt_name" | tr '-' '_')"
opt_name="${opt_name%x}"
if test -n "$(printf '%sx' "$opt_name" | tr -d 'a-z_')" ; then
getopts_error "Option contains invalid characters: $opt_name"
fi
opt_base="longopt_$opt_name"
else
: $(( positional+=1 ))
opt_base="positional_$positional"
is_positional=1
fi
if test -n "$opt_base" ; then
eval "local occurred_$opt_base=1"
eval "local act_1=\"\${act_1_$opt_base:-}\""
eval "local varname=\"\${varname_$opt_base:-}\""
local need_val=
local func=
case "$act_1" in
(store_const)
eval "local const=\"\${act_2_${opt_base}:-1}\""
eval "local varname=\"\${act_3_${opt_base}:-$varname}\""
printf 'local %s=%s\n' "$varname" "$const"
;;
(store)
eval "varname=\"\${act_2_${opt_base}:-$varname}\""
need_val=1
;;
(run)
eval "func=\"\${act_2_${opt_base}}\""
eval "varname=\"\${act_3_${opt_base}:-$varname}\""
printf 'local %s="$(%s)"\n' "$varname" "$func"
;;
(modify)
eval "func=\"\${act_2_${opt_base}}\""
eval "varname=\"\${act_3_${opt_base}:-$varname}\""
need_val=1
;;
("")
getopts_error --help "Wrong argument: $argument"
;;
esac
if test -n "$need_val" ; then
local val=
if test -z "$is_positional" ; then
if test $has_equal = 1 ; then
val="$equal_arg"
else
if test $# -eq 0 ; then
getopts_error "Missing argument for $opt_name"
fi
val="$1" ; shift
fi
else
val="$argument"
fi
local escaped_val="'$(printf "%s" "$val" | sed "s/'/'\\\\''/g")'"
case "$act_1" in
(store)
printf 'local %s=%s\n' "$varname" "$escaped_val"
;;
(modify)
printf 'local %s="$(%s %s)"\n' "$varname" "$func" "$escaped_val"
;;
esac
fi
fi
done
# Print default values when no values were provided
local opt_base=
for opt_base in $opt_bases ; do
eval "local occurred=\"\${occurred_$opt_base:-}\""
if test -n "$occurred" ; then
continue
fi
eval "local act_1=\"\$act_1_$opt_base\""
eval "local varname=\"\$varname_$opt_base\""
case "$act_1" in
(store)
eval "local varname=\"\${act_2_${opt_base}:-$varname}\""
eval "local default=\"\${act_3_${opt_base}:-}\""
printf 'local %s=%s\n' "$varname" "$default"
;;
(store_const|run|modify)
eval "local varname=\"\${act_3_${opt_base}:-$varname}\""
eval "local default=\"\${act_4_${opt_base}:-}\""
printf 'local %s=%s\n' "$varname" "$default"
;;
esac
done
}
get_pvs_comment() {
local tgt="$1" ; shift
cat > "$tgt/pvs-comment" << EOF
// This is an open source non-commercial project. Dear PVS-Studio, please check
// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
EOF
}
install_pvs() {(
local tgt="$1" ; shift
local pvs_url="$1" ; shift
cd "$tgt"
if test -d pvs-studio ; then
log_info 'install_pvs: "pvs-studio" directory already exists, skipping install'
return 0
fi
mkdir pvs-studio
cd pvs-studio
curl -L -o pvs-studio.tar.gz "$pvs_url"
tar xzf pvs-studio.tar.gz
rm pvs-studio.tar.gz
local pvsdir="$(find . -maxdepth 1 -mindepth 1)"
find "$pvsdir" -maxdepth 1 -mindepth 1 -exec mv '{}' . \;
rmdir "$pvsdir"
)}
create_compile_commands() {(
local tgt="$1" ; shift
local deps="$1" ; shift
local environment_cc="$1" ; shift
if test -z "$environment_cc" ; then
export CC=clang
fi
export CFLAGS=' -O0 '
if test -z "$deps" ; then
mkdir -p "$tgt/build"
(
cd "$tgt/build"
cmake .. -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX="$PWD/root"
make -j"$(get_jobs_num)"
)
else
(
cd "$tgt"
make -j"$(get_jobs_num)" CMAKE_EXTRA_FLAGS=" -DCMAKE_INSTALL_PREFIX=$PWD/root -DCMAKE_BUILD_TYPE=Debug "
)
fi
find "$tgt/build/src/nvim/auto" -name '*.test-include.c' -delete
)}
# Warning: realdir below only cares about directories unlike realpath.
#
# realpath is not available in Ubuntu trusty yet.
realdir() {(
local dir="$1"
local add=""
while ! cd "$dir" 2>/dev/null ; do
add="${dir##*/}/$add"
local new_dir="${dir%/*}"
if test "$new_dir" = "$dir" ; then
return 1
fi
dir="$new_dir"
done
printf '%s\n' "$PWD/$add"
)}
patch_sources() {(
local tgt="$1" ; shift
local only_build="${1}" ; shift
get_pvs_comment "$tgt"
local sh_script='
pvs_comment="$(cat pvs-comment ; echo -n EOS)"
filehead="$(head -c $(( ${#pvs_comment} - 3 )) "$1" ; echo -n EOS)"
if test "x$filehead" != "x$pvs_comment" ; then
cat pvs-comment "$1" > "$1.tmp"
mv "$1.tmp" "$1"
fi
'
cd "$tgt"
if test "$only_build" != "--only-build" ; then
find \
src/nvim test/functional/fixtures test/unit/fixtures \
\( -name '*.c' -a '!' -path '*xdiff*' \) \
-exec /bin/sh -c "$sh_script" - '{}' \;
fi
find \
build/src/nvim/auto build/config \
-name '*.c' -not -name '*.test-include.c' \
-exec /bin/sh -c "$sh_script" - '{}' \;
rm pvs-comment
)}
run_analysis() {(
local tgt="$1" ; shift
cd "$tgt"
if [ ! -r PVS-Studio.lic ]; then
pvs-studio-analyzer credentials -o PVS-Studio.lic 'PVS-Studio Free' 'FREE-FREE-FREE-FREE'
fi
# pvs-studio-analyzer exits with a non-zero exit code when there are detected
# errors, so ignore its return
pvs-studio-analyzer \
analyze \
--lic-file PVS-Studio.lic \
--threads "$(get_jobs_num)" \
--exclude-path src/cjson \
--exclude-path src/klib \
--exclude-path src/mpack \
--exclude-path src/xdiff \
--exclude-path build \
--output-file PVS-studio.log \
--file build/compile_commands.json \
--sourcetree-root . || true
rm -rf PVS-studio.{xml,err,tsk,html.d}
local plog_args="PVS-studio.log --srcRoot . --excludedCodes V002,V011,V601,V1028,V1042,V1051,V1074"
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
plog-converter $plog_args --renderTypes fullhtml --output PVS-studio.html.d
)}
detect_url() {
local url="${1:-detect}"
if test "$url" = detect ; then
curl --silent -L 'https://pvs-studio.com/en/pvs-studio/download-all/' \
| grep -o 'https\{0,1\}://[^"<>]\{1,\}/pvs-studio[^/"<>]*-x86_64\.tgz' \
|| echo FAILED
else
printf '%s' "$url"
fi
}
do_check() {
local tgt="$1" ; shift
local branch="$1" ; shift
local pvs_url="$1" ; shift
local deps="$1" ; shift
local environment_cc="$1" ; shift
if test -z "$pvs_url" || test "$pvs_url" = FAILED ; then
pvs_url="$(detect_url detect)"
if test -z "$pvs_url" || test "$pvs_url" = FAILED ; then
echo "failed to auto-detect PVS URL"
exit 1
fi
echo "Auto-detected PVS URL: ${pvs_url}"
fi
git clone --branch="$branch" . "$tgt"
install_pvs "$tgt" "$pvs_url"
do_recheck "$tgt" "$deps" "$environment_cc" ""
}
do_recheck() {
local tgt="$1" ; shift
local deps="$1" ; shift
local environment_cc="$1" ; shift
local update="$1" ; shift
if test -n "$update" ; then
(
cd "$tgt"
local branch="$(git rev-parse --abbrev-ref HEAD)"
git checkout --detach
git fetch -f origin "${branch}:${branch}"
git checkout -f "$branch"
)
fi
create_compile_commands "$tgt" "$deps" "$environment_cc"
do_analysis "$tgt"
}
do_analysis() {
local tgt="$1" ; shift
if test -d "$tgt/pvs-studio" ; then
local saved_pwd="$PWD"
cd "$tgt/pvs-studio"
export PATH="$PWD/bin${PATH+:}${PATH}"
cd "$saved_pwd"
fi
run_analysis "$tgt"
}
main() {
eval "$(
getopts_long \
help store_const \
pvs 'modify detect_url pvs_url' \
patch store_const \
only-build 'store_const --only-build' \
recheck store_const \
only-analyse store_const \
pvs-install store_const \
deps store_const \
environment-cc store_const \
update store_const \
-- \
'modify realdir tgt "$PWD/../neovim-pvs"' \
'store branch master' \
-- "$@"
)"
if test -n "$help" ; then
help
return 0
fi
if test -n "$patch" ; then
patch_sources "$tgt" "$only_build"
elif test -n "$pvs_install" ; then
install_pvs "$tgt" "$pvs_url"
elif test -n "$recheck" ; then
do_recheck "$tgt" "$deps" "$environment_cc" "$update"
elif test -n "$only_analyse" ; then
do_analysis "$tgt"
else
do_check "$tgt" "$branch" "$pvs_url" "$deps" "$environment_cc"
fi
}
main "$@"

View File

@ -61,9 +61,6 @@ print_bold "[*] Writing $target... "
sorted_terms="$(echo "${!entries[@]}" | tr ' ' '\n' | sort | xargs)"
cat > "$target" <<EOF
// This is an open source non-commercial project. Dear PVS-Studio, please check
// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
// uncrustify:off
//

View File

@ -170,8 +170,6 @@ static inline void *_memcpy_free(void *const restrict dest, void *const restrict
return dest;
}
// -V:kvi_push:512
/// Resize vector with preallocated array
///
/// @note May not resize to an array smaller then init_array: if requested,

View File

@ -1,6 +1,3 @@
// This is an open source non-commercial project. Dear PVS-Studio, please check
// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
#include "conv.h"
static int mpack_fits_single(double v);

View File

@ -1,6 +1,3 @@
// This is an open source non-commercial project. Dear PVS-Studio, please check
// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
/*
* This module exports three classes, and each instance of those classes has its
* own private registry for temporary reference storage(keeping state between
@ -246,7 +243,7 @@ static mpack_uint32_t lmpack_objlen(lua_State *L, int *is_array)
}
end:
if ((size_t)-1 > (mpack_uint32_t)-1 && len > (mpack_uint32_t)-1) // -V560
if ((size_t)-1 > (mpack_uint32_t)-1 && len > (mpack_uint32_t)-1)
/* msgpack spec doesn't allow lengths > 32 bits */
len = (mpack_uint32_t)-1;
assert(top == lua_gettop(L));

View File

@ -1,6 +1,3 @@
// This is an open source non-commercial project. Dear PVS-Studio, please check
// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
#include <string.h>
#include "mpack_core.h"

View File

@ -1,6 +1,3 @@
// This is an open source non-commercial project. Dear PVS-Studio, please check
// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
#include <string.h>
#include "object.h"

View File

@ -1,6 +1,3 @@
// This is an open source non-commercial project. Dear PVS-Studio, please check
// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
#include <string.h>
#include "rpc.h"

View File

@ -1,6 +1,3 @@
// This is an open source non-commercial project. Dear PVS-Studio, please check
// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
#include <assert.h>
#include <stdbool.h>
#include <stdint.h>

View File

@ -1,6 +1,3 @@
// This is an open source non-commercial project. Dear PVS-Studio, please check
// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
// Some of this code was adapted from 'if_py_both.h' from the original
// vim source

View File

@ -1,6 +1,3 @@
// This is an open source non-commercial project. Dear PVS-Studio, please check
// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
#include <inttypes.h>
#include <stdbool.h>
#include <stdio.h>

View File

@ -1,6 +1,3 @@
// This is an open source non-commercial project. Dear PVS-Studio, please check
// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
#include <limits.h>
#include <stdbool.h>
#include <stdint.h>

View File

@ -1,6 +1,3 @@
// This is an open source non-commercial project. Dear PVS-Studio, please check
// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
#include <assert.h>
#include <stdbool.h>
#include <stdint.h>

View File

@ -1,6 +1,3 @@
// This is an open source non-commercial project. Dear PVS-Studio, please check
// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
#include <assert.h>
#include <inttypes.h>
#include <stdbool.h>

View File

@ -1,6 +1,3 @@
// This is an open source non-commercial project. Dear PVS-Studio, please check
// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
#include <assert.h>
#include <stdbool.h>
#include <stddef.h>

View File

@ -1,6 +1,3 @@
// This is an open source non-commercial project. Dear PVS-Studio, please check
// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
#include <stddef.h>
#include "nvim/api/private/defs.h"

View File

@ -1,6 +1,3 @@
// This is an open source non-commercial project. Dear PVS-Studio, please check
// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
#include <assert.h>
#include <inttypes.h>
#include <limits.h>

View File

@ -1,6 +1,3 @@
// This is an open source non-commercial project. Dear PVS-Studio, please check
// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
#include <inttypes.h>
#include <stdio.h>
#include <string.h>

View File

@ -1,6 +1,3 @@
// This is an open source non-commercial project. Dear PVS-Studio, please check
// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
#include <stdbool.h>
#include <stdlib.h>

View File

@ -1,6 +1,3 @@
// This is an open source non-commercial project. Dear PVS-Studio, please check
// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
#include <assert.h>
#include <inttypes.h>
#include <msgpack/pack.h>

View File

@ -1,6 +1,3 @@
// This is an open source non-commercial project. Dear PVS-Studio, please check
// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
#include <assert.h>
#include <inttypes.h>
#include <limits.h>

View File

@ -1,6 +1,3 @@
// This is an open source non-commercial project. Dear PVS-Studio, please check
// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
#include <assert.h>
#include <stdbool.h>
#include <stddef.h>

View File

@ -1,6 +1,3 @@
// This is an open source non-commercial project. Dear PVS-Studio, please check
// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
#include <stdbool.h>
#include <stdlib.h>
#include <string.h>

View File

@ -1,6 +1,3 @@
// This is an open source non-commercial project. Dear PVS-Studio, please check
// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
#include <limits.h>
#include <stdbool.h>
#include <stdint.h>

View File

@ -1,6 +1,3 @@
// This is an open source non-commercial project. Dear PVS-Studio, please check
// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
/// @file arabic.c
///
/// Functions for Arabic language.

View File

@ -1,6 +1,3 @@
// This is an open source non-commercial project. Dear PVS-Studio, please check
// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
// arglist.c: functions for dealing with the argument list
#include <assert.h>

View File

@ -1,6 +1,3 @@
// This is an open source non-commercial project. Dear PVS-Studio, please check
// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
// autocmd.c: Autocommand related functions
#include <assert.h>

View File

@ -1,6 +1,3 @@
// This is an open source non-commercial project. Dear PVS-Studio, please check
// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
#include <assert.h>
#include <stddef.h>
#include <string.h>

View File

@ -1,6 +1,3 @@
// This is an open source non-commercial project. Dear PVS-Studio, please check
// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
//
// buffer.c: functions for dealing with the buffer structure
//
@ -1020,7 +1017,7 @@ void handle_swap_exists(bufref_T *old_curbuf)
// new aborting error, interrupt, or uncaught exception.
leave_cleanup(&cs);
}
swap_exists_action = SEA_NONE; // -V519
swap_exists_action = SEA_NONE;
}
/// do_bufdel() - delete or unload buffer(s)

View File

@ -1,6 +1,3 @@
// This is an open source non-commercial project. Dear PVS-Studio, please check
// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
#include <inttypes.h>
#include <stdbool.h>
#include <stddef.h>

View File

@ -1,6 +1,3 @@
// This is an open source non-commercial project. Dear PVS-Studio, please check
// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
// bufwrite.c: functions for writing a buffer
#include <fcntl.h>

View File

@ -1,6 +1,3 @@
// This is an open source non-commercial project. Dear PVS-Studio, please check
// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
/// change.c: functions related to changing text
#include <assert.h>

View File

@ -1,6 +1,3 @@
// This is an open source non-commercial project. Dear PVS-Studio, please check
// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
#include <assert.h>
#include <inttypes.h>
#include <stddef.h>

View File

@ -1,6 +1,3 @@
// This is an open source non-commercial project. Dear PVS-Studio, please check
// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
/// @file charset.c
///
/// Code related to character sets.
@ -1328,7 +1325,6 @@ void vim_str2nr(const char *const start, int *const prep, int *const len, const
// Do the conversion manually to avoid sscanf() quirks.
abort(); // Shouldve used goto earlier.
// -V:PARSE_NUMBER:560
#define PARSE_NUMBER(base, cond, conv) \
do { \
const char *const after_prefix = ptr; \

View File

@ -1,6 +1,3 @@
// This is an open source non-commercial project. Dear PVS-Studio, please check
// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
// cmdexpand.c: functions for command-line completion
#include <assert.h>

View File

@ -1,6 +1,3 @@
// This is an open source non-commercial project. Dear PVS-Studio, please check
// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
// cmdhist.c: Functions for the history of the command-line.
#include <assert.h>

View File

@ -1,6 +1,3 @@
// This is an open source non-commercial project. Dear PVS-Studio, please check
// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
// Context: snapshot of the entire editor state as one big object/map
#include <assert.h>

View File

@ -1,6 +1,3 @@
// This is an open source non-commercial project. Dear PVS-Studio, please check
// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
#include <assert.h>
#include <inttypes.h>
#include <stdbool.h>

View File

@ -1,6 +1,3 @@
// This is an open source non-commercial project. Dear PVS-Studio, please check
// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
#include <stdbool.h>
#include <stdint.h>
#include <string.h>

View File

@ -1,6 +1,3 @@
// This is an open source non-commercial project. Dear PVS-Studio, please check
// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
/// @file debugger.c
///
/// Vim script debugger functions

View File

@ -1,6 +1,3 @@
// This is an open source non-commercial project. Dear PVS-Studio, please check
// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
#include <assert.h>
#include <limits.h>

View File

@ -1,6 +1,3 @@
// This is an open source non-commercial project. Dear PVS-Studio, please check
// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
#include <assert.h>
#include <string.h>

View File

@ -1,6 +1,3 @@
// This is an open source non-commercial project. Dear PVS-Studio, please check
// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
/// @file diff.c
///
/// Code for diff'ing two, three or four buffers.
@ -1579,10 +1576,10 @@ static bool extract_hunk(FILE *fd, diffhunk_T *hunk, diffstyle_T *diffstyle)
*diffstyle = DIFF_ED;
} else if ((strncmp(line, "@@ ", 3) == 0)) {
*diffstyle = DIFF_UNIFIED;
} else if ((strncmp(line, "--- ", 4) == 0) // -V501
&& (vim_fgets(line, LBUFLEN, fd) == 0) // -V501
} else if ((strncmp(line, "--- ", 4) == 0)
&& (vim_fgets(line, LBUFLEN, fd) == 0)
&& (strncmp(line, "+++ ", 4) == 0)
&& (vim_fgets(line, LBUFLEN, fd) == 0) // -V501
&& (vim_fgets(line, LBUFLEN, fd) == 0)
&& (strncmp(line, "@@ ", 3) == 0)) {
*diffstyle = DIFF_UNIFIED;
} else {

View File

@ -1,6 +1,3 @@
// This is an open source non-commercial project. Dear PVS-Studio, please check
// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
/// @file digraph.c
///
/// code for digraphs
@ -1624,7 +1621,7 @@ int digraph_get(int char1, int char2, bool meta_char)
if (((retval = getexactdigraph(char1, char2, meta_char)) == char2)
&& (char1 != char2)
&& ((retval = getexactdigraph(char2, char1, meta_char)) // -V764
&& ((retval = getexactdigraph(char2, char1, meta_char))
== char1)) {
return char2;
}

View File

@ -1,6 +1,3 @@
// This is an open source non-commercial project. Dear PVS-Studio, please check
// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
// drawline.c: Functions for drawing window lines on the screen.
// This is the middle level, drawscreen.c is the top and grid.c the lower level.
@ -1439,7 +1436,7 @@ int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, bool number_onl
} else {
// Long line, use only the last SPWORDLEN bytes.
nextlinecol = (int)v - SPWORDLEN;
memmove(nextline, line + nextlinecol, SPWORDLEN); // -V1086
memmove(nextline, line + nextlinecol, SPWORDLEN);
nextline_idx = SPWORDLEN + 1;
}
}
@ -2146,7 +2143,7 @@ int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, bool number_onl
decor_attr = get_syntax_attr((colnr_T)v - 1,
spv->spv_has_spell ? &can_spell : NULL, false);
if (did_emsg) { // -V547
if (did_emsg) {
wp->w_s->b_syn_error = true;
has_syntax = false;
} else {

View File

@ -1,6 +1,3 @@
// This is an open source non-commercial project. Dear PVS-Studio, please check
// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
// drawscreen.c: Code for updating all the windows on the screen.
// This is the top level, drawline.c is the middle and grid.c/screen.c the lower level.

View File

@ -1,6 +1,3 @@
// This is an open source non-commercial project. Dear PVS-Studio, please check
// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
// edit.c: functions for Insert mode
#include <assert.h>

View File

@ -1,6 +1,3 @@
// This is an open source non-commercial project. Dear PVS-Studio, please check
// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
// eval.c: Expression evaluation.
#include <assert.h>

View File

@ -1,6 +1,3 @@
// This is an open source non-commercial project. Dear PVS-Studio, please check
// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
// eval/buffer.c: Buffer related builtin functions
#include <stdbool.h>

View File

@ -1,6 +1,3 @@
// This is an open source non-commercial project. Dear PVS-Studio, please check
// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
#include <assert.h>
#include <msgpack/object.h>
#include <stdbool.h>
@ -964,7 +961,7 @@ int msgpack_to_vim(const msgpack_object mobj, typval_T *const rettv)
}
break;
case MSGPACK_OBJECT_NEGATIVE_INTEGER:
if (mobj.via.i64 >= VARNUMBER_MIN) { // -V547
if (mobj.via.i64 >= VARNUMBER_MIN) {
*rettv = (typval_T) {
.v_type = VAR_NUMBER,
.v_lock = VAR_UNLOCKED,

View File

@ -1,6 +1,3 @@
// This is an open source non-commercial project. Dear PVS-Studio, please check
// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
/// @file encode.c
///
/// File containing functions for encoding and decoding Vimscript values.

View File

@ -1,6 +1,3 @@
// This is an open source non-commercial project. Dear PVS-Studio, please check
// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
#include <inttypes.h>
#include <stdlib.h>

View File

@ -1,6 +1,3 @@
// This is an open source non-commercial project. Dear PVS-Studio, please check
// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
#include <assert.h>
#include <fcntl.h>
#include <float.h>
@ -4810,7 +4807,7 @@ static void f_min(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
/// "mkdir()" function
static void f_mkdir(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
{
int prot = 0755; // -V536
int prot = 0755;
rettv->vval.v_number = FAIL;
if (check_secure()) {
@ -5732,9 +5729,9 @@ static void read_file_or_blob(typval_T *argvars, typval_T *rettv, bool always_bl
// have to shuffle buf to close gap
int adjust_prevlen = 0;
if (dest < buf) { // -V782
if (dest < buf) {
// adjust_prevlen must be 1 or 2.
adjust_prevlen = (int)(buf - dest); // -V782
adjust_prevlen = (int)(buf - dest);
dest = buf;
}
if (readlen > p - buf + 1) {

View File

@ -1,6 +1,3 @@
// This is an open source non-commercial project. Dear PVS-Studio, please check
// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
#include <stddef.h>
#include "nvim/eval/gc.h"

View File

@ -1,6 +1,3 @@
// This is an open source non-commercial project. Dear PVS-Studio, please check
// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
#include <assert.h>
#include <stdbool.h>
#include <stddef.h>
@ -4422,7 +4419,7 @@ const char *tv_get_string_buf_chk(const typval_T *const tv, char *const buf)
{
switch (tv->v_type) {
case VAR_NUMBER:
snprintf(buf, NUMBUFLEN, "%" PRIdVARNUMBER, tv->vval.v_number); // -V576
snprintf(buf, NUMBUFLEN, "%" PRIdVARNUMBER, tv->vval.v_number);
return buf;
case VAR_FLOAT:
vim_snprintf(buf, NUMBUFLEN, "%g", tv->vval.v_float);

View File

@ -252,8 +252,6 @@
#include "nvim/func_attr.h"
#include "klib/kvec.h"
// -V::1063
/// Dummy variable used because some macros need lvalue
///
/// Must not be written to, if needed one must check that address of the
@ -347,8 +345,8 @@ static int _TYPVAL_ENCODE_CONVERT_ONE_VALUE(
case VAR_PARTIAL: {
partial_T *const pt = tv->vval.v_partial;
(void)pt;
TYPVAL_ENCODE_CONV_FUNC_START(tv, (pt == NULL ? NULL : partial_name(pt))); // -V547
_mp_push(*mpstack, ((MPConvStackVal) { // -V779
TYPVAL_ENCODE_CONV_FUNC_START(tv, (pt == NULL ? NULL : partial_name(pt)));
_mp_push(*mpstack, ((MPConvStackVal) {
.type = kMPConvPartial,
.tv = tv,
.saved_copyID = copyID - 1,
@ -396,7 +394,7 @@ static int _TYPVAL_ENCODE_CONVERT_ONE_VALUE(
case VAR_SPECIAL:
switch (tv->vval.v_special) {
case kSpecialVarNull:
TYPVAL_ENCODE_CONV_NIL(tv); // -V1037
TYPVAL_ENCODE_CONV_NIL(tv);
break;
}
break;
@ -509,7 +507,7 @@ static int _TYPVAL_ENCODE_CONVERT_ONE_VALUE(
}
if (is_string) {
TYPVAL_ENCODE_CONV_STR_STRING(tv, buf, len);
} else { // -V523
} else {
TYPVAL_ENCODE_CONV_STRING(tv, buf, len);
}
xfree(buf);
@ -544,8 +542,7 @@ static int _TYPVAL_ENCODE_CONVERT_ONE_VALUE(
}
list_T *const val_list = val_di->di_tv.vval.v_list;
if (val_list == NULL || tv_list_len(val_list) == 0) {
TYPVAL_ENCODE_CONV_EMPTY_DICT( // -V501
tv, TYPVAL_ENCODE_NODICT_VAR);
TYPVAL_ENCODE_CONV_EMPTY_DICT(tv, TYPVAL_ENCODE_NODICT_VAR);
break;
}
TV_LIST_ITER_CONST(val_list, li, {
@ -632,7 +629,7 @@ _convert_one_value_regular_dict: {}
typval_encode_stop_converting_one_item:
return OK;
// Prevent “unused label” warnings.
goto typval_encode_stop_converting_one_item; // -V779
goto typval_encode_stop_converting_one_item;
}
TYPVAL_ENCODE_SCOPE int _TYPVAL_ENCODE_ENCODE(
@ -835,5 +832,5 @@ encode_vim_to__error_ret:
_mp_destroy(mpstack);
return FAIL;
// Prevent “unused label” warnings.
goto typval_encode_stop_converting_one_item; // -V779
goto typval_encode_stop_converting_one_item;
}

View File

@ -1,6 +1,3 @@
// This is an open source non-commercial project. Dear PVS-Studio, please check
// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
// User defined function support
#include <assert.h>
@ -1214,7 +1211,7 @@ void call_user_func(ufunc_T *fp, int argcount, typval_T *argvars, typval_T *rett
if (func_or_func_caller_profiling) {
call_start = profile_end(call_start);
call_start = profile_sub_wait(wait_start, call_start); // -V614
call_start = profile_sub_wait(wait_start, call_start);
fp->uf_tm_total = profile_add(fp->uf_tm_total, call_start);
fp->uf_tm_self = profile_self(fp->uf_tm_self, call_start,
fp->uf_tm_children);
@ -1400,7 +1397,7 @@ void free_all_functions(void)
// Clean up the current_funccal chain and the funccal stack.
while (current_funccal != NULL) {
tv_clear(current_funccal->fc_rettv);
cleanup_function_call(current_funccal); // -V595
cleanup_function_call(current_funccal);
if (current_funccal == NULL && funccal_stack != NULL) {
restore_funccal();
}

View File

@ -1,6 +1,3 @@
// This is an open source non-commercial project. Dear PVS-Studio, please check
// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
// eval/vars.c: functions for dealing with variables
#include <assert.h>

View File

@ -1,6 +1,3 @@
// This is an open source non-commercial project. Dear PVS-Studio, please check
// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
// eval/window.c: Window related builtin functions
#include <stdbool.h>

View File

@ -1,6 +1,3 @@
// This is an open source non-commercial project. Dear PVS-Studio, please check
// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
#include <assert.h>
#include <stdint.h>
#include <uv.h>
@ -68,8 +65,7 @@ int libuv_process_spawn(LibuvProcess *uvproc)
#ifdef MSWIN
uvproc->uvstdio[0].flags |= proc->overlapped ? UV_OVERLAPPED_PIPE : 0;
#endif
uvproc->uvstdio[0].data.stream = STRUCT_CAST(uv_stream_t,
&proc->in.uv.pipe);
uvproc->uvstdio[0].data.stream = (uv_stream_t *)(&proc->in.uv.pipe);
}
if (!proc->out.closed) {
@ -79,14 +75,12 @@ int libuv_process_spawn(LibuvProcess *uvproc)
uvproc->uvstdio[1].flags |= proc->overlapped ?
(UV_READABLE_PIPE | UV_OVERLAPPED_PIPE) : 0;
#endif
uvproc->uvstdio[1].data.stream = STRUCT_CAST(uv_stream_t,
&proc->out.uv.pipe);
uvproc->uvstdio[1].data.stream = (uv_stream_t *)(&proc->out.uv.pipe);
}
if (!proc->err.closed) {
uvproc->uvstdio[2].flags = UV_CREATE_PIPE | UV_WRITABLE_PIPE;
uvproc->uvstdio[2].data.stream = STRUCT_CAST(uv_stream_t,
&proc->err.uv.pipe);
uvproc->uvstdio[2].data.stream = (uv_stream_t *)(&proc->err.uv.pipe);
} else if (proc->fwd_err) {
uvproc->uvstdio[2].flags = UV_INHERIT_FD;
uvproc->uvstdio[2].data.fd = STDERR_FILENO;

View File

@ -1,6 +1,3 @@
// This is an open source non-commercial project. Dear PVS-Studio, please check
// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
@ -61,9 +58,9 @@ bool loop_uv_run(Loop *loop, int64_t ms, bool once)
mode = UV_RUN_NOWAIT;
}
do { // -V1044
do {
uv_run(&loop->uv, mode);
} while (ms > 0 && !once && !*timeout_expired); // -V560
} while (ms > 0 && !once && !*timeout_expired);
if (ms > 0) {
uv_timer_stop(&loop->poll_timer);
@ -163,7 +160,7 @@ bool loop_close(Loop *loop, bool wait)
while (true) {
// Run the loop to tickle close-callbacks (which should then free memory).
// Use UV_RUN_NOWAIT to avoid a hang. #11820
uv_run(&loop->uv, didstop ? UV_RUN_DEFAULT : UV_RUN_NOWAIT); // -V547
uv_run(&loop->uv, didstop ? UV_RUN_DEFAULT : UV_RUN_NOWAIT);
if ((uv_loop_close(&loop->uv) != UV_EBUSY) || !wait) {
break;
}

View File

@ -53,8 +53,6 @@ typedef struct loop {
} \
} while (0)
// -V:LOOP_PROCESS_EVENTS_UNTIL:547
// Poll for events until a condition or timeout
#define LOOP_PROCESS_EVENTS_UNTIL(loop, multiqueue, timeout, condition) \
do { \

View File

@ -1,6 +1,3 @@
// This is an open source non-commercial project. Dear PVS-Studio, please check
// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
// Multi-level queue for selective async event processing.
// Not threadsafe; access must be synchronized externally.
//

View File

@ -1,6 +1,3 @@
// This is an open source non-commercial project. Dear PVS-Studio, please check
// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
#include <assert.h>
#include <inttypes.h>
#include <signal.h>
@ -102,24 +99,21 @@ int process_spawn(Process *proc, bool in, bool out, bool err)
}
if (in) {
stream_init(NULL, &proc->in, -1,
STRUCT_CAST(uv_stream_t, &proc->in.uv.pipe));
stream_init(NULL, &proc->in, -1, (uv_stream_t *)&proc->in.uv.pipe);
proc->in.internal_data = proc;
proc->in.internal_close_cb = on_process_stream_close;
proc->refcount++;
}
if (out) {
stream_init(NULL, &proc->out, -1,
STRUCT_CAST(uv_stream_t, &proc->out.uv.pipe));
stream_init(NULL, &proc->out, -1, (uv_stream_t *)&proc->out.uv.pipe);
proc->out.internal_data = proc;
proc->out.internal_close_cb = on_process_stream_close;
proc->refcount++;
}
if (err) {
stream_init(NULL, &proc->err, -1,
STRUCT_CAST(uv_stream_t, &proc->err.uv.pipe));
stream_init(NULL, &proc->err, -1, (uv_stream_t *)&proc->err.uv.pipe);
proc->err.internal_data = proc;
proc->err.internal_close_cb = on_process_stream_close;
proc->refcount++;
@ -376,7 +370,7 @@ static void flush_stream(Process *proc, Stream *stream)
}
// Stream can be closed if it is empty.
if (num_bytes == stream->num_bytes) { // -V547
if (num_bytes == stream->num_bytes) {
if (stream->read_cb && !stream->did_eof) {
// Stream callback could miss EOF handling if a child keeps the stream
// open. But only send EOF if we haven't already.

View File

@ -1,6 +1,3 @@
// This is an open source non-commercial project. Dear PVS-Studio, please check
// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
#include <assert.h>
#include <stdbool.h>
#include <stddef.h>

View File

@ -1,6 +1,3 @@
// This is an open source non-commercial project. Dear PVS-Studio, please check
// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
#include <stddef.h>
#include <uv.h>

View File

@ -1,6 +1,3 @@
// This is an open source non-commercial project. Dear PVS-Studio, please check
// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
#include <assert.h>
#include <inttypes.h>
#include <stdbool.h>
@ -64,10 +61,10 @@ int socket_watcher_init(Loop *loop, SocketWatcher *watcher, const char *endpoint
uv_tcp_init(&loop->uv, &watcher->uv.tcp.handle);
uv_tcp_nodelay(&watcher->uv.tcp.handle, true);
watcher->stream = STRUCT_CAST(uv_stream_t, &watcher->uv.tcp.handle);
watcher->stream = (uv_stream_t *)(&watcher->uv.tcp.handle);
} else {
uv_pipe_init(&loop->uv, &watcher->uv.pipe.handle, 0);
watcher->stream = STRUCT_CAST(uv_stream_t, &watcher->uv.pipe.handle);
watcher->stream = (uv_stream_t *)(&watcher->uv.pipe.handle);
}
watcher->stream->data = watcher;
@ -102,9 +99,8 @@ int socket_watcher_start(SocketWatcher *watcher, int backlog, socket_cb cb)
// contain 0 in this case, unless uv_tcp_getsockname() is used first.
uv_tcp_getsockname(&watcher->uv.tcp.handle, (struct sockaddr *)&sas,
&(int){ sizeof(sas) });
uint16_t port = (uint16_t)((sas.ss_family == AF_INET)
? (STRUCT_CAST(struct sockaddr_in, &sas))->sin_port
: (STRUCT_CAST(struct sockaddr_in6, &sas))->sin6_port);
uint16_t port = (sas.ss_family == AF_INET) ? ((struct sockaddr_in *)(&sas))->sin_port
: ((struct sockaddr_in6 *)(&sas))->sin6_port;
// v:servername uses the string from watcher->addr
size_t len = strlen(watcher->addr);
snprintf(watcher->addr + len, sizeof(watcher->addr) - len, ":%" PRIu16,
@ -142,11 +138,11 @@ int socket_watcher_accept(SocketWatcher *watcher, Stream *stream)
uv_stream_t *client;
if (watcher->stream->type == UV_TCP) {
client = STRUCT_CAST(uv_stream_t, &stream->uv.tcp);
client = (uv_stream_t *)(&stream->uv.tcp);
uv_tcp_init(watcher->uv.tcp.handle.loop, (uv_tcp_t *)client);
uv_tcp_nodelay((uv_tcp_t *)client, true);
} else {
client = STRUCT_CAST(uv_stream_t, &stream->uv.pipe);
client = (uv_stream_t *)&stream->uv.pipe;
uv_pipe_init(watcher->uv.pipe.handle.loop, (uv_pipe_t *)client, 0);
}
@ -165,7 +161,7 @@ void socket_watcher_close(SocketWatcher *watcher, socket_close_cb cb)
FUNC_ATTR_NONNULL_ARG(1)
{
watcher->close_cb = cb;
uv_close(STRUCT_CAST(uv_handle_t, watcher->stream), close_cb);
uv_close((uv_handle_t *)watcher->stream, close_cb);
}
static void connection_event(void **argv)
@ -242,11 +238,11 @@ tcp_retry:
uv_pipe_t *pipe = &stream->uv.pipe;
uv_pipe_init(&loop->uv, pipe, 0);
uv_pipe_connect(&req, pipe, address, connect_cb);
uv_stream = STRUCT_CAST(uv_stream_t, pipe);
uv_stream = (uv_stream_t *)pipe;
}
status = 1;
LOOP_PROCESS_EVENTS_UNTIL(&main_loop, NULL, timeout, status != 1);
if (status == 0) { // -V547
if (status == 0) {
stream_init(NULL, stream, -1, uv_stream);
success = true;
} else if (is_tcp && addrinfo->ai_next) {

View File

@ -1,6 +1,3 @@
// This is an open source non-commercial project. Dear PVS-Studio, please check
// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
#include <assert.h>
#include <stdbool.h>
#include <stddef.h>
@ -37,9 +34,8 @@ int stream_set_blocking(int fd, bool blocking)
uv_loop_init(&loop);
uv_pipe_init(&loop, &stream, 0);
uv_pipe_open(&stream, fd);
int retval = uv_stream_set_blocking(STRUCT_CAST(uv_stream_t, &stream),
blocking);
uv_close(STRUCT_CAST(uv_handle_t, &stream), NULL);
int retval = uv_stream_set_blocking((uv_stream_t *)&stream, blocking);
uv_close((uv_handle_t *)&stream, NULL);
uv_run(&loop, UV_RUN_NOWAIT); // not necessary, but couldn't hurt.
uv_loop_close(&loop);
return retval;
@ -71,12 +67,12 @@ void stream_init(Loop *loop, Stream *stream, int fd, uv_stream_t *uvstream)
dwMode |= ENABLE_VIRTUAL_TERMINAL_INPUT;
SetConsoleMode(stream->uv.tty.handle, dwMode);
}
stream->uvstream = STRUCT_CAST(uv_stream_t, &stream->uv.tty);
stream->uvstream = (uv_stream_t *)&stream->uv.tty;
} else {
#endif
uv_pipe_init(&loop->uv, &stream->uv.pipe, 0);
uv_pipe_open(&stream->uv.pipe, fd);
stream->uvstream = STRUCT_CAST(uv_stream_t, &stream->uv.pipe);
stream->uvstream = (uv_stream_t *)&stream->uv.pipe;
#ifdef MSWIN
}
#endif

View File

@ -1,6 +1,3 @@
// This is an open source non-commercial project. Dear PVS-Studio, please check
// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
#include <stdint.h>
#include <uv.h>

View File

@ -1,6 +1,3 @@
// This is an open source non-commercial project. Dear PVS-Studio, please check
// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
#include <assert.h>
#include <stdbool.h>
#include <uv.h>

View File

@ -1,6 +1,3 @@
// This is an open source non-commercial project. Dear PVS-Studio, please check
// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
// ex_cmds.c: some functions for command line commands
#include <assert.h>

View File

@ -1,6 +1,3 @@
// This is an open source non-commercial project. Dear PVS-Studio, please check
// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
/// @file ex_cmds2.c
///
/// Some more functions for command line commands

View File

@ -1,6 +1,3 @@
// This is an open source non-commercial project. Dear PVS-Studio, please check
// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
// ex_docmd.c: functions for executing an Ex command line.
#include <assert.h>
@ -1127,7 +1124,7 @@ static void get_wincmd_addr_type(const char *arg, exarg_T *eap)
case 'd':
case Ctrl_D:
// window size or any count
eap->addr_type = ADDR_OTHER; // -V1037
eap->addr_type = ADDR_OTHER;
break;
case Ctrl_HAT:

View File

@ -1,6 +1,3 @@
// This is an open source non-commercial project. Dear PVS-Studio, please check
// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
/// @file ex_eval.c
///
/// Functions for Ex command line for the +eval feature.

View File

@ -1,6 +1,3 @@
// This is an open source non-commercial project. Dear PVS-Studio, please check
// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
// ex_getln.c: Functions for entering and editing an Ex command line.
#include <assert.h>
@ -609,7 +606,7 @@ static void finish_incsearch_highlighting(int gotesc, incsearch_state_T *s, bool
curwin->w_cursor = s->save_cursor;
setpcmark();
}
curwin->w_cursor = s->search_start; // -V519
curwin->w_cursor = s->search_start;
}
restore_viewstate(curwin, &s->old_viewstate);
highlight_match = false;
@ -3386,7 +3383,7 @@ void ui_ext_cmdline_block_append(size_t indent, const char *line)
{
char *buf = xmallocz(indent + strlen(line));
memset(buf, ' ', indent);
memcpy(buf + indent, line, strlen(line)); // -V575
memcpy(buf + indent, line, strlen(line));
Array item = ARRAY_DICT_INIT;
ADD(item, INTEGER_OBJ(0));

View File

@ -1,6 +1,3 @@
// This is an open source non-commercial project. Dear PVS-Studio, please check
// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
// Functions for creating a session file, i.e. implementing:
// :mkexrc
// :mkvimrc

View File

@ -1,6 +1,3 @@
// This is an open source non-commercial project. Dear PVS-Studio, please check
// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
// Implements extended marks for plugins. Marks sit in a MarkTree
// datastructure which provides both efficient mark insertations/lookups
// and adjustment to text changes. See marktree.c for more details.

View File

@ -1,6 +1,3 @@
// This is an open source non-commercial project. Dear PVS-Studio, please check
// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
// File searching functions for 'path', 'tags' and 'cdpath' options.
//
// External visible functions:
@ -1547,7 +1544,7 @@ void do_autocmd_dirchanged(char *new_dir, CdScope scope, CdCause cause, bool pre
} else {
tv_dict_add_str(dict, S_LEN("cwd"), new_dir);
}
tv_dict_add_str(dict, S_LEN("scope"), buf); // -V614
tv_dict_add_str(dict, S_LEN("scope"), buf);
tv_dict_add_bool(dict, S_LEN("changed_window"), cause == kCdCauseWindow);
tv_dict_set_keys_readonly(dict);

View File

@ -1,6 +1,3 @@
// This is an open source non-commercial project. Dear PVS-Studio, please check
// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
// fileio.c: read from and write to a file
#include <assert.h>
@ -935,7 +932,7 @@ retry:
if (conv_restlen > 0) {
// Insert unconverted bytes from previous line.
memmove(ptr, conv_rest, (size_t)conv_restlen); // -V614
memmove(ptr, conv_rest, (size_t)conv_restlen);
ptr += conv_restlen;
size -= conv_restlen;
}

View File

@ -1,6 +1,3 @@
// This is an open source non-commercial project. Dear PVS-Studio, please check
// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
// vim: set fdm=marker fdl=1 fdc=3
// fold.c: code for folding
@ -2741,7 +2738,6 @@ static void truncate_fold(win_T *const wp, fold_T *fp, linenr_T end)
}
#define FOLD_END(fp) ((fp)->fd_top + (fp)->fd_len - 1)
// -V:VALID_FOLD:V560
#define VALID_FOLD(fp, gap) \
((gap)->ga_len > 0 && (fp) < ((fold_T *)(gap)->ga_data + (gap)->ga_len))
#define FOLD_INDEX(fp, gap) ((size_t)((fp) - ((fold_T *)(gap)->ga_data)))

View File

@ -1,6 +1,3 @@
// This is an open source non-commercial project. Dear PVS-Studio, please check
// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
/// @file garray.c
///
/// Functions for handling growing arrays.

View File

@ -550,8 +550,6 @@ end
output = io.open(lua_c_bindings_outputf, 'wb')
output:write([[
// This is an open source non-commercial project. Dear PVS-Studio, please check
// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
#include <lua.h>
#include <lualib.h>
#include <lauxlib.h>

View File

@ -1,6 +1,3 @@
// This is an open source non-commercial project. Dear PVS-Studio, please check
// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
// getchar.c: Code related to getting a character from the user or a script
// file, manipulations with redo buffer and stuff buffer.

View File

@ -426,7 +426,6 @@ EXTERN win_T *prevwin INIT( = NULL); // previous window
FOR_ALL_TABS(tp) \
FOR_ALL_WINDOWS_IN_TAB(wp, tp)
// -V:FOR_ALL_WINDOWS_IN_TAB:501
#define FOR_ALL_WINDOWS_IN_TAB(wp, tp) \
for (win_T *wp = ((tp) == curtab) \
? firstwin : (tp)->tp_firstwin; wp != NULL; wp = wp->w_next)

View File

@ -1,6 +1,3 @@
// This is an open source non-commercial project. Dear PVS-Studio, please check
// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
// Most of the routines in this file perform screen (grid) manipulations. The
// given operation is performed physically on the screen. The corresponding
// change is also made to the internal screen image. In this way, the editor

View File

@ -1,6 +1,3 @@
// This is an open source non-commercial project. Dear PVS-Studio, please check
// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
/// @file hashtab.c
///
/// Handling of a hashtable with Vim-specific properties.

View File

@ -1,6 +1,3 @@
// This is an open source non-commercial project. Dear PVS-Studio, please check
// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
// help.c: functions for Vim help
#include <stdbool.h>

View File

@ -1,6 +1,3 @@
// This is an open source non-commercial project. Dear PVS-Studio, please check
// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
// highlight.c: low level code for UI and syntax highlighting
#include <assert.h>
@ -349,7 +346,7 @@ void update_window_hl(win_T *wp, bool invalid)
wp->w_ns_hl_active = ns_id;
wp->w_ns_hl_attr = *(NSHlAttr *)pmap_get(int)(&ns_hl_attr, ns_id);
if (!wp->w_ns_hl_attr) { // -V547
if (!wp->w_ns_hl_attr) {
// No specific highlights, use the defaults.
wp->w_ns_hl_attr = highlight_attr;
}

View File

@ -1,6 +1,3 @@
// This is an open source non-commercial project. Dear PVS-Studio, please check
// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
// highlight_group.c: code for managing highlight groups
#include <ctype.h>

View File

@ -1,6 +1,3 @@
// This is an open source non-commercial project. Dear PVS-Studio, please check
// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
#include <assert.h>
#include <limits.h>
#include <stdbool.h>

View File

@ -1,6 +1,3 @@
// This is an open source non-commercial project. Dear PVS-Studio, please check
// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
#include <inttypes.h>
#include <stdbool.h>
#include <stddef.h>

View File

@ -1,6 +1,3 @@
// This is an open source non-commercial project. Dear PVS-Studio, please check
// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
// input.c: high level functions for prompting the user or input
// like yes/no or number prompts.

View File

@ -1,6 +1,3 @@
// This is an open source non-commercial project. Dear PVS-Studio, please check
// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
// insexpand.c: functions for Insert mode completion
#include <assert.h>

View File

@ -1,6 +1,3 @@
// This is an open source non-commercial project. Dear PVS-Studio, please check
// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
#include <assert.h>
#include <inttypes.h>
#include <limits.h>

View File

@ -1,6 +1,3 @@
// This is an open source non-commercial project. Dear PVS-Studio, please check
// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
#include <assert.h>
#include <math.h>
#include <stdbool.h>

View File

@ -1,6 +1,3 @@
// This is an open source non-commercial project. Dear PVS-Studio, please check
// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
//
// Log module
//

View File

@ -1,6 +1,3 @@
// This is an open source non-commercial project. Dear PVS-Studio, please check
// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
#include <assert.h>
#include <lauxlib.h>
#include <lua.h>

Some files were not shown because too many files have changed in this diff Show More