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
370 int lines = getmaxy(stdscr);370 int lines = getmaxy(stdscr);
371 371
372 for (i = 0; i < function_keys_num; i++) {372 for (i = 0; i < function_keys_num; i++) {
373 (void) wattrset(main_window, attributes[FUNCTION_HIGHLIGHT]);373 wattrset(main_window, attributes[FUNCTION_HIGHLIGHT]);
374 mvwprintw(main_window, lines-3, offset,374 mvwprintw(main_window, lines-3, offset,
375 "%s",375 "%s",
376 function_keys[i].key_str);376 function_keys[i].key_str);
377 (void) wattrset(main_window, attributes[FUNCTION_TEXT]);377 wattrset(main_window, attributes[FUNCTION_TEXT]);
378 offset += strlen(function_keys[i].key_str);378 offset += strlen(function_keys[i].key_str);
379 mvwprintw(main_window, lines-3,379 mvwprintw(main_window, lines-3,
380 offset, "%s",380 offset, "%s",
381 function_keys[i].func);381 function_keys[i].func);
382 offset += strlen(function_keys[i].func) + skip;382 offset += strlen(function_keys[i].func) + skip;
383 }383 }
384 (void) wattrset(main_window, attributes[NORMAL]);384 wattrset(main_window, attributes[NORMAL]);
385}385}
386 386
387/* help */387/* help */
@@ -954,16 +954,16 @@ static void show_menu(const char *prompt, const char *instructions, · 566 unmodified lines
954 current_instructions = instructions;954 current_instructions = instructions;
955 955
956 clear();956 clear();
957 (void) wattrset(main_window, attributes[NORMAL]);957 wattrset(main_window, attributes[NORMAL]);
958 print_in_middle(stdscr, 1, 0, getmaxx(stdscr),958 print_in_middle(stdscr, 1, 0, getmaxx(stdscr),
959 menu_backtitle,959 menu_backtitle,
960 attributes[MAIN_HEADING]);960 attributes[MAIN_HEADING]);
961 961
962 (void) wattrset(main_window, attributes[MAIN_MENU_BOX]);962 wattrset(main_window, attributes[MAIN_MENU_BOX]);
963 box(main_window, 0, 0);963 box(main_window, 0, 0);
964 (void) wattrset(main_window, attributes[MAIN_MENU_HEADING]);964 wattrset(main_window, attributes[MAIN_MENU_HEADING]);
965 mvwprintw(main_window, 0, 3, " %s ", prompt);965 mvwprintw(main_window, 0, 3, " %s ", prompt);
966 (void) wattrset(main_window, attributes[NORMAL]);966 wattrset(main_window, attributes[NORMAL]);
967 967
968 set_menu_items(curses_menu, curses_menu_items);968 set_menu_items(curses_menu, curses_menu_items);
969 969
scripts/kconfig/nconf.gui.c+10−10
@@ -167,7 +167,7 @@ void print_in_middle(WINDOW *win, · 166 unmodified lines
167 length = strlen(string);167 length = strlen(string);
168 temp = (width - length) / 2;168 temp = (width - length) / 2;
169 x = startx + (int)temp;169 x = startx + (int)temp;
170 (void) wattrset(win, color);170 wattrset(win, color);
171 mvwprintw(win, y, x, "%s", string);171 mvwprintw(win, y, x, "%s", string);
172 refresh();172 refresh();
173}173}
@@ -297,11 +297,11 @@ int btn_dialog(WINDOW *main_window, const char *msg, int btn_num, ...) · 123 unmodified lines
297 set_menu_fore(menu, attributes[DIALOG_MENU_FORE]);297 set_menu_fore(menu, attributes[DIALOG_MENU_FORE]);
298 set_menu_back(menu, attributes[DIALOG_MENU_BACK]);298 set_menu_back(menu, attributes[DIALOG_MENU_BACK]);
299 299
300 (void) wattrset(win, attributes[DIALOG_BOX]);300 wattrset(win, attributes[DIALOG_BOX]);
301 box(win, 0, 0);301 box(win, 0, 0);
302 302
303 /* print message */303 /* print message */
304 (void) wattrset(msg_win, attributes[DIALOG_TEXT]);304 wattrset(msg_win, attributes[DIALOG_TEXT]);
305 fill_window(msg_win, msg);305 fill_window(msg_win, msg);
306 306
307 set_menu_win(menu, win);307 set_menu_win(menu, win);
@@ -405,16 +405,16 @@ int dialog_inputbox(WINDOW *main_window, · 97 unmodified lines
405 form_win = derwin(win, 1, prompt_width, prompt_lines+3, 2);405 form_win = derwin(win, 1, prompt_width, prompt_lines+3, 2);
406 keypad(form_win, TRUE);406 keypad(form_win, TRUE);
407 407
408 (void) wattrset(form_win, attributes[INPUT_FIELD]);408 wattrset(form_win, attributes[INPUT_FIELD]);
409 409
410 (void) wattrset(win, attributes[INPUT_BOX]);410 wattrset(win, attributes[INPUT_BOX]);
411 box(win, 0, 0);411 box(win, 0, 0);
412 (void) wattrset(win, attributes[INPUT_HEADING]);412 wattrset(win, attributes[INPUT_HEADING]);
413 if (title)413 if (title)
414 mvwprintw(win, 0, 3, "%s", title);414 mvwprintw(win, 0, 3, "%s", title);
415 415
416 /* print message */416 /* print message */
417 (void) wattrset(prompt_win, attributes[INPUT_TEXT]);417 wattrset(prompt_win, attributes[INPUT_TEXT]);
418 fill_window(prompt_win, prompt);418 fill_window(prompt_win, prompt);
419 419
420 mvwprintw(form_win, 0, 0, "%*s", prompt_width, " ");420 mvwprintw(form_win, 0, 0, "%*s", prompt_width, " ");
@@ -576,7 +576,7 @@ void show_scroll_win(WINDOW *main_window, · 155 unmodified lines
576 576
577 /* create the pad */577 /* create the pad */
578 pad = newpad(total_lines+10, total_cols+10);578 pad = newpad(total_lines+10, total_cols+10);
579 (void) wattrset(pad, attributes[SCROLLWIN_TEXT]);579 wattrset(pad, attributes[SCROLLWIN_TEXT]);
580 fill_window(pad, text);580 fill_window(pad, text);
581 581
582 win_lines = min(total_lines+4, lines-2);582 win_lines = min(total_lines+4, lines-2);
@@ -591,9 +591,9 @@ void show_scroll_win(WINDOW *main_window, · 8 unmodified lines
591 win = newwin(win_lines, win_cols, y, x);591 win = newwin(win_lines, win_cols, y, x);
592 keypad(win, TRUE);592 keypad(win, TRUE);
593 /* show the help in the help window, and show the help panel */593 /* 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]);
595 box(win, 0, 0);595 box(win, 0, 0);
596 (void) wattrset(win, attributes[SCROLLWIN_HEADING]);596 wattrset(win, attributes[SCROLLWIN_HEADING]);
597 mvwprintw(win, 0, 3, " %s ", title);597 mvwprintw(win, 0, 3, " %s ", title);
598 panel = new_panel(win);598 panel = new_panel(win);
599 599