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>
2 files changed