From patchwork Fri May 17 16:22:42 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 32748 Received: (qmail 25064 invoked by alias); 17 May 2019 16:22:48 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 24993 invoked by uid 89); 17 May 2019 16:22:47 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-21.9 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=HX-Languages-Length:1012, sk:find_an, HContent-Transfer-Encoding:8bit X-HELO: rock.gnat.com Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 17 May 2019 16:22:46 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 5E076117E90; Fri, 17 May 2019 12:22:45 -0400 (EDT) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id bKkobeo-2Zd1; Fri, 17 May 2019 12:22:45 -0400 (EDT) Received: from murgatroyd.Home (71-218-69-43.hlrn.qwest.net [71.218.69.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by rock.gnat.com (Postfix) with ESMTPSA id 052A1117E6C; Fri, 17 May 2019 12:22:44 -0400 (EDT) From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [FYI 2/2] Don't cast away const in find_and_open_source Date: Fri, 17 May 2019 10:22:42 -0600 Message-Id: <20190517162242.27738-3-tromey@adacore.com> In-Reply-To: <20190517162242.27738-1-tromey@adacore.com> References: <20190517162242.27738-1-tromey@adacore.com> MIME-Version: 1.0 find_and_open_source casts away const, but hasn't needed to in a while. This removes the cast and a strangely hostile comment. gdb/ChangeLog 2019-05-17 Tom Tromey * source.c (find_and_open_source): Remove cast. --- gdb/ChangeLog | 4 ++++ gdb/source.c | 4 +--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/gdb/source.c b/gdb/source.c index b61880ab503..9a30209880b 100644 --- a/gdb/source.c +++ b/gdb/source.c @@ -1009,9 +1009,7 @@ find_and_open_source (const char *filename, /* Replace a path entry of $cdir with the compilation directory name. */ #define cdir_len 5 - /* We cast strstr's result in case an ANSIhole has made it const, - which produces a "required warning" when assigned to a nonconst. */ - p = (char *) strstr (source_path, "$cdir"); + p = strstr (source_path, "$cdir"); if (p && (p == path || p[-1] == DIRNAME_SEPARATOR) && (p[cdir_len] == DIRNAME_SEPARATOR || p[cdir_len] == '\0')) {