From patchwork Wed Feb 12 10:17:17 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom de Vries X-Patchwork-Id: 37990 Received: (qmail 89322 invoked by alias); 12 Feb 2020 10:17:23 -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 89311 invoked by uid 89); 12 Feb 2020 10:17:22 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-25.1 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SPF_PASS autolearn=ham version=3.3.1 spammy= X-HELO: mx2.suse.de Received: from mx2.suse.de (HELO mx2.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 12 Feb 2020 10:17:21 +0000 Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id C3D76B029; Wed, 12 Feb 2020 10:17:18 +0000 (UTC) Subject: [committed][gdb] Fix -Wstrict-null-sentinel warning (--with-iconv-bin) To: Lukas Durfina , "Aktemur, Tankut Baris" , Simon Marchi , "gdb-patches@sourceware.org" References: <20200128142830.89282-1-ldurfina@tachyum.com> <20200128142830.89282-2-ldurfina@tachyum.com> <920e08c2-dfc3-bb13-21e7-90635341df77@simark.ca> From: Tom de Vries Message-ID: Date: Wed, 12 Feb 2020 11:17:17 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1 MIME-Version: 1.0 In-Reply-To: X-IsSubscribed: yes [ was: Re: [PATCH 2/2] gdb: Fix a type of sentinel ] On 30-01-2020 14:58, Lukas Durfina wrote: > Hello, > > To Simon: I will merge both patches into the single one. I was not aware of this thread, so I've fixed the gdb_environ::set occurrence in commit 85f0dd3ce8 "[gdb] Fix -Wstrict-null-sentinel warnings". After seeing this thread and the charset.c occurrence, I realized it would cause a build breaker when using --with-iconv-bin, now that we have the warning on-by-default. So, given the higher urgency, I've committed the patch for charset.c as well. Thanks, - Tom [gdb] Fix -Wstrict-null-sentinel warning (--with-iconv-bin) When using configure flag --with-iconv-bin=$(which iconv), we run into: ... gdb/charset.c: In function 'void find_charset_names()': gdb/charset.c:821:75: error: missing sentinel in function call [-Werror=format=] iconv_program = concat (iconv_dir.c_str(), SLASH_STRING, "iconv", NULL); ^ cc1plus: all warnings being treated as errors ... Fix the warning. Build and reg-tested on x86_64-linux. 2020-02-12 Lukas Durfina Tom de Vries * charset.c (find_charset_names): Cast concat NULL sentinel to char *. --- gdb/charset.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gdb/charset.c b/gdb/charset.c index 5cfd2d8030..4e459c2b45 100644 --- a/gdb/charset.c +++ b/gdb/charset.c @@ -818,7 +818,8 @@ find_charset_names (void) { std::string iconv_dir = relocate_gdb_directory (ICONV_BIN, ICONV_BIN_RELOCATABLE); - iconv_program = concat (iconv_dir.c_str(), SLASH_STRING, "iconv", NULL); + iconv_program + = concat (iconv_dir.c_str(), SLASH_STRING, "iconv", (char *) NULL); } #else iconv_program = xstrdup ("iconv");