From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31226 invoked by alias); 24 Nov 2016 17:02:11 -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 31217 invoked by uid 89); 24 Nov 2016 17:02:11 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.9 required=5.0 tests=BAYES_00,KAM_LAZY_DOMAIN_SECURITY,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=sk:wmismat, sk:Wmismat, heritage 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; Thu, 24 Nov 2016 17:02:10 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5ACE719CF3E; Thu, 24 Nov 2016 17:02:09 +0000 (UTC) Received: from [127.0.0.1] (ovpn03.gateway.prod.ext.phx2.redhat.com [10.5.9.3]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id uAOH27TZ006635; Thu, 24 Nov 2016 12:02:08 -0500 Subject: Re: [PATCH 1/3] Fix mismatched struct vs class tags. To: John Baldwin , Simon Marchi References: <20161123200652.89209-1-jhb@FreeBSD.org> <20161123200652.89209-2-jhb@FreeBSD.org> <7640c59773727c1d5d784f18663312ed@polymtl.ca> <1829402.8oCIcIW1E7@ralph.baldwin.cx> Cc: gdb-patches@sourceware.org From: Pedro Alves Message-ID: Date: Thu, 24 Nov 2016 17:02:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <1829402.8oCIcIW1E7@ralph.baldwin.cx> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-SW-Source: 2016-11/txt/msg00770.txt.bz2 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. Thanks, Pedro Alves