-
Notifications
You must be signed in to change notification settings - Fork 3
/
uncrustify.cfg
200 lines (154 loc) · 3.97 KB
/
uncrustify.cfg
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
#
# GNOME style (GNU variant)
#
input_tab_size = 8
output_tab_size = 8
# {
# size = 2; // etc.
# ^^
indent_columns = 2
indent_with_tabs = 0 # Don't use tabs for indentation
# if ()\n{} // level of endentation before '{'
# ^
indent_brace = 2
# exit:
#^ // indentation before label
# 2 = 1 space
indent_label = 2
# size = size + 2; // +, -, *, /, &, |, >>, <<, etc
# ^ ^
sp_arith = force
# int width, height
# ^ ^
sp_after_comma = force
sp_before_comma = remove
# size = 4; // +=, -=, |=, etc.
# ^ ^
sp_assign = add
# success = start && go; // &&, ||
# ^ ^
sp_bool = force
# if (size > 2) // >, <, ==, >=, etc.
# ^ ^
sp_compare = force
# perimeter = (width + height) * 2 // remove space around '('
# ^ ^
sp_inside_paren = remove
# int main (void) // remove spaces around '(' in functions
# ^ ^
sp_inside_fparen = remove
# int main () // remove spaces in empty parameters
# ^
sp_inside_fparens = remove
# int foo (void);
# ^
sp_func_proto_paren = add
# int foo (void){}
# ^
sp_func_def_paren = force
# printf ("");
# ^
sp_func_call_paren = force
# if ( // if/for/while/switch etc.
# ^
sp_before_sparen = force
set func_call_user _ N_ C_ Q_ NC_
set func_call_user g_autoptr g_auto
# space after user defined functions (above) and paren
sp_func_call_user_paren = remove
# printf ("") ;
# ^ // remove the space
sp_before_semi = remove
sp_inside_braces = ignore
# return (3*2);
# ^
sp_return_paren = force
# long distance;
# int name;
# // ^ space b/w type and variable name
sp_after_type = add
# char *name; // add space before '*' (keep spacing if more than 1)
# ^
sp_before_ptr_star = add
# char *name; // remove space after '*'
# ^
sp_after_ptr_star = remove
# char **name (){} // remove space b/w 2 '*'
# ^
sp_between_ptr_star = remove
# maximum consecutive new lines
# 3 = 2 blank lines
nl_max = 3
# char *names[] = { // remove newline if any
# ^
nl_assign_brace = remove
# } else // insert newline
# ^
nl_brace_else = force
# else if // remove newline if any
# ^
nl_else_if = remove
# do {} // insert newline
# ^
nl_do_brace = force
nl_union_brace = force
nl_enum_brace = ignore # don't care for enums
nl_struct_brace = force
# while () {} // insert newline.
# ^
nl_while_brace = force
nl_for_brace = force
nl_if_brace = force
nl_switch_brace = force
# do ()\n while();
# ^
nl_brace_while = force
# int main (void){} // newline after type
# ^
nl_func_type_name = force
# int main () {} // insert newline
# ^
nl_fdef_brace = force
# int main () {}
# ^
# nl_after_func_body = 2
# int main (int argc, char **argv) // force newline at ','
# ^
nl_func_decl_args = force
nl_func_def_args = force
# remove blank lines after '{' and before '}'
eat_blanks_after_open_brace = true
eat_blanks_before_close_brace = true
# add newline at end of file
nl_end_of_file = force
# min number of newlines to be added
nl_end_of_file_min = 1
# main (int argc, // add enough spaces to align
# char *argv[])
# ^^
align_func_params = true
# func (int *square, // stick '*' to parameter
# double match)
align_var_def_star_style = 2
# #define ADD(x,y,x) ((x) \
# + (y) \
# + (z))
# ^ // align '/'
align_nl_cont = true
# Add a '*' at beginning of multiline comment lines
cmt_star_cont = true
# Remove braces for single line statements in
# while, for, if, and switch case
mod_full_brace_while = remove
mod_full_brace_for = remove
mod_full_brace_if = remove
mod_case_brace = remove
# if (is_good \n || \n is_okay)
# ^ ^ // If newline present,
# where to put &&, ||, | etc.
pos_conditional = lead
# FIXME: Not working
pos_bool = trail
# Hack to avoid indentation of following line
# consider the following tokens as a comment
set COMMENT G_BEGIN_DECLS