Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom de Vries <tdevries@suse.de>
To: Tom Tromey <tom@tromey.com>
Cc: Simon Marchi <simark@simark.ca>,
	Christian Biesinger <cbiesinger@google.com>,
	gdb-patches <gdb-patches@sourceware.org>
Subject: [PATCH][gdb] Fix -Wstrict-null-sentinel warnings
Date: Mon, 10 Feb 2020 10:18:00 -0000	[thread overview]
Message-ID: <5588f044-4f8b-ff32-070a-aacf7932671f@suse.de> (raw)
In-Reply-To: <87v9ofx4s8.fsf@tromey.com>

[-- Attachment #1: Type: text/plain, Size: 424 bytes --]

[ was: Re: [PATCH][gdb] Mention CU offset for <artifical> if verbose ]

On 09-02-2020 14:35, Tom Tromey wrote:
>>>>>> "Tom" == Tom de Vries <tdevries@suse.de> 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


[-- Attachment #2: 0001-gdb-Fix-Wstrict-null-sentinel-warnings.patch --]
[-- Type: text/x-patch, Size: 1593 bytes --]

[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  <tdevries@suse.de>

	* dwarf2/read.c (process_psymtab_comp_unit_reader): Cast concat NULL
	sentinel to char *.

gdbsupport/ChangeLog:

2020-02-10  Tom de Vries  <tdevries@suse.de>

	* 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);

  reply	other threads:[~2020-02-10 10:18 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-07 11:34 [PATCH][gdb] Mention CU offset for <artifical> if verbose Tom de Vries
2020-02-07 14:45 ` Christian Biesinger via gdb-patches
2020-02-08  9:16   ` Tom de Vries
2020-02-08 15:48     ` Simon Marchi
2020-02-09 11:48       ` Tom de Vries
2020-02-09 12:16         ` Simon Marchi
2020-02-09 13:35         ` Tom Tromey
2020-02-10 10:18           ` Tom de Vries [this message]
2020-02-10 14:08             ` [PATCH][gdb] Fix -Wstrict-null-sentinel warnings Simon Marchi
2020-02-10 14:19               ` Tom de Vries
2020-02-11 15:14               ` Tom Tromey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5588f044-4f8b-ff32-070a-aacf7932671f@suse.de \
    --to=tdevries@suse.de \
    --cc=cbiesinger@google.com \
    --cc=gdb-patches@sourceware.org \
    --cc=simark@simark.ca \
    --cc=tom@tromey.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox