From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 121946 invoked by alias); 23 Nov 2016 23:23:50 -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 121930 invoked by uid 89); 23 Nov 2016 23:23:49 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=1.3 required=5.0 tests=AWL,BAYES_50,SPF_HELO_PASS,SPF_SOFTFAIL autolearn=no version=3.3.2 spammy=baldwin, Baldwin, assigning, VEC X-HELO: mail.baldwin.cx Received: from bigwig.baldwin.cx (HELO mail.baldwin.cx) (96.47.65.170) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 23 Nov 2016 23:23:39 +0000 Received: from ralph.baldwin.cx (c-73-231-226-104.hsd1.ca.comcast.net [73.231.226.104]) by mail.baldwin.cx (Postfix) with ESMTPSA id B689810AA27; Wed, 23 Nov 2016 18:23:37 -0500 (EST) From: John Baldwin To: Simon Marchi Cc: gdb-patches@sourceware.org Subject: Re: [PATCH 0/3] Fix various C++ related clang warnings Date: Wed, 23 Nov 2016 23:23:00 -0000 Message-ID: <1578473.QnoY8bLuFt@ralph.baldwin.cx> User-Agent: KMail/4.14.10 (FreeBSD/11.0-PRERELEASE; KDE/4.14.10; amd64; ; ) In-Reply-To: <30005d3699beb3adc0f38d0499611e4d@polymtl.ca> References: <20161123200652.89209-1-jhb@FreeBSD.org> <30005d3699beb3adc0f38d0499611e4d@polymtl.ca> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-IsSubscribed: yes X-SW-Source: 2016-11/txt/msg00736.txt.bz2 On Wednesday, November 23, 2016 05:18:28 PM Simon Marchi wrote: > On 2016-11-23 15:06, John Baldwin wrote: > > These patches fix various new C++ warnings reported by clang 3.8.0. > > The last one regarding std::move is a bit surprising I think, but > > there's a not-bad answer to a similar issue here: > > > > http://stackoverflow.com/questions/19267408/why-does-stdmove-prevent-rvo > > > > John Baldwin (3): > > Fix mismatched struct vs class tags. > > Add noexcept to custom non-throwing new operators. > > Do not use std::move when assigning an anonymous object to a > > unique_ptr. > > Hi John, > > When I tried to build gdb and gdbserver on Linux with clang, I got many > more warnings/errors (often relevant). I assume you have many more > fixups to do to actually get it building on FreeBSD with clang? I build without -Werror when using clang. There are several more warnings beyond these. One set in particular is a set of -Wunused-function that get generated by VEC(). My understanding is that VEC() will be replaced by templates at some point which will trim many of the current clang warnings. There are several tautological compare warnings due to doing 'if (foo >= 0 && foo <= X)' when 'foo' is unsigned (the comparison against 0 is always true in that case). However, I sometimes think that listing the explicit bounds can be useful to the reader in those cases so have been hesitant to change those. One option we could take is to provide different WARN_CFLAGS for GCC vs clang, but I haven't sat down to figure out how to do that. I do try to fix the warnings that I think are relevant however (such as in this set). -- John Baldwin