Re: [PATCH] kconfig: fix warnings due to unused return values

From: Michal Marek
Date: Wed Oct 05 2011 - 11:07:37 EST


On 22.9.2011 13:36, Sanjeev Premi wrote:
> The return value of wattrset() is being ignored in the
> code and newer compilers complain about this e.g.
>
> HOSTCC scripts/kconfig/lxdialog/checklist.o
> scripts/kconfig/lxdialog/checklist.c: In function print_item:
> scripts/kconfig/lxdialog/checklist.c:40: warning: value computed is not used
> scripts/kconfig/lxdialog/checklist.c:46: warning: value computed is not used
>
> Let the compiler know that ignore is intentional.
>
> Signed-off-by: Sanjeev Premi <premi@xxxxxx>
> ---
>
> The patch was created against the last pull from git.kernel.org
> The 'pull' from github is taking more than few hours...
>
> Based on the time stamps at this url, I believe the patch should
> apply cleanly:
> https://github.com/torvalds/linux/tree/master/scripts/kconfig/lxdialog

The latest kconfig tree is at http://repo.or.cz/w/linux-kbuild.git,
branch kconfig. You can pull it by

$ git fetch git://repo.or.cz/linux-kbuild.git kconfig:kconfig

> diff --git a/scripts/kconfig/lxdialog/checklist.c b/scripts/kconfig/lxdialog/checklist.c
> index a2eb80f..8407849 100644
> --- a/scripts/kconfig/lxdialog/checklist.c
> +++ b/scripts/kconfig/lxdialog/checklist.c
> @@ -37,20 +37,20 @@ static void print_item(WINDOW * win, int choice, int selected)
> list_item[list_width - item_x] = '\0';
>
> /* Clear 'residue' of last item */
> - wattrset(win, dlg.menubox.atr);
> + (void)wattrset(win, dlg.menubox.atr);
> wmove(win, choice, 0);
> for (i = 0; i < list_width; i++)
> waddch(win, ' ');
>
> wmove(win, choice, check_x);
> - wattrset(win, selected ? dlg.check_selected.atr
> + (void)wattrset(win, selected ? dlg.check_selected.atr

Uhm, not pretty. What ncurses version are you using? Can you post the
output of make V=1 menuconfig? It seems like wattrset is defined as a
macro instead of a function call. FWIW, it does not print any warnings
here with

$ rpm -qf /usr/include/ncurses
ncurses-devel-5.8-2.6.x86_64
and
gcc version 4.6.1 20110801 [gcc-4_6-branch revision 177033] (SUSE Linux)

on openSUSE Factory.

Michal
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/