mirror of
https://github.com/MarlinFirmware/Marlin.git
synced 2024-11-30 07:17:59 +00:00
Update formatting rules
This commit is contained in:
parent
8609f5b2f2
commit
5ba1cbaf8e
@ -6,7 +6,7 @@
|
||||
TMPDIR=`mktemp -d`
|
||||
|
||||
# Reformat a single file to tmp/
|
||||
uncrustify -c ./buildroot/share/extras/uncrustify.cfg -f "$1" >$TMPDIR/uncrustify.out
|
||||
uncrustify -l CPP -c ./buildroot/share/extras/uncrustify.cfg -f "$1" >$TMPDIR/uncrustify.out
|
||||
|
||||
# Replace the original file
|
||||
cp "$TMPDIR/uncrustify.out" "$1"
|
||||
|
26
buildroot/share/extras/header.h
Normal file
26
buildroot/share/extras/header.h
Normal file
@ -0,0 +1,26 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* $(filename)
|
||||
*/
|
||||
|
@ -1,346 +1,84 @@
|
||||
#
|
||||
# http://uncrustify.sourceforge.net/
|
||||
# Uncrustify Configuration File
|
||||
# File Created With UncrustifyX 0.4.3 (252)
|
||||
#
|
||||
# Source beautifier configuration which helps to create
|
||||
# more consistent look to your source with the expected
|
||||
# coding style in VICE
|
||||
#
|
||||
# Usage: "uncrustify -c uncrustify.cfg source.c"
|
||||
#
|
||||
# There's no guarantee the look is perfect after this
|
||||
# but at least the most common stuff is corrected.
|
||||
#
|
||||
# Make sure to use the latest version.
|
||||
#
|
||||
|
||||
# no cr/lf
|
||||
newlines = lf
|
||||
|
||||
# no tabs
|
||||
indent_with_tabs = 0
|
||||
|
||||
# no tabs
|
||||
output_tab_size = 2
|
||||
|
||||
# small indents
|
||||
indent_columns = 2
|
||||
|
||||
# Spaces to indent '{' from 'case'.
|
||||
# By default, the brace will appear under the 'c' in case.
|
||||
# Usually set to 0 or indent_columns.
|
||||
indent_case_brace = 0
|
||||
|
||||
# Spaces to indent 'case' from 'switch'
|
||||
# Usually 0 or indent_columns.
|
||||
indent_switch_case = 2
|
||||
|
||||
# indent 'break' with 'case' from 'switch'.
|
||||
indent_switch_break_with_case = false
|
||||
|
||||
# Whether to indent continued function call parameters one indent level,
|
||||
# rather than aligning parameters under the open parenthesis.
|
||||
indent_func_call_param = true
|
||||
|
||||
# Whether to indent continued function definition parameters one indent level,
|
||||
# rather than aligning parameters under the open parenthesis.
|
||||
indent_func_def_param = true
|
||||
|
||||
# Add or remove space between function name and '(' on function declaration.
|
||||
sp_func_proto_paren = remove
|
||||
|
||||
# Add or remove space between function name and '(' on function calls.
|
||||
sp_func_call_paren = remove
|
||||
|
||||
# Add or remove space around arithmetic operator '+', '-', '/', '*', etc
|
||||
sp_arith = force
|
||||
|
||||
# Add or remove space around assignment operator '=', '+=', etc
|
||||
sp_assign = force
|
||||
|
||||
# Add or remove space around boolean operators '&&' and '||'
|
||||
sp_bool = force
|
||||
|
||||
# Add or remove space around compare operator '<', '>', '==', etc
|
||||
sp_compare = force
|
||||
|
||||
# Add or remove space around the ':' in 'b ? t : f'
|
||||
sp_cond_colon = force
|
||||
|
||||
# Add or remove space around the '?' in 'b ? t : f'
|
||||
sp_cond_question = force
|
||||
|
||||
# In the abbreviated ternary form '(a ?: b)', add or remove space between '?'
|
||||
# and ':'.
|
||||
#
|
||||
# Overrides all other sp_cond_* options.
|
||||
sp_cond_ternary_short = remove
|
||||
|
||||
# Add or remove space between nested parens
|
||||
sp_paren_paren = remove
|
||||
|
||||
# Add or remove space inside '(' and ')'
|
||||
sp_inside_sparen = remove
|
||||
|
||||
# Add or remove space between 'else' and '{' if on the same line
|
||||
sp_else_brace = add
|
||||
|
||||
# Add or remove space between '}' and 'else' if on the same line
|
||||
sp_brace_else = add
|
||||
|
||||
# Add or remove space inside a non-empty '[' and ']'
|
||||
sp_inside_square = remove
|
||||
|
||||
# Add or remove space before '(' of 'if', 'for', 'switch', and 'while'
|
||||
sp_before_sparen = add
|
||||
|
||||
# Add or remove space after ','
|
||||
sp_after_comma = add
|
||||
|
||||
# Add or remove space before ','
|
||||
sp_before_comma = remove
|
||||
|
||||
# Add or remove space between ')' and '{'
|
||||
sp_paren_brace = add
|
||||
|
||||
# Add or remove space between ')' and '{' of function.
|
||||
sp_fparen_brace = add
|
||||
|
||||
# Add or remove space after ')' of 'if', 'for', 'switch', and 'while'
|
||||
sp_after_sparen = add
|
||||
|
||||
# Add or remove space after ';', except when followed by a comment. Default=Add
|
||||
sp_after_semi = add
|
||||
|
||||
# Add or remove newline between '}' and 'else'
|
||||
nl_brace_else = add
|
||||
|
||||
# Add or remove newline between 'enum' and '{'
|
||||
nl_enum_brace = remove
|
||||
|
||||
# Add or remove newline between 'struct and '{'
|
||||
nl_struct_brace = remove
|
||||
|
||||
# Add or remove newline between 'union' and '{'
|
||||
nl_union_brace = remove
|
||||
|
||||
# Whether to put a newline after brace open.
|
||||
# This also adds a newline before the matching brace close.
|
||||
nl_after_brace_open = true
|
||||
|
||||
# Add or remove newline between 'if' and '{'
|
||||
nl_if_brace = remove
|
||||
|
||||
# Add or remove newline between 'else' and '{'
|
||||
nl_else_brace = remove
|
||||
|
||||
# Add or remove newline between 'switch' and '{'
|
||||
nl_switch_brace = remove
|
||||
|
||||
# Add or remove newline at the end of the file
|
||||
nl_end_of_file = add
|
||||
|
||||
# Add or remove newline between function signature and '{'
|
||||
nl_fdef_brace = remove
|
||||
|
||||
# Whether to collapse a function definition whose body (not counting braces)
|
||||
# is only one line so that the entire definition (prototype, braces, body) is
|
||||
# a single line.
|
||||
nl_create_func_def_one_liner = true
|
||||
|
||||
# Whether to remove blank lines after '{'
|
||||
eat_blanks_after_open_brace = false
|
||||
|
||||
# Whether to remove blank lines before '}'
|
||||
eat_blanks_before_close_brace = false
|
||||
|
||||
# Whether to enforce that all blocks of an 'if'/'else if'/'else' chain either
|
||||
# have, or do not have, braces. If true, braces will be added if any block
|
||||
# needs braces, and will only be removed if they can be removed from all
|
||||
# blocks.
|
||||
#
|
||||
# Overrides mod_full_brace_if.
|
||||
mod_full_brace_if_chain = true
|
||||
|
||||
# Add or remove braces on single-line 'if' statement. Will not remove the braces if they contain an 'else'.
|
||||
mod_full_brace_if = false
|
||||
|
||||
# Add or remove braces on single-line 'do' statement
|
||||
mod_full_brace_do = false
|
||||
|
||||
# Add or remove braces on single-line 'for' statement
|
||||
mod_full_brace_for = false
|
||||
|
||||
# Add or remove braces on single-line 'while' statement
|
||||
mod_full_brace_while = false
|
||||
|
||||
# Whether to remove superfluous semicolons
|
||||
mod_remove_extra_semicolon = true
|
||||
|
||||
# Whether to put a newline after a brace close.
|
||||
# Does not apply if followed by a necessary ';'.
|
||||
nl_after_brace_close = true
|
||||
|
||||
# If false, disable all multi-line comment changes, including cmt_width. keyword substitution, and leading chars.
|
||||
# Default is true.
|
||||
cmt_indent_multi = false
|
||||
|
||||
#
|
||||
# Indent all code and preprocessor directives together
|
||||
# to remove all ambiguity and permit code folding.
|
||||
# TODO: Reduce indent at the "whole file" level.
|
||||
#
|
||||
|
||||
# Add or remove indentation of preprocessor directives inside #if blocks
|
||||
# at brace level 0 (file-level).
|
||||
pp_indent = add
|
||||
|
||||
# Whether to indent #if/#else/#endif at the brace level. If false, these are
|
||||
# indented from column 1.
|
||||
pp_indent_at_level = true
|
||||
|
||||
# Whether to indent '#define' at the brace level. If false, these are
|
||||
# indented from column 1.
|
||||
pp_define_at_level = true
|
||||
|
||||
# If pp_indent_at_level=true, sets the indent for #if, #else and #endif when
|
||||
# not at file-level. Negative values decrease indent down to the first column.
|
||||
#
|
||||
# =0: Indent preprocessors using output_tab_size
|
||||
# >0: Column at which all preprocessors will be indented
|
||||
pp_indent_if = 0
|
||||
|
||||
# Whether to indent case statements between #if, #else, and #endif.
|
||||
# Only applies to the indent of the preprocesser that the case statements
|
||||
# directly inside of.
|
||||
#
|
||||
# Default: true
|
||||
pp_indent_case = false
|
||||
|
||||
# Whether to indent the code between #if, #else and #endif.
|
||||
pp_if_indent_code = true
|
||||
|
||||
# Specifies the number of columns to indent preprocessors per level
|
||||
# at brace level 0 (file-level). If pp_indent_at_level=false, also specifies
|
||||
# the number of columns to indent preprocessors per level
|
||||
# at brace level > 0 (function-level).
|
||||
#
|
||||
# Default: 1
|
||||
pp_indent_count = 2
|
||||
|
||||
# Whether to ignore the '#define' body while formatting.
|
||||
pp_ignore_define_body = true
|
||||
|
||||
# Whether to indent extern C blocks between #if, #else, and #endif.
|
||||
# Only applies to the indent of the preprocesser that the extern block is
|
||||
# directly inside of.
|
||||
#
|
||||
# Default: true
|
||||
pp_indent_extern = false
|
||||
|
||||
# Whether to indent braces directly inside #if, #else, and #endif.
|
||||
# Only applies to the indent of the preprocesser that the braces are directly
|
||||
# inside of.
|
||||
#
|
||||
# Default: true
|
||||
pp_indent_brace = false
|
||||
|
||||
# If an #ifdef body exceeds the specified number of newlines and doesn't have
|
||||
# a comment after the #endif, a comment will be added.
|
||||
mod_add_long_ifdef_endif_comment = 40
|
||||
|
||||
# If an #ifdef or #else body exceeds the specified number of newlines and
|
||||
# doesn't have a comment after the #else, a comment will be added.
|
||||
mod_add_long_ifdef_else_comment = 40
|
||||
|
||||
# Whether to remove blanks after '#ifxx' and '#elxx', or before '#elxx' and
|
||||
# '#endif'. Does not affect top-level #ifdefs.
|
||||
nl_squeeze_ifdef = true
|
||||
|
||||
#
|
||||
# Newline adding and removing options
|
||||
#
|
||||
|
||||
# Don't split one-line braced assignments, as in 'foo_t f = { 1, 2 };'.
|
||||
nl_assign_leave_one_liners = true
|
||||
|
||||
# Don't split one-line braced statements inside a 'class xx { }' body.
|
||||
nl_class_leave_one_liners = true
|
||||
|
||||
# Don't split one-line enums, as in 'enum foo { BAR = 15 };'
|
||||
nl_enum_leave_one_liners = true
|
||||
|
||||
# Don't split one-line get or set functions.
|
||||
nl_getset_leave_one_liners = true
|
||||
|
||||
# (C#) Don't split one-line property get or set functions.
|
||||
nl_cs_property_leave_one_liners = true
|
||||
|
||||
# Don't split one-line function definitions, as in 'int foo() { return 0; }'.
|
||||
# might modify nl_func_type_name
|
||||
nl_func_leave_one_liners = true
|
||||
|
||||
# Don't split one-line C++11 lambdas, as in '[]() { return 0; }'.
|
||||
nl_cpp_lambda_leave_one_liners = false
|
||||
|
||||
# Don't split one-line if/else statements, as in 'if(...) b++;'.
|
||||
nl_if_leave_one_liners = true
|
||||
|
||||
# Don't split one-line while statements, as in 'while(...) b++;'.
|
||||
nl_while_leave_one_liners = true
|
||||
|
||||
# Don't split one-line for statements, as in 'for(...) b++;'.
|
||||
nl_for_leave_one_liners = true
|
||||
|
||||
# Whether to indent the body of a C++11 lambda.
|
||||
indent_cpp_lambda_body = true
|
||||
|
||||
# The value might be used twice:
|
||||
# - at the assignment
|
||||
# - at the opening brace
|
||||
#
|
||||
# To prevent the double use of the indentation value, use this option with the
|
||||
# value 'true'.
|
||||
#
|
||||
# true: indentation will be used only once
|
||||
# false: indentation will be used every time (default)
|
||||
indent_cpp_lambda_only_once = true
|
||||
|
||||
# How to reflow comments.
|
||||
#
|
||||
# 0: No reflowing (apart from the line wrapping due to cmt_width) (default)
|
||||
# 1: No touching at all
|
||||
# 2: Full reflow
|
||||
cmt_reflow_mode = 1
|
||||
|
||||
# Whether to group cpp-comments that look like they are in a block. Only
|
||||
# meaningful if cmt_cpp_to_c=true.
|
||||
cmt_cpp_group = true
|
||||
|
||||
# Whether to put a star on subsequent comment lines.
|
||||
cmt_star_cont = true
|
||||
|
||||
# The number of spaces to insert at the start of subsequent comment lines.
|
||||
cmt_sp_before_star_cont = 1
|
||||
|
||||
# The number of spaces to insert after the star on subsequent comment lines.
|
||||
cmt_sp_after_star_cont = 1
|
||||
|
||||
# Whether to convert all tabs to spaces in comments. If false, tabs in
|
||||
# comments are left alone, unless used for indenting.
|
||||
cmt_convert_tab_to_spaces = true
|
||||
|
||||
|
||||
# Add a newline before ')' if an if/for/while/switch condition spans multiple
|
||||
# lines. Overrides nl_before_if_closing_paren if both are specified.
|
||||
nl_multi_line_sparen_close = ignore
|
||||
|
||||
# Add or remove newline before 'if'/'else if' closing parenthesis.
|
||||
nl_before_if_closing_paren = ignore
|
||||
|
||||
# Add or remove space around assignment operator '=' in a prototype.
|
||||
#
|
||||
# If set to ignore, use sp_assign.
|
||||
sp_assign_default = remove
|
||||
|
||||
# Whether to right-align numbers.
|
||||
align_number_right = true
|
||||
align_assign_span = 1
|
||||
cmt_cpp_to_c = false
|
||||
cmt_indent_multi = false
|
||||
cmt_insert_file_header = "./header.h"
|
||||
cmt_reflow_mode = 1
|
||||
cmt_sp_after_star_cont = 1
|
||||
cmt_sp_before_star_cont = 1
|
||||
cmt_star_cont = true
|
||||
eat_blanks_after_open_brace = false
|
||||
eat_blanks_before_close_brace = false
|
||||
indent_align_assign = false
|
||||
indent_case_brace = 0
|
||||
indent_columns = 2
|
||||
indent_cpp_lambda_body = false
|
||||
indent_func_call_param = true
|
||||
indent_func_def_param = true
|
||||
indent_switch_case = 2
|
||||
indent_with_tabs = 0
|
||||
input_tab_size = 2
|
||||
mod_add_long_ifdef_else_comment = 40
|
||||
mod_add_long_ifdef_endif_comment = 40
|
||||
mod_full_brace_do = false
|
||||
mod_full_brace_for = false
|
||||
mod_full_brace_if = false
|
||||
mod_full_brace_if_chain = true
|
||||
mod_full_brace_while = false
|
||||
mod_remove_extra_semicolon = true
|
||||
newlines = lf
|
||||
nl_after_brace_close = true
|
||||
nl_after_brace_open = true
|
||||
nl_assign_leave_one_liners = true
|
||||
nl_brace_else = add
|
||||
nl_class_leave_one_liners = true
|
||||
nl_create_for_one_liner = true
|
||||
nl_create_if_one_liner = false
|
||||
nl_create_while_one_liner = true
|
||||
nl_else_brace = remove
|
||||
nl_end_of_file = add
|
||||
nl_enum_brace = remove
|
||||
nl_enum_leave_one_liners = true
|
||||
nl_fdef_brace = remove
|
||||
nl_for_brace = remove
|
||||
nl_func_leave_one_liners = true
|
||||
nl_getset_leave_one_liners = true
|
||||
nl_if_brace = remove
|
||||
nl_if_leave_one_liners = true
|
||||
nl_multi_line_sparen_close = add
|
||||
nl_squeeze_ifdef = false
|
||||
nl_struct_brace = remove
|
||||
nl_switch_brace = remove
|
||||
nl_union_brace = remove
|
||||
pp_define_at_level = true
|
||||
pp_if_indent_code = true
|
||||
pp_indent = add
|
||||
pp_indent_at_level = true
|
||||
pp_indent_count = 2
|
||||
pp_indent_if = 0
|
||||
sp_after_comma = add
|
||||
sp_after_semi = add
|
||||
sp_after_sparen = add
|
||||
sp_arith = add
|
||||
sp_assign = add
|
||||
sp_assign_default = remove
|
||||
sp_before_comma = remove
|
||||
sp_before_sparen = add
|
||||
sp_bool = add
|
||||
sp_brace_else = add
|
||||
sp_cmt_cpp_start = add
|
||||
sp_compare = add
|
||||
sp_cond_colon = add
|
||||
sp_cond_question = add
|
||||
sp_else_brace = add
|
||||
sp_endif_cmt = true
|
||||
sp_fparen_brace = add
|
||||
sp_func_call_paren = remove
|
||||
sp_func_proto_paren = remove
|
||||
sp_inside_sparen = remove
|
||||
sp_inside_square = remove
|
||||
sp_paren_brace = add
|
||||
sp_paren_paren = remove
|
||||
|
Loading…
Reference in New Issue
Block a user