[PATCH v2 10/14] lib: Reorganize upgrade around document types
[notmuch-archives.git] / 24 / b23c4bb4d9a63364a0dff8501701ea81a9dea0
1 Return-Path: <tomi.ollila@nixu.com>\r
2 X-Original-To: notmuch@notmuchmail.org\r
3 Delivered-To: notmuch@notmuchmail.org\r
4 Received: from localhost (localhost [127.0.0.1])\r
5         by olra.theworths.org (Postfix) with ESMTP id 36549421181\r
6         for <notmuch@notmuchmail.org>; Tue, 17 Jan 2012 07:36:59 -0800 (PST)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: 0\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]\r
12         autolearn=disabled\r
13 Received: from olra.theworths.org ([127.0.0.1])\r
14         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
15         with ESMTP id KTkQBpbIThds for <notmuch@notmuchmail.org>;\r
16         Tue, 17 Jan 2012 07:36:58 -0800 (PST)\r
17 Received: from mail-gw3.nixu.fi (mail-gw3.nixu.fi [193.209.237.7])\r
18         (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))\r
19         (No client certificate requested)\r
20         by olra.theworths.org (Postfix) with ESMTPS id 56C23429E3B\r
21         for <notmuch@notmuchmail.org>; Tue, 17 Jan 2012 07:36:58 -0800 (PST)\r
22 Received: from pps.filterd (mail-gw3 [127.0.0.1])\r
23         by mail-gw3.nixu.fi (8.14.4/8.14.4) with SMTP id q0HFatZ8010226;\r
24         Tue, 17 Jan 2012 17:36:55 +0200\r
25 Received: from taco2.nixu.fi (taco2.nixu.fi [194.197.118.31])\r
26         by mail-gw3.nixu.fi with ESMTP id 114cs180p2-1\r
27         (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);\r
28         Tue, 17 Jan 2012 17:36:55 +0200\r
29 Received: from taco2.nixu.fi (taco2.nixu.fi [194.197.118.31])\r
30         by taco2.nixu.fi (8.14.3/8.14.3/Debian-5+lenny1) with ESMTP id\r
31         q0HFarfx032298; Tue, 17 Jan 2012 17:36:53 +0200\r
32 From: Tomi Ollila <tomi.ollila@iki.fi>\r
33 To: David Bremner <david@tethera.net>, <notmuch@notmuchmail.org>\r
34 Subject: Re: [PATCH 1/2] uncrustify.cfg: initial support for notmuch coding\r
35         style\r
36 In-Reply-To: <1326197228-10356-2-git-send-email-david@tethera.net>\r
37 References: <1324135695-15487-1-git-send-email-david@tethera.net>\r
38         <1326197228-10356-1-git-send-email-david@tethera.net>\r
39         <1326197228-10356-2-git-send-email-david@tethera.net>\r
40 User-Agent: Notmuch/0.11+71~gefa5d6c (http://notmuchmail.org) Emacs/23.3.1\r
41         (i686-pc-linux-gnu)\r
42 X-Face: HhBM'cA~<r"^Xv\KRN0P{vn'Y"Kd;zg_y3S[4)KSN~s?O\"QPoL\r
43         $[Xv_BD:i/F$WiEWax}R(MPS`^UaptOGD`*/=@\1lKoVa9tnrg0TW?"r7aRtgk[F\r
44         !)g;OY^,BjTbr)Np:%c_o'jj,Z\r
45 Date: Tue, 17 Jan 2012 17:36:53 +0200\r
46 Message-ID: <yf6d3ai5oiy.fsf@taco2.nixu.fi>\r
47 MIME-Version: 1.0\r
48 Content-Type: text/plain; charset=us-ascii\r
49 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:5.5.7110,\r
50  1.0.211,       0.0.0000        definitions=2012-01-17_06:2012-01-17, 2012-01-17,\r
51         1970-01-01 signatures=0\r
52 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0\r
53         ipscore=0 suspectscore=2\r
54         phishscore=0 bulkscore=0 adultscore=0 classifier=spam adjust=0\r
55         reason=mlx\r
56         scancount=1 engine=6.0.2-1012030000 definitions=main-1201170127\r
57 X-BeenThere: notmuch@notmuchmail.org\r
58 X-Mailman-Version: 2.1.13\r
59 Precedence: list\r
60 List-Id: "Use and development of the notmuch mail system."\r
61         <notmuch.notmuchmail.org>\r
62 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
63         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
64 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
65 List-Post: <mailto:notmuch@notmuchmail.org>\r
66 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
67 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
68         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
69 X-List-Received-Date: Tue, 17 Jan 2012 15:36:59 -0000\r
70 \r
71 On Tue, 10 Jan 2012 08:07:07 -0400, David Bremner <david@tethera.net> wrote:\r
72 > From: David Bremner <bremner@debian.org>\r
73\r
74 > Uncrustify is a free (as in GPL2+) tool that indents and beautifies\r
75 > C/C++ code. It is similar to GNU indent in functionality although\r
76 > probably more configurable (in fairness, indent has better\r
77 > documentation).  Uncrustify does not have the indent mis-feature of\r
78 > needing to have every typedef'ed type defined in the\r
79 > configuration (even standard types like size_t).\r
80\r
81 > This configuration starts with the linux-kernel style from the\r
82 > uncrustify config, disables aggressive re-indenting of structs,\r
83 > and fine tunes the handling 'else' and braces.\r
84\r
85 > In an ideal situation, running uncrustify on notmuch code would be\r
86 > NOP; currently this is not true for all files because 1) the\r
87 > configuration is not perfect 2) the coding style of notmuch is not\r
88 > completely consistent; in particular the treatment of braces after\r
89 > e.g. for (_) is not consistent.\r
90 > ---\r
91 >  uncrustify.cfg |   99 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++\r
92 \r
93 Good stuff: while testing I did these changes:\r
94 \r
95 --- uncrustify.cfg0     2012-01-17 16:20:18.686489325 +0200\r
96 +++ uncrustify.cfg      2012-01-17 17:02:39.664512588 +0200\r
97 @@ -21 +20,0 @@\r
98 -\r
99 @@ -60,0 +60,4 @@\r
100 +sp_before_ptr_star     = force\r
101 +sp_between_ptr_star    = remove\r
102 +sp_after_ptr_star      = remove\r
103 +\r
104 @@ -62 +65 @@\r
105 -sp_sizeof_paren                = remove        # "sizeof (int)" vs "sizeof(int)"\r
106 +sp_sizeof_paren                = force         # "sizeof (int)" vs "sizeof(int)"\r
107 @@ -93 +96 @@\r
108 -align_right_cmt_span   = 0\r
109 +align_right_cmt_span   = 1             # 0 -> 1 -- just to fix some alignments\r
110 \r
111 \r
112 The first three:\r
113 \r
114 +sp_before_ptr_star     = force\r
115 +sp_between_ptr_star    = remove\r
116 +sp_after_ptr_star      = remove\r
117 \r
118 are important and pretty uncontroversial; fixes more than breaks (if\r
119 anything)\r
120 \r
121 \r
122 +sp_sizeof_paren        = force         # "sizeof (int)" vs "sizeof(int)"\r
123 \r
124 adds space after sizeof; do 'grep sizeof *.c' and you see this is\r
125 prevalent in the code. I think this is the right way (especially) as \r
126 sizeof is an operator...\r
127 \r
128 \r
129 +align_right_cmt_span   = 1             # 0 -> 1 -- just to fix some alignments\r
130 \r
131 This fixes, for example, comment alignment in g_mime_filter_headers_get_type()\r
132 (in gmime-filter-headers.c).\r
133 \r
134 \r
135 I also tested using this change:\r
136 \r
137 @@ -66 +69 @@\r
138 -sp_after_cast          = force         # "(int) a" vs "(int)a"\r
139 +sp_after_cast          = remove        # "(int) a" vs "(int)a"\r
140 \r
141 But this changes basically all the casts in code not to have space\r
142 after cast. I'd prefer this but it is not the prevalent style.\r
143 \r
144 Note that just running \r
145 uncrustify --replace -c uncrustify.cfg notmuch-show.c\r
146 does this:\r
147 \r
148 format_part_start_json (unused (GMimeObject * part),\r
149 \r
150 I.e. there is space after '*' and 'part'. This is probably\r
151 the old known problem: uncrustify thinks unused is function \r
152 which takes int parameter and there is multiplication to be \r
153 done. If there is way to tell uncrustify that GMimeObject is \r
154 type then this change would not take place.\r
155 \r
156 \r
157 I run for f in *.c; do uncrustify --replace -c uncrustify.cfg $f; done\r
158 \r
159 in notmuch source root directory and the output is pretty good, in addition\r
160 to the above problem there are these format_* structure initialization\r
161 changes: \r
162 Quoting Austin: "The good news is that that structure is on its way out."\r
163 \r
164 So, it would be good to get devel/uncrustify.cfg in place so developers\r
165 can start playing with it...\r
166 \r
167 Tomi\r
168 \r