Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom de Vries <tdevries@suse.de>
To: Simon Marchi <simon.marchi@efficios.com>, gdb-patches@sourceware.org
Subject: Re: [PATCH 1/2] gdb: use XML_GetCurrentLineNumber64 with expat >= 2.9.0
Date: Tue, 13 Oct 2026 11:23:12 +0200	[thread overview]
Message-ID: <89c300fa-77b0-4524-b3ee-11d58af2125c@suse.de> (raw)
In-Reply-To: <20261011133136.472634-1-simon.marchi@efficios.com>

On 10/11/26 3:31 PM, Simon Marchi wrote:
> When building against expat 2.9.0, I get:
> 
>        CXX    xml-support.o
>      /home/smarchi/src/binutils-gdb/gdb/xml-support.c:182:39: error: 'XML_Size XML_GetCurrentLineNumber(XML_Parser)' is deprecated: please use XML_GetCurrentLineNumber64 instead [-Werror=deprecated-declarations]
>        182 |   int line = XML_GetCurrentLineNumber (m_expat_parser);
>            |              ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~
> 
> The functions that return XML_Size were deprecated in favor of the new
> functions, with suffix 64, that return uint64_t.
> 
> Add a gdb_xml_get_current_line_number wrapper in gdb_expat.h, which
> calls XML_GetCurrentLineNumber64 with expat 2.9.0 and later, and
> XML_GetCurrentLineNumber otherwise.  Use it in xml-support.c.
> 
> The uint64_t gets truncated when converted to int, but that was already
> true before, as XML_Size is 64-bits when building on an arch where
> unsigned long is 64-bits.
> 

Hi Simon.

I ran into the same issue on Tumbleweed.

I applied this series, and I managed to complete the build.

Both patches LGTM.

Reviewed-By: Tom de Vries <tdevries@suse.de>

Thanks,
- Tom

> Change-Id: I31a0657702cf45d9d7572276d5c8cc37aed41f79
> ---
>   gdb/gdb_expat.h   | 16 ++++++++++++++++
>   gdb/xml-support.c |  4 ++--
>   2 files changed, 18 insertions(+), 2 deletions(-)
> 
> diff --git a/gdb/gdb_expat.h b/gdb/gdb_expat.h
> index 1feac7f764c0..756cf81be95c 100644
> --- a/gdb/gdb_expat.h
> +++ b/gdb/gdb_expat.h
> @@ -35,4 +35,20 @@
>   #define XMLCALL
>   #endif
>   
> +/* Return the line number of PARSER's current position.
> +
> +   Expat 2.9.0 deprecates XML_GetCurrentLineNumber in favor of
> +   XML_GetCurrentLineNumber64.  */
> +
> +static inline std::uint64_t
> +gdb_xml_get_current_line_number (XML_Parser parser)
> +{
> +#if (XML_MAJOR_VERSION > 2 \
> +     || (XML_MAJOR_VERSION == 2 && XML_MINOR_VERSION >= 9))
> +  return XML_GetCurrentLineNumber64 (parser);
> +#else
> +  return XML_GetCurrentLineNumber (parser);
> +#endif
> +}
> +
>   #endif /* GDB_GDB_EXPAT_H */
> diff --git a/gdb/xml-support.c b/gdb/xml-support.c
> index d806b53c9fa2..7d86dbb8c698 100644
> --- a/gdb/xml-support.c
> +++ b/gdb/xml-support.c
> @@ -179,7 +179,7 @@ gdb_xml_body_text (void *data, const XML_Char *text, int length)
>   void
>   gdb_xml_parser::vdebug (const char *format, va_list ap)
>   {
> -  int line = XML_GetCurrentLineNumber (m_expat_parser);
> +  int line = gdb_xml_get_current_line_number (m_expat_parser);
>   
>     std::string message = string_vprintf (format, ap);
>     if (line)
> @@ -208,7 +208,7 @@ gdb_xml_debug (struct gdb_xml_parser *parser, const char *format, ...)
>   void
>   gdb_xml_parser::verror (const char *format, va_list ap)
>   {
> -  int line = XML_GetCurrentLineNumber (m_expat_parser);
> +  int line = gdb_xml_get_current_line_number (m_expat_parser);
>   
>     m_last_line = line;
>     throw_verror (XML_PARSE_ERROR, format, ap);
> 
> base-commit: 0aeb555307247b71116fd063f436d9311aadfbe0


  parent reply	other threads:[~2026-10-13  9:23 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-11 13:31 Simon Marchi
2026-10-11 13:31 ` [PATCH 2/2] gdb: remove workarounds for old expat versions Simon Marchi
2026-10-13  9:23 ` Tom de Vries [this message]
2026-10-13 14:54   ` [PATCH 1/2] gdb: use XML_GetCurrentLineNumber64 with expat >= 2.9.0 Simon Marchi

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=89c300fa-77b0-4524-b3ee-11d58af2125c@suse.de \
    --to=tdevries@suse.de \
    --cc=gdb-patches@sourceware.org \
    --cc=simon.marchi@efficios.com \
    /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