From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 87617 invoked by alias); 4 Apr 2017 18:42:31 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 87055 invoked by uid 89); 4 Apr 2017 18:42:30 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy= X-Spam-User: qpsmtpd, 2 recipients X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 04 Apr 2017 18:42:28 +0000 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 mx1.redhat.com (Postfix) with ESMTPS id 2C5CD80480; Tue, 4 Apr 2017 18:42:29 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 2C5CD80480 Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=sergiodj@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 2C5CD80480 Received: from localhost (unused-10-15-17-193.yyz.redhat.com [10.15.17.193]) by smtp.corp.redhat.com (Postfix) with ESMTPS id F224A17146; Tue, 4 Apr 2017 18:42:28 +0000 (UTC) From: Sergio Durigan Junior To: Pedro Alves Cc: gdb-patches@sourceware.org, Binutils Subject: Re: [PATCH 00/18] gdb: Enable -Wwrite-strings (aka remove -Wno-write-strings) References: <1491326751-16180-1-git-send-email-palves@redhat.com> X-URL: https://sergiodj.net Date: Tue, 04 Apr 2017 18:42:00 -0000 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") Message-ID: <8737dodnfv.fsf@redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-IsSubscribed: yes X-SW-Source: 2017-04/txt/msg00053.txt.bz2 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/