]>
Commit | Line | Data |
---|---|---|
d1c7ee54 | 1 | To: vim_dev@googlegroups.com |
2 | Subject: Patch 7.3.164 | |
3 | Fcc: outbox | |
4 | From: Bram Moolenaar <Bram@moolenaar.net> | |
5 | Mime-Version: 1.0 | |
6 | Content-Type: text/plain; charset=UTF-8 | |
7 | Content-Transfer-Encoding: 8bit | |
8 | ------------ | |
9 | ||
10 | Patch 7.3.164 | |
11 | Problem: C-indenting: a preprocessor statement confuses detection of a | |
12 | function delcaration. | |
13 | Solution: Ignore preprocessor lines. (Lech Lorens) Also recognize the style | |
14 | to put a comma before the argument name. | |
15 | Files: src/misc1.c, src/testdir/test3.in, src/testdir/test3.ok | |
16 | ||
17 | ||
18 | *** ../vim-7.3.163/src/misc1.c 2011-04-11 16:56:29.000000000 +0200 | |
19 | --- src/misc1.c 2011-04-28 12:49:55.000000000 +0200 | |
20 | *************** | |
21 | *** 5396,5403 **** | |
22 | cin_ispreproc(s) | |
23 | char_u *s; | |
24 | { | |
25 | ! s = skipwhite(s); | |
26 | ! if (*s == '#') | |
27 | return TRUE; | |
28 | return FALSE; | |
29 | } | |
30 | --- 5396,5402 ---- | |
31 | cin_ispreproc(s) | |
32 | char_u *s; | |
33 | { | |
34 | ! if (*skipwhite(s) == '#') | |
35 | return TRUE; | |
36 | return FALSE; | |
37 | } | |
38 | *************** | |
39 | *** 5513,5518 **** | |
40 | --- 5512,5521 ---- | |
41 | else | |
42 | s = *sp; | |
43 | ||
44 | + /* Ignore line starting with #. */ | |
45 | + if (cin_ispreproc(s)) | |
46 | + return FALSE; | |
47 | + | |
48 | while (*s && *s != '(' && *s != ';' && *s != '\'' && *s != '"') | |
49 | { | |
50 | if (cin_iscomment(s)) /* ignore comments */ | |
51 | *************** | |
52 | *** 5538,5550 **** | |
53 | retval = TRUE; | |
54 | goto done; | |
55 | } | |
56 | ! if (*s == ',' && cin_nocode(s + 1)) | |
57 | { | |
58 | ! /* ',' at the end: continue looking in the next line */ | |
59 | if (lnum >= curbuf->b_ml.ml_line_count) | |
60 | break; | |
61 | ! | |
62 | ! s = ml_get(++lnum); | |
63 | } | |
64 | else if (cin_iscomment(s)) /* ignore comments */ | |
65 | s = cin_skipcomment(s); | |
66 | --- 5541,5569 ---- | |
67 | retval = TRUE; | |
68 | goto done; | |
69 | } | |
70 | ! if ((*s == ',' && cin_nocode(s + 1)) || s[1] == NUL || cin_nocode(s)) | |
71 | { | |
72 | ! int comma = (*s == ','); | |
73 | ! | |
74 | ! /* ',' at the end: continue looking in the next line. | |
75 | ! * At the end: check for ',' in the next line, for this style: | |
76 | ! * func(arg1 | |
77 | ! * , arg2) */ | |
78 | ! for (;;) | |
79 | ! { | |
80 | ! if (lnum >= curbuf->b_ml.ml_line_count) | |
81 | ! break; | |
82 | ! s = ml_get(++lnum); | |
83 | ! if (!cin_ispreproc(s)) | |
84 | ! break; | |
85 | ! } | |
86 | if (lnum >= curbuf->b_ml.ml_line_count) | |
87 | break; | |
88 | ! /* Require a comma at end of the line or a comma or ')' at the | |
89 | ! * start of next line. */ | |
90 | ! s = skipwhite(s); | |
91 | ! if (!comma && *s != ',' && *s != ')') | |
92 | ! break; | |
93 | } | |
94 | else if (cin_iscomment(s)) /* ignore comments */ | |
95 | s = cin_skipcomment(s); | |
96 | *** ../vim-7.3.163/src/testdir/test3.in 2010-08-15 21:57:29.000000000 +0200 | |
97 | --- src/testdir/test3.in 2011-04-28 12:15:12.000000000 +0200 | |
98 | *************** | |
99 | *** 1315,1320 **** | |
100 | --- 1315,1349 ---- | |
101 | } | |
102 | ||
103 | STARTTEST | |
104 | + :set cino=(0,ts | |
105 | + 2kdd=][ | |
106 | + ENDTEST | |
107 | + | |
108 | + void func(int a | |
109 | + #if defined(FOO) | |
110 | + , int b | |
111 | + , int c | |
112 | + #endif | |
113 | + ) | |
114 | + { | |
115 | + } | |
116 | + | |
117 | + STARTTEST | |
118 | + :set cino=(0 | |
119 | + 2kdd=][ | |
120 | + ENDTEST | |
121 | + | |
122 | + void | |
123 | + func(int a | |
124 | + #if defined(FOO) | |
125 | + , int b | |
126 | + , int c | |
127 | + #endif | |
128 | + ) | |
129 | + { | |
130 | + } | |
131 | + | |
132 | + STARTTEST | |
133 | :g/^STARTTEST/.,/^ENDTEST/d | |
134 | :1;/start of AUTO/,$wq! test.out | |
135 | ENDTEST | |
136 | *** ../vim-7.3.163/src/testdir/test3.ok 2010-08-15 21:57:29.000000000 +0200 | |
137 | --- src/testdir/test3.ok 2011-04-28 12:54:04.000000000 +0200 | |
138 | *************** | |
139 | *** 1183,1185 **** | |
140 | --- 1183,1206 ---- | |
141 | foo; | |
142 | } | |
143 | ||
144 | + | |
145 | + void func(int a | |
146 | + #if defined(FOO) | |
147 | + , int b | |
148 | + , int c | |
149 | + #endif | |
150 | + ) | |
151 | + { | |
152 | + } | |
153 | + | |
154 | + | |
155 | + void | |
156 | + func(int a | |
157 | + #if defined(FOO) | |
158 | + , int b | |
159 | + , int c | |
160 | + #endif | |
161 | + ) | |
162 | + { | |
163 | + } | |
164 | + | |
165 | *** ../vim-7.3.163/src/version.c 2011-04-28 12:56:57.000000000 +0200 | |
166 | --- src/version.c 2011-04-28 12:59:55.000000000 +0200 | |
167 | *************** | |
168 | *** 716,717 **** | |
169 | --- 716,719 ---- | |
170 | { /* Add new patch number below this line */ | |
171 | + /**/ | |
172 | + 164, | |
173 | /**/ | |
174 | ||
175 | -- | |
176 | Due knot trussed yore spell chequer two fined awl miss steaks. | |
177 | ||
178 | /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ | |
179 | /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ | |
180 | \\\ an exciting new programming language -- http://www.Zimbu.org /// | |
181 | \\\ help me help AIDS victims -- http://ICCF-Holland.org /// |