From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 94765 invoked by alias); 5 Dec 2018 17:37:45 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 94749 invoked by uid 89); 5 Dec 2018 17:37:44 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 spammy=hits X-HELO: gate.crashing.org Received: from gate.crashing.org (HELO gate.crashing.org) (63.228.1.57) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 05 Dec 2018 17:37:43 +0000 Received: from gate.crashing.org (localhost.localdomain [127.0.0.1]) by gate.crashing.org (8.14.1/8.14.1) with ESMTP id wB5HbTre032176; Wed, 5 Dec 2018 11:37:29 -0600 Received: (from segher@localhost) by gate.crashing.org (8.14.1/8.14.1/Submit) id wB5HbREs032171; Wed, 5 Dec 2018 11:37:27 -0600 Date: Wed, 05 Dec 2018 17:37:00 -0000 From: Segher Boessenkool To: Martin Sebor , Gcc Patch List , Martin =?utf-8?B?TGnFoWth?= , richard.sandiford@arm.com Subject: Re: [PATCH/coding style] clarify pointers and operators Message-ID: <20181205173725.GR3803@gate.crashing.org> References: <6bce0b3a-0b0d-f03f-5f92-e00156e63629@gmail.com> <87wooo5lx3.fsf@arm.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87wooo5lx3.fsf@arm.com> User-Agent: Mutt/1.4.2.3i X-IsSubscribed: yes X-SW-Source: 2018-12/txt/msg00300.txt.bz2 On Wed, Dec 05, 2018 at 10:04:56AM +0000, Richard Sandiford wrote: > Martin Sebor writes: > > Martin suggested we update the Coding Conventions to describe > > the expected style for function declarations with a pointer > > return types, and for overloaded operators. Below is the patch. > > > > As an aside, regarding the space convention in casts: a crude > > grep search yields about 10,000 instances of the "(type)x" kinds > > of casts in GCC sources and 40,000 of the preferred "(type) x" > > style with the space. That's a consistency of only 80%. Is > > it worth documenting a preference for a convention that's so > > inconsistently followed? > > Just to be sure, does that grep include things like the go frontend > and its GCC interface, which deliberately don't follow GNU conventions? > A crude grep for me gives 92% consistency in gcc/* itself (excluding > subdirectories), although that's still disappointingly low... I get: $ grep '([a-zA-Z_][a-zA-Z0-9_]*)[a-zA-Z_]' *.[ch]|wc -l 454 $ grep '([a-zA-Z_][a-zA-Z0-9_]*) ' *.[ch]|wc -l 28690 (that's gcc/*.[ch]). About 1.6%, not so terrible. $ grep '([a-zA-Z_][a-zA-Z0-9_]*\( \?\*\+\)\?)[a-zA-Z_]' *.[ch]|wc -l 631 $ grep '([a-zA-Z_][a-zA-Z0-9_]*\( \?\*\+\)\?) ' *.[ch]|wc -l 29426 With pointer casts it is worse, but still only about 2.2%. Files other than *.[ch] will probably have many more false hits? Segher