Browse Source

Update formatting rules

Scott Lahteine 5 years ago
parent
commit
0c4cf2ce32
1 changed files with 72 additions and 21 deletions
  1. 72
    21
      buildroot/share/extras/uncrustify.cfg

+ 72
- 21
buildroot/share/extras/uncrustify.cfg View File

28
 # Spaces to indent '{' from 'case'.
28
 # Spaces to indent '{' from 'case'.
29
 # By default, the brace will appear under the 'c' in case.
29
 # By default, the brace will appear under the 'c' in case.
30
 # Usually set to 0 or indent_columns.
30
 # Usually set to 0 or indent_columns.
31
-indent_case_brace = 4
31
+indent_case_brace = 0
32
 
32
 
33
 # Spaces to indent 'case' from 'switch'
33
 # Spaces to indent 'case' from 'switch'
34
 # Usually 0 or indent_columns.
34
 # Usually 0 or indent_columns.
35
-indent_switch_case = 4
35
+indent_switch_case = 2
36
+
37
+# indent 'break' with 'case' from 'switch'.
38
+indent_switch_break_with_case = false
39
+
40
+# Whether to indent continued function call parameters one indent level,
41
+# rather than aligning parameters under the open parenthesis.
42
+indent_func_call_param = true
43
+
44
+# Whether to indent continued function definition parameters one indent level,
45
+# rather than aligning parameters under the open parenthesis.
46
+indent_func_def_param = true
47
+
48
+# Add or remove space between function name and '(' on function declaration.
49
+sp_func_proto_paren = remove
50
+
51
+# Add or remove space between function name and '(' on function calls.
52
+sp_func_call_paren = remove
36
 
53
 
37
 # Add or remove space around arithmetic operator '+', '-', '/', '*', etc
54
 # Add or remove space around arithmetic operator '+', '-', '/', '*', etc
38
 sp_arith = force
55
 sp_arith = force
65
 sp_inside_sparen = remove
82
 sp_inside_sparen = remove
66
 
83
 
67
 # Add or remove space between 'else' and '{' if on the same line
84
 # Add or remove space between 'else' and '{' if on the same line
68
-sp_else_brace = force
85
+sp_else_brace = add
69
 
86
 
70
 # Add or remove space between '}' and 'else' if on the same line
87
 # Add or remove space between '}' and 'else' if on the same line
71
-sp_brace_else = force
88
+sp_brace_else = add
72
 
89
 
73
 # Add or remove space inside a non-empty '[' and ']'
90
 # Add or remove space inside a non-empty '[' and ']'
74
 sp_inside_square = remove
91
 sp_inside_square = remove
75
 
92
 
76
 # Add or remove space before '(' of 'if', 'for', 'switch', and 'while'
93
 # Add or remove space before '(' of 'if', 'for', 'switch', and 'while'
77
-sp_before_sparen = force
94
+sp_before_sparen = add
78
 
95
 
79
 # Add or remove space after ','
96
 # Add or remove space after ','
80
-sp_after_comma = force
97
+sp_after_comma = add
81
 
98
 
82
 # Add or remove space before ','
99
 # Add or remove space before ','
83
 sp_before_comma = remove
100
 sp_before_comma = remove
84
 
101
 
85
 # Add or remove space between ')' and '{'
102
 # Add or remove space between ')' and '{'
86
-sp_paren_brace = force
103
+sp_paren_brace = add
104
+
105
+# Add or remove space between ')' and '{' of function.
106
+sp_fparen_brace = add
87
 
107
 
88
 # Add or remove space after ')' of 'if', 'for', 'switch', and 'while'
108
 # Add or remove space after ')' of 'if', 'for', 'switch', and 'while'
89
-sp_after_sparen  = force
109
+sp_after_sparen  = add
90
 
110
 
91
 # Add or remove space after ';', except when followed by a comment. Default=Add
111
 # Add or remove space after ';', except when followed by a comment. Default=Add
92
-sp_after_semi = force
112
+sp_after_semi = add
93
 
113
 
94
 # Add or remove newline between '}' and 'else'
114
 # Add or remove newline between '}' and 'else'
95
-nl_brace_else = force
115
+nl_brace_else = add
96
 
116
 
97
 # Add or remove newline between 'enum' and '{'
117
 # Add or remove newline between 'enum' and '{'
98
 nl_enum_brace = remove
118
 nl_enum_brace = remove
122
 # Add or remove newline between function signature and '{'
142
 # Add or remove newline between function signature and '{'
123
 nl_fdef_brace = remove
143
 nl_fdef_brace = remove
124
 
144
 
145
+# Whether to collapse a function definition whose body (not counting braces)
146
+# is only one line so that the entire definition (prototype, braces, body) is
147
+# a single line.
148
+nl_create_func_def_one_liner = true
149
+
125
 # Whether to remove blank lines after '{'
150
 # Whether to remove blank lines after '{'
126
-eat_blanks_after_open_brace = true
151
+eat_blanks_after_open_brace = false
127
 
152
 
128
 # Whether to remove blank lines before '}'
153
 # Whether to remove blank lines before '}'
129
 eat_blanks_before_close_brace = false
154
 eat_blanks_before_close_brace = false
151
 # Whether to remove superfluous semicolons
176
 # Whether to remove superfluous semicolons
152
 mod_remove_extra_semicolon = true
177
 mod_remove_extra_semicolon = true
153
 
178
 
154
-# If an #ifdef or #else body exceeds the specified number of newlines and
155
-# doesn't have a comment after the #else, a comment will be added.
156
-mod_add_long_ifdef_else_comment = 40
157
-
158
-
159
 # Whether to put a newline after a brace close.
179
 # Whether to put a newline after a brace close.
160
 # Does not apply if followed by a necessary ';'.
180
 # Does not apply if followed by a necessary ';'.
161
 nl_after_brace_close = true
181
 nl_after_brace_close = true
164
 # Default is true.
184
 # Default is true.
165
 cmt_indent_multi = false
185
 cmt_indent_multi = false
166
 
186
 
187
+#
188
+# Indent all code and preprocessor directives together
189
+# to remove all ambiguity and permit code folding.
190
+# TODO: Reduce indent at the "whole file" level.
191
+#
192
+
167
 # Add or remove indentation of preprocessor directives inside #if blocks
193
 # Add or remove indentation of preprocessor directives inside #if blocks
168
 # at brace level 0 (file-level).
194
 # at brace level 0 (file-level).
169
 pp_indent = add
195
 pp_indent = add
172
 # indented from column 1.
198
 # indented from column 1.
173
 pp_indent_at_level = true
199
 pp_indent_at_level = true
174
 
200
 
201
+# Whether to indent '#define' at the brace level. If false, these are
202
+# indented from column 1.
203
+pp_define_at_level = true
204
+
175
 # If pp_indent_at_level=true, sets the indent for #if, #else and #endif when
205
 # If pp_indent_at_level=true, sets the indent for #if, #else and #endif when
176
 # not at file-level. Negative values decrease indent down to the first column.
206
 # not at file-level. Negative values decrease indent down to the first column.
177
 #
207
 #
197
 # Default: 1
227
 # Default: 1
198
 pp_indent_count = 2
228
 pp_indent_count = 2
199
 
229
 
200
-
201
-# Whether to indent '#define' at the brace level. If false, these are
202
-# indented from column 1.
203
-pp_define_at_level = true
204
-
205
 # Whether to ignore the '#define' body while formatting.
230
 # Whether to ignore the '#define' body while formatting.
206
 pp_ignore_define_body = true
231
 pp_ignore_define_body = true
207
 
232
 
233
+# Whether to indent extern C blocks between #if, #else, and #endif.
234
+# Only applies to the indent of the preprocesser that the extern block is
235
+# directly inside of.
236
+#
237
+# Default: true
238
+pp_indent_extern = false
239
+
240
+# Whether to indent braces directly inside #if, #else, and #endif.
241
+# Only applies to the indent of the preprocesser that the braces are directly
242
+# inside of.
243
+#
244
+# Default: true
245
+pp_indent_brace = false
246
+
247
+# If an #ifdef body exceeds the specified number of newlines and doesn't have
248
+# a comment after the #endif, a comment will be added.
249
+mod_add_long_ifdef_endif_comment = 40
250
+
251
+# If an #ifdef or #else body exceeds the specified number of newlines and
252
+# doesn't have a comment after the #else, a comment will be added.
253
+mod_add_long_ifdef_else_comment = 40
254
+
255
+# Whether to remove blanks after '#ifxx' and '#elxx', or before '#elxx' and
256
+# '#endif'. Does not affect top-level #ifdefs.
257
+nl_squeeze_ifdef = true
258
+
208
 #
259
 #
209
 # Newline adding and removing options
260
 # Newline adding and removing options
210
 #
261
 #

Loading…
Cancel
Save