Scott Lahteine 4 лет назад
Родитель
Сommit
5ba1cbaf8e
3 измененных файлов: 110 добавлений и 346 удалений
  1. 1
    1
      buildroot/bin/uncrust
  2. 26
    0
      buildroot/share/extras/header.h
  3. 83
    345
      buildroot/share/extras/uncrustify.cfg

+ 1
- 1
buildroot/bin/uncrust Просмотреть файл

@@ -6,7 +6,7 @@
6 6
 TMPDIR=`mktemp -d`
7 7
 
8 8
 # Reformat a single file to tmp/
9
-uncrustify -c ./buildroot/share/extras/uncrustify.cfg -f "$1" >$TMPDIR/uncrustify.out
9
+uncrustify -l CPP -c ./buildroot/share/extras/uncrustify.cfg -f "$1" >$TMPDIR/uncrustify.out
10 10
 
11 11
 # Replace the original file
12 12
 cp "$TMPDIR/uncrustify.out" "$1"

+ 26
- 0
buildroot/share/extras/header.h Просмотреть файл

@@ -0,0 +1,26 @@
1
+/**
2
+ * Marlin 3D Printer Firmware
3
+ * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
4
+ *
5
+ * Based on Sprinter and grbl.
6
+ * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
7
+ *
8
+ * This program is free software: you can redistribute it and/or modify
9
+ * it under the terms of the GNU General Public License as published by
10
+ * the Free Software Foundation, either version 3 of the License, or
11
+ * (at your option) any later version.
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
20
+ *
21
+ */
22
+
23
+/**
24
+ * $(filename)
25
+ */
26
+

+ 83
- 345
buildroot/share/extras/uncrustify.cfg Просмотреть файл

@@ -1,346 +1,84 @@
1 1
 #
2
-# http://uncrustify.sourceforge.net/
3
-#
4
-# Source beautifier configuration which helps to create
5
-# more consistent look to your source with the expected
6
-# coding style in VICE
7
-#
8
-# Usage: "uncrustify -c uncrustify.cfg source.c"
9
-#
10
-# There's no guarantee the look is perfect after this
11
-# but at least the most common stuff is corrected.
12
-#
13
-# Make sure to use the latest version.
14
-#
15
-
16
-# no cr/lf
17
-newlines = lf
18
-
19
-# no tabs
20
-indent_with_tabs = 0
21
-
22
-# no tabs
23
-output_tab_size = 2
24
-
25
-# small indents
26
-indent_columns = 2
27
-
28
-# Spaces to indent '{' from 'case'.
29
-# By default, the brace will appear under the 'c' in case.
30
-# Usually set to 0 or indent_columns.
31
-indent_case_brace = 0
32
-
33
-# Spaces to indent 'case' from 'switch'
34
-# Usually 0 or indent_columns.
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
53
-
54
-# Add or remove space around arithmetic operator '+', '-', '/', '*', etc
55
-sp_arith = force
56
-
57
-# Add or remove space around assignment operator '=', '+=', etc
58
-sp_assign = force
59
-
60
-# Add or remove space around boolean operators '&&' and '||'
61
-sp_bool = force
62
-
63
-# Add or remove space around compare operator '<', '>', '==', etc
64
-sp_compare = force
65
-
66
-# Add or remove space around the ':' in 'b ? t : f'
67
-sp_cond_colon = force
68
-
69
-# Add or remove space around the '?' in 'b ? t : f'
70
-sp_cond_question = force
71
-
72
-# In the abbreviated ternary form '(a ?: b)', add or remove space between '?'
73
-# and ':'.
74
-#
75
-# Overrides all other sp_cond_* options.
76
-sp_cond_ternary_short = remove
77
-
78
-# Add or remove space between nested parens
79
-sp_paren_paren = remove
80
-
81
-# Add or remove space inside '(' and ')'
82
-sp_inside_sparen = remove
83
-
84
-# Add or remove space between 'else' and '{' if on the same line
85
-sp_else_brace = add
86
-
87
-# Add or remove space between '}' and 'else' if on the same line
88
-sp_brace_else = add
89
-
90
-# Add or remove space inside a non-empty '[' and ']'
91
-sp_inside_square = remove
92
-
93
-# Add or remove space before '(' of 'if', 'for', 'switch', and 'while'
94
-sp_before_sparen = add
95
-
96
-# Add or remove space after ','
97
-sp_after_comma = add
98
-
99
-# Add or remove space before ','
100
-sp_before_comma = remove
101
-
102
-# Add or remove space between ')' and '{'
103
-sp_paren_brace = add
104
-
105
-# Add or remove space between ')' and '{' of function.
106
-sp_fparen_brace = add
107
-
108
-# Add or remove space after ')' of 'if', 'for', 'switch', and 'while'
109
-sp_after_sparen  = add
110
-
111
-# Add or remove space after ';', except when followed by a comment. Default=Add
112
-sp_after_semi = add
113
-
114
-# Add or remove newline between '}' and 'else'
115
-nl_brace_else = add
116
-
117
-# Add or remove newline between 'enum' and '{'
118
-nl_enum_brace = remove
119
-
120
-# Add or remove newline between 'struct and '{'
121
-nl_struct_brace = remove
122
-
123
-# Add or remove newline between 'union' and '{'
124
-nl_union_brace = remove
125
-
126
-# Whether to put a newline after brace open.
127
-# This also adds a newline before the matching brace close.
128
-nl_after_brace_open = true
129
-
130
-# Add or remove newline between 'if' and '{'
131
-nl_if_brace = remove
132
-
133
-# Add or remove newline between 'else' and '{'
134
-nl_else_brace = remove
135
-
136
-# Add or remove newline between 'switch' and '{'
137
-nl_switch_brace = remove
138
-
139
-# Add or remove newline at the end of the file
140
-nl_end_of_file = add
141
-
142
-# Add or remove newline between function signature and '{'
143
-nl_fdef_brace = remove
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
-
150
-# Whether to remove blank lines after '{'
151
-eat_blanks_after_open_brace = false
152
-
153
-# Whether to remove blank lines before '}'
154
-eat_blanks_before_close_brace = false
155
-
156
-# Whether to enforce that all blocks of an 'if'/'else if'/'else' chain either
157
-# have, or do not have, braces. If true, braces will be added if any block
158
-# needs braces, and will only be removed if they can be removed from all
159
-# blocks.
160
-#
161
-# Overrides mod_full_brace_if.
162
-mod_full_brace_if_chain = true
163
-
164
-# Add or remove braces on single-line 'if' statement. Will not remove the braces if they contain an 'else'.
165
-mod_full_brace_if = false
166
-
167
-# Add or remove braces on single-line 'do' statement
168
-mod_full_brace_do = false
169
-
170
-# Add or remove braces on single-line 'for' statement
171
-mod_full_brace_for = false
172
-
173
-# Add or remove braces on single-line 'while' statement
174
-mod_full_brace_while = false
175
-
176
-# Whether to remove superfluous semicolons
177
-mod_remove_extra_semicolon = true
178
-
179
-# Whether to put a newline after a brace close.
180
-# Does not apply if followed by a necessary ';'.
181
-nl_after_brace_close = true
182
-
183
-# If false, disable all multi-line comment changes, including cmt_width. keyword substitution, and leading chars.
184
-# Default is true.
185
-cmt_indent_multi = false
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
-
193
-# Add or remove indentation of preprocessor directives inside #if blocks
194
-# at brace level 0 (file-level).
195
-pp_indent = add
196
-
197
-# Whether to indent #if/#else/#endif at the brace level. If false, these are
198
-# indented from column 1.
199
-pp_indent_at_level = true
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
-# If pp_indent_at_level=true, sets the indent for #if, #else and #endif when
206
-# not at file-level. Negative values decrease indent down to the first column.
207
-#
208
-# =0: Indent preprocessors using output_tab_size
209
-# >0: Column at which all preprocessors will be indented
210
-pp_indent_if = 0
211
-
212
-# Whether to indent case statements between #if, #else, and #endif.
213
-# Only applies to the indent of the preprocesser that the case statements
214
-# directly inside of.
215
-#
216
-# Default: true
217
-pp_indent_case = false
218
-
219
-# Whether to indent the code between #if, #else and #endif.
220
-pp_if_indent_code = true
221
-
222
-# Specifies the number of columns to indent preprocessors per level
223
-# at brace level 0 (file-level). If pp_indent_at_level=false, also specifies
224
-# the number of columns to indent preprocessors per level
225
-# at brace level > 0 (function-level).
226
-#
227
-# Default: 1
228
-pp_indent_count = 2
229
-
230
-# Whether to ignore the '#define' body while formatting.
231
-pp_ignore_define_body = true
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
-
259
-#
260
-# Newline adding and removing options
261
-#
262
-
263
-# Don't split one-line braced assignments, as in 'foo_t f = { 1, 2 };'.
264
-nl_assign_leave_one_liners = true
265
-
266
-# Don't split one-line braced statements inside a 'class xx { }' body.
267
-nl_class_leave_one_liners = true
268
-
269
-# Don't split one-line enums, as in 'enum foo { BAR = 15 };'
270
-nl_enum_leave_one_liners = true
271
-
272
-# Don't split one-line get or set functions.
273
-nl_getset_leave_one_liners = true
274
-
275
-# (C#) Don't split one-line property get or set functions.
276
-nl_cs_property_leave_one_liners = true
277
-
278
-# Don't split one-line function definitions, as in 'int foo() { return 0; }'.
279
-# might modify nl_func_type_name
280
-nl_func_leave_one_liners = true
281
-
282
-# Don't split one-line C++11 lambdas, as in '[]() { return 0; }'.
283
-nl_cpp_lambda_leave_one_liners = false
284
-
285
-# Don't split one-line if/else statements, as in 'if(...) b++;'.
286
-nl_if_leave_one_liners = true
287
-
288
-# Don't split one-line while statements, as in 'while(...) b++;'.
289
-nl_while_leave_one_liners = true
290
-
291
-# Don't split one-line for statements, as in 'for(...) b++;'.
292
-nl_for_leave_one_liners = true
293
-
294
-# Whether to indent the body of a C++11 lambda.
295
-indent_cpp_lambda_body = true
296
-
297
-# The value might be used twice:
298
-# - at the assignment
299
-# - at the opening brace
300
-#
301
-# To prevent the double use of the indentation value, use this option with the
302
-# value 'true'.
303
-#
304
-# true:  indentation will be used only once
305
-# false: indentation will be used every time (default)
306
-indent_cpp_lambda_only_once = true
307
-
308
-# How to reflow comments.
309
-#
310
-# 0: No reflowing (apart from the line wrapping due to cmt_width) (default)
311
-# 1: No touching at all
312
-# 2: Full reflow
313
-cmt_reflow_mode = 1
314
-
315
-# Whether to group cpp-comments that look like they are in a block. Only
316
-# meaningful if cmt_cpp_to_c=true.
317
-cmt_cpp_group = true
318
-
319
-# Whether to put a star on subsequent comment lines.
320
-cmt_star_cont = true
321
-
322
-# The number of spaces to insert at the start of subsequent comment lines.
323
-cmt_sp_before_star_cont = 1
324
-
325
-# The number of spaces to insert after the star on subsequent comment lines.
326
-cmt_sp_after_star_cont = 1
327
-
328
-# Whether to convert all tabs to spaces in comments. If false, tabs in
329
-# comments are left alone, unless used for indenting.
330
-cmt_convert_tab_to_spaces = true
331
-
332
-
333
-# Add a newline before ')' if an if/for/while/switch condition spans multiple
334
-# lines. Overrides nl_before_if_closing_paren if both are specified.
335
-nl_multi_line_sparen_close = ignore
336
-
337
-# Add or remove newline before 'if'/'else if' closing parenthesis.
338
-nl_before_if_closing_paren = ignore
339
-
340
-# Add or remove space around assignment operator '=' in a prototype.
341
-#
342
-# If set to ignore, use sp_assign.
343
-sp_assign_default = remove
344
-
345
-# Whether to right-align numbers.
346
-align_number_right = true
2
+# Uncrustify Configuration File
3
+# File Created With UncrustifyX 0.4.3 (252)
4
+#
5
+align_assign_span                 = 1
6
+cmt_cpp_to_c                      = false
7
+cmt_indent_multi                  = false
8
+cmt_insert_file_header            = "./header.h"
9
+cmt_reflow_mode                   = 1
10
+cmt_sp_after_star_cont            = 1
11
+cmt_sp_before_star_cont           = 1
12
+cmt_star_cont                     = true
13
+eat_blanks_after_open_brace       = false
14
+eat_blanks_before_close_brace     = false
15
+indent_align_assign               = false
16
+indent_case_brace                 = 0
17
+indent_columns                    = 2
18
+indent_cpp_lambda_body            = false
19
+indent_func_call_param            = true
20
+indent_func_def_param             = true
21
+indent_switch_case                = 2
22
+indent_with_tabs                  = 0
23
+input_tab_size                    = 2
24
+mod_add_long_ifdef_else_comment   = 40
25
+mod_add_long_ifdef_endif_comment  = 40
26
+mod_full_brace_do                 = false
27
+mod_full_brace_for                = false
28
+mod_full_brace_if                 = false
29
+mod_full_brace_if_chain           = true
30
+mod_full_brace_while              = false
31
+mod_remove_extra_semicolon        = true
32
+newlines                          = lf
33
+nl_after_brace_close              = true
34
+nl_after_brace_open               = true
35
+nl_assign_leave_one_liners        = true
36
+nl_brace_else                     = add
37
+nl_class_leave_one_liners         = true
38
+nl_create_for_one_liner           = true
39
+nl_create_if_one_liner            = false
40
+nl_create_while_one_liner         = true
41
+nl_else_brace                     = remove
42
+nl_end_of_file                    = add
43
+nl_enum_brace                     = remove
44
+nl_enum_leave_one_liners          = true
45
+nl_fdef_brace                     = remove
46
+nl_for_brace                      = remove
47
+nl_func_leave_one_liners          = true
48
+nl_getset_leave_one_liners        = true
49
+nl_if_brace                       = remove
50
+nl_if_leave_one_liners            = true
51
+nl_multi_line_sparen_close        = add
52
+nl_squeeze_ifdef                  = false
53
+nl_struct_brace                   = remove
54
+nl_switch_brace                   = remove
55
+nl_union_brace                    = remove
56
+pp_define_at_level                = true
57
+pp_if_indent_code                 = true
58
+pp_indent                         = add
59
+pp_indent_at_level                = true
60
+pp_indent_count                   = 2
61
+pp_indent_if                      = 0
62
+sp_after_comma                    = add
63
+sp_after_semi                     = add
64
+sp_after_sparen                   = add
65
+sp_arith                          = add
66
+sp_assign                         = add
67
+sp_assign_default                 = remove
68
+sp_before_comma                   = remove
69
+sp_before_sparen                  = add
70
+sp_bool                           = add
71
+sp_brace_else                     = add
72
+sp_cmt_cpp_start                  = add
73
+sp_compare                        = add
74
+sp_cond_colon                     = add
75
+sp_cond_question                  = add
76
+sp_else_brace                     = add
77
+sp_endif_cmt                      = true
78
+sp_fparen_brace                   = add
79
+sp_func_call_paren                = remove
80
+sp_func_proto_paren               = remove
81
+sp_inside_sparen                  = remove
82
+sp_inside_square                  = remove
83
+sp_paren_brace                    = add
84
+sp_paren_paren                    = remove

Загрузка…
Отмена
Сохранить