From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm1-f42.google.com (mail-wm1-f42.google.com [209.85.128.42]) by sourceware.org (Postfix) with ESMTPS id 750B73857836 for ; Mon, 7 Jun 2021 22:57:37 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 750B73857836 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=palves.net Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-wm1-f42.google.com with SMTP id t4-20020a1c77040000b029019d22d84ebdso676053wmi.3 for ; Mon, 07 Jun 2021 15:57:37 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=Zss77DrM6m7ncM6z7ls3xWAnWId+c2ZNC3CbkHIrHHY=; b=RSB695wPB8gS+xMyPR/r2cFgvhoD9m339/wVAoljZMFKeDpu4FKinioBx3WT+CtysU 4jXJoaeDTYHIZDcuIOUJoYLhDOg+EWxSPijl99xL/wnaEU8CYjq93Ki17tSMMkjiqxtZ 8wQsSXVVACC9+U80hrWUoWI6T4if0fyw3bbJ2Tjy6UYlJElDP5Ha1pQycTrTKLy7ScfY Wqh+hxN2+4YJ9IU3vwsJxvAFyzjKP7yTE7u2t+usjujE8uFrMSE1qWtnT7JB+rTZcPX4 ApF3s541Le9Jt4V/jk5bhCMAkONmrMP5Lirw9snsfBaanQspzg8WzsFreSSzhnMmTY4W twfw== X-Gm-Message-State: AOAM533Az5hBkeR867GSJmdEz3vj5YVqDz/2IF9TA5dtaFvUW12u7rJj AOA/pAdkHEIJEO27KFCC1xqCUPOkNThtig== X-Google-Smtp-Source: ABdhPJzO8iy0B+wbc5acTIJHfOtU9l8kMr9uFZO2xYi+3ND8gwzXYNarATeOGsi3U1lukE8+SovW2g== X-Received: by 2002:a1c:b603:: with SMTP id g3mr1186457wmf.58.1623106655826; Mon, 07 Jun 2021 15:57:35 -0700 (PDT) Received: from localhost ([2001:8a0:f932:6a00:46bc:d03b:7b3a:2227]) by smtp.gmail.com with ESMTPSA id k36sm6904529wms.30.2021.06.07.15.57.34 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 07 Jun 2021 15:57:35 -0700 (PDT) From: Pedro Alves To: gdb-patches@sourceware.org Subject: [pushed] gdb_rl_find_completion_word: Remove 'found_quote' local Date: Mon, 7 Jun 2021 23:57:33 +0100 Message-Id: <20210607225733.1391632-1-pedro@palves.net> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-9.8 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Jun 2021 22:57:48 -0000 Compiling GDB with current git Clang (future 13) runs into this: src/gdb/completer.c:287:18: error: variable 'found_quote' set but not used [-Werror,-Wunused-but-set-variable] int scan, end, found_quote, delimiter, pass_next, isbrk; ^ gdb_rl_find_completion_word came to life as a modified (stripped down) version of readline's internal _rl_find_completion_word function. When I added it, I don't remember whether I realized that 'found_quote' wasn't really necessary. Maybe I kept it thinking of keeping the source code in sync with readline? I don't recall anymore. Since the function is already stripped down compared to the original, stripping it down some more doesn't hurt. So fix the issue by removing the unnecessary code. gdb/ChangeLog: yyyy-mm-dd Pedro Alves * completer.c (RL_QF_SINGLE_QUOTE, RL_QF_DOUBLE_QUOTE) (RL_QF_BACKSLASH, RL_QF_OTHER_QUOTE): Delete. (gdb_rl_find_completion_word): Remove write-only 'found_quote' local. --- gdb/ChangeLog | 7 +++++++ gdb/completer.c | 22 ++-------------------- 2 files changed, 9 insertions(+), 20 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index f0afa4e1b36..3026d383dd0 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,10 @@ +2021-06-07 Pedro Alves + + * completer.c (RL_QF_SINGLE_QUOTE, RL_QF_DOUBLE_QUOTE) + (RL_QF_BACKSLASH, RL_QF_OTHER_QUOTE): Delete. + (gdb_rl_find_completion_word): Remove write-only 'found_quote' + local. + 2021-06-07 Pedro Alves * nat/amd64-linux-siginfo.c (union nat_sigval): Rename to ... diff --git a/gdb/completer.c b/gdb/completer.c index 060160f17fa..40b976c8001 100644 --- a/gdb/completer.c +++ b/gdb/completer.c @@ -250,14 +250,6 @@ filename_completer_handle_brkchars (struct cmd_list_element *ignore, (gdb_completer_file_name_break_characters); } -/* Possible values for the found_quote flags word used by the completion - functions. It says what kind of (shell-like) quoting we found anywhere - in the line. */ -#define RL_QF_SINGLE_QUOTE 0x01 -#define RL_QF_DOUBLE_QUOTE 0x02 -#define RL_QF_BACKSLASH 0x04 -#define RL_QF_OTHER_QUOTE 0x08 - /* Find the bounds of the current word for completion purposes, and return a pointer to the end of the word. This mimics (and is a modified version of) readline's _rl_find_completion_word internal @@ -284,7 +276,7 @@ gdb_rl_find_completion_word (struct gdb_rl_completion_word_info *info, int *qc, int *dp, const char *line_buffer) { - int scan, end, found_quote, delimiter, pass_next, isbrk; + int scan, end, delimiter, pass_next, isbrk; char quote_char; const char *brkchars; int point = strlen (line_buffer); @@ -301,7 +293,7 @@ gdb_rl_find_completion_word (struct gdb_rl_completion_word_info *info, } end = point; - found_quote = delimiter = 0; + delimiter = 0; quote_char = '\0'; brkchars = info->word_break_characters; @@ -311,8 +303,6 @@ gdb_rl_find_completion_word (struct gdb_rl_completion_word_info *info, /* We have a list of characters which can be used in pairs to quote substrings for the completer. Try to find the start of an unclosed quoted substring. */ - /* FOUND_QUOTE is set so we know what kind of quotes we - found. */ for (scan = pass_next = 0; scan < end; scan++) @@ -330,7 +320,6 @@ gdb_rl_find_completion_word (struct gdb_rl_completion_word_info *info, if (quote_char != '\'' && line_buffer[scan] == '\\') { pass_next = 1; - found_quote |= RL_QF_BACKSLASH; continue; } @@ -351,13 +340,6 @@ gdb_rl_find_completion_word (struct gdb_rl_completion_word_info *info, /* Found start of a quoted substring. */ quote_char = line_buffer[scan]; point = scan + 1; - /* Shell-like quoting conventions. */ - if (quote_char == '\'') - found_quote |= RL_QF_SINGLE_QUOTE; - else if (quote_char == '"') - found_quote |= RL_QF_DOUBLE_QUOTE; - else - found_quote |= RL_QF_OTHER_QUOTE; } } } base-commit: c57eb1a26982fd55f4fa991ede68576d91634f33 -- 2.26.2