4 From: Bram Moolenaar <Bram@moolenaar.net>
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
11 Problem: Without lint there is no check for unused function arguments.
12 Solution: Use gcc -Wunused-parameter instead of lint. For a few files add
13 attributes to arguments that are known not to be used.
14 Files: src/auto/configure, src/buffer.c, src/charset.c, src/diff.c,
15 src/configure.in, src/config.h.in, src/edit.c, src/ex_cmds.c,
16 src/ex_cmds2.c, src/version.c, src/vim.h
19 *** ../vim-7.2.172/src/auto/configure 2009-05-13 14:48:55.000000000 +0200
20 --- src/auto/configure 2009-05-14 22:08:12.000000000 +0200
25 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
27 + { $as_echo "$as_me:$LINENO: checking whether __attribute__((unused)) is allowed" >&5
28 + $as_echo_n "checking whether __attribute__((unused)) is allowed... " >&6; }
29 + cat >conftest.$ac_ext <<_ACEOF
32 + cat confdefs.h >>conftest.$ac_ext
33 + cat >>conftest.$ac_ext <<_ACEOF
34 + /* end confdefs.h. */
39 + int x __attribute__((unused));
44 + rm -f conftest.$ac_objext
45 + if { (ac_try="$ac_compile"
47 + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
48 + *) ac_try_echo=$ac_try;;
50 + eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
51 + $as_echo "$ac_try_echo") >&5
52 + (eval "$ac_compile") 2>conftest.er1
54 + grep -v '^ *+' conftest.er1 >conftest.err
56 + cat conftest.err >&5
57 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
58 + (exit $ac_status); } && {
59 + test -z "$ac_c_werror_flag" ||
60 + test ! -s conftest.err
61 + } && test -s conftest.$ac_objext; then
62 + { $as_echo "$as_me:$LINENO: result: yes" >&5
63 + $as_echo "yes" >&6; }; cat >>confdefs.h <<\_ACEOF
64 + #define HAVE_ATTRIBUTE_UNUSED 1
68 + $as_echo "$as_me: failed program was:" >&5
69 + sed 's/^/| /' conftest.$ac_ext >&5
71 + { $as_echo "$as_me:$LINENO: result: no" >&5
72 + $as_echo "no" >&6; }
75 + rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
77 if test "${ac_cv_header_elf_h+set}" = set; then
78 { $as_echo "$as_me:$LINENO: checking for elf.h" >&5
79 $as_echo_n "checking for elf.h... " >&6; }
80 *** ../vim-7.2.172/src/buffer.c 2009-05-13 20:47:07.000000000 +0200
81 --- src/buffer.c 2009-05-14 21:34:06.000000000 +0200
84 * buf_freeall() - free all things allocated for a buffer that are related to
89 buf_freeall(buf, del_buf, wipe_buf)
91 ! int del_buf; /* buffer is going to be deleted */
92 ! int wipe_buf; /* buffer is going to be wiped out */
95 int is_curbuf = (buf == curbuf);
97 * buf_freeall() - free all things allocated for a buffer that are related to
101 buf_freeall(buf, del_buf, wipe_buf)
103 ! int del_buf UNUSED; /* buffer is going to be deleted */
104 ! int wipe_buf UNUSED; /* buffer is going to be wiped out */
107 int is_curbuf = (buf == curbuf);
111 * Returns NULL when there isn't any info.
115 find_wininfo(buf, skip_diff_buffer)
117 ! int skip_diff_buffer;
123 * Returns NULL when there isn't any info.
126 find_wininfo(buf, skip_diff_buffer)
128 ! int skip_diff_buffer UNUSED;
134 * Make "ffname" a full file name, set "sfname" to "ffname" if not NULL.
135 * "ffname" becomes a pointer to allocated memory (or NULL).
139 fname_expand(buf, ffname, sfname)
145 * Make "ffname" a full file name, set "sfname" to "ffname" if not NULL.
146 * "ffname" becomes a pointer to allocated memory (or NULL).
149 fname_expand(buf, ffname, sfname)
156 * this buffer. Call this to wipe out a temp buffer that does not contain any
161 wipe_buffer(buf, aucmd)
163 ! int aucmd; /* When TRUE trigger autocommands. */
165 if (buf->b_fnum == top_file_num - 1)
168 * this buffer. Call this to wipe out a temp buffer that does not contain any
172 wipe_buffer(buf, aucmd)
174 ! int aucmd UNUSED; /* When TRUE trigger autocommands. */
176 if (buf->b_fnum == top_file_num - 1)
178 *** ../vim-7.2.172/src/charset.c 2009-05-13 14:10:46.000000000 +0200
179 --- src/charset.c 2009-05-14 21:34:30.000000000 +0200
182 * string at start of line. Warning: *headp is only set if it's a non-zero
183 * value, init to 0 before calling.
187 win_lbr_chartabsize(wp, s, col, headp)
193 #ifdef FEAT_LINEBREAK
196 * string at start of line. Warning: *headp is only set if it's a non-zero
197 * value, init to 0 before calling.
200 win_lbr_chartabsize(wp, s, col, headp)
206 #ifdef FEAT_LINEBREAK
208 *** ../vim-7.2.172/src/diff.c 2009-05-13 18:54:14.000000000 +0200
209 --- src/diff.c 2009-05-14 21:24:59.000000000 +0200
212 * The buffers are written to a file, also for unmodified buffers (the file
213 * could have been produced by autocommands, e.g. the netrw plugin).
218 ! exarg_T *eap; /* can be NULL, it's not used */
223 * The buffers are written to a file, also for unmodified buffers (the file
224 * could have been produced by autocommands, e.g. the netrw plugin).
228 ! exarg_T *eap UNUSED; /* can be NULL */
235 * Set options to show difs for the current window.
242 /* Set 'diff', 'scrollbind' on and 'wrap' off. */
243 diff_win_options(curwin, TRUE);
246 * Set options to show difs for the current window.
250 ! exarg_T *eap UNUSED;
252 /* Set 'diff', 'scrollbind' on and 'wrap' off. */
253 diff_win_options(curwin, TRUE);
254 *** ../vim-7.2.172/src/configure.in 2009-05-13 14:48:55.000000000 +0200
255 --- src/configure.in 2009-05-14 22:08:06.000000000 +0200
259 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_DATE_TIME),
262 + AC_MSG_CHECKING(whether __attribute__((unused)) is allowed)
263 + AC_TRY_COMPILE([#include <stdio.h>], [int x __attribute__((unused));],
264 + AC_MSG_RESULT(yes); AC_DEFINE(HAVE_ATTRIBUTE_UNUSED),
267 dnl Checks for header files.
268 AC_CHECK_HEADER(elf.h, HAS_ELF=1)
269 dnl AC_CHECK_HEADER(dwarf.h, SVR4=1)
270 *** ../vim-7.2.172/src/config.h.in 2009-03-02 02:44:54.000000000 +0100
271 --- src/config.h.in 2009-05-14 21:15:02.000000000 +0200
275 /* Define when __DATE__ " " __TIME__ can be used */
276 #undef HAVE_DATE_TIME
278 + /* Define when __attribute__((unused)) can be used */
279 + #undef HAVE_ATTRIBUTE_UNUSED
281 /* defined always when using configure */
284 *** ../vim-7.2.172/src/edit.c 2009-05-13 18:54:14.000000000 +0200
285 --- src/edit.c 2009-05-14 21:35:08.000000000 +0200
288 * Only redraw when there are no characters available. This speeds up
289 * inserting sequences of characters (e.g., for CTRL-R).
294 ! int ready; /* not busy with something */
299 * Only redraw when there are no characters available. This speeds up
300 * inserting sequences of characters (e.g., for CTRL-R).
304 ! int ready UNUSED; /* not busy with something */
310 * Only matters when there are composing characters.
311 * Return TRUE when something was deleted.
315 del_char_after_col(limit_col)
319 if (enc_utf8 && limit_col >= 0)
321 * Only matters when there are composing characters.
322 * Return TRUE when something was deleted.
325 del_char_after_col(limit_col)
326 ! int limit_col UNUSED;
329 if (enc_utf8 && limit_col >= 0)
330 *** ../vim-7.2.172/src/ex_cmds.c 2009-05-14 21:51:06.000000000 +0200
331 --- src/ex_cmds.c 2009-05-14 21:11:01.000000000 +0200
350 ! exarg_T *eap UNUSED;
372 ! exarg_T *eap UNUSED;
386 do_cmdline_cmd((char_u *)"help ex-cmd-index");
394 ! exarg_T *eap UNUSED;
396 do_cmdline_cmd((char_u *)"help ex-cmd-index");
408 do_cmdline_cmd((char_u *)"help normal-index");
416 ! exarg_T *eap UNUSED;
418 do_cmdline_cmd((char_u *)"help normal-index");
422 * Function given to ExpandGeneric() to obtain the sign command
427 get_sign_name(xp, idx)
433 * Function given to ExpandGeneric() to obtain the sign command
437 get_sign_name(xp, idx)
438 ! expand_T *xp UNUSED;
442 *** ../vim-7.2.172/src/ex_cmds2.c 2009-05-13 18:54:14.000000000 +0200
443 --- src/ex_cmds2.c 2009-05-14 21:35:40.000000000 +0200
462 ! exarg_T *eap UNUSED;
469 * return TRUE if buffer was changed and cannot be abandoned.
473 check_changed(buf, checkaw, mult_win, forceit, allbuf)
475 int checkaw; /* do autowrite if buffer was changed */
476 int mult_win; /* check also when several wins for the buf */
478 ! int allbuf; /* may write all buffers */
484 * return TRUE if buffer was changed and cannot be abandoned.
487 check_changed(buf, checkaw, mult_win, forceit, allbuf)
489 int checkaw; /* do autowrite if buffer was changed */
490 int mult_win; /* check also when several wins for the buf */
492 ! int allbuf UNUSED; /* may write all buffers */
499 * Return FAIL for failure, OK otherwise.
503 do_arglist(str, what, after)
506 ! int after; /* 0 means before first one */
512 * Return FAIL for failure, OK otherwise.
515 do_arglist(str, what, after)
518 ! int after UNUSED; /* 0 means before first one */
525 static void source_callback __ARGS((char_u *fname, void *cookie));
529 source_callback(fname, cookie)
533 (void)do_source(fname, FALSE, DOSO_NONE);
537 static void source_callback __ARGS((char_u *fname, void *cookie));
540 source_callback(fname, cookie)
542 ! void *cookie UNUSED;
544 (void)do_source(fname, FALSE, DOSO_NONE);
556 cmd_source((char_u *)SYS_OPTWIN_FILE, NULL);
564 ! exarg_T *eap UNUSED;
566 cmd_source((char_u *)SYS_OPTWIN_FILE, NULL);
586 ! exarg_T *eap UNUSED;
592 * Return a pointer to the line in allocated memory.
593 * Return NULL for end-of-file or some error.
597 getsourceline(c, cookie, indent)
598 ! int c; /* not used */
600 ! int indent; /* not used */
602 struct source_cookie *sp = (struct source_cookie *)cookie;
605 * Return a pointer to the line in allocated memory.
606 * Return NULL for end-of-file or some error.
609 getsourceline(c, cookie, indent)
614 struct source_cookie *sp = (struct source_cookie *)cookie;
618 * ":scriptencoding": Set encoding conversion for a sourced script.
619 * Without the multi-byte feature it's simply ignored.
623 ex_scriptencoding(eap)
627 struct source_cookie *sp;
629 * ":scriptencoding": Set encoding conversion for a sourced script.
630 * Without the multi-byte feature it's simply ignored.
633 ex_scriptencoding(eap)
634 ! exarg_T *eap UNUSED;
637 struct source_cookie *sp;
640 * Function given to ExpandGeneric() to obtain the possible arguments of the
641 * ":language" command.
645 get_lang_arg(xp, idx)
651 * Function given to ExpandGeneric() to obtain the possible arguments of the
652 * ":language" command.
655 get_lang_arg(xp, idx)
656 ! expand_T *xp UNUSED;
660 *** ../vim-7.2.172/src/version.c 2009-05-14 22:00:37.000000000 +0200
661 --- src/version.c 2009-05-14 22:14:51.000000000 +0200
665 * ":intro": clear screen, display intro screen and wait for return.
676 * ":intro": clear screen, display intro screen and wait for return.
680 ! exarg_T *eap UNUSED;
684 *** ../vim-7.2.172/src/vim.h 2009-05-13 18:54:14.000000000 +0200
685 --- src/vim.h 2009-05-14 21:17:51.000000000 +0200
689 # define __PARMS(x) __ARGS(x)
692 + /* Mark unused function arguments with UNUSED, so that gcc -Wunused-parameter
693 + * can be used to check for mistakes. */
694 + #ifdef HAVE_ATTRIBUTE_UNUSED
695 + # define UNUSED __attribute__((unused))
700 /* if we're compiling in C++ (currently only KVim), the system
701 * headers must have the correct prototypes or nothing will build.
702 * conversely, our prototypes might clash due to throw() specifiers and
703 *** ../vim-7.2.172/src/version.c 2009-05-14 22:00:37.000000000 +0200
704 --- src/version.c 2009-05-14 22:14:51.000000000 +0200
708 { /* Add new patch number below this line */
714 SIGIRO -- irony detected (iron core dumped)
716 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
717 /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
718 \\\ download, build and distribute -- http://www.A-A-P.org ///
719 \\\ help me help AIDS victims -- http://ICCF-Holland.org ///