public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Yury Gribov <y.gribov@samsung.com>
To: Alexander Monakov <amonakov@ispras.ru>
Cc: Richard Biener <richard.guenther@gmail.com>,
	GCC Patches <gcc-patches@gcc.gnu.org>,
	Laurynas Biveinis <laurynas.biveinis@gmail.com>,
	Jeff Law <law@redhat.com>,
	Segher Boessenkool <segher@kernel.crashing.org>,
	Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>,
	Trevor Saunders <tsaunders@mozilla.com>,
	Mike Stump <mikestump@comcast.net>
Subject: Re: [PATCHv2] Vimrc config with GNU formatting
Date: Mon, 15 Sep 2014 09:54:00 -0000	[thread overview]
Message-ID: <5416B758.8060508@samsung.com> (raw)
In-Reply-To: <alpine.LNX.2.00.1409141349290.32042@monopod.intra.ispras.ru>

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

  reply	other threads:[~2014-09-15  9:54 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-04 13:06 Yury Gribov
2014-09-04 13:22 ` Richard Biener
2014-09-04 20:23   ` Bernhard Reutner-Fischer
2014-09-05 15:10     ` Yury Gribov
2014-09-05 16:46       ` Bernhard Reutner-Fischer
2014-09-06 16:33         ` Yury Gribov
2014-09-05 17:35       ` Segher Boessenkool
2014-09-06 15:40         ` Yury Gribov
2014-09-06 18:21           ` Trevor Saunders
2014-09-06 19:35           ` Segher Boessenkool
2014-09-07  4:18             ` Yuri Gribov
2014-09-07  4:48               ` Yuri Gribov
2014-09-07 13:33               ` Segher Boessenkool
2014-09-05 15:04   ` Yury Gribov
2014-09-10  8:09 ` [PATCHv2] " Yury Gribov
2014-09-10  8:17   ` Yury Gribov
2014-09-10 19:17   ` Segher Boessenkool
2014-09-11  4:47     ` Yury Gribov
2014-09-11  9:14       ` pinskia
2014-09-11  9:35         ` Yury Gribov
2014-09-11  9:06   ` Richard Biener
2014-09-11  9:18     ` Richard Biener
2014-09-11 10:10       ` Yury Gribov
2014-09-11 16:07         ` Yury Gribov
2014-09-14 10:32           ` Alexander Monakov
2014-09-15  9:54             ` Yury Gribov [this message]
2014-09-16 16:38   ` [PATCHv3] " Yury Gribov
2014-09-16 21:59     ` Trevor Saunders
2014-09-17 13:02       ` Segher Boessenkool
2014-09-17 14:05         ` Yury Gribov
2014-09-17 14:10           ` Yury Gribov
2014-09-17 17:08     ` [PATCHv4] " Yury Gribov
2014-09-18  3:54       ` Segher Boessenkool
2014-09-18  8:39         ` Yury Gribov
2014-09-18 15:37           ` Mike Stump
2014-09-18 17:20           ` Segher Boessenkool
2014-09-19  4:17             ` Yury Gribov
2014-09-19 11:11               ` Segher Boessenkool
2014-10-02 17:14       ` [PATCHv5] " Yury Gribov
2014-10-13 10:33         ` [PATCHv5][PING] " Yury Gribov
2014-10-21 15:24           ` [PATCHv5][PING^2] " Yury Gribov
2014-11-06 10:31             ` [PATCHv5][PING^3] " Yury Gribov
2014-11-28 18:00               ` [PATCHv5][PING^4] " Yury Gribov
2014-12-08 21:46                 ` Jeff Law

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5416B758.8060508@samsung.com \
    --to=y.gribov@samsung.com \
    --cc=amonakov@ispras.ru \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=laurynas.biveinis@gmail.com \
    --cc=law@redhat.com \
    --cc=mikestump@comcast.net \
    --cc=rep.dot.nop@gmail.com \
    --cc=richard.guenther@gmail.com \
    --cc=segher@kernel.crashing.org \
    --cc=tsaunders@mozilla.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).