summaryrefslogtreecommitdiffstats
path: root/tools/ws-coding-style.cfg
blob: aabd05e368740cba4d959f2ef5372b7146366266 (plain)
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
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
# Ref: https://gitlab.com/wireshark/wireshark/-/issues/5924
#
# FF: uncrustify config file for Wireshark (based on cheese-indent.cfg and
# linux.cfg... taken somewhere from the Net)
# http://uncrustify.sourceforge.net/
# typical usage:
#
# uncrustify -c ../../tools/ws-coding-style.cfg --replace packet-dccp.c
#

# The number of columns to indent per level.
# Usually 2, 3, 4, or 8.
indent_columns = 4        # number, FF: 8 on linux

# How to use tabs when indenting code
# 0=spaces only
# 1=indent with tabs, align with spaces
# 2=indent and align with tabs
indent_with_tabs = 0        # number, FF: spaces only, questionable... as
                            # everything about this topic :-)

# Spaces to indent '{' from level
indent_brace = 0        # number

# Spaces to indent 'case' from 'switch'
# Usually 0 or indent_columns.
indent_switch_case = 0 #indent_columns # number

# Add or remove space around arithmetic operator '+', '-', '/', '*', etc
sp_arith = force   # ignore/add/remove/force

# Add or remove space around assignment operator '=', '+=', etc
sp_assign = force   # ignore/add/remove/force

# Add or remove space around assignment '=' in enum
sp_enum_assign = force   # ignore/add/remove/force

# Add or remove space around boolean operators '&&' and '||'
sp_bool = force   # ignore/add/remove/force

# Add or remove space around compare operator '<', '>', '==', etc
sp_compare = force   # ignore/add/remove/force

# Add or remove space inside '(' and ')'
sp_inside_paren = remove   # ignore/add/remove/force

# Add or remove space between nested parens
sp_paren_paren = remove   # ignore/add/remove/force

# Add or remove space before pointer star '*'
sp_before_ptr_star = force   # ignore/add/remove/force

# Add or remove space between pointer stars '*'
sp_between_ptr_star = remove   # ignore/add/remove/force

# Add or remove space after pointer star '*', if followed by a word.
sp_after_ptr_star = remove   # ignore/add/remove/force

# Add or remove space before reference sign '&'
sp_before_byref = force   # ignore/add/remove/force

# Add or remove space after reference sign '&', if followed by a word.
sp_after_byref = remove   # ignore/add/remove/force

# Add or remove space between type and word
sp_after_type = force    # ignore/add/remove/force

# Add or remove space before '(' of 'if', 'for', 'switch', and 'while'
sp_before_sparen = force   # ignore/add/remove/force

# Add or remove space inside if-condition '(' and ')'
sp_inside_sparen = remove   # ignore/add/remove/force

# Add or remove space after ')' of 'if', 'for', 'switch', and 'while'
sp_after_sparen = force   # ignore/add/remove/force

# Add or remove space between ')' and '{' of 'if', 'for', 'switch', and 'while'
sp_sparen_brace = force   # ignore/add/remove/force

# Add or remove space before empty statement ';' on 'if', 'for' and 'while'
sp_special_semi = remove   # ignore/add/remove/force

# Add or remove space before ';'
sp_before_semi = remove   # ignore/add/remove/force

# Add or remove space before ';' in non-empty 'for' statements
sp_before_semi_for = remove   # ignore/add/remove/force

# Add or remove space inside '[' and ']'
sp_inside_square = remove   # ignore/add/remove/force

# Add or remove space before '[' (except '[]')
sp_before_square = remove   # ignore/add/remove/force

# Add or remove space before '[]'
sp_before_squares = remove   # ignore/add/remove/force

# Add or remove space after ','
sp_after_comma = force   # ignore/add/remove/force

# Add or remove space before ','
sp_before_comma = remove   # ignore/add/remove/force

# Add or remove space after C/D cast, ie 'cast(int)a' vs 'cast(int) a' or '(int)a' vs '(int) a'
sp_after_cast = force   # ignore/add/remove/force

# Add or remove spaces inside cast parens
sp_inside_paren_cast = remove   # ignore/add/remove/force

# Add or remove space between 'sizeof' and '('
sp_sizeof_paren = force   # ignore/add/remove/force

# Add or remove space inside '{' and '}'
sp_inside_braces = remove   # ignore/add/remove/force

# Add or remove space inside '{}'
sp_inside_braces_empty = remove   # ignore/add/remove/force

# Add or remove space inside enum '{' and '}'
sp_inside_braces_enum = remove   # ignore/add/remove/force

# Add or remove space inside struct/union '{' and '}'
sp_inside_braces_struct = remove   # ignore/add/remove/force

# Add or remove space between function name and '(' on function declaration
sp_func_proto_paren = remove   # ignore/add/remove/force, FF was force

# Add or remove space between function name and '(' on function definition
sp_func_def_paren = remove   # ignore/add/remove/force, FF was force

# Add or remove space inside empty function '()'
sp_inside_fparens = remove   # ignore/add/remove/force

# Add or remove space inside function '(' and ')'
sp_inside_fparen = remove   # ignore/add/remove/force

# Add or remove space between function name and '(' on function calls
sp_func_call_paren = remove   # ignore/add/remove/force, FF: was 'force'
sp_func_call_user_paren = remove   # ignore/add/remove/force
set func_call_user _ N_

# Add or remove space between 'return' and '('
sp_return_paren = force   # ignore/add/remove/force

# Add or remove space between 'defined' and '(' in '#if defined (FOO)'
sp_defined_paren = force   # ignore/add/remove/force

# Add or remove space between macro and value
sp_macro = force   # ignore/add/remove/force

# Add or remove space between macro function ')' and value
sp_macro_func = force   # ignore/add/remove/force

# Add or remove space around the ':' in 'b ? t : f'
sp_cond_colon = force   # ignore/add/remove/force

# Add or remove space around the '?' in 'b ? t : f'
sp_cond_question = force   # ignore/add/remove/force

# Add or remove space before a semicolon of an empty part of a for statment.
sp_before_semi_for_empty = force    # ignore/add/remove/force

# Space between close brace and else
sp_brace_else                           = force         # string (add/force/ignore/remove)

# Space between close parenthesis and open brace
sp_paren_brace                          = force         # string (add/force/ignore/remove)

# Space between else and open brace
sp_else_brace                           = force         # string (add/force/ignore/remove)

# How to align the star in variable definitions.
#  0=Part of the type
#  1=Part of the variable
#  2=Dangling
align_var_def_star_style = 2        # number (FF: see align_typedef_star_style)

# How to align the '&' in variable definitions.
#  0=Part of the type
#  1=Part of the variable
#  2=Dangling
align_var_def_amp_style = 2        # number

# Align variable definitions in prototypes and functions
align_func_params = true     # false/true

# Whether to align the colon in struct bit fields
align_var_def_colon = true     # false/true

# Whether to align inline struct/enum/union variable definitions
align_var_def_inline = true     # false/true

# The span for aligning function prototypes (0=don't align)
align_func_proto_span = 1        # number

# The span for aligning on '#define' bodies (0=don't align)
align_pp_define_span = 0        # number

# Controls the positioning of the '*' in typedefs. Just try it.
# 0: Align on typdef type, ignore '*'
# 1: The '*' is part of type name: typedef int  *pint;
# 2: The '*' is part of the type, but dangling: typedef int *pint;
align_typedef_star_style = 2        # number

# Controls the positioning of the '&' in typedefs. Just try it.
# 0: Align on typdef type, ignore '&'
# 1: The '&' is part of type name: typedef int  &pint;
# 2: The '&' is part of the type, but dangling: typedef int &pint;
align_typedef_amp_style = 2        # number

# Whether to align macros wrapped with a backslash and a newline.
# This will not work right if the macro contains a multi-line comment.
align_nl_cont = true    # false/true

# The span for aligning struct/union (0=don't align)
align_var_struct_span                    = 1        # number

# The threshold for aligning struct/union member definitions (0=no limit)
align_var_struct_thresh                  = 1        # number

# The gap for aligning struct/union member definitions
align_var_struct_gap                     = 1        # number

# The span for aligning struct initializer values (0=don't align)
align_struct_init_span                   = 1        # number

# The gap for aligning variable definitions
align_var_def_gap                        = 1        # number

# The span for aligning on '=' in assignments (0=don't align)
align_assign_span                        = 0        # number

# The span for aligning on '=' in enums (0=don't align)
align_enum_equ_span                      = 0        # number

# The span for aligning variable definitions (0=don't align)
align_var_def_span                       = 0        # number

# Add or remove newline at the end of the file
nl_end_of_file = force   # ignore/add/remove/force

# The number of newlines at the end of the file (only used if nl_end_of_file is 'add' or 'force')
nl_end_of_file_min = 1        # number

# Add or remove newline between '=' and '{'
nl_assign_brace = remove   # ignore/add/remove/force

# Add or remove newline between 'enum' and '{'
nl_enum_brace = force   # ignore/add/remove/force

# Add or remove newline between 'struct and '{'
nl_struct_brace = force   # ignore/add/remove/force

# Add or remove newline between 'union' and '{'
nl_union_brace = force   # ignore/add/remove/force

# Add or remove newline between 'if' and '{'
nl_if_brace = remove   # ignore/add/remove/force, FF: was 'force'

# Add or remove newline between '}' and 'else'
nl_brace_else = remove   # ignore/add/remove/force, FF: was 'force'

# Add or remove newline between a function call's ')' and '{', as in:
# list_for_each(item, &list) { }
nl_fcall_brace = force   # ignore/add/remove/force

# Add or remove newline between 'else if' and '{'
# If set to ignore, nl_if_brace is used instead
nl_elseif_brace = remove   # ignore/add/remove/force, FF: was 'force'

# Add or remove newline between 'else' and '{'
nl_else_brace = remove   # ignore/add/remove/force, FF: was 'force'

# Add or remove newline between 'else' and 'if'
nl_else_if = remove   # ignore/add/remove/force

# Add or remove newline between 'for' and '{'
nl_for_brace = remove   # ignore/add/remove/force

# Add or remove newline between 'while' and '{'
nl_while_brace = remove   # ignore/add/remove/force, FF: was 'force'

# Add or remove newline between 'do' and '{'
nl_do_brace = force   # ignore/add/remove/force

# Add or remove newline between '}' and 'while' of 'do' statement
nl_brace_while = force   # ignore/add/remove/force

# Add or remove newline between 'switch' and '{'
nl_switch_brace = remove   # ignore/add/remove/force

# Add or remove newline between return type and function name in definition
nl_func_type_name = force   # ignore/add/remove/force

# Add or remove newline between return type and function name in a prototype
nl_func_proto_type_name = remove   # ignore/add/remove/force

# Add or remove newline between a function name and the opening '('
nl_func_paren = remove   # ignore/add/remove/force

# Add or remove newline after '(' in a function declaration
nl_func_decl_start = remove   # ignore/add/remove/force

# Add or remove newline after each ',' in a function declaration
nl_func_decl_args = ignore   # ignore/add/remove/force

# Add or remove newline before the ')' in a function declaration
nl_func_decl_end = remove   # ignore/add/remove/force

# Add or remove newline between function signature and '{'
nl_fdef_brace = force   # ignore/add/remove/force

# The number of newlines after '}' of a multi-line function body
nl_after_func_body = 2        # number

# The number of newlines after '}' of a single line function body
nl_after_func_body_one_liner = 2        # number

# The number of newlines after a block of variable definitions
nl_func_var_def_blk = 1        # number

# The minimum number of newlines before a multi-line comment.
# Doesn't apply if after a brace open or another multi-line comment.
nl_before_block_comment = 2        # number

# The minimum number of newlines before a single-line C comment.
# Doesn't apply if after a brace open or other single-line C comments.
nl_before_c_comment = 2        # number

# The minimum number of newlines before a CPP comment.
# Doesn't apply if after a brace open or other CPP comments.
nl_before_cpp_comment = 2        # number

# Don't touch one-line braced assignments - 'foo_t f = { 1, 2 };'
nl_assign_leave_one_liners = true     # false/true

# Whether to not put blanks after '#ifxx', '#elxx', or before '#endif'
nl_squeeze_ifdef = true    # false/true

# Whether to remove blank lines after '{'
eat_blanks_after_open_brace = true    # false/true

# Whether to remove blank lines before '}'
eat_blanks_before_close_brace = true    # false/true

# Whether to put a star on subsequent comment lines
cmt_star_cont = true    # false/true

# Whether to group c-comments that look like they are in a block
cmt_c_group = true    # false/true

# Whether to group cpp-comments that look like they are in a block
cmt_cpp_group = false    # false/true

# Whether to change cpp-comments into c-comments
cmt_cpp_to_c = false    # false/true

# If pp_indent_at_level=false, specifies the number of columns to indent per
# level. Default=1.
pp_indent_count = indent_columns        # number

# Add or remove indent of preprocessor directives
pp_indent = remove    # ignore/add/remove/force FF: was 'force'

# Try to limit code width to N number of columns
code_width = 100        # number

# Whether to fully split long function protos/calls at commas
ls_func_split_full = false    # false/true, FF: was 'true'