Commit 2ba50da9 authored by Masahiro Yamada's avatar Masahiro Yamada

kconfig: nconf: get rid of (void) casts from wattrset() calls

This reverts commit 10175ba6 ("nconfig: Silence unused return values
from wattrset").

With this patch applied, recent GCC versions can cleanly build nconf
without "value computed is not used" warnings.

The wattrset() used to be implemented as a macro, like this:

  #define wattrset(win,at) \
          (NCURSES_OK_ADDR(win) \
            ? ((win)->_attrs = NCURSES_CAST(attr_t, at), \
               OK) \
            : ERR)

The GCC bugzilla [1] reported a false-positive -Wunused-value warning
in a similar test case. It was fixed by GCC 4.4.1.

Let's revert that commit, and see if somebody will claim the issue.

[1]: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=39889Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
parent 7f5ff55b
...@@ -370,18 +370,18 @@ static void print_function_line(void) ...@@ -370,18 +370,18 @@ static void print_function_line(void)
int lines = getmaxy(stdscr); int lines = getmaxy(stdscr);
for (i = 0; i < function_keys_num; i++) { for (i = 0; i < function_keys_num; i++) {
(void) wattrset(main_window, attributes[FUNCTION_HIGHLIGHT]); wattrset(main_window, attributes[FUNCTION_HIGHLIGHT]);
mvwprintw(main_window, lines-3, offset, mvwprintw(main_window, lines-3, offset,
"%s", "%s",
function_keys[i].key_str); function_keys[i].key_str);
(void) wattrset(main_window, attributes[FUNCTION_TEXT]); wattrset(main_window, attributes[FUNCTION_TEXT]);
offset += strlen(function_keys[i].key_str); offset += strlen(function_keys[i].key_str);
mvwprintw(main_window, lines-3, mvwprintw(main_window, lines-3,
offset, "%s", offset, "%s",
function_keys[i].func); function_keys[i].func);
offset += strlen(function_keys[i].func) + skip; offset += strlen(function_keys[i].func) + skip;
} }
(void) wattrset(main_window, attributes[NORMAL]); wattrset(main_window, attributes[NORMAL]);
} }
/* help */ /* help */
...@@ -954,16 +954,16 @@ static void show_menu(const char *prompt, const char *instructions, ...@@ -954,16 +954,16 @@ static void show_menu(const char *prompt, const char *instructions,
current_instructions = instructions; current_instructions = instructions;
clear(); clear();
(void) wattrset(main_window, attributes[NORMAL]); wattrset(main_window, attributes[NORMAL]);
print_in_middle(stdscr, 1, 0, getmaxx(stdscr), print_in_middle(stdscr, 1, 0, getmaxx(stdscr),
menu_backtitle, menu_backtitle,
attributes[MAIN_HEADING]); attributes[MAIN_HEADING]);
(void) wattrset(main_window, attributes[MAIN_MENU_BOX]); wattrset(main_window, attributes[MAIN_MENU_BOX]);
box(main_window, 0, 0); box(main_window, 0, 0);
(void) wattrset(main_window, attributes[MAIN_MENU_HEADING]); wattrset(main_window, attributes[MAIN_MENU_HEADING]);
mvwprintw(main_window, 0, 3, " %s ", prompt); mvwprintw(main_window, 0, 3, " %s ", prompt);
(void) wattrset(main_window, attributes[NORMAL]); wattrset(main_window, attributes[NORMAL]);
set_menu_items(curses_menu, curses_menu_items); set_menu_items(curses_menu, curses_menu_items);
......
...@@ -167,7 +167,7 @@ void print_in_middle(WINDOW *win, ...@@ -167,7 +167,7 @@ void print_in_middle(WINDOW *win,
length = strlen(string); length = strlen(string);
temp = (width - length) / 2; temp = (width - length) / 2;
x = startx + (int)temp; x = startx + (int)temp;
(void) wattrset(win, color); wattrset(win, color);
mvwprintw(win, y, x, "%s", string); mvwprintw(win, y, x, "%s", string);
refresh(); refresh();
} }
...@@ -297,11 +297,11 @@ int btn_dialog(WINDOW *main_window, const char *msg, int btn_num, ...) ...@@ -297,11 +297,11 @@ int btn_dialog(WINDOW *main_window, const char *msg, int btn_num, ...)
set_menu_fore(menu, attributes[DIALOG_MENU_FORE]); set_menu_fore(menu, attributes[DIALOG_MENU_FORE]);
set_menu_back(menu, attributes[DIALOG_MENU_BACK]); set_menu_back(menu, attributes[DIALOG_MENU_BACK]);
(void) wattrset(win, attributes[DIALOG_BOX]); wattrset(win, attributes[DIALOG_BOX]);
box(win, 0, 0); box(win, 0, 0);
/* print message */ /* print message */
(void) wattrset(msg_win, attributes[DIALOG_TEXT]); wattrset(msg_win, attributes[DIALOG_TEXT]);
fill_window(msg_win, msg); fill_window(msg_win, msg);
set_menu_win(menu, win); set_menu_win(menu, win);
...@@ -405,16 +405,16 @@ int dialog_inputbox(WINDOW *main_window, ...@@ -405,16 +405,16 @@ int dialog_inputbox(WINDOW *main_window,
form_win = derwin(win, 1, prompt_width, prompt_lines+3, 2); form_win = derwin(win, 1, prompt_width, prompt_lines+3, 2);
keypad(form_win, TRUE); keypad(form_win, TRUE);
(void) wattrset(form_win, attributes[INPUT_FIELD]); wattrset(form_win, attributes[INPUT_FIELD]);
(void) wattrset(win, attributes[INPUT_BOX]); wattrset(win, attributes[INPUT_BOX]);
box(win, 0, 0); box(win, 0, 0);
(void) wattrset(win, attributes[INPUT_HEADING]); wattrset(win, attributes[INPUT_HEADING]);
if (title) if (title)
mvwprintw(win, 0, 3, "%s", title); mvwprintw(win, 0, 3, "%s", title);
/* print message */ /* print message */
(void) wattrset(prompt_win, attributes[INPUT_TEXT]); wattrset(prompt_win, attributes[INPUT_TEXT]);
fill_window(prompt_win, prompt); fill_window(prompt_win, prompt);
mvwprintw(form_win, 0, 0, "%*s", prompt_width, " "); mvwprintw(form_win, 0, 0, "%*s", prompt_width, " ");
...@@ -576,7 +576,7 @@ void show_scroll_win(WINDOW *main_window, ...@@ -576,7 +576,7 @@ void show_scroll_win(WINDOW *main_window,
/* create the pad */ /* create the pad */
pad = newpad(total_lines+10, total_cols+10); pad = newpad(total_lines+10, total_cols+10);
(void) wattrset(pad, attributes[SCROLLWIN_TEXT]); wattrset(pad, attributes[SCROLLWIN_TEXT]);
fill_window(pad, text); fill_window(pad, text);
win_lines = min(total_lines+4, lines-2); win_lines = min(total_lines+4, lines-2);
...@@ -591,9 +591,9 @@ void show_scroll_win(WINDOW *main_window, ...@@ -591,9 +591,9 @@ void show_scroll_win(WINDOW *main_window,
win = newwin(win_lines, win_cols, y, x); win = newwin(win_lines, win_cols, y, x);
keypad(win, TRUE); keypad(win, TRUE);
/* show the help in the help window, and show the help panel */ /* show the help in the help window, and show the help panel */
(void) wattrset(win, attributes[SCROLLWIN_BOX]); wattrset(win, attributes[SCROLLWIN_BOX]);
box(win, 0, 0); box(win, 0, 0);
(void) wattrset(win, attributes[SCROLLWIN_HEADING]); wattrset(win, attributes[SCROLLWIN_HEADING]);
mvwprintw(win, 0, 3, " %s ", title); mvwprintw(win, 0, 3, " %s ", title);
panel = new_panel(win); panel = new_panel(win);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment