Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom Tromey <tom@tromey.com>
To: Ciaran Woodward <ciaranwoodward@xmos.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH 1/1] gdb/tui: Fix build for older ncurses
Date: Fri, 12 Sep 2025 09:04:09 -0600	[thread overview]
Message-ID: <878qijogpi.fsf@tromey.com> (raw)
In-Reply-To: <20250911183021.17844-1-ciaranwoodward@xmos.com> (Ciaran Woodward's message of "Thu, 11 Sep 2025 19:30:21 +0100")

>>>>> "Ciaran" == Ciaran Woodward <ciaranwoodward@xmos.com> writes:

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

Thanks for doing this.

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

Seems reasonable enough.

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

Ciaran> diff --git a/gdb/ui-style.c b/gdb/ui-style.c
Ciaran> index 9a58e4dd2ae..ccc9094ca59 100644
Ciaran> --- a/gdb/ui-style.c
Ciaran> +++ b/gdb/ui-style.c
Ciaran> @@ -594,7 +594,7 @@ colorsupport ()
Ciaran>      {
Ciaran>        std::vector<color_space> result = {color_space::MONOCHROME};
 
Ciaran> -      int colors = tgetnum ("Co");
Ciaran> +      int colors = tgetnum (const_cast<char*> ("Co"));

Would you mind adding a comment here explaining the need for the cast
and also for which version of curses it was found to be needed?
I think that may help future developers.

Anyway ok with this change.
Approved-By: Tom Tromey <tom@tromey.com>

Tom

  reply	other threads:[~2025-09-12 15:04 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-11 18:30 Ciaran Woodward
2025-09-12 15:04 ` Tom Tromey [this message]
2025-09-12 17:17   ` Ciaran Woodward
2026-07-27 16:15     ` Daniel Fellows
2026-07-28 13:29       ` Ciaran Woodward
2026-07-28 13:38         ` Daniel Fellows

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=878qijogpi.fsf@tromey.com \
    --to=tom@tromey.com \
    --cc=ciaranwoodward@xmos.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox