gdb: re-add necessary includes in tui/tui-win.c

Commit 9102a6c15c ("gdb/tui: cleanup includes") broke
gdb.python/tui-window.exp on Linux:

    Running /data/vries/gdb/src/gdb/testsuite/gdb.python/tui-window.exp ...
    WARNING: timeout in accept_gdb_output
    WARNING: timeout in accept_gdb_output
    FAIL: gdb.python/tui-window.exp: Window was updated

and caused a build failure on AIX:

    CXX    tui/tui-win.o
    tui/tui-win.c: In function 'void tui_sigwinch_handler(int)':
    tui/tui-win.c:532:3: error: 'mark_async_signal_handler' was not declared in this scope; did you mean 'async_signal_handler'?
      532 |   mark_async_signal_handler (tui_sigwinch_token);
          |   ^~~~~~~~~~~~~~~~~~~~~~~~~
          |   async_signal_handler
    tui/tui-win.c: At global scope:
    tui/tui-win.c:538:1: error: variable or field 'tui_async_resize_screen' declared void
      538 | tui_async_resize_screen (gdb_client_data arg)
          | ^~~~~~~~~~~~~~~~~~~~~~~
    tui/tui-win.c:538:26: error: 'gdb_client_data' was not declared in this scope
      538 | tui_async_resize_screen (gdb_client_data arg)
          |                          ^~~~~~~~~~~~~~~
    tui/tui-win.c: In function 'void tui_initialize_win()':
    tui/tui-win.c:579:36: error: 'tui_async_resize_screen' was not declared in this scope
      579 |     = create_async_signal_handler (tui_async_resize_screen, NULL,
          |                                    ^~~~~~~~~~~~~~~~~~~~~~~
    tui/tui-win.c:579:7: error: 'create_async_signal_handler' was not declared in this scope; did you mean 'async_signal_handler'?
      579 |     = create_async_signal_handler (tui_async_resize_screen, NULL,
          |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~
          |       async_signal_handler
    gmake: *** [Makefile:1947: tui/tui-win.o] Error 1

On Linux, the removal of the signal.h include causes the `#ifdef
SIGWINCH` sections to become inactive.  The code builds, but then the
TUI fails to react to terminal size changes.  When we add back the
inclusion of signal.h, then we see the same build error as on AIX.

On AIX, I suppose that the SIGWINCH define is still seen by some other
transitive include.

When I go back to before 9102a6c15c, I don't see async-event.h and
signal.h being marked as unneeded by clangd, so I'm not sure why I
removed them in the first place... I'll be more careful in the future
(files with #ifdef/#ifndef can be tricky w.r.t. determining necessary
includes).

So, re-add the inclusion of signal.h and async-event.h

Change-Id: I3ed385c2dc1726ade2118a5186ea7cccffd12635
Reported-By: Aditya Kamath1 <Aditya.Kamath1@ibm.com>
Reported-By: Tom de Vries <tdevries@suse.de>
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31865
This commit is contained in:
Simon Marchi 2024-06-10 10:43:10 +02:00 committed by Tom de Vries
parent 3ee50921cb
commit 8ebb6fcd07

View File

@ -24,6 +24,7 @@
Author: Susan B. Macchia */
#include "async-event.h"
#include "command.h"
#include "symtab.h"
#include "frame.h"
@ -46,6 +47,7 @@
#include "gdb_curses.h"
#include <ctype.h>
#include "readline/readline.h"
#include <signal.h>
#include <string_view>
static void tui_set_tab_width_command (const char *, int);