diff options
author | Davi Arnaut <davi.arnaut@oracle.com> | 2010-10-20 16:21:40 -0200 |
---|---|---|
committer | Davi Arnaut <davi.arnaut@oracle.com> | 2010-10-20 16:21:40 -0200 |
commit | 560ee2158d17212ecb2ec282ee15b1e1eb5f2092 (patch) | |
tree | d427278052923d3b649a03292a823b7468075b95 /cmd-line-utils | |
parent | 60f30f690956e8e9066b40bb9e08cdcc66debf06 (diff) | |
download | mariadb-git-560ee2158d17212ecb2ec282ee15b1e1eb5f2092.tar.gz |
Bug#45288: pb2 returns a lot of compilation warnings
Fix assorted warnings that are generated in optimized builds.
Most of it is silencing variables that are set but unused.
This patch also introduces the MY_ASSERT_UNREACHABLE macro
which helps the compiler to deduce that a certain piece of
code is unreachable.
Diffstat (limited to 'cmd-line-utils')
-rw-r--r-- | cmd-line-utils/readline/complete.c | 7 | ||||
-rw-r--r-- | cmd-line-utils/readline/histexpand.c | 3 | ||||
-rw-r--r-- | cmd-line-utils/readline/histfile.c | 1 | ||||
-rw-r--r-- | cmd-line-utils/readline/isearch.c | 8 | ||||
-rw-r--r-- | cmd-line-utils/readline/parens.c | 4 | ||||
-rw-r--r-- | cmd-line-utils/readline/readline.c | 3 | ||||
-rw-r--r-- | cmd-line-utils/readline/text.c | 3 |
7 files changed, 16 insertions, 13 deletions
diff --git a/cmd-line-utils/readline/complete.c b/cmd-line-utils/readline/complete.c index 2745e4e4801..d11ea2493a6 100644 --- a/cmd-line-utils/readline/complete.c +++ b/cmd-line-utils/readline/complete.c @@ -1839,8 +1839,11 @@ rl_username_completion_function (text, state) #else /* !__WIN32__ && !__OPENNT) */ static char *username = (char *)NULL; static struct passwd *entry; - static int namelen, first_char, first_char_loc; + static int first_char, first_char_loc; char *value; +#if defined (HAVE_GETPWENT) + static int namelen; +#endif if (state == 0) { @@ -1850,7 +1853,9 @@ rl_username_completion_function (text, state) first_char_loc = first_char == '~'; username = savestring (&text[first_char_loc]); +#if defined (HAVE_GETPWENT) namelen = strlen (username); +#endif setpwent (); } diff --git a/cmd-line-utils/readline/histexpand.c b/cmd-line-utils/readline/histexpand.c index ab8d8ecc866..7b51c369827 100644 --- a/cmd-line-utils/readline/histexpand.c +++ b/cmd-line-utils/readline/histexpand.c @@ -693,7 +693,7 @@ history_expand_internal (string, start, end_index_ptr, ret_string, current_line) case 's': { char *new_event; - int delimiter, failed, si, l_temp, ws, we; + int delimiter, failed, si, l_temp, we; if (c == 's') { @@ -792,7 +792,6 @@ history_expand_internal (string, start, end_index_ptr, ret_string, current_line) { for (; temp[si] && whitespace (temp[si]); si++) ; - ws = si; we = history_tokenize_word (temp, si); } diff --git a/cmd-line-utils/readline/histfile.c b/cmd-line-utils/readline/histfile.c index cbd367542ce..1a6d69b6684 100644 --- a/cmd-line-utils/readline/histfile.c +++ b/cmd-line-utils/readline/histfile.c @@ -402,6 +402,7 @@ history_truncate_file (fname, lines) if (bp > buffer && ((file = open (filename, O_WRONLY|O_TRUNC|O_BINARY, 0600)) != -1)) { bytes_written= write (file, bp, chars_read - (bp - buffer)); + (void) bytes_written; #if defined (__BEOS__) /* BeOS ignores O_TRUNC. */ diff --git a/cmd-line-utils/readline/isearch.c b/cmd-line-utils/readline/isearch.c index 305c847d8da..977e08eb9ba 100644 --- a/cmd-line-utils/readline/isearch.c +++ b/cmd-line-utils/readline/isearch.c @@ -617,7 +617,7 @@ rl_search_history (direction, invoking_key) int direction, invoking_key __attribute__((unused)); { _rl_search_cxt *cxt; /* local for now, but saved globally */ - int c, r; + int r; RL_SETSTATE(RL_STATE_ISEARCH); cxt = _rl_isearch_init (direction); @@ -632,7 +632,7 @@ rl_search_history (direction, invoking_key) r = -1; for (;;) { - c = _rl_search_getchar (cxt); + _rl_search_getchar (cxt); /* We might want to handle EOF here (c == 0) */ r = _rl_isearch_dispatch (cxt, cxt->lastc); if (r <= 0) @@ -655,9 +655,9 @@ int _rl_isearch_callback (cxt) _rl_search_cxt *cxt; { - int c, r; + int r; - c = _rl_search_getchar (cxt); + _rl_search_getchar (cxt); /* We might want to handle EOF here */ r = _rl_isearch_dispatch (cxt, cxt->lastc); diff --git a/cmd-line-utils/readline/parens.c b/cmd-line-utils/readline/parens.c index fe1578ed3e2..58f22291172 100644 --- a/cmd-line-utils/readline/parens.c +++ b/cmd-line-utils/readline/parens.c @@ -115,7 +115,7 @@ rl_insert_close (count, invoking_key) else { #if defined (HAVE_SELECT) - int orig_point, match_point, ready; + int orig_point, match_point; struct timeval timer; fd_set readfds; @@ -136,7 +136,7 @@ rl_insert_close (count, invoking_key) orig_point = rl_point; rl_point = match_point; (*rl_redisplay_function) (); - ready = select (1, &readfds, (fd_set *)NULL, (fd_set *)NULL, &timer); + select (1, &readfds, (fd_set *)NULL, (fd_set *)NULL, &timer); rl_point = orig_point; #else /* !HAVE_SELECT */ _rl_insert_char (count, invoking_key); diff --git a/cmd-line-utils/readline/readline.c b/cmd-line-utils/readline/readline.c index fb92becdbf9..95947551823 100644 --- a/cmd-line-utils/readline/readline.c +++ b/cmd-line-utils/readline/readline.c @@ -447,11 +447,10 @@ readline_internal_char () readline_internal_charloop () #endif { - static int lastc, eof_found; + static int lastc; int c, code, lk; lastc = -1; - eof_found = 0; #if !defined (READLINE_CALLBACKS) while (rl_done == 0) diff --git a/cmd-line-utils/readline/text.c b/cmd-line-utils/readline/text.c index bb0f5d97160..02b28750c86 100644 --- a/cmd-line-utils/readline/text.c +++ b/cmd-line-utils/readline/text.c @@ -811,11 +811,10 @@ _rl_overwrite_char (count, c) int i; #if defined (HANDLE_MULTIBYTE) char mbkey[MB_LEN_MAX]; - int k; /* Read an entire multibyte character sequence to insert COUNT times. */ if (count > 0 && MB_CUR_MAX > 1 && rl_byte_oriented == 0) - k = _rl_read_mbstring (c, mbkey, MB_LEN_MAX); + _rl_read_mbstring (c, mbkey, MB_LEN_MAX); #endif rl_begin_undo_group (); |