From patchwork Mon Feb 10 10:18:02 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: 37845 Received: (qmail 55854 invoked by alias); 10 Feb 2020 10:18:07 -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 55025 invoked by uid 89); 10 Feb 2020 10:18:06 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-25.2 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; Mon, 10 Feb 2020 10:18:05 +0000 Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 1510DAB95; Mon, 10 Feb 2020 10:18:03 +0000 (UTC) Subject: [PATCH][gdb] Fix -Wstrict-null-sentinel warnings To: Tom Tromey Cc: Simon Marchi , Christian Biesinger , gdb-patches References: <20200207113429.GA6532@delia> <7a8ea599-5254-46be-95b3-fa2af134656d@simark.ca> <99e7c8e5-8662-5b66-9d05-6ec3581b08bd@suse.de> <87v9ofx4s8.fsf@tromey.com> From: Tom de Vries Message-ID: <5588f044-4f8b-ff32-070a-aacf7932671f@suse.de> Date: Mon, 10 Feb 2020 11:18:02 +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: <87v9ofx4s8.fsf@tromey.com> X-IsSubscribed: yes [ was: Re: [PATCH][gdb] Mention CU offset for if verbose ] On 09-02-2020 14:35, Tom Tromey wrote: >>>>>> "Tom" == Tom de Vries writes: > > Tom> + debug_filename.reset (concat (artificial, "@", > Tom> + sect_offset_str (per_cu->sect_off), NULL)); > > When passing NULL to concat, you either need nullptr or (char *) NULL. Fixed in attached patch. OK for trunk? Thanks, - Tom [gdb] Fix -Wstrict-null-sentinel warnings When passed in CXXFLAGS, -Wstrict-null-sentinel triggers twice in a gdb/gdbserver build. Fix the two occurrences. Build and reg-tested on x86_64-linux. gdb/ChangeLog: 2020-02-10 Tom de Vries * dwarf2/read.c (process_psymtab_comp_unit_reader): Cast concat NULL sentinel to char *. gdbsupport/ChangeLog: 2020-02-10 Tom de Vries * environ.c (gdb_environ::set): Cast concat NULL sentinel to char *. --- gdb/dwarf2/read.c | 3 ++- gdbsupport/environ.c | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index 9e66e613cd..a7646c87f3 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -7260,7 +7260,8 @@ process_psymtab_comp_unit_reader (const struct die_reader_specs *reader, else if (strcmp (filename, artificial) == 0) { debug_filename.reset (concat (artificial, "@", - sect_offset_str (per_cu->sect_off), NULL)); + sect_offset_str (per_cu->sect_off), + (char *)NULL)); filename = debug_filename.get (); } diff --git a/gdbsupport/environ.c b/gdbsupport/environ.c index 55d0a74c37..a618cf0f6f 100644 --- a/gdbsupport/environ.c +++ b/gdbsupport/environ.c @@ -105,7 +105,7 @@ gdb_environ::get (const char *var) const void gdb_environ::set (const char *var, const char *value) { - char *fullvar = concat (var, "=", value, NULL); + char *fullvar = concat (var, "=", value, (char *)NULL); /* We have to unset the variable in the vector if it exists. */ unset (var, false);