mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-10-16 20:32:21 +08:00
Remove unnecessary casts from TUI
This removes a number of unnecessary casts from the TUI. Some were found with -Wuseless-cast (which, I think, can't easily be enabled for gdb); and some were found by inspection. Tested by rebuilding on x86-64 Fedora 28. I'm checking this in. gdb/ChangeLog 2018-10-15 Tom Tromey <tom@tromey.com> * tui/tui.c (strcat_to_buf): Remove casts. * tui/tui-winsource.c (tui_show_source_line) (tui_set_is_exec_point_at, tui_line_is_displayed): Remove casts. * tui/tui-wingeneral.c (tui_refresh_win, box_win): Remove casts. * tui/tui-windata.c (tui_first_data_item_displayed) (tui_delete_data_content_windows, tui_erase_data_content) (tui_display_all_data, tui_display_data_from) (tui_refresh_data_win, tui_vertical_data_scroll): Remove casts. * tui/tui-win.c (tui_set_win_height) (make_invisible_and_set_new_height, parse_scrolling_args): Remove casts. * tui/tui-win.c (tui_resize_all): Remove casts. (tui_scroll_backward_command, tui_set_focus) (tui_set_tab_width_command): Likewise. * tui/tui-source.c (tui_vertical_source_scroll): Remove cast. * tui/tui-regs.c (tui_show_register_group): Remove cast. * tui/tui-layout.c (tui_set_layout_by_name): Remove cast. * tui/tui-disasm.c (tui_vertical_disassem_scroll): Remove cast. * tui/tui-data.c (tui_partial_win_by_name, tui_free_win_content): Remove casts.
This commit is contained in:
@ -1,3 +1,26 @@
|
|||||||
|
2018-10-15 Tom Tromey <tom@tromey.com>
|
||||||
|
|
||||||
|
* tui/tui.c (strcat_to_buf): Remove casts.
|
||||||
|
* tui/tui-winsource.c (tui_show_source_line)
|
||||||
|
(tui_set_is_exec_point_at, tui_line_is_displayed): Remove casts.
|
||||||
|
* tui/tui-wingeneral.c (tui_refresh_win, box_win): Remove casts.
|
||||||
|
* tui/tui-windata.c (tui_first_data_item_displayed)
|
||||||
|
(tui_delete_data_content_windows, tui_erase_data_content)
|
||||||
|
(tui_display_all_data, tui_display_data_from)
|
||||||
|
(tui_refresh_data_win, tui_vertical_data_scroll): Remove casts.
|
||||||
|
* tui/tui-win.c (tui_set_win_height)
|
||||||
|
(make_invisible_and_set_new_height, parse_scrolling_args): Remove
|
||||||
|
casts.
|
||||||
|
* tui/tui-win.c (tui_resize_all): Remove casts.
|
||||||
|
(tui_scroll_backward_command, tui_set_focus)
|
||||||
|
(tui_set_tab_width_command): Likewise.
|
||||||
|
* tui/tui-source.c (tui_vertical_source_scroll): Remove cast.
|
||||||
|
* tui/tui-regs.c (tui_show_register_group): Remove cast.
|
||||||
|
* tui/tui-layout.c (tui_set_layout_by_name): Remove cast.
|
||||||
|
* tui/tui-disasm.c (tui_vertical_disassem_scroll): Remove cast.
|
||||||
|
* tui/tui-data.c (tui_partial_win_by_name, tui_free_win_content):
|
||||||
|
Remove casts.
|
||||||
|
|
||||||
2018-10-15 Simon Marchi <simon.marchi@ericsson.com>
|
2018-10-15 Simon Marchi <simon.marchi@ericsson.com>
|
||||||
|
|
||||||
* MAINTAINERS (Responsible Maintainers): Add Alan Hayward as
|
* MAINTAINERS (Responsible Maintainers): Add Alan Hayward as
|
||||||
|
@ -375,7 +375,7 @@ tui_partial_win_by_name (const char *name)
|
|||||||
{
|
{
|
||||||
struct tui_win_info *win_info = NULL;
|
struct tui_win_info *win_info = NULL;
|
||||||
|
|
||||||
if (name != (char *) NULL)
|
if (name != NULL)
|
||||||
{
|
{
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
@ -766,7 +766,7 @@ tui_free_win_content (struct tui_gen_win_info *win_info)
|
|||||||
{
|
{
|
||||||
if (win_info->content != NULL)
|
if (win_info->content != NULL)
|
||||||
{
|
{
|
||||||
free_content ((tui_win_content) win_info->content,
|
free_content (win_info->content,
|
||||||
win_info->content_size,
|
win_info->content_size,
|
||||||
win_info->type);
|
win_info->type);
|
||||||
win_info->content = NULL;
|
win_info->content = NULL;
|
||||||
|
@ -384,7 +384,7 @@ tui_vertical_disassem_scroll (enum tui_scroll_direction scroll_direction,
|
|||||||
struct tui_line_or_address val;
|
struct tui_line_or_address val;
|
||||||
int dir;
|
int dir;
|
||||||
|
|
||||||
content = (tui_win_content) TUI_DISASM_WIN->generic.content;
|
content = TUI_DISASM_WIN->generic.content;
|
||||||
|
|
||||||
pc = content[0]->which_element.source.line_or_addr.u.addr;
|
pc = content[0]->which_element.source.line_or_addr.u.addr;
|
||||||
num_to_scroll++;
|
num_to_scroll++;
|
||||||
|
@ -401,7 +401,7 @@ tui_set_layout_by_name (const char *layout_name)
|
|||||||
{
|
{
|
||||||
enum tui_status status = TUI_SUCCESS;
|
enum tui_status status = TUI_SUCCESS;
|
||||||
|
|
||||||
if (layout_name != (char *) NULL)
|
if (layout_name != NULL)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
enum tui_layout_type new_layout = UNDEFINED_LAYOUT;
|
enum tui_layout_type new_layout = UNDEFINED_LAYOUT;
|
||||||
|
@ -247,8 +247,7 @@ tui_show_register_group (struct reggroup *group,
|
|||||||
TUI_DATA_WIN->generic.content = NULL;
|
TUI_DATA_WIN->generic.content = NULL;
|
||||||
TUI_DATA_WIN->generic.content_size = 0;
|
TUI_DATA_WIN->generic.content_size = 0;
|
||||||
tui_add_content_elements (&TUI_DATA_WIN->generic, nr_regs);
|
tui_add_content_elements (&TUI_DATA_WIN->generic, nr_regs);
|
||||||
display_info->regs_content
|
display_info->regs_content = TUI_DATA_WIN->generic.content;
|
||||||
= (tui_win_content) TUI_DATA_WIN->generic.content;
|
|
||||||
display_info->regs_content_count = nr_regs;
|
display_info->regs_content_count = nr_regs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -351,7 +351,7 @@ tui_vertical_source_scroll (enum tui_scroll_direction scroll_direction,
|
|||||||
{
|
{
|
||||||
struct tui_line_or_address l;
|
struct tui_line_or_address l;
|
||||||
struct symtab *s;
|
struct symtab *s;
|
||||||
tui_win_content content = (tui_win_content) TUI_SRC_WIN->generic.content;
|
tui_win_content content = TUI_SRC_WIN->generic.content;
|
||||||
struct symtab_and_line cursal = get_current_source_symtab_and_line ();
|
struct symtab_and_line cursal = get_current_source_symtab_and_line ();
|
||||||
|
|
||||||
if (cursal.symtab == (struct symtab *) NULL)
|
if (cursal.symtab == (struct symtab *) NULL)
|
||||||
|
@ -793,7 +793,7 @@ tui_resize_all (void)
|
|||||||
{
|
{
|
||||||
case SRC_COMMAND:
|
case SRC_COMMAND:
|
||||||
case DISASSEM_COMMAND:
|
case DISASSEM_COMMAND:
|
||||||
first_win = (struct tui_win_info *) (tui_source_windows ())->list[0];
|
first_win = tui_source_windows ()->list[0];
|
||||||
first_win->generic.width += width_diff;
|
first_win->generic.width += width_diff;
|
||||||
locator->width += width_diff;
|
locator->width += width_diff;
|
||||||
/* Check for invalid heights. */
|
/* Check for invalid heights. */
|
||||||
@ -830,8 +830,7 @@ tui_resize_all (void)
|
|||||||
{
|
{
|
||||||
first_win = TUI_DATA_WIN;
|
first_win = TUI_DATA_WIN;
|
||||||
first_win->generic.width += width_diff;
|
first_win->generic.width += width_diff;
|
||||||
second_win = (struct tui_win_info *)
|
second_win = tui_source_windows ()->list[0];
|
||||||
(tui_source_windows ())->list[0];
|
|
||||||
second_win->generic.width += width_diff;
|
second_win->generic.width += width_diff;
|
||||||
}
|
}
|
||||||
/* Change the first window's height/width. */
|
/* Change the first window's height/width. */
|
||||||
@ -984,7 +983,7 @@ tui_scroll_forward_command (const char *arg, int from_tty)
|
|||||||
|
|
||||||
/* Make sure the curses mode is enabled. */
|
/* Make sure the curses mode is enabled. */
|
||||||
tui_enable ();
|
tui_enable ();
|
||||||
if (arg == (char *) NULL)
|
if (arg == NULL)
|
||||||
parse_scrolling_args (arg, &win_to_scroll, (int *) NULL);
|
parse_scrolling_args (arg, &win_to_scroll, (int *) NULL);
|
||||||
else
|
else
|
||||||
parse_scrolling_args (arg, &win_to_scroll, &num_to_scroll);
|
parse_scrolling_args (arg, &win_to_scroll, &num_to_scroll);
|
||||||
@ -1000,7 +999,7 @@ tui_scroll_backward_command (const char *arg, int from_tty)
|
|||||||
|
|
||||||
/* Make sure the curses mode is enabled. */
|
/* Make sure the curses mode is enabled. */
|
||||||
tui_enable ();
|
tui_enable ();
|
||||||
if (arg == (char *) NULL)
|
if (arg == NULL)
|
||||||
parse_scrolling_args (arg, &win_to_scroll, (int *) NULL);
|
parse_scrolling_args (arg, &win_to_scroll, (int *) NULL);
|
||||||
else
|
else
|
||||||
parse_scrolling_args (arg, &win_to_scroll, &num_to_scroll);
|
parse_scrolling_args (arg, &win_to_scroll, &num_to_scroll);
|
||||||
@ -1038,9 +1037,9 @@ tui_scroll_right_command (const char *arg, int from_tty)
|
|||||||
static void
|
static void
|
||||||
tui_set_focus (const char *arg, int from_tty)
|
tui_set_focus (const char *arg, int from_tty)
|
||||||
{
|
{
|
||||||
if (arg != (char *) NULL)
|
if (arg != NULL)
|
||||||
{
|
{
|
||||||
char *buf_ptr = (char *) xstrdup (arg);
|
char *buf_ptr = xstrdup (arg);
|
||||||
int i;
|
int i;
|
||||||
struct tui_win_info *win_info = NULL;
|
struct tui_win_info *win_info = NULL;
|
||||||
|
|
||||||
@ -1121,7 +1120,7 @@ tui_set_tab_width_command (const char *arg, int from_tty)
|
|||||||
{
|
{
|
||||||
/* Make sure the curses mode is enabled. */
|
/* Make sure the curses mode is enabled. */
|
||||||
tui_enable ();
|
tui_enable ();
|
||||||
if (arg != (char *) NULL)
|
if (arg != NULL)
|
||||||
{
|
{
|
||||||
int ts;
|
int ts;
|
||||||
|
|
||||||
@ -1160,7 +1159,7 @@ tui_set_win_height (const char *arg, int from_tty)
|
|||||||
{
|
{
|
||||||
/* Make sure the curses mode is enabled. */
|
/* Make sure the curses mode is enabled. */
|
||||||
tui_enable ();
|
tui_enable ();
|
||||||
if (arg != (char *) NULL)
|
if (arg != NULL)
|
||||||
{
|
{
|
||||||
std::string copy = arg;
|
std::string copy = arg;
|
||||||
char *buf = ©[0];
|
char *buf = ©[0];
|
||||||
@ -1171,7 +1170,7 @@ tui_set_win_height (const char *arg, int from_tty)
|
|||||||
|
|
||||||
wname = buf_ptr;
|
wname = buf_ptr;
|
||||||
buf_ptr = strchr (buf_ptr, ' ');
|
buf_ptr = strchr (buf_ptr, ' ');
|
||||||
if (buf_ptr != (char *) NULL)
|
if (buf_ptr != NULL)
|
||||||
{
|
{
|
||||||
*buf_ptr = (char) 0;
|
*buf_ptr = (char) 0;
|
||||||
|
|
||||||
@ -1444,9 +1443,8 @@ make_invisible_and_set_new_height (struct tui_win_info *win_info,
|
|||||||
/* Delete all data item windows. */
|
/* Delete all data item windows. */
|
||||||
for (i = 0; i < win_info->generic.content_size; i++)
|
for (i = 0; i < win_info->generic.content_size; i++)
|
||||||
{
|
{
|
||||||
gen_win_info = (struct tui_gen_win_info *)
|
gen_win_info
|
||||||
&((struct tui_win_element *)
|
= &win_info->generic.content[i]->which_element.data_window;
|
||||||
win_info->generic.content[i])->which_element.data_window;
|
|
||||||
tui_delete_win (gen_win_info->handle);
|
tui_delete_win (gen_win_info->handle);
|
||||||
gen_win_info->handle = NULL;
|
gen_win_info->handle = NULL;
|
||||||
}
|
}
|
||||||
@ -1653,7 +1651,7 @@ parse_scrolling_args (const char *arg,
|
|||||||
|
|
||||||
/* First set up the default window to scroll, in case there is no
|
/* First set up the default window to scroll, in case there is no
|
||||||
window name arg. */
|
window name arg. */
|
||||||
if (arg != (char *) NULL)
|
if (arg != NULL)
|
||||||
{
|
{
|
||||||
char *buf_ptr;
|
char *buf_ptr;
|
||||||
|
|
||||||
@ -1666,7 +1664,7 @@ parse_scrolling_args (const char *arg,
|
|||||||
|
|
||||||
num_str = buf_ptr;
|
num_str = buf_ptr;
|
||||||
buf_ptr = strchr (buf_ptr, ' ');
|
buf_ptr = strchr (buf_ptr, ' ');
|
||||||
if (buf_ptr != (char *) NULL)
|
if (buf_ptr != NULL)
|
||||||
{
|
{
|
||||||
*buf_ptr = (char) 0;
|
*buf_ptr = (char) 0;
|
||||||
if (num_to_scroll)
|
if (num_to_scroll)
|
||||||
@ -1678,7 +1676,7 @@ parse_scrolling_args (const char *arg,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Process the window name if one is specified. */
|
/* Process the window name if one is specified. */
|
||||||
if (buf_ptr != (char *) NULL)
|
if (buf_ptr != NULL)
|
||||||
{
|
{
|
||||||
const char *wname;
|
const char *wname;
|
||||||
|
|
||||||
|
@ -53,8 +53,8 @@ tui_first_data_item_displayed (void)
|
|||||||
{
|
{
|
||||||
struct tui_gen_win_info *data_item_win;
|
struct tui_gen_win_info *data_item_win;
|
||||||
|
|
||||||
data_item_win = &((tui_win_content)
|
data_item_win
|
||||||
TUI_DATA_WIN->generic.content)[i]->which_element.data_window;
|
= &TUI_DATA_WIN->generic.content[i]->which_element.data_window;
|
||||||
if (data_item_win->handle != (WINDOW *) NULL
|
if (data_item_win->handle != (WINDOW *) NULL
|
||||||
&& data_item_win->is_visible)
|
&& data_item_win->is_visible)
|
||||||
element_no = i;
|
element_no = i;
|
||||||
@ -91,8 +91,8 @@ tui_delete_data_content_windows (void)
|
|||||||
|
|
||||||
for (i = 0; (i < TUI_DATA_WIN->generic.content_size); i++)
|
for (i = 0; (i < TUI_DATA_WIN->generic.content_size); i++)
|
||||||
{
|
{
|
||||||
data_item_win_ptr = &((tui_win_content)
|
data_item_win_ptr
|
||||||
TUI_DATA_WIN->generic.content)[i]->which_element.data_window;
|
= &TUI_DATA_WIN->generic.content[i]->which_element.data_window;
|
||||||
tui_delete_win (data_item_win_ptr->handle);
|
tui_delete_win (data_item_win_ptr->handle);
|
||||||
data_item_win_ptr->handle = NULL;
|
data_item_win_ptr->handle = NULL;
|
||||||
data_item_win_ptr->is_visible = FALSE;
|
data_item_win_ptr->is_visible = FALSE;
|
||||||
@ -105,7 +105,7 @@ tui_erase_data_content (const char *prompt)
|
|||||||
{
|
{
|
||||||
werase (TUI_DATA_WIN->generic.handle);
|
werase (TUI_DATA_WIN->generic.handle);
|
||||||
tui_check_and_display_highlight_if_needed (TUI_DATA_WIN);
|
tui_check_and_display_highlight_if_needed (TUI_DATA_WIN);
|
||||||
if (prompt != (char *) NULL)
|
if (prompt != NULL)
|
||||||
{
|
{
|
||||||
int half_width = (TUI_DATA_WIN->generic.width - 2) / 2;
|
int half_width = (TUI_DATA_WIN->generic.width - 2) / 2;
|
||||||
int x_pos;
|
int x_pos;
|
||||||
@ -132,7 +132,7 @@ tui_display_all_data (void)
|
|||||||
tui_erase_data_content (NO_DATA_STRING);
|
tui_erase_data_content (NO_DATA_STRING);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
tui_erase_data_content ((char *) NULL);
|
tui_erase_data_content (NULL);
|
||||||
tui_delete_data_content_windows ();
|
tui_delete_data_content_windows ();
|
||||||
tui_check_and_display_highlight_if_needed (TUI_DATA_WIN);
|
tui_check_and_display_highlight_if_needed (TUI_DATA_WIN);
|
||||||
tui_display_registers_from (0);
|
tui_display_registers_from (0);
|
||||||
@ -201,7 +201,7 @@ tui_display_data_from (int element_no, int reuse_windows)
|
|||||||
|
|
||||||
if (first_line >= 0)
|
if (first_line >= 0)
|
||||||
{
|
{
|
||||||
tui_erase_data_content ((char *) NULL);
|
tui_erase_data_content (NULL);
|
||||||
if (!reuse_windows)
|
if (!reuse_windows)
|
||||||
tui_delete_data_content_windows ();
|
tui_delete_data_content_windows ();
|
||||||
tui_display_data_from_line (first_line);
|
tui_display_data_from_line (first_line);
|
||||||
@ -213,7 +213,7 @@ tui_display_data_from (int element_no, int reuse_windows)
|
|||||||
void
|
void
|
||||||
tui_refresh_data_win (void)
|
tui_refresh_data_win (void)
|
||||||
{
|
{
|
||||||
tui_erase_data_content ((char *) NULL);
|
tui_erase_data_content (NULL);
|
||||||
if (TUI_DATA_WIN->generic.content_size > 0)
|
if (TUI_DATA_WIN->generic.content_size > 0)
|
||||||
{
|
{
|
||||||
int first_element = tui_first_data_item_displayed ();
|
int first_element = tui_first_data_item_displayed ();
|
||||||
@ -284,7 +284,7 @@ tui_vertical_data_scroll (enum tui_scroll_direction scroll_direction,
|
|||||||
first_line += num_to_scroll;
|
first_line += num_to_scroll;
|
||||||
else
|
else
|
||||||
first_line -= num_to_scroll;
|
first_line -= num_to_scroll;
|
||||||
tui_erase_data_content ((char *) NULL);
|
tui_erase_data_content (NULL);
|
||||||
tui_delete_data_content_windows ();
|
tui_delete_data_content_windows ();
|
||||||
tui_display_data_from_line (first_line);
|
tui_display_data_from_line (first_line);
|
||||||
}
|
}
|
||||||
|
@ -43,8 +43,7 @@ tui_refresh_win (struct tui_gen_win_info *win_info)
|
|||||||
{
|
{
|
||||||
struct tui_gen_win_info *data_item_win_ptr;
|
struct tui_gen_win_info *data_item_win_ptr;
|
||||||
|
|
||||||
data_item_win_ptr = &((tui_win_content)
|
data_item_win_ptr = &win_info->content[i]->which_element.data_window;
|
||||||
win_info->content)[i]->which_element.data_window;
|
|
||||||
if (data_item_win_ptr != NULL
|
if (data_item_win_ptr != NULL
|
||||||
&& data_item_win_ptr->handle != (WINDOW *) NULL)
|
&& data_item_win_ptr->handle != (WINDOW *) NULL)
|
||||||
wrefresh (data_item_win_ptr->handle);
|
wrefresh (data_item_win_ptr->handle);
|
||||||
@ -101,7 +100,7 @@ box_win (struct tui_gen_win_info *win_info,
|
|||||||
box (win, tui_border_vline, tui_border_hline);
|
box (win, tui_border_vline, tui_border_hline);
|
||||||
#endif
|
#endif
|
||||||
if (win_info->title)
|
if (win_info->title)
|
||||||
mvwaddstr (win, 0, 3, (char *) win_info->title);
|
mvwaddstr (win, 0, 3, win_info->title);
|
||||||
wattroff (win, attrs);
|
wattroff (win, attrs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -279,7 +279,7 @@ tui_show_source_line (struct tui_win_info *win_info, int lineno)
|
|||||||
wattron (win_info->generic.handle, A_STANDOUT);
|
wattron (win_info->generic.handle, A_STANDOUT);
|
||||||
|
|
||||||
mvwaddstr (win_info->generic.handle, lineno, 1,
|
mvwaddstr (win_info->generic.handle, lineno, 1,
|
||||||
(char *) line->which_element.source.line);
|
line->which_element.source.line);
|
||||||
if (line->which_element.source.is_exec_point)
|
if (line->which_element.source.is_exec_point)
|
||||||
wattroff (win_info->generic.handle, A_STANDOUT);
|
wattroff (win_info->generic.handle, A_STANDOUT);
|
||||||
|
|
||||||
@ -364,7 +364,7 @@ tui_set_is_exec_point_at (struct tui_line_or_address l,
|
|||||||
{
|
{
|
||||||
int changed = 0;
|
int changed = 0;
|
||||||
int i;
|
int i;
|
||||||
tui_win_content content = (tui_win_content) win_info->generic.content;
|
tui_win_content content = win_info->generic.content;
|
||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
while (i < win_info->generic.content_size)
|
while (i < win_info->generic.content_size)
|
||||||
@ -651,7 +651,7 @@ tui_line_is_displayed (int line,
|
|||||||
= win_info->generic.content[i]
|
= win_info->generic.content[i]
|
||||||
->which_element.source.line_or_addr.loa == LOA_LINE
|
->which_element.source.line_or_addr.loa == LOA_LINE
|
||||||
&& win_info->generic.content[i]
|
&& win_info->generic.content[i]
|
||||||
->which_element.source.line_or_addr.u.line_no == (int) line;
|
->which_element.source.line_or_addr.u.line_no == line;
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -562,7 +562,7 @@ void
|
|||||||
strcat_to_buf (char *buf, int buflen,
|
strcat_to_buf (char *buf, int buflen,
|
||||||
const char *item_to_add)
|
const char *item_to_add)
|
||||||
{
|
{
|
||||||
if (item_to_add != (char *) NULL && buf != (char *) NULL)
|
if (item_to_add != NULL && buf != NULL)
|
||||||
{
|
{
|
||||||
if ((strlen (buf) + strlen (item_to_add)) <= buflen)
|
if ((strlen (buf) + strlen (item_to_add)) <= buflen)
|
||||||
strcat (buf, item_to_add);
|
strcat (buf, item_to_add);
|
||||||
|
Reference in New Issue
Block a user