From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29121 invoked by alias); 15 Sep 2014 09:54:27 -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 29099 invoked by uid 89); 15 Sep 2014 09:54:25 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.8 required=5.0 tests=AWL,BAYES_50,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 X-HELO: mailout2.w1.samsung.com Received: from mailout2.w1.samsung.com (HELO mailout2.w1.samsung.com) (210.118.77.12) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (DES-CBC3-SHA encrypted) ESMTPS; Mon, 15 Sep 2014 09:54:23 +0000 Received: from eucpsbgm1.samsung.com (unknown [203.254.199.244]) by mailout2.w1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0NBX003EOSZAI890@mailout2.w1.samsung.com> for gcc-patches@gcc.gnu.org; Mon, 15 Sep 2014 10:57:10 +0100 (BST) Received: from eusync2.samsung.com ( [203.254.199.212]) by eucpsbgm1.samsung.com (EUCPMTA) with SMTP id 7B.BF.25543.B47B6145; Mon, 15 Sep 2014 10:54:19 +0100 (BST) Received: from [106.109.9.145] by eusync2.samsung.com (Oracle Communications Messaging Server 7u4-23.01(7.0.4.23.0) 64bit (built Aug 10 2011)) with ESMTPA id <0NBX002H7SUIEVA0@eusync2.samsung.com>; Mon, 15 Sep 2014 10:54:19 +0100 (BST) Message-id: <5416B758.8060508@samsung.com> Date: Mon, 15 Sep 2014 09:54:00 -0000 From: Yury Gribov User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.0 MIME-version: 1.0 To: Alexander Monakov Cc: Richard Biener , GCC Patches , Laurynas Biveinis , Jeff Law , Segher Boessenkool , Bernhard Reutner-Fischer , Trevor Saunders , Mike Stump Subject: Re: [PATCHv2] Vimrc config with GNU formatting References: <540863C1.4000909@samsung.com> <54100735.5040700@samsung.com> <541174FC.6080400@samsung.com> <5411C8D9.5030109@samsung.com> In-reply-to: Content-type: text/plain; charset=windows-1252; format=flowed Content-transfer-encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2014-09/txt/msg01173.txt.bz2 On 09/14/2014 02:30 PM, Alexander Monakov wrote: > On Thu, 11 Sep 2014, Yury Gribov wrote: >> Ok, it tooks some time. Basically we want brace symbol to behave differently >> in two contexts: >> >> 1) not add any additional offset when not following control flow operator: >> void >> f () >> { >> int x; >> { >> } >> } > > Note that GCC commonly uses custom iteration macros, e.g.: > > FOR_EACH_BB_FN(bb, fn) > { > do_stuff; > } > > and cinoptions that get the braces-in-switch case wrong should get constructs > like the above right. Right, looks like a fair tradeoff. > (to get gnu-style autoindent in Vim, I've been using > http://www.vim.org/scripts/script.php?script_id=575 and would adjust braces in > switch by hand if need arose; the script is probably very close to one of > approaches posted in this thread, but I haven't checked) Thanks for sharing, these Vim configs just keep popping up. Here are results of quick analysis. Plugin's pros: * KR-style parameters are 4 chars instead of 5 (not sure that's important for GCC but matters in e.g. zlib so makes sense to borrow; I'll update next version of patch with this) * explicitly set f0 in cino (again makes sense to borrow) And cons: * sets formatting globally for all *.c files * only works for C sources and headers so e.g. won't work for libstdc++ * does not know about C++ formatting (e.g. public:, etc.) * continuation line is indented by 1 char instead of GCC's 2 And also some stuff which we probably don't care about: * plugin does not use softtabstop so Tab inserts a real tab character * better formatting of special type of comments: /* Start * Middle */ * sets up browsefilter on MS platforms -Y