From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id QZC6C9Y22WoyIwkAWB0awg (envelope-from ) for ; Wed, 21 Oct 2026 18:04:06 -0400 Received: by simark.ca (Postfix, from userid 112) id 2B2B71E051; Wed, 21 Oct 2026 18:04:06 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-5.3 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=4.0.1 Received: from vm01.sourceware.org (vm01.sourceware.org [IPv6:2620:52:6:3111::32]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 710701E04D for ; Wed, 21 Oct 2026 18:04:05 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 06A524BA2E3C for ; Wed, 21 Oct 2026 22:04:05 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 06A524BA2E3C Received: from simark.ca (simark.ca [158.69.221.121]) by sourceware.org (Postfix) with ESMTPS id 8B9E54BA2E2F for ; Wed, 21 Oct 2026 22:03:04 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 8B9E54BA2E2F Authentication-Results: sourceware.org; dmarc=fail (p=none dis=none) header.from=efficios.com Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=efficios.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 8B9E54BA2E2F Authentication-Results: sourceware.org; arc=none smtp.remote-ip=158.69.221.121 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1792620184; cv=none; b=o8qy8aUEz1SZsUUHhQq87n6Ulgk9ZfZGPbzt3JX+CQLHiA6PTigWjKXeQ2ppWuJnI4yJhhxJCgE6SdeOVrFrIoJkSmcutgvA0Jl7DcmZswTU7ZocSNHuDSr8cDfUn0UIC/qnnaKxswFgaMT6Dz+dbHm5yTU1RXIGRs7+YlZHhsE= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1792620184; c=relaxed/simple; bh=jgCyHQ0jj650s85VCyPZ+9uDBoZYmvY6o0yzPxvSqHw=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=ezEXHM0VBoVL/VUBShkR2xx2RdedzHtB3n6f9OBC+vdKgb44FDxuHVqnQTsAjTCp+VKLlcM1hLBDdX8l+KYwGtPV78BKHQv8ChCOID69eJcRd9m4WmLWlFm9nzkBXLA7i2NM503Jbv+WoNP5dZSzkmhhfP3XQFFwg4dVjfPVYms= ARC-Authentication-Results: i=1; sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8B9E54BA2E2F Received: by simark.ca (Postfix) id 03CD81E04D; Wed, 21 Oct 2026 18:03:02 -0400 (EDT) From: Simon Marchi To: gdb-patches@sourceware.org Cc: Simon Marchi Subject: [pushed 1/3] gdb: remove strcmp_iw_ordered Date: Wed, 21 Oct 2026 18:02:44 -0400 Message-ID: <20261021220252.683337-1-simon.marchi@efficios.com> X-Mailer: git-send-email 2.56.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~public-inbox=simark.ca@sourceware.org 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", "goo". Then, if - we try to do a search for "foo", strcmp will locate this - after "foo" and before "goo". Then lookup_partial_symbol - will start looking at strings beginning with "goo", and will never - see the correct match of "foo". - - 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; - } -} - 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