-
Notifications
You must be signed in to change notification settings - Fork 183
/
.uncrustify.cfg
238 lines (215 loc) · 10.2 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
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
#
# uncrustify config file (initially based on the linux kernel coding style)
#
input_tab_size = 4 # original tab size
output_tab_size = 4 # new tab size
newlines = lf # \n
utf8_force = true
utf8_bom = remove
# Indent
indent_with_tabs = 0 # 1=indent to level only, 2=indent with tabs
indent_columns = 4 # indents are 4 cols
indent_continue = 8 # line continuations are indented by 8 columns
indent_label = -4 # pos: absolute col, neg: relative column
indent_xml_string = 2 # embedded XML indents are 2 cols
indent_ctor_init = 4 # indent c++ ctor initializer list
indent_switch_case = 4 # indent 'case' inside switch statements
indent_namespace = false
indent_extern = false
indent_class = false
indent_class_colon = true
indent_access_spec_body = true
# Newlines
nl_max = 2 # no duplicate blank lines
nl_func_paren = remove # "int foo()" vs "int foo\n()"
nl_func_decl_start = ignore
nl_func_decl_empty = remove
nl_func_decl_args = ignore
nl_func_decl_end = remove
nl_enum_brace = remove # "enum {" vs "enum \n {"
nl_union_brace = remove # "union {" vs "union \n {"
nl_struct_brace = remove # "struct {" vs "struct \n {"
nl_do_brace = remove # "do {" vs "do \n {"
nl_if_brace = remove # "if () {" vs "if () \n {"
nl_for_brace = remove # "for () {" vs "for () \n {"
nl_else_brace = remove # "else {" vs "else \n {"
nl_while_brace = remove # "while () {" vs "while () \n {"
nl_switch_brace = remove # "switch () {" vs "switch () \n {"
nl_brace_while = remove # "} while" vs "} \n while" - cuddle while
nl_brace_else = remove # "} else" vs "} \n else" - cuddle else
nl_namespace_brace = force # "namespace name {" vs "namespace name \n {"
nl_func_var_def_blk = 0
nl_fcall_brace = remove # "list_for_each() {" vs "list_for_each()\n{"
nl_fdef_brace = add # "int foo() {" vs "int foo()\n{"
nl_after_label_colon = false # "fail:\nfree(foo);" vs "fail: free(foo);"
nl_start_of_file = remove
nl_end_of_file = force
nl_end_of_file_min = 1
nl_comment_func_def = 1
nl_assign_leave_one_liners = true
nl_class_leave_one_liners = true
nl_enum_leave_one_liners = true
nl_getset_leave_one_liners = true
nl_func_leave_one_liners = true
nl_cpp_lambda_leave_one_liners = true
nl_while_leave_one_liners = false
nl_if_leave_one_liners = false
nl_multi_line_define = true
nl_func_call_start_multi_line = false
nl_func_call_end_multi_line = false
# Source code modifications
mod_paren_on_return = remove # "return 1;" vs "return (1);"
mod_full_brace_if = ignore # "if (a) a--;" vs "if (a) { a--; }"
mod_full_brace_for = ignore # "for () a--;" vs "for () { a--; }"
mod_full_brace_do = force # "do a--; while ();" vs "do { a--; } while ();"
mod_full_brace_while = ignore # "while (a) a--;" vs "while (a) { a--; }"
mod_full_brace_nl = 3 # don't remove if more than 3 newlines
# Spacing
sp_addr = remove
sp_after_angle = force
sp_after_byref = remove
sp_after_byref_func = remove
sp_after_cast = force # "(int) a" vs "(int)a"
sp_after_class_colon = force
sp_after_comma = force
sp_after_dc = remove
sp_after_new = force
sp_after_operator = remove
sp_after_operator_sym = remove
sp_after_ptr_star = remove # "int *foo" vs "int * foo"
sp_after_ptr_star_func = remove
sp_after_semi = force
sp_after_semi_for = force
sp_after_semi_for_empty = remove
sp_after_sparen = force # "if () {" vs "if (){"
sp_after_type = force
sp_angle_paren = remove
sp_angle_shift = ignore
sp_angle_word = force
sp_arith = force
sp_assign = add
sp_assign_default = force
sp_attribute_paren = remove
sp_balance_nested_parens = false
sp_before_angle = remove
sp_before_byref = force
sp_before_byref_func = force
sp_before_case_colon = remove
sp_before_class_colon = force
sp_before_comma = remove
sp_before_dc = remove
sp_before_ellipsis = remove
sp_before_nl_cont = force
sp_before_ptr_star = force # "int*" vs "int *"
sp_before_ptr_star_func = force
sp_before_semi = remove
sp_before_semi_for = remove
sp_before_semi_for_empty = remove
sp_before_sparen = force # "if (" vs "if("
sp_before_square = remove
sp_before_tr_emb_cmt = force
sp_before_unnamed_byref = force
sp_between_ptr_star = remove # "int **" vs "int * *"
sp_bool = force
sp_brace_catch = force
sp_brace_else = force # "}else" vs "} else"
sp_brace_finally = force
sp_brace_typedef = force
sp_case_label = force
sp_catch_brace = force
sp_catch_paren = force
sp_cmt_cpp_start = force
sp_compare = force
sp_cond_colon = add
sp_cond_question = add
sp_cpp_cast_paren = force
sp_defined_paren = force
sp_deref = remove
sp_else_brace = force # "else{" vs "else {"
sp_endif_cmt = force
sp_enum_assign = force
sp_finally_brace = force
sp_fparen_brace = force
sp_func_call_paren = remove # "foo (" vs "foo("
sp_func_call_user_paren = remove
sp_func_class_paren = remove
sp_func_def_paren = remove # "int foo (){" vs "int foo(){"
sp_func_proto_paren = remove # "int foo ();" vs "int foo();"
sp_getset_brace = force
sp_incdec = remove
sp_inside_angle = remove
sp_inside_braces = force # "{ 1 }" vs "{1}"
sp_inside_braces_empty = remove
sp_inside_braces_enum = force # "{ 1 }" vs "{1}"
sp_inside_braces_struct = force # "{ 1 }" vs "{1}"
sp_inside_fparen = remove
sp_inside_fparens = remove
sp_inside_paren = remove
sp_inside_paren_cast = remove
sp_inside_sparen = remove
sp_inside_square = remove
sp_inv = remove
sp_macro = force
sp_macro_func = force
sp_member = remove
sp_not = remove
sp_num_before_tr_emb_cmt = 1
sp_paren_brace = force
sp_paren_comma = ignore
sp_paren_paren = remove # "((" vs "( ("
sp_pp_concat = force
sp_pp_stringify = remove
sp_return_paren = force # "return (1);" vs "return(1);"
sp_sign = remove
sp_sizeof_paren = force # "sizeof (int)" vs "sizeof(int)"
sp_sparen_brace = force
sp_special_semi = remove
sp_square_fparen = remove
sp_template_angle = add
sp_throw_paren = force
sp_try_brace = force
cmt_sp_before_star_cont = 0
cmt_sp_after_star_cont = 1
# Positioning
pos_arith = lead
pos_assign = trail
pos_bool = lead
pos_compare = lead
pos_conditional = lead
pos_comma = trail
pos_class_comma = trail
pos_class_colon = lead
# Alignment
align_with_tabs = false # use tabs to align
align_on_tabstop = false # align on tabstops
align_enum_equ_span = 4 # '=' in enum definition
align_nl_cont = true
align_assign_span = 0
align_struct_init_span = 3 # align stuff in a structure init '= { }'
align_right_cmt_span = 3
align_pp_define_span = 2
align_pp_define_gap = 4
align_func_params = false
align_var_struct_span = 0
# Comment
cmt_indent_multi = true
cmt_c_group = false
cmt_c_nl_start = false
cmt_c_nl_end = false
cmt_cpp_group = true
cmt_cpp_nl_start = false
cmt_cpp_nl_end = false
cmt_cpp_to_c = true
cmt_star_cont = false
cmt_multi_check_last = true
eat_blanks_after_open_brace = true
eat_blanks_before_close_brace = true
# Preprocessor
pp_indent = remove
pp_space = force
pp_space_count = 1
# Misc
set cpp_cast nonstd # nonstd cast attributes
set compare Op # typical (A) Op (B) macro scenarios
set func_call_user _ N_ # gettext macros
set attribute CR_FORMAT CR_API CR_PURE CR_INLINE