]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
gdb/tui: Fix build for older ncurses
authorCiaran Woodward <ciaranwoodward@xmos.com>
Thu, 11 Sep 2025 16:20:00 +0000 (16:20 +0000)
committerCiaran Woodward <ciaranwoodward@xmos.com>
Fri, 12 Sep 2025 17:15:37 +0000 (18:15 +0100)
commit9076d69190007e263cadbffc480fb93b1ca27f9c
treed6d46bd9632e591d4b83f2269cf53eb4d817e197
parent503fc476079060728f160f1a1af8b048fdef0c7e
gdb/tui: Fix build for older ncurses

Older versions of ncurses (including the version that ships inside
macos, and Centos 7) do not include the A_ITALIC macro. This patch
simply hides any use of A_ITALIC behind a preprocessor guard.

The result of this is that italics won't be rendered in the tui
if ncurses isn't supported. We do have other options if we think
it's important - for instance we could show italics as bold if
italics aren't supported. From my understanding, that might be
overthinking it - so I took the simplest approach here, just to
fix the build.

Those versions also define tgetnum as:
  int tgetnum(char *id);
so attempting to compile for c++ results in the error:
  ISO C++ forbids converting a string constant to 'char*' [-Werror=write-strings]

This is just a dated API issue, so a const cast resolves the issue.

Approved-By: Tom Tromey <tom@tromey.com>
gdb/tui/tui-io.c
gdb/ui-style.c