提交 9eb23fe2 编写于 作者: R Ryota Ozaki 提交者: Eric Blake

build: work around super-old readline.h

This patch shuts up the following warning of clang
on Mac OS X:

  virsh.c:2761:22: error: assigning to 'char *' from 'const char [6]' discards qualifiers
      [-Werror,-Wincompatible-pointer-types-discards-qualifiers]
      rl_readline_name = "virsh";
                       ^ ~~~~~~~

The warning happens because rl_readline_name on Mac OS X comes
from an old readline header that still uses 'char *', while it
is 'const char *' in readline 4.2 (April 2001) and newer.

Tested on Mac OS X 10.8.5 (clang-500.2.75) and Fedora 19 (gcc 4.8.1).
Signed-off-by: NRyota Ozaki <ozaki.ryota@gmail.com>
Signed-off-by: NEric Blake <eblake@redhat.com>
上级 6ce83e91
...@@ -2757,8 +2757,11 @@ vshReadlineInit(vshControl *ctl) ...@@ -2757,8 +2757,11 @@ vshReadlineInit(vshControl *ctl)
int max_history = 500; int max_history = 500;
const char *histsize_str; const char *histsize_str;
/* Allow conditional parsing of the ~/.inputrc file. */ /* Allow conditional parsing of the ~/.inputrc file.
rl_readline_name = "virsh"; * Work around ancient readline 4.1 (hello Mac OS X),
* which declared it as 'char *' instead of 'const char *'.
*/
rl_readline_name = (char *) "virsh";
/* Tell the completer that we want a crack first. */ /* Tell the completer that we want a crack first. */
rl_attempted_completion_function = vshReadlineCompletion; rl_attempted_completion_function = vshReadlineCompletion;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册