From: Tom de Vries <tdevries@suse.de>
To: gdb-patches@sourceware.org
Subject: [PATCH 1/7] [gdb] Handle overloaded strncasecmp in find_label_symbols_in_block
Date: Tue, 17 Nov 2026 18:25:46 +0100 [thread overview]
Message-ID: <20261117172552.3083331-2-tdevries@suse.de> (raw)
In-Reply-To: <20261117172552.3083331-1-tdevries@suse.de>
In find_label_symbols_in_block we have:
...
int (*cmp) (const char *, const char *, size_t);
cmp = case_sensitivity == case_sensitive_on ? strncmp : strncasecmp;
...
If strncasecmp is overloaded, we run into:
...
gdb/linespec.c: In function ‘void find_label_symbols_in_block(...)’:
gdb/linespec.c:3822:63: error: \
overloaded function with no contextual type information
| cmp = case_sensitivity == case_sensitive_on ? strncmp : strncasecmp;
| ^~~~~~~~~~~
...
I ran into this while testing a gnulib update on the gdb-try-solaris11-amd64
buildbot. I'm not sure why there are multiple definitions, but a theory is
that it's due to gnulib enabling __STDC_WANT_LIB_EXT1__.
Regardless, fix this by using an if/else instead of a ternary operator.
---
gdb/linespec.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/gdb/linespec.c b/gdb/linespec.c
index 95ad0b048d2..9a3074c9bc5 100644
--- a/gdb/linespec.c
+++ b/gdb/linespec.c
@@ -3819,7 +3819,15 @@ find_label_symbols_in_block (const struct block *block,
size_t name_len = strlen (name);
int (*cmp) (const char *, const char *, size_t);
- cmp = case_sensitivity == case_sensitive_on ? strncmp : strncasecmp;
+ /* If strncasecmp is overloaded, using a ternary operator
+ cmp = case_sensitivity == case_sensitive_on ? strncmp : strncasecmp;
+ gets us:
+ error: overloaded function with no contextual type information
+ So instead, use an if/else. */
+ if (case_sensitivity == case_sensitive_on)
+ cmp = strncmp;
+ else
+ cmp = strncasecmp;
for (struct symbol *sym : block_iterator_range (block))
{
--
2.51.0
next prev parent reply other threads:[~2026-11-17 17:26 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-17 17:25 [PATCH 0/7] [gnulib, stable-202607] Update to latest stable branch Tom de Vries
2026-11-17 17:25 ` Tom de Vries [this message]
2026-11-17 17:25 ` [PATCH 2/7] [sim] Include defs.h via command line Tom de Vries
2026-11-17 17:25 ` [PATCH 3/7] [gnulib, stable-202607] Update GNULIB_COMMIT_SHA1 Tom de Vries
2026-11-17 17:25 ` [PATCH 4/7] [gnulib, stable-202607] Update 0002-no-solaris-_gl_attribute_dealloc Tom de Vries
2026-11-17 17:25 ` [PATCH 5/7] [gnulib, stable-202607] Add streq to IMPORTED_GNULIB_MODULES Tom de Vries
2026-11-17 17:25 ` [PATCH 6/7] [gnulib, stable-202607] Call gnulib-tool with --avoid=pthread-once Tom de Vries
2026-11-17 17:25 ` [PATCH 7/7] [gnulib, stable-202607] Run update-gnulib.sh Tom de Vries
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=20261117172552.3083331-2-tdevries@suse.de \
--to=tdevries@suse.de \
--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