From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 58939 invoked by alias); 24 Nov 2016 17:47:36 -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 58930 invoked by uid 89); 24 Nov 2016 17:47:36 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.1 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_SOFTFAIL autolearn=no version=3.3.2 spammy=HX-Greylist:EST, HX-Greylist:0500 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; Thu, 24 Nov 2016 17:47:34 +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 0877510A81A; Thu, 24 Nov 2016 12:47:33 -0500 (EST) From: John Baldwin To: Pedro Alves Cc: Simon Marchi , gdb-patches@sourceware.org Subject: Re: [PATCH 1/3] Fix mismatched struct vs class tags. Date: Thu, 24 Nov 2016 17:47:00 -0000 Message-ID: <5282476.671uSJnE6M@ralph.baldwin.cx> User-Agent: KMail/4.14.10 (FreeBSD/11.0-PRERELEASE; KDE/4.14.10; amd64; ; ) In-Reply-To: References: <20161123200652.89209-1-jhb@FreeBSD.org> <1829402.8oCIcIW1E7@ralph.baldwin.cx> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-IsSubscribed: yes X-SW-Source: 2016-11/txt/msg00772.txt.bz2 On Thursday, November 24, 2016 05:02:07 PM Pedro Alves wrote: > On 11/23/2016 11:00 PM, John Baldwin wrote: > > On Wednesday, November 23, 2016 03:58:11 PM Simon Marchi wrote: > >> On 2016-11-23 15:06, John Baldwin wrote: > >>> The 'collection_list' and 'number_or_range_parser' types were converted > >>> from structs to classes, but some code still used 'struct'. Fix all > >>> references to use 'class' which fixes -Wmismatched-tags warnings issued > >>> by clang. > >> > >> Whjen using the type in a parameter or variable declaration, should we > >> simply drop the keyword? > >> > >> For example: > >> > >> - struct collection_list *collect; > >> + collection_list *collect; > >> > >> That's the approach I took in my upcoming C++ patches, so I hope it's ok > >> :). I have also dropped the "enum" keyword when possible. > > > > Hmm. I don't see anything about this in the GCC C++ language conventions, > > so I will have to defer to others as far as what is the desired style here? > > (And we should document whatever style is chosen) > > I wouldn't say it's a matter of style to drop the "struct" or now. > It's just that we'll have legacy code using the explicit "struct" > style due to C heritage. Dropping it is fine. You can't drop it > in forward declarations, though. > > I think I'd prefer a patch to add "-Wno-mismatched-tags" to the warning set. > This warning is useless for us. Forward declaring with "struct" > and defining with "class" is perfectly valid. That's useful as "struct" > vs "class" is just an implementation detail. IIRC, that clang > warning only exists because struct/class somehow makes a > difference with Microsoft's compilers (maybe it mangles > those differently, not sure), even though that's non conforming. But, > we don't support building with that. Ok. At the moment we don't have a clang-specific warning set, but if we add one we can add this to that. -- John Baldwin