History

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

This reverts commit 10175ba65fde ("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=39889

Masahiro Yamada committed 5 years ago

Commit 2ba50da1 parent 7f5ff552 files · +17 −17Browse files

Showing the changes to scripts (2 of 2 files). Show all

Unified · Split

2 files
  1. scripts/kconfig/nconf.c +7 −7
  2. scripts/kconfig/nconf.gui.c +10 −10
scripts/kconfig/nconf.c+7−7
@@ -370,18 +370,18 @@ static void print_function_line(void) · 369 unmodified lines
370370 int lines = getmaxy(stdscr);
371371
372372 for (i = 0; i < function_keys_num; i++) {
373− (void) wattrset(main_window, attributes[FUNCTION_HIGHLIGHT]);
373+ wattrset(main_window, attributes[FUNCTION_HIGHLIGHT]);
374374 mvwprintw(main_window, lines-3, offset,
375375 "%s",
376376 function_keys[i].key_str);
377− (void) wattrset(main_window, attributes[FUNCTION_TEXT]);
377+ wattrset(main_window, attributes[FUNCTION_TEXT]);
378378 offset += strlen(function_keys[i].key_str);
379379 mvwprintw(main_window, lines-3,
380380 offset, "%s",
381381 function_keys[i].func);
382382 offset += strlen(function_keys[i].func) + skip;
383383 }
384− (void) wattrset(main_window, attributes[NORMAL]);
384+ wattrset(main_window, attributes[NORMAL]);
385385 }
386386
387387 /* help */
@@ -954,16 +954,16 @@ static void show_menu(const char *prompt, const char *instructions, · 566 unmodified lines
954954 current_instructions = instructions;
955955
956956 clear();
957− (void) wattrset(main_window, attributes[NORMAL]);
957+ wattrset(main_window, attributes[NORMAL]);
958958 print_in_middle(stdscr, 1, 0, getmaxx(stdscr),
959959 menu_backtitle,
960960 attributes[MAIN_HEADING]);
961961
962− (void) wattrset(main_window, attributes[MAIN_MENU_BOX]);
962+ wattrset(main_window, attributes[MAIN_MENU_BOX]);
963963 box(main_window, 0, 0);
964− (void) wattrset(main_window, attributes[MAIN_MENU_HEADING]);
964+ wattrset(main_window, attributes[MAIN_MENU_HEADING]);
965965 mvwprintw(main_window, 0, 3, " %s ", prompt);
966− (void) wattrset(main_window, attributes[NORMAL]);
966+ wattrset(main_window, attributes[NORMAL]);
967967
968968 set_menu_items(curses_menu, curses_menu_items);
969969
scripts/kconfig/nconf.gui.c+10−10
@@ -167,7 +167,7 @@ void print_in_middle(WINDOW *win, · 166 unmodified lines
167167 length = strlen(string);
168168 temp = (width - length) / 2;
169169 x = startx + (int)temp;
170− (void) wattrset(win, color);
170+ wattrset(win, color);
171171 mvwprintw(win, y, x, "%s", string);
172172 refresh();
173173 }
@@ -297,11 +297,11 @@ int btn_dialog(WINDOW *main_window, const char *msg, int btn_num, ...) · 123 unmodified lines
297297 set_menu_fore(menu, attributes[DIALOG_MENU_FORE]);
298298 set_menu_back(menu, attributes[DIALOG_MENU_BACK]);
299299
300− (void) wattrset(win, attributes[DIALOG_BOX]);
300+ wattrset(win, attributes[DIALOG_BOX]);
301301 box(win, 0, 0);
302302
303303 /* print message */
304− (void) wattrset(msg_win, attributes[DIALOG_TEXT]);
304+ wattrset(msg_win, attributes[DIALOG_TEXT]);
305305 fill_window(msg_win, msg);
306306
307307 set_menu_win(menu, win);
@@ -405,16 +405,16 @@ int dialog_inputbox(WINDOW *main_window, · 97 unmodified lines
405405 form_win = derwin(win, 1, prompt_width, prompt_lines+3, 2);
406406 keypad(form_win, TRUE);
407407
408− (void) wattrset(form_win, attributes[INPUT_FIELD]);
408+ wattrset(form_win, attributes[INPUT_FIELD]);
409409
410− (void) wattrset(win, attributes[INPUT_BOX]);
410+ wattrset(win, attributes[INPUT_BOX]);
411411 box(win, 0, 0);
412− (void) wattrset(win, attributes[INPUT_HEADING]);
412+ wattrset(win, attributes[INPUT_HEADING]);
413413 if (title)
414414 mvwprintw(win, 0, 3, "%s", title);
415415
416416 /* print message */
417− (void) wattrset(prompt_win, attributes[INPUT_TEXT]);
417+ wattrset(prompt_win, attributes[INPUT_TEXT]);
418418 fill_window(prompt_win, prompt);
419419
420420 mvwprintw(form_win, 0, 0, "%*s", prompt_width, " ");
@@ -576,7 +576,7 @@ void show_scroll_win(WINDOW *main_window, · 155 unmodified lines
576576
577577 /* create the pad */
578578 pad = newpad(total_lines+10, total_cols+10);
579− (void) wattrset(pad, attributes[SCROLLWIN_TEXT]);
579+ wattrset(pad, attributes[SCROLLWIN_TEXT]);
580580 fill_window(pad, text);
581581
582582 win_lines = min(total_lines+4, lines-2);
@@ -591,9 +591,9 @@ void show_scroll_win(WINDOW *main_window, · 8 unmodified lines
591591 win = newwin(win_lines, win_cols, y, x);
592592 keypad(win, TRUE);
593593 /* show the help in the help window, and show the help panel */
594− (void) wattrset(win, attributes[SCROLLWIN_BOX]);
594+ wattrset(win, attributes[SCROLLWIN_BOX]);
595595 box(win, 0, 0);
596− (void) wattrset(win, attributes[SCROLLWIN_HEADING]);
596+ wattrset(win, attributes[SCROLLWIN_HEADING]);
597597 mvwprintw(win, 0, 3, " %s ", title);
598598 panel = new_panel(win);
599599