From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) by sourceware.org (Postfix) with ESMTP id 2FBD03893676 for ; Tue, 23 Jun 2020 14:57:19 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 2FBD03893676 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-482-GksiXQWNPd6tx-BK6M9quA-1; Tue, 23 Jun 2020 10:57:16 -0400 X-MC-Unique: GksiXQWNPd6tx-BK6M9quA-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 6A13010059A5 for ; Tue, 23 Jun 2020 14:57:15 +0000 (UTC) Received: from blade.nx (ovpn-112-118.ams2.redhat.com [10.36.112.118]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2FFA95C3E7 for ; Tue, 23 Jun 2020 14:57:15 +0000 (UTC) Received: from blade.com (localhost [127.0.0.1]) by blade.nx (Postfix) with ESMTP id B5F91816CCA9 for ; Tue, 23 Jun 2020 15:57:10 +0100 (BST) From: Gary Benson To: gdb-patches@sourceware.org Subject: [PATCH] Fix -Wstring-compare testcase build failure Date: Tue, 23 Jun 2020 15:57:08 +0100 Message-Id: <1592924228-13346-1-git-send-email-gbenson@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII X-Spam-Status: No, score=-15.4 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, 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: Tue, 23 Jun 2020 14:57:21 -0000 Hi all, Clang fails to compile the file gdb/testsuite/gdb.cp/try_catch.cc with the following error: warning: result of comparison against a string literal is unspecified (use strncmp instead) [-Wstring-compare] This patch replaces the string literal with a pointer, to avoid the error. Is it ok to commit? Cheers, Gary -- gdb/testsuite/ChangeLog: * gdb.cp/try_catch.cc: Replace string literal with a pointer to avoid build failure with -Wstring-compare. --- gdb/testsuite/ChangeLog | 5 +++++ gdb/testsuite/gdb.cp/try_catch.cc | 5 +++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/gdb/testsuite/gdb.cp/try_catch.cc b/gdb/testsuite/gdb.cp/try_catch.cc index 4c4add2..b0c01ba 100644 --- a/gdb/testsuite/gdb.cp/try_catch.cc +++ b/gdb/testsuite/gdb.cp/try_catch.cc @@ -122,14 +122,15 @@ int main() // 3 use standard library using namespace std; + const char *throwme = "gdb.1"; try { if (j < 100) - throw invalid_argument("gdb.1"); // marker 3-throw + throw invalid_argument(throwme); // marker 3-throw } catch (exception& obj) { - if (obj.what() != "gdb.1") // marker 3-catch + if (obj.what() != throwme) // marker 3-catch test &= false; } return 0; -- 1.8.3.1