dead code in between #idef USE_ARGV in job.c

11 views
Skip to first unread message

Dominique Pellé

unread,
Dec 9, 2020, 3:23:40 AM12/9/20
to vim_dev
Hi

I noticed that src/job.c has code in between
#ifdef USE_ARGV. However, USE_ARGV is
not defined anywhere. So there is some dead
code reported as not covered by tests in codecov
at job.c:876:

https://codecov.io/gh/vim/vim/src/master/src/job.c#L896

I see that USE_ARGV used to be defined, but
that got removed in the following patch:

===
commit 8b5866ded6036f7adece26b6d16962bbd2d47842 (tag: v8.2.1597)
Author: Bram Moolenaar <Br...@vim.org>
Date: Sat Sep 5 15:48:51 2020 +0200

patch 8.2.1597: the channel source file is too big

Problem: The channel source file is too big.
Solution: Move job related code to a new source file.
===

Prior to that patch, file src/channel.c used to define
USE_ARGV as follows:

#if defined(UNIX)
# define USE_ARGV

Either there was a mistake in patch 8.2.1597 or
we can remove the dead code in between #ifdef USE_ARGV.
The description of patch 8.2.1597 suggests that it
was a refactoring that should not have changed the behavior.

Regards
Dominique

Bram Moolenaar

unread,
Dec 9, 2020, 7:16:48 AM12/9/20
to vim...@googlegroups.com, Dominique Pellé
Well spotted. USE_ARGV is defined, but it's further down. Making the
functions "static" and moving them to before job_start() caused this
problem: Win32 functions are defined on Unix but never used. It worked
because the checks are only "if !defined(USE_ARGV)".

I'll move defining USE_ARGV to the top.

--
There are only two hard things in programming: Cache invalidation,
naming things and off-by-one errors.

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
Reply all
Reply to author
Forward
0 new messages