From: Sergio Durigan Junior <sergiodj@redhat.com>
To: Pedro Alves <palves@redhat.com>
Cc: gdb-patches@sourceware.org, Binutils <binutils@sourceware.org>
Subject: Re: [PATCH 00/18] gdb: Enable -Wwrite-strings (aka remove -Wno-write-strings)
Date: Tue, 04 Apr 2017 18:42:00 -0000 [thread overview]
Message-ID: <8737dodnfv.fsf@redhat.com> (raw)
In-Reply-To: <1491326751-16180-1-git-send-email-palves@redhat.com> (Pedro Alves's message of "Tue, 4 Apr 2017 18:25:33 +0100")
On Tuesday, April 04 2017, Pedro Alves wrote:
> "-Wwrite-strings" is enabled by default for C++ programs:
>
> "When compiling C++, warn about the deprecated conversion from
> string literals to char *. This warning is enabled by default for
> C++ programs. "
>
> This warning, via -Werror, makes this be a compile-time error:
>
> char *str = "hello";
>
> It forces us to write instead either
>
> char *str = (char *) "hello"; // I know what I'm doing! (TM)
>
> or:
>
> const char *str = "hello"; // Preferable.
>
> However, I had disabled the warning for GDB in the earlier steps of
> the C++ conversion:
>
> https://sourceware.org/ml/gdb-patches/2015-02/msg00203.html
>
> ... as an expedient hack, since we weren't enabling it in C mode
> either.
>
> I'd like to enable the warning now, to catch more bugs at compile
> time. I spotted one related bug in review last week (storing a string
> literal in a vector of heap-allocated strings, leading to a bogus
> "free" call later on), which was what prompted me to do this.
>
> "Bah, I'll just do it. Can't take more than a couple hours..."
>
> Yeah, right... /me will never learn.
>
> Tested on x86_64 Fedora 23, built with --enable-targets=all.
>
> Compile tested GDB on Aarch64 GNU/Linux, Power 64 GNU/Linux, AIX 7.1,
> and 32-bit/64-bit mingw32-w64.
>
> Also cross built MIPS and ARM GNU/Linux gdbserver.
>
> The first patch needs approval from the binutils side, hence the cross
> post. The rest of the series is GDB-specific, so I'm sending those
> patches to gdb-patches@ only.
Hey Pedro,
Thank you very much for doing this. I love these kinds of cleanups.
I looked at all the patches (except for the last patch, which I glanced
over everything due to its size), and aside from two comments that I
already posted, the series is fine by me.
Happy to see GDB more const-correct.
Cheers,
--
Sergio
GPG key ID: 237A 54B1 0287 28BF 00EF 31F4 D0EB 7628 65FC 5E36
Please send encrypted e-mail if possible
http://sergiodj.net/
next prev parent reply other threads:[~2017-04-04 18:42 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-04 17:25 Pedro Alves
2017-04-04 17:26 ` [PATCH 01/18] -Wwrite-strings: Constify struct disassemble_info's disassembler_options field Pedro Alves
2017-04-05 7:22 ` Nick Clifton
2017-04-04 17:26 ` [PATCH 14/18] -Wwrite-strings: Add a PyArg_ParseTupleAndKeywords "const char *" overload Pedro Alves
2017-04-04 18:37 ` Sergio Durigan Junior
2017-04-05 12:58 ` Pedro Alves
2017-04-05 15:49 ` Sergio Durigan Junior
2017-04-04 17:26 ` [PATCH 08/18] -Wwrite-strings: Constify mi_cmd_argv_ftype's 'command' parameter Pedro Alves
2017-04-04 17:26 ` [PATCH 02/18] -Wwrite-strings: Constify macroexp.c:init_shared_buffer Pedro Alves
2017-04-04 17:26 ` [PATCH 05/18] -Wwrite-strings: Constify warning_pre_print Pedro Alves
2017-04-04 17:26 ` [PATCH 06/18] -Wwrite-strings: Constify target_pid_to_str and target_thread_extra_thread_info Pedro Alves
2017-04-04 18:44 ` John Baldwin
2017-04-04 17:26 ` [PATCH 03/18] -Wwrite-strings: Don't initialize string command variables to empty string Pedro Alves
2017-04-04 17:26 ` [PATCH 04/18] -Wwrite-strings: Constify shell_escape and plug make_command leak Pedro Alves
2017-04-04 17:26 ` [PATCH 07/18] -Wwrite-strings: Constify work break character arrays Pedro Alves
2017-04-05 8:46 ` Philipp Rudo
2017-04-05 13:17 ` Pedro Alves
2017-04-04 17:26 ` [PATCH 09/18] -Wwrite-strings: MI -info-os Pedro Alves
2017-04-04 17:26 ` [PATCH 15/18] -Wwrite-strings: execute_command calls with string literals Pedro Alves
2017-04-05 7:13 ` Metzger, Markus T
2017-04-05 13:10 ` Pedro Alves
2017-04-04 17:26 ` [PATCH 16/18] -Wwrite-strings: Some constification in gdb/breakpoint.c Pedro Alves
2017-04-04 17:31 ` [PATCH 10/18] -Wwrite-strings: gdbserver's 'port' parsing Pedro Alves
2017-04-04 17:32 ` [PATCH 18/18] -Wwrite-strings: Remove -Wno-write-strings Pedro Alves
2019-02-14 16:17 ` Thomas Schwinge
2017-04-04 17:32 ` [PATCH 13/18] -Wwrite-strings: Wrap PyGetSetDef for construction with string literals Pedro Alves
2017-04-04 18:40 ` Sergio Durigan Junior
2017-04-05 12:35 ` Pedro Alves
2017-04-05 15:48 ` Sergio Durigan Junior
2017-04-05 8:49 ` Philipp Rudo
2017-04-05 13:03 ` Pedro Alves
2017-04-04 17:32 ` [PATCH 11/18] -Wwrite-strings: gdbserver/win32-low.c and TARGET_WAITKIND_EXECD Pedro Alves
2017-04-04 17:33 ` [PATCH 12/18] -Wwrite-strings: More fix-old-Python-API wrappers Pedro Alves
2017-04-04 17:36 ` [PATCH 17/18] -Wwrite-strings: The Rest Pedro Alves
2017-04-04 18:44 ` John Baldwin
2017-04-05 12:59 ` Pedro Alves
2017-04-04 18:42 ` Sergio Durigan Junior [this message]
2017-04-04 19:37 ` [PATCH 00/18] gdb: Enable -Wwrite-strings (aka remove -Wno-write-strings) Simon Marchi
2017-04-05 18:05 ` Pedro Alves
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=8737dodnfv.fsf@redhat.com \
--to=sergiodj@redhat.com \
--cc=binutils@sourceware.org \
--cc=gdb-patches@sourceware.org \
--cc=palves@redhat.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).