Compare commits

...

6 Commits

Author SHA1 Message Date
Bram Moolenaar
0c094b9d7f updated for version 7.2-173 2009-05-14 20:20:33 +00:00
Bram Moolenaar
d30f9d92c4 updated for version 7.2-172 2009-05-14 20:01:05 +00:00
Bram Moolenaar
985cb44573 updated for version 7.2-171 2009-05-14 19:51:46 +00:00
Bram Moolenaar
f1726cc8d6 updated for version 7.2-170 2009-05-13 18:48:16 +00:00
Bram Moolenaar
5fd0ca70d3 updated for version 7.2-169 2009-05-13 16:56:33 +00:00
Bram Moolenaar
0c7ce77a00 updated for version 7.2-168 2009-05-13 12:49:39 +00:00
21 changed files with 241 additions and 145 deletions

51
src/auto/configure vendored
View File

@@ -10362,6 +10362,56 @@ fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
{ $as_echo "$as_me:$LINENO: checking whether __attribute__((unused)) is allowed" >&5
$as_echo_n "checking whether __attribute__((unused)) is allowed... " >&6; }
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include <stdio.h>
int
main ()
{
int x __attribute__((unused));
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (ac_try="$ac_compile"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
$as_echo "$ac_try_echo") >&5
(eval "$ac_compile") 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
$as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } && {
test -z "$ac_c_werror_flag" ||
test ! -s conftest.err
} && test -s conftest.$ac_objext; then
{ $as_echo "$as_me:$LINENO: result: yes" >&5
$as_echo "yes" >&6; }; cat >>confdefs.h <<\_ACEOF
#define HAVE_ATTRIBUTE_UNUSED 1
_ACEOF
else
$as_echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
{ $as_echo "$as_me:$LINENO: result: no" >&5
$as_echo "no" >&6; }
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
if test "${ac_cv_header_elf_h+set}" = set; then
{ $as_echo "$as_me:$LINENO: checking for elf.h" >&5
$as_echo_n "checking for elf.h... " >&6; }
@@ -15707,6 +15757,7 @@ test -f tags && mv tags tags.save
if (eval ctags --version /dev/null | grep Exuberant) < /dev/null 1>&5 2>&1; then
TAGPRG="ctags -I INIT+ --fields=+S"
else
TAGPRG="ctags"
(eval etags /dev/null) < /dev/null 1>&5 2>&1 && TAGPRG="etags"
(eval etags -c /dev/null) < /dev/null 1>&5 2>&1 && TAGPRG="etags -c"
(eval ctags /dev/null) < /dev/null 1>&5 2>&1 && TAGPRG="ctags"

View File

@@ -512,12 +512,11 @@ buf_clear_file(buf)
* buf_freeall() - free all things allocated for a buffer that are related to
* the file.
*/
/*ARGSUSED*/
void
buf_freeall(buf, del_buf, wipe_buf)
buf_T *buf;
int del_buf; /* buffer is going to be deleted */
int wipe_buf; /* buffer is going to be wiped out */
int del_buf UNUSED; /* buffer is going to be deleted */
int wipe_buf UNUSED; /* buffer is going to be wiped out */
{
#ifdef FEAT_AUTOCMD
int is_curbuf = (buf == curbuf);
@@ -1678,9 +1677,10 @@ buflist_new(ffname, sfname, lnum, flags)
buf->b_fname = buf->b_sfname;
#ifdef UNIX
if (st.st_dev == (dev_T)-1)
buf->b_dev = -1;
buf->b_dev_valid = FALSE;
else
{
buf->b_dev_valid = TRUE;
buf->b_dev = st.st_dev;
buf->b_ino = st.st_ino;
}
@@ -2436,11 +2436,10 @@ wininfo_other_tab_diff(wip)
* another tab page.
* Returns NULL when there isn't any info.
*/
/*ARGSUSED*/
static wininfo_T *
find_wininfo(buf, skip_diff_buffer)
buf_T *buf;
int skip_diff_buffer;
int skip_diff_buffer UNUSED;
{
wininfo_T *wip;
@@ -2693,9 +2692,10 @@ setfname(buf, ffname, sfname, message)
buf->b_fname = buf->b_sfname;
#ifdef UNIX
if (st.st_dev == (dev_T)-1)
buf->b_dev = -1;
buf->b_dev_valid = FALSE;
else
{
buf->b_dev_valid = TRUE;
buf->b_dev = st.st_dev;
buf->b_ino = st.st_ino;
}
@@ -2889,7 +2889,7 @@ otherfile_buf(buf, ffname
/* If no struct stat given, get it now */
if (stp == NULL)
{
if (buf->b_dev < 0 || mch_stat((char *)ffname, &st) < 0)
if (!buf->b_dev_valid || mch_stat((char *)ffname, &st) < 0)
st.st_dev = (dev_T)-1;
stp = &st;
}
@@ -2926,11 +2926,12 @@ buf_setino(buf)
if (buf->b_fname != NULL && mch_stat((char *)buf->b_fname, &st) >= 0)
{
buf->b_dev_valid = TRUE;
buf->b_dev = st.st_dev;
buf->b_ino = st.st_ino;
}
else
buf->b_dev = -1;
buf->b_dev_valid = FALSE;
}
/*
@@ -2941,7 +2942,7 @@ buf_same_ino(buf, stp)
buf_T *buf;
struct stat *stp;
{
return (buf->b_dev >= 0
return (buf->b_dev_valid
&& stp->st_dev == buf->b_dev
&& stp->st_ino == buf->b_ino);
}
@@ -4275,10 +4276,9 @@ fix_fname(fname)
* Make "ffname" a full file name, set "sfname" to "ffname" if not NULL.
* "ffname" becomes a pointer to allocated memory (or NULL).
*/
/*ARGSUSED*/
void
fname_expand(buf, ffname, sfname)
buf_T *buf;
buf_T *buf UNUSED;
char_u **ffname;
char_u **sfname;
{
@@ -5574,11 +5574,10 @@ buf_contents_changed(buf)
* this buffer. Call this to wipe out a temp buffer that does not contain any
* marks.
*/
/*ARGSUSED*/
void
wipe_buffer(buf, aucmd)
buf_T *buf;
int aucmd; /* When TRUE trigger autocommands. */
int aucmd UNUSED; /* When TRUE trigger autocommands. */
{
if (buf->b_fnum == top_file_num - 1)
--top_file_num;

View File

@@ -1026,13 +1026,12 @@ lbr_chartabsize_adv(s, col)
* string at start of line. Warning: *headp is only set if it's a non-zero
* value, init to 0 before calling.
*/
/*ARGSUSED*/
int
win_lbr_chartabsize(wp, s, col, headp)
win_T *wp;
char_u *s;
colnr_T col;
int *headp;
int *headp UNUSED;
{
#ifdef FEAT_LINEBREAK
int c;

View File

@@ -1,27 +1,32 @@
" Vim tool: Filter output of splint
"
" Maintainer: Bram Moolenaar <Bram@vim.org>
" Last Change: 2009 May 05
" Last Change: 2009 May 13
" Usage: redirect output of "make lint" to a file, edit that file with Vim and
" :call CleanLint()
" This deletes irrelevant messages. What remains might be valid warnings.
fun! CleanLint()
g/^ Types are incompatible/lockmarks d
g/Assignment of dev_t to __dev_t:/lockmarks d
g/Assignment of __dev_t to dev_t:/lockmarks d
g/Operands of == have incompatible types (__dev_t, dev_t): /lockmarks d
g/Operands of == have incompatible types (unsigned int, int): /lockmarks d
g/Operands of == have incompatible types (char_u, int): /lockmarks d
g/Assignment of char to char_u: /lockmarks d
g/Assignment of unsigned int to int: /lockmarks d
g/Assignment of colnr_T to int: /lockmarks d
g/Assignment of int to unsigned int: /lockmarks d
g/Assignment of unsigned int to long int: /lockmarks d
g/Assignment of int to char_u: /lockmarks d
g/Function .* expects arg . to be wint_t gets int: /lockmarks d
g/^digraph.c.*digraphdefault.*is type char, expects char_u:/lockmarks d
g/Function .* expects arg . to be size_t gets int: /lockmarks d
g/Initial value of .* is type char, expects char_u: /lockmarks d
g/^ex_cmds.h:.* Function types are inconsistent. Parameter 1 is implicitly temp, but unqualified in assigned function:/lockmarks d
g/^ex_docmd.c:.* nospec_str/lockmarks d
g/^digraph.c.*Additional initialization errors for digraphdefault not reported/lockmarks d
g/Function strncasecmp expects arg 3 to be int gets size_t: /lockmarks d
g/^ Types are incompatible/lockmarks d
g/ To ignore signs in type comparisons use +ignoresigns/lockmarks d
g/ To allow arbitrary integral types to match any integral type, use +matchanyintegral./lockmarks d
g/ To allow arbitrary integral types to match long unsigned, use +longintegral./lockmarks d
g+ A variable is declared but never used. Use /.@unused@./ in front of declaration to suppress message.+lockmarks d
endfun

View File

@@ -30,6 +30,9 @@
/* Define when __DATE__ " " __TIME__ can be used */
#undef HAVE_DATE_TIME
/* Define when __attribute__((unused)) can be used */
#undef HAVE_ATTRIBUTE_UNUSED
/* defined always when using configure */
#undef UNIX

View File

@@ -2067,6 +2067,11 @@ AC_TRY_COMPILE([#include <stdio.h>], [printf("(" __DATE__ " " __TIME__ ")");],
AC_MSG_RESULT(yes); AC_DEFINE(HAVE_DATE_TIME),
AC_MSG_RESULT(no))
AC_MSG_CHECKING(whether __attribute__((unused)) is allowed)
AC_TRY_COMPILE([#include <stdio.h>], [int x __attribute__((unused));],
AC_MSG_RESULT(yes); AC_DEFINE(HAVE_ATTRIBUTE_UNUSED),
AC_MSG_RESULT(no))
dnl Checks for header files.
AC_CHECK_HEADER(elf.h, HAS_ELF=1)
dnl AC_CHECK_HEADER(dwarf.h, SVR4=1)
@@ -2968,7 +2973,7 @@ fi
dnl Link with xpg4, it is said to make Korean locale working
AC_CHECK_LIB(xpg4, _xpg4_setrunelocale, [LIBS="$LIBS -lxpg4"],,)
dnl Check how we can run ctags
dnl Check how we can run ctags. Default to "ctags" when nothing works.
dnl --version for Exuberant ctags (preferred)
dnl Add --fields=+S to get function signatures for omni completion.
dnl -t for typedefs (many ctags have this)
@@ -2980,6 +2985,7 @@ test -f tags && mv tags tags.save
if (eval ctags --version /dev/null | grep Exuberant) < /dev/null 1>&AC_FD_CC 2>&1; then
TAGPRG="ctags -I INIT+ --fields=+S"
else
TAGPRG="ctags"
(eval etags /dev/null) < /dev/null 1>&AC_FD_CC 2>&1 && TAGPRG="etags"
(eval etags -c /dev/null) < /dev/null 1>&AC_FD_CC 2>&1 && TAGPRG="etags -c"
(eval ctags /dev/null) < /dev/null 1>&AC_FD_CC 2>&1 && TAGPRG="ctags"

View File

@@ -652,10 +652,9 @@ diff_write(buf, fname)
* The buffers are written to a file, also for unmodified buffers (the file
* could have been produced by autocommands, e.g. the netrw plugin).
*/
/*ARGSUSED*/
void
ex_diffupdate(eap)
exarg_T *eap; /* can be NULL, it's not used */
exarg_T *eap UNUSED; /* can be NULL */
{
buf_T *buf;
int idx_orig;
@@ -827,6 +826,7 @@ diff_file(tmp_orig, tmp_new, tmp_diff)
char_u *tmp_diff;
{
char_u *cmd;
size_t len;
#ifdef FEAT_EVAL
if (*p_dex != NUL)
@@ -835,8 +835,9 @@ diff_file(tmp_orig, tmp_new, tmp_diff)
else
#endif
{
cmd = alloc((unsigned)(STRLEN(tmp_orig) + STRLEN(tmp_new)
+ STRLEN(tmp_diff) + STRLEN(p_srr) + 27));
len = STRLEN(tmp_orig) + STRLEN(tmp_new)
+ STRLEN(tmp_diff) + STRLEN(p_srr) + 27;
cmd = alloc((unsigned)len);
if (cmd != NULL)
{
/* We don't want $DIFF_OPTIONS to get in the way. */
@@ -846,7 +847,7 @@ diff_file(tmp_orig, tmp_new, tmp_diff)
/* Build the diff command and execute it. Always use -a, binary
* differences are of no use. Ignore errors, diff returns
* non-zero when differences have been found. */
sprintf((char *)cmd, "diff %s%s%s%s%s %s",
vim_snprintf((char *)cmd, len, "diff %s%s%s%s%s %s",
diff_a_works == FALSE ? "" : "-a ",
#if defined(MSWIN) || defined(MSDOS)
diff_bin_works == TRUE ? "--binary " : "",
@@ -856,7 +857,7 @@ diff_file(tmp_orig, tmp_new, tmp_diff)
(diff_flags & DIFF_IWHITE) ? "-b " : "",
(diff_flags & DIFF_ICASE) ? "-i " : "",
tmp_orig, tmp_new);
append_redir(cmd, p_srr, tmp_diff);
append_redir(cmd, (int)len, p_srr, tmp_diff);
#ifdef FEAT_AUTOCMD
block_autocmds(); /* Avoid ShellCmdPost stuff */
#endif
@@ -881,6 +882,7 @@ ex_diffpatch(eap)
char_u *tmp_orig; /* name of original temp file */
char_u *tmp_new; /* name of patched temp file */
char_u *buf = NULL;
size_t buflen;
win_T *old_curwin = curwin;
char_u *newname = NULL; /* name of patched file buffer */
#ifdef UNIX
@@ -920,11 +922,12 @@ ex_diffpatch(eap)
/* Get the absolute path of the patchfile, changing directory below. */
fullname = FullName_save(eap->arg, FALSE);
#endif
buf = alloc((unsigned)(STRLEN(tmp_orig) + (
buflen = STRLEN(tmp_orig) + (
# ifdef UNIX
fullname != NULL ? STRLEN(fullname) :
# endif
STRLEN(eap->arg)) + STRLEN(tmp_new) + 16));
STRLEN(eap->arg)) + STRLEN(tmp_new) + 16;
buf = alloc((unsigned)buflen);
if (buf == NULL)
goto theend;
@@ -961,7 +964,8 @@ ex_diffpatch(eap)
{
/* Build the patch command and execute it. Ignore errors. Switch to
* cooked mode to allow the user to respond to prompts. */
sprintf((char *)buf, "patch -o %s %s < \"%s\"", tmp_new, tmp_orig,
vim_snprintf((char *)buf, buflen, "patch -o %s %s < \"%s\"",
tmp_new, tmp_orig,
# ifdef UNIX
fullname != NULL ? fullname :
# endif
@@ -1089,10 +1093,9 @@ ex_diffsplit(eap)
/*
* Set options to show difs for the current window.
*/
/*ARGSUSED*/
void
ex_diffthis(eap)
exarg_T *eap;
exarg_T *eap UNUSED;
{
/* Set 'diff', 'scrollbind' on and 'wrap' off. */
diff_win_options(curwin, TRUE);

View File

@@ -169,7 +169,7 @@ static int ins_compl_pum_key __ARGS((int c));
static int ins_compl_key2count __ARGS((int c));
static int ins_compl_use_match __ARGS((int c));
static int ins_complete __ARGS((int c));
static int quote_meta __ARGS((char_u *dest, char_u *str, int len));
static unsigned quote_meta __ARGS((char_u *dest, char_u *str, int len));
#endif /* FEAT_INS_EXPAND */
#define BACKSPACE_CHAR 1
@@ -757,7 +757,7 @@ edit(cmdchar, startln, count)
* there is nothing to add, CTRL-L works like CTRL-P then. */
if (c == Ctrl_L
&& (ctrl_x_mode != CTRL_X_WHOLE_LINE
|| STRLEN(compl_shown_match->cp_str)
|| (int)STRLEN(compl_shown_match->cp_str)
> curwin->w_cursor.col - compl_col))
{
ins_compl_addfrommatch();
@@ -1447,10 +1447,9 @@ force_cindent:
* Only redraw when there are no characters available. This speeds up
* inserting sequences of characters (e.g., for CTRL-R).
*/
/*ARGSUSED*/
static void
ins_redraw(ready)
int ready; /* not busy with something */
int ready UNUSED; /* not busy with something */
{
if (!char_avail())
{
@@ -1962,10 +1961,9 @@ backspace_until_column(col)
* Only matters when there are composing characters.
* Return TRUE when something was deleted.
*/
/*ARGSUSED*/
static int
del_char_after_col(limit_col)
int limit_col;
int limit_col UNUSED;
{
#ifdef FEAT_MBYTE
if (enc_utf8 && limit_col >= 0)
@@ -3837,7 +3835,11 @@ ins_compl_add_tv(tv, dir)
char_u *word;
int icase = FALSE;
int adup = FALSE;
#ifdef S_SPLINT_S /* splint doesn't parse array of pointers correctly */
char_u **cptext;
#else
char_u *(cptext[CPT_COUNT]);
#endif
if (tv->v_type == VAR_DICT && tv->vval.v_dict != NULL)
{
@@ -3994,7 +3996,7 @@ ins_compl_get_exp(ini)
else if (*e_cpt == ']' || *e_cpt == 't')
{
type = CTRL_X_TAGS;
sprintf((char*)IObuff, _("Scanning tags."));
vim_snprintf((char *)IObuff, IOSIZE, _("Scanning tags."));
(void)msg_trunc_attr(IObuff, TRUE, hl_attr(HLF_R));
}
else
@@ -4093,7 +4095,7 @@ ins_compl_get_exp(ini)
case CTRL_X_SPELL:
#ifdef FEAT_SPELL
num_matches = expand_spelling(first_match_pos.lnum,
first_match_pos.col, compl_pattern, &matches);
compl_pattern, &matches);
if (num_matches > 0)
ins_compl_add_matches(num_matches, matches, p_ic);
#endif
@@ -4803,10 +4805,9 @@ ins_complete(c)
{
char_u *prefix = (char_u *)"\\<";
/* we need 3 extra chars, 1 for the NUL and
* 2 >= strlen(prefix) -- Acevedo */
/* we need up to 2 extra chars for the prefix */
compl_pattern = alloc(quote_meta(NULL, line + compl_col,
compl_length) + 3);
compl_length) + 2);
if (compl_pattern == NULL)
return FAIL;
if (!vim_iswordp(line + compl_col)
@@ -4881,7 +4882,7 @@ ins_complete(c)
else
{
compl_pattern = alloc(quote_meta(NULL, line + compl_col,
compl_length) + 3);
compl_length) + 2);
if (compl_pattern == NULL)
return FAIL;
STRCPY((char *)compl_pattern, "\\<");
@@ -4963,7 +4964,7 @@ ins_complete(c)
if (col < 0)
col = curs_col;
compl_col = col;
if ((colnr_T)compl_col > curs_col)
if (compl_col > curs_col)
compl_col = curs_col;
/* Setup variables for completion. Need to obtain "line" again,
@@ -5236,15 +5237,15 @@ ins_complete(c)
* a backslash) the metachars, and dest would be NUL terminated.
* Returns the length (needed) of dest
*/
static int
static unsigned
quote_meta(dest, src, len)
char_u *dest;
char_u *src;
int len;
{
int m;
unsigned m = (unsigned)len + 1; /* one extra for the NUL */
for (m = len; --len >= 0; src++)
for ( ; --len >= 0; src++)
{
switch (*src)
{
@@ -6073,7 +6074,7 @@ auto_format(trailblank, prev_line)
* in 'formatoptions' and there is a single character before the cursor.
* Otherwise the line would be broken and when typing another non-white
* next they are not joined back together. */
wasatend = (pos.col == STRLEN(old));
wasatend = (pos.col == (colnr_T)STRLEN(old));
if (*old != NUL && !trailblank && wasatend)
{
dec_cursor();
@@ -6250,7 +6251,7 @@ redo_literal(c)
* three digits. */
if (VIM_ISDIGIT(c))
{
sprintf((char *)buf, "%03d", c);
vim_snprintf((char *)buf, sizeof(buf), "%03d", c);
AppendToRedobuff(buf);
}
else
@@ -6453,10 +6454,11 @@ stop_insert(end_insert_pos, esc)
* deleted characters. */
if (VIsual_active && VIsual.lnum == curwin->w_cursor.lnum)
{
cc = (int)STRLEN(ml_get_curline());
if (VIsual.col > (colnr_T)cc)
int len = (int)STRLEN(ml_get_curline());
if (VIsual.col > len)
{
VIsual.col = cc;
VIsual.col = len;
# ifdef FEAT_VIRTUALEDIT
VIsual.coladd = 0;
# endif
@@ -8315,6 +8317,7 @@ ins_bs(c, mode, inserted_space_p)
linenr_T lnum;
int cc;
int temp = 0; /* init for GCC */
colnr_T save_col;
colnr_T mincol;
int did_backspace = FALSE;
int in_indent;
@@ -8472,13 +8475,13 @@ ins_bs(c, mode, inserted_space_p)
*/
while (cc > 0)
{
temp = curwin->w_cursor.col;
save_col = curwin->w_cursor.col;
#ifdef FEAT_MBYTE
mb_replace_pop_ins(cc);
#else
ins_char(cc);
#endif
curwin->w_cursor.col = temp;
curwin->w_cursor.col = save_col;
cc = replace_pop();
}
/* restore the characters that NL replaced */
@@ -8510,11 +8513,11 @@ ins_bs(c, mode, inserted_space_p)
#endif
)
{
temp = curwin->w_cursor.col;
save_col = curwin->w_cursor.col;
beginline(BL_WHITE);
if (curwin->w_cursor.col < (colnr_T)temp)
mincol = curwin->w_cursor.col;
curwin->w_cursor.col = temp;
curwin->w_cursor.col = save_col;
}
/*

View File

@@ -43,10 +43,9 @@ static int
/*
* ":ascii" and "ga".
*/
/*ARGSUSED*/
void
do_ascii(eap)
exarg_T *eap;
exarg_T *eap UNUSED;
{
int c;
int cval;
@@ -87,13 +86,14 @@ do_ascii(eap)
))
{
transchar_nonprint(buf3, c);
sprintf(buf1, " <%s>", (char *)buf3);
vim_snprintf(buf1, sizeof(buf1), " <%s>", (char *)buf3);
}
else
buf1[0] = NUL;
#ifndef EBCDIC
if (c >= 0x80)
sprintf(buf2, " <M-%s>", transchar(c & 0x7f));
vim_snprintf(buf2, sizeof(buf2), " <M-%s>",
(char *)transchar(c & 0x7f));
else
#endif
buf2[0] = NUL;
@@ -358,7 +358,7 @@ ex_sort(eap)
linenr_T lnum;
long maxlen = 0;
sorti_T *nrs;
size_t count = eap->line2 - eap->line1 + 1;
size_t count = (size_t)(eap->line2 - eap->line1 + 1);
size_t i;
char_u *p;
char_u *s;
@@ -957,7 +957,7 @@ do_bang(addr_count, eap, forceit, do_in, do_out)
}
len += (int)STRLEN(prevcmd);
}
if ((t = alloc(len)) == NULL)
if ((t = alloc((unsigned)len)) == NULL)
{
vim_free(newcmd);
return;
@@ -1548,7 +1548,7 @@ make_filter_cmd(cmd, itmp, otmp)
* redirecting input and/or output.
*/
if (itmp != NULL || otmp != NULL)
sprintf((char *)buf, "(%s)", (char *)cmd);
vim_snprintf((char *)buf, len, "(%s)", (char *)cmd);
else
STRCPY(buf, cmd);
if (itmp != NULL)
@@ -1597,37 +1597,41 @@ make_filter_cmd(cmd, itmp, otmp)
}
#endif
if (otmp != NULL)
append_redir(buf, p_srr, otmp);
append_redir(buf, (int)len, p_srr, otmp);
return buf;
}
/*
* Append output redirection for file "fname" to the end of string buffer "buf"
* Append output redirection for file "fname" to the end of string buffer
* "buf[buflen]"
* Works with the 'shellredir' and 'shellpipe' options.
* The caller should make sure that there is enough room:
* STRLEN(opt) + STRLEN(fname) + 3
*/
void
append_redir(buf, opt, fname)
append_redir(buf, buflen, opt, fname)
char_u *buf;
int buflen;
char_u *opt;
char_u *fname;
{
char_u *p;
char_u *end;
buf += STRLEN(buf);
end = buf + STRLEN(buf);
/* find "%s", skipping "%%" */
for (p = opt; (p = vim_strchr(p, '%')) != NULL; ++p)
if (p[1] == 's')
break;
if (p != NULL)
{
*buf = ' '; /* not really needed? Not with sh, ksh or bash */
sprintf((char *)buf + 1, (char *)opt, (char *)fname);
*end = ' '; /* not really needed? Not with sh, ksh or bash */
vim_snprintf((char *)end + 1, (size_t)(buflen - (end + 1 - buf)),
(char *)opt, (char *)fname);
}
else
sprintf((char *)buf,
vim_snprintf((char *)end, (size_t)(buflen - (end - buf)),
#ifdef FEAT_QUICKFIX
# ifndef RISCOS
opt != p_sp ? " %s%s" :
@@ -2368,10 +2372,9 @@ viminfo_writestring(fd, p)
* ^? ^H
* not ^? ^?
*/
/*ARGSUSED*/
void
do_fixdel(eap)
exarg_T *eap;
exarg_T *eap UNUSED;
{
char_u *p;
@@ -2390,7 +2393,8 @@ print_line_no_prefix(lnum, use_number, list)
if (curwin->w_p_nu || use_number)
{
sprintf((char *)numbuf, "%*ld ", number_width(curwin), (long)lnum);
vim_snprintf((char *)numbuf, sizeof(numbuf),
"%*ld ", number_width(curwin), (long)lnum);
msg_puts_attr(numbuf, hl_attr(HLF_N)); /* Highlight line nrs */
}
msg_prt_line(ml_get(lnum), list);
@@ -4486,7 +4490,7 @@ do_sub(eap)
char_u *p1;
int did_sub = FALSE;
int lastone;
unsigned len, needed_len;
int len, copy_len, needed_len;
long nmatch_tl = 0; /* nr of lines matched below lnum */
int do_again; /* do it again after joining lines */
int skip_match = FALSE;
@@ -4631,6 +4635,8 @@ do_sub(eap)
if (do_ask)
{
int typed = 0;
/* change State to CONFIRM, so that the mouse works
* properly */
save_State = State;
@@ -4669,7 +4675,7 @@ do_sub(eap)
resp = getexmodeline('?', NULL, 0);
if (resp != NULL)
{
i = *resp;
typed = *resp;
vim_free(resp);
}
}
@@ -4721,7 +4727,7 @@ do_sub(eap)
#endif
++no_mapping; /* don't map this key */
++allow_keys; /* allow special keys */
i = plain_vgetc();
typed = plain_vgetc();
--allow_keys;
--no_mapping;
@@ -4732,35 +4738,35 @@ do_sub(eap)
}
need_wait_return = FALSE; /* no hit-return prompt */
if (i == 'q' || i == ESC || i == Ctrl_C
if (typed == 'q' || typed == ESC || typed == Ctrl_C
#ifdef UNIX
|| i == intr_char
|| typed == intr_char
#endif
)
{
got_quit = TRUE;
break;
}
if (i == 'n')
if (typed == 'n')
break;
if (i == 'y')
if (typed == 'y')
break;
if (i == 'l')
if (typed == 'l')
{
/* last: replace and then stop */
do_all = FALSE;
line2 = lnum;
break;
}
if (i == 'a')
if (typed == 'a')
{
do_ask = FALSE;
break;
}
#ifdef FEAT_INS_EXPAND
if (i == Ctrl_E)
if (typed == Ctrl_E)
scrollup_clamp();
else if (i == Ctrl_Y)
else if (typed == Ctrl_Y)
scrolldown_clamp();
#endif
}
@@ -4771,7 +4777,7 @@ do_sub(eap)
if (vim_strchr(p_cpo, CPO_UNDO) != NULL)
--no_u_sync;
if (i == 'n')
if (typed == 'n')
{
/* For a multi-line match, put matchcol at the NUL at
* the end of the line and set nmatch to one, so that
@@ -4822,9 +4828,9 @@ do_sub(eap)
p1 = ml_get(sub_firstlnum + nmatch - 1);
nmatch_tl += nmatch - 1;
}
i = regmatch.startpos[0].col - copycol;
needed_len = i + ((unsigned)STRLEN(p1) - regmatch.endpos[0].col)
+ sublen + 1;
copy_len = regmatch.startpos[0].col - copycol;
needed_len = copy_len + ((unsigned)STRLEN(p1)
- regmatch.endpos[0].col) + sublen + 1;
if (new_start == NULL)
{
/*
@@ -4847,7 +4853,7 @@ do_sub(eap)
*/
len = (unsigned)STRLEN(new_start);
needed_len += len;
if (needed_len > new_start_len)
if (needed_len > (int)new_start_len)
{
new_start_len = needed_len + 50;
if ((p1 = alloc_check(new_start_len)) == NULL)
@@ -4865,8 +4871,8 @@ do_sub(eap)
/*
* copy the text up to the part that matched
*/
mch_memmove(new_end, sub_firstline + copycol, (size_t)i);
new_end += i;
mch_memmove(new_end, sub_firstline + copycol, (size_t)copy_len);
new_end += copy_len;
(void)vim_regsub_multi(&regmatch,
sub_firstlnum - regmatch.startpos[0].lnum,
@@ -5768,6 +5774,10 @@ find_help_tags(arg, num_matches, matches, keep_lang)
{
char_u *s, *d;
int i;
#ifdef S_SPLINT_S /* splint doesn't understand array of pointers */
static char **mtable;
static char **rtable;
#else
static char *(mtable[]) = {"*", "g*", "[*", "]*", ":*",
"/*", "/\\*", "\"*", "**",
"/\\(\\)",
@@ -5782,6 +5792,7 @@ find_help_tags(arg, num_matches, matches, keep_lang)
"/\\\\?", "/\\\\z(\\\\)", "\\\\=", ":s\\\\=",
"\\[count]", "\\[quotex]", "\\[range]",
"\\[pattern]", "\\\\bar", "/\\\\%\\$"};
#endif
int flags;
d = IObuff; /* assume IObuff is long enough! */
@@ -5790,7 +5801,7 @@ find_help_tags(arg, num_matches, matches, keep_lang)
* Recognize a few exceptions to the rule. Some strings that contain '*'
* with "star". Otherwise '*' is recognized as a wildcard.
*/
for (i = sizeof(mtable) / sizeof(char *); --i >= 0; )
for (i = (int)(sizeof(mtable) / sizeof(char *)); --i >= 0; )
if (STRCMP(arg, mtable[i]) == 0)
{
STRCPY(d, rtable[i]);
@@ -6114,10 +6125,9 @@ fix_help_buffer()
/*
* ":exusage"
*/
/*ARGSUSED*/
void
ex_exusage(eap)
exarg_T *eap;
exarg_T *eap UNUSED;
{
do_cmdline_cmd((char_u *)"help ex-cmd-index");
}
@@ -6125,10 +6135,9 @@ ex_exusage(eap)
/*
* ":viusage"
*/
/*ARGSUSED*/
void
ex_viusage(eap)
exarg_T *eap;
exarg_T *eap UNUSED;
{
do_cmdline_cmd((char_u *)"help normal-index");
}
@@ -6540,6 +6549,7 @@ struct sign
static sign_T *first_sign = NULL;
static int last_sign_typenr = MAX_TYPENR; /* is decremented */
static int sign_cmd_idx __ARGS((char_u *begin_cmd, char_u *end_cmd));
static void sign_list_defined __ARGS((sign_T *sp));
static void sign_undefine __ARGS((sign_T *sp, sign_T *sp_prev));
@@ -6566,8 +6576,8 @@ static char *cmds[] = {
*/
static int
sign_cmd_idx(begin_cmd, end_cmd)
char *begin_cmd; /* begin of sign subcmd */
char *end_cmd; /* just after sign subcmd */
char_u *begin_cmd; /* begin of sign subcmd */
char_u *end_cmd; /* just after sign subcmd */
{
int idx;
char save = *end_cmd;
@@ -7140,10 +7150,9 @@ static enum
* Function given to ExpandGeneric() to obtain the sign command
* expansion.
*/
/*ARGSUSED*/
char_u *
get_sign_name(xp, idx)
expand_T *xp;
expand_T *xp UNUSED;
int idx;
{
sign_T *sp;

View File

@@ -680,10 +680,9 @@ ex_breakdel(eap)
/*
* ":breaklist".
*/
/*ARGSUSED*/
void
ex_breaklist(eap)
exarg_T *eap;
exarg_T *eap UNUSED;
{
struct debuggy *bp;
int i;
@@ -1342,14 +1341,13 @@ autowrite_all()
/*
* return TRUE if buffer was changed and cannot be abandoned.
*/
/*ARGSUSED*/
int
check_changed(buf, checkaw, mult_win, forceit, allbuf)
buf_T *buf;
int checkaw; /* do autowrite if buffer was changed */
int mult_win; /* check also when several wins for the buf */
int forceit;
int allbuf; /* may write all buffers */
int allbuf UNUSED; /* may write all buffers */
{
if ( !forceit
&& bufIsChanged(buf)
@@ -1759,12 +1757,11 @@ set_arglist(str)
*
* Return FAIL for failure, OK otherwise.
*/
/*ARGSUSED*/
static int
do_arglist(str, what, after)
char_u *str;
int what;
int after; /* 0 means before first one */
int what UNUSED;
int after UNUSED; /* 0 means before first one */
{
garray_T new_ga;
int exp_count;
@@ -2549,11 +2546,10 @@ ex_runtime(eap)
static void source_callback __ARGS((char_u *fname, void *cookie));
/*ARGSUSED*/
static void
source_callback(fname, cookie)
char_u *fname;
void *cookie;
void *cookie UNUSED;
{
(void)do_source(fname, FALSE, DOSO_NONE);
}
@@ -2680,10 +2676,9 @@ do_in_runtimepath(name, all, callback, cookie)
/*
* ":options"
*/
/*ARGSUSED*/
void
ex_options(eap)
exarg_T *eap;
exarg_T *eap UNUSED;
{
cmd_source((char_u *)SYS_OPTWIN_FILE, NULL);
}
@@ -3190,10 +3185,9 @@ theend:
/*
* ":scriptnames"
*/
/*ARGSUSED*/
void
ex_scriptnames(eap)
exarg_T *eap;
exarg_T *eap UNUSED;
{
int i;
@@ -3317,12 +3311,11 @@ fgets_cr(s, n, stream)
* Return a pointer to the line in allocated memory.
* Return NULL for end-of-file or some error.
*/
/* ARGSUSED */
char_u *
getsourceline(c, cookie, indent)
int c; /* not used */
int c UNUSED;
void *cookie;
int indent; /* not used */
int indent UNUSED;
{
struct source_cookie *sp = (struct source_cookie *)cookie;
char_u *line;
@@ -3373,7 +3366,7 @@ getsourceline(c, cookie, indent)
p = skipwhite(sp->nextline);
if (*p != '\\')
break;
s = alloc((int)(STRLEN(line) + STRLEN(p)));
s = alloc((unsigned)(STRLEN(line) + STRLEN(p)));
if (s == NULL) /* out of memory */
break;
STRCPY(s, line);
@@ -3649,10 +3642,9 @@ script_line_end()
* ":scriptencoding": Set encoding conversion for a sourced script.
* Without the multi-byte feature it's simply ignored.
*/
/*ARGSUSED*/
void
ex_scriptencoding(eap)
exarg_T *eap;
exarg_T *eap UNUSED;
{
#ifdef FEAT_MBYTE
struct source_cookie *sp;
@@ -4101,10 +4093,9 @@ ex_language(eap)
* Function given to ExpandGeneric() to obtain the possible arguments of the
* ":language" command.
*/
/*ARGSUSED*/
char_u *
get_lang_arg(xp, idx)
expand_T *xp;
expand_T *xp UNUSED;
int idx;
{
if (idx == 0)

View File

@@ -2737,7 +2737,7 @@ checkforcmd(pp, cmd, len)
int i;
for (i = 0; cmd[i] != NUL; ++i)
if (cmd[i] != (*pp)[i])
if (((char_u *)cmd)[i] != (*pp)[i])
break;
if (i >= len && !isalpha((*pp)[i]))
{
@@ -2803,7 +2803,7 @@ find_command(eap, full)
/* Check for ":dl", ":dell", etc. to ":deletel": that's
* :delete with the 'l' flag. Same for 'p'. */
for (i = 0; i < len; ++i)
if (eap->cmd[i] != "delete"[i])
if (eap->cmd[i] != ((char_u *)"delete")[i])
break;
if (i == len - 1)
{
@@ -3823,7 +3823,7 @@ skip_range(cmd, ctx)
char_u *cmd;
int *ctx; /* pointer to xp_context or NULL */
{
int delim;
unsigned delim;
while (vim_strchr((char_u *)" \t0123456789.$%'/?-+,;", *cmd) != NULL)
{
@@ -9417,7 +9417,13 @@ find_cmdline_var(src, usedlen)
{
int len;
int i;
static char *(spec_str[]) = {
#ifdef S_SPLINT_S /* splint can't handle array of pointers */
static char **spec_str;
static char *(nospec_str[])
#else
static char *(spec_str[])
#endif
= {
"%",
#define SPEC_PERC 0
"#",
@@ -9443,9 +9449,8 @@ find_cmdline_var(src, usedlen)
# define SPEC_CLIENT 9
#endif
};
#define SPEC_COUNT (sizeof(spec_str) / sizeof(char *))
for (i = 0; i < SPEC_COUNT; ++i)
for (i = 0; i < (int)(sizeof(spec_str) / sizeof(char *)); ++i)
{
len = (int)STRLEN(spec_str[i]);
if (STRNCMP(src, spec_str[i], len) == 0)
@@ -9796,7 +9801,7 @@ arg_all()
}
/* allocate memory */
retval = alloc(len + 1);
retval = alloc((unsigned)len + 1);
if (retval == NULL)
break;
}

View File

@@ -4416,7 +4416,7 @@ restore_backup:
# endif
buf_setino(buf);
}
else if (buf->b_dev < 0)
else if (!buf->b_dev_valid)
/* Set the inode when creating a new file. */
buf_setino(buf);
#endif

View File

@@ -1227,8 +1227,8 @@ utf16_to_enc(short_u *str, int *lenp)
* Wait for another process to Close the Clipboard.
* Returns TRUE for success.
*/
int
vim_open_clipboard()
static int
vim_open_clipboard(void)
{
int delay = 10;

View File

@@ -9,7 +9,7 @@ void free_prev_shellcmd __ARGS((void));
void do_bang __ARGS((int addr_count, exarg_T *eap, int forceit, int do_in, int do_out));
void do_shell __ARGS((char_u *cmd, int flags));
char_u *make_filter_cmd __ARGS((char_u *cmd, char_u *itmp, char_u *otmp));
void append_redir __ARGS((char_u *buf, char_u *opt, char_u *fname));
void append_redir __ARGS((char_u *buf, int buflen, char_u *opt, char_u *fname));
int viminfo_error __ARGS((char *errnum, char *message, char_u *line));
int read_viminfo __ARGS((char_u *file, int flags));
void write_viminfo __ARGS((char_u *file, int forceit));

View File

@@ -22,5 +22,5 @@ void spell_dump_compl __ARGS((buf_T *buf, char_u *pat, int ic, int *dir, int dum
char_u *spell_to_word_end __ARGS((char_u *start, buf_T *buf));
int spell_word_start __ARGS((int startcol));
void spell_expand_check_cap __ARGS((colnr_T col));
int expand_spelling __ARGS((linenr_T lnum, int col, char_u *pat, char_u ***matchp));
int expand_spelling __ARGS((linenr_T lnum, char_u *pat, char_u ***matchp));
/* vim: set ft=c : */

View File

@@ -2774,7 +2774,7 @@ ex_make(eap)
sprintf((char *)cmd, "%s%s%s", (char *)p_shq, (char *)eap->arg,
(char *)p_shq);
if (*p_sp != NUL)
append_redir(cmd, p_sp, fname);
append_redir(cmd, len, p_sp, fname);
/*
* Output a newline if there's something else than the :make command that
* was typed (in which case the cursor is in column 0).

View File

@@ -16151,11 +16151,9 @@ spell_expand_check_cap(col)
* Returns the number of matches. The matches are in "matchp[]", array of
* allocated strings.
*/
/*ARGSUSED*/
int
expand_spelling(lnum, col, pat, matchp)
expand_spelling(lnum, pat, matchp)
linenr_T lnum;
int col;
char_u *pat;
char_u ***matchp;
{

View File

@@ -16,7 +16,7 @@
*/
#if defined(SASC) && SASC < 658
typedef long linenr_T;
typedef unsigned colnr_T;
typedef int colnr_T;
typedef unsigned short short_u;
#endif
@@ -1166,7 +1166,8 @@ struct file_buffer
char_u *b_fname; /* current file name */
#ifdef UNIX
dev_t b_dev; /* device number (-1 if not set) */
int b_dev_valid; /* TRUE when b_dev has a valid number */
dev_t b_dev; /* device number */
ino_t b_ino; /* inode number */
#endif
#ifdef FEAT_CW_EDITOR

View File

@@ -96,7 +96,11 @@ enum SpecialKey
* - there should be code in term.c to obtain the value from the termcap
*/
#ifdef S_SPLINT_S /* splint doesn't understand array of pointers */
extern char_u **term_strings; /* current terminal strings */
#else
extern char_u *(term_strings[]); /* current terminal strings */
#endif
/*
* strings used for terminal

View File

@@ -676,6 +676,18 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
173,
/**/
172,
/**/
171,
/**/
170,
/**/
169,
/**/
168,
/**/
167,
/**/
@@ -1613,10 +1625,9 @@ do_intro_line(row, mesg, add_version, attr)
/*
* ":intro": clear screen, display intro screen and wait for return.
*/
/*ARGSUSED*/
void
ex_intro(eap)
exarg_T *eap;
exarg_T *eap UNUSED;
{
screenclear();
intro_message(TRUE);

View File

@@ -262,6 +262,14 @@
# define __PARMS(x) __ARGS(x)
#endif
/* Mark unused function arguments with UNUSED, so that gcc -Wunused-parameter
* can be used to check for mistakes. */
#ifdef HAVE_ATTRIBUTE_UNUSED
# define UNUSED __attribute__((unused))
#else
# define UNUSED
#endif
/* if we're compiling in C++ (currently only KVim), the system
* headers must have the correct prototypes or nothing will build.
* conversely, our prototypes might clash due to throw() specifiers and
@@ -1460,8 +1468,8 @@ typedef enum
# define PERROR(msg) perror(msg)
#endif
typedef long linenr_T; /* line number type */
typedef unsigned colnr_T; /* column number type */
typedef long linenr_T; /* line number type */
typedef int colnr_T; /* column number type */
typedef unsigned short disptick_T; /* display tick type */
#define MAXLNUM (0x7fffffffL) /* maximum (invalid) line number */