Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [pushed 1/3] gdb: remove strcmp_iw_ordered
@ 2026-10-21 22:02 Simon Marchi
  2026-10-21 22:02 ` [pushed 2/3] gdb: remove strip_leading_path_elements and count_path_elements Simon Marchi
  2026-10-21 22:02 ` [pushed 3/3] gdb: remove demangler_vwarning Simon Marchi
  0 siblings, 2 replies; 3+ messages in thread
From: Simon Marchi @ 2026-10-21 22:02 UTC (permalink / raw)
  To: gdb-patches; +Cc: Simon Marchi

strcmp_iw_ordered has been unused since commit b3f7f1e9d974 ("gdb:
remove psymtab.{c,h}", 2026-02-27).  Remove it.

Change-Id: I80cd927a346159c04a95aadcf9501bc3d5edafa6
---
 gdb/utils.c | 115 ----------------------------------------------------
 gdb/utils.h |   2 -
 2 files changed, 117 deletions(-)

diff --git a/gdb/utils.c b/gdb/utils.c
index 5deecdbba942..b644a936312b 100644
--- a/gdb/utils.c
+++ b/gdb/utils.c
@@ -3142,121 +3142,6 @@ strcmp_iw (const char *string1, const char *string2)
 			       strncmp_iw_mode::MATCH_PARAMS, language_minimal);
 }
 
-/* This is like strcmp except that it ignores whitespace and treats
-   '(' as the first non-NULL character in terms of ordering.  Like
-   strcmp (and unlike strcmp_iw), it returns negative if STRING1 <
-   STRING2, 0 if STRING2 = STRING2, and positive if STRING1 > STRING2
-   according to that ordering.
-
-   If a list is sorted according to this function and if you want to
-   find names in the list that match some fixed NAME according to
-   strcmp_iw(LIST_ELT, NAME), then the place to start looking is right
-   where this function would put NAME.
-
-   This function must be neutral to the CASE_SENSITIVITY setting as the user
-   may choose it during later lookup.  Therefore this function always sorts
-   primarily case-insensitively and secondarily case-sensitively.
-
-   Here are some examples of why using strcmp to sort is a bad idea:
-
-   Whitespace example:
-
-   Say your partial symtab contains: "foo<char *>", "goo".  Then, if
-   we try to do a search for "foo<char*>", strcmp will locate this
-   after "foo<char *>" and before "goo".  Then lookup_partial_symbol
-   will start looking at strings beginning with "goo", and will never
-   see the correct match of "foo<char *>".
-
-   Parenthesis example:
-
-   In practice, this is less like to be an issue, but I'll give it a
-   shot.  Let's assume that '$' is a legitimate character to occur in
-   symbols.  (Which may well even be the case on some systems.)  Then
-   say that the partial symbol table contains "foo$" and "foo(int)".
-   strcmp will put them in this order, since '$' < '('.  Now, if the
-   user searches for "foo", then strcmp will sort "foo" before "foo$".
-   Then lookup_partial_symbol will notice that strcmp_iw("foo$",
-   "foo") is false, so it won't proceed to the actual match of
-   "foo(int)" with "foo".  */
-
-int
-strcmp_iw_ordered (const char *string1, const char *string2)
-{
-  const char *saved_string1 = string1, *saved_string2 = string2;
-  enum case_sensitivity case_pass = case_sensitive_off;
-
-  for (;;)
-    {
-      /* C1 and C2 are valid only if *string1 != '\0' && *string2 != '\0'.
-	 Provide stub characters if we are already at the end of one of the
-	 strings.  */
-      char c1 = 'X', c2 = 'X';
-
-      while (*string1 != '\0' && *string2 != '\0')
-	{
-	  while (c_isspace (*string1))
-	    string1++;
-	  while (c_isspace (*string2))
-	    string2++;
-
-	  switch (case_pass)
-	  {
-	    case case_sensitive_off:
-	      c1 = c_tolower (*string1);
-	      c2 = c_tolower (*string2);
-	      break;
-	    case case_sensitive_on:
-	      c1 = *string1;
-	      c2 = *string2;
-	      break;
-	  }
-	  if (c1 != c2)
-	    break;
-
-	  if (*string1 != '\0')
-	    {
-	      string1++;
-	      string2++;
-	    }
-	}
-
-      switch (*string1)
-	{
-	  /* Characters are non-equal unless they're both '\0'; we want to
-	     make sure we get the comparison right according to our
-	     comparison in the cases where one of them is '\0' or '('.  */
-	case '\0':
-	  if (*string2 == '\0')
-	    break;
-	  else
-	    return -1;
-	case '(':
-	  if (*string2 == '\0')
-	    return 1;
-	  else
-	    return -1;
-	default:
-	  if (*string2 == '\0' || *string2 == '(')
-	    return 1;
-	  else if (c1 > c2)
-	    return 1;
-	  else if (c1 < c2)
-	    return -1;
-	  /* PASSTHRU */
-	}
-
-      if (case_pass == case_sensitive_on)
-	return 0;
-
-      /* Otherwise the strings were equal in case insensitive way, make
-	 a more fine grained comparison in a case sensitive way.  */
-
-      case_pass = case_sensitive_on;
-      string1 = saved_string1;
-      string2 = saved_string2;
-    }
-}
-
 \f
 
 static void
diff --git a/gdb/utils.h b/gdb/utils.h
index 07d707ce9cf0..5aac6f0b33a8 100644
--- a/gdb/utils.h
+++ b/gdb/utils.h
@@ -87,8 +87,6 @@ extern int strncmp_iw (const char *string1, const char *string2,
    therefore be avoided if a more suitable language is available.  */
 extern int strcmp_iw (const char *string1, const char *string2);
 
-extern int strcmp_iw_ordered (const char *, const char *);
-
 /* Reset the prompt_for_continue clock.  */
 void reset_prompt_for_continue_wait_time (void);
 /* Return the time spent in prompt_for_continue.  */

base-commit: 4f1619d9d9d06f94e55f2bbe6e27b288714118d0
-- 
2.56.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-10-21 22:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-21 22:02 [pushed 1/3] gdb: remove strcmp_iw_ordered Simon Marchi
2026-10-21 22:02 ` [pushed 2/3] gdb: remove strip_leading_path_elements and count_path_elements Simon Marchi
2026-10-21 22:02 ` [pushed 3/3] gdb: remove demangler_vwarning Simon Marchi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox