diff --git a/tools/uncrustify.cfg b/tools/uncrustify.cfg new file mode 100644 index 0000000000..8f5d7b3e62 --- /dev/null +++ b/tools/uncrustify.cfg @@ -0,0 +1,144 @@ +# +# uncrustify config file for NuttX +# + +indent_with_tabs = 0 # 0=spaces only; 1=indent to level only; 2=indent with tabs +input_tab_size = 4 # original tab size +output_tab_size = 4 # new tab size +indent_columns = 2 # Two columns per indent level +indent_label = 1 # pos: absolute col, neg: relative column + +# +# Newlines +# + +nl_max = 2 # No more than \n\n +nl_after_func_proto = 1 # One \n after function prototype +nl_after_func_proto_group = 2 # Two \n after last prototype +nl_after_func_body = 1 # One \n after function body +nl_after_func_body_class = 1 # One \n after '}' of a single line function body +nl_after_multiline_comment = true # Newline after multiline comment +nl_before_block_comment = 2 # Two \n after block comment +nl_before_c_comment = 1 # At least line space before C comment +nl_before_cpp_comment = 1 # At least line space before C++ comment +nl_after_multiline_comment = true # Force newline after mult-line comment +nl_after_struct = 2 # Two \n after struct +nl_after_class = 2 # Two \n after class +nl_before_access_spec = 2 # Two \n before 'private:', 'public:', ... +nl_after_access_spec = 1 # One \n after 'private:', 'public:', ... +nl_comment_func_def = 2 # Two \n between function def and function comment. +nl_after_try_catch_finally = 2 # Two \n after a try-catch-finally block +nl_around_cs_property = 0 # No change in number of newlines before/after a property, indexer or event decl. +eat_blanks_after_open_brace = true # Remove blank lines after '{' +eat_blanks_before_close_brace = true # Remove blank lines after '}' +nl_remove_extra_newlines = 2 # Remove all newlines not specified by config +nl_before_return = false # No newline before return +nl_after_return = false # No newline after return statement` + +nl_enum_brace = add # "enum \n { vs enum {" +nl_union_brace = add # "union \n {" vs "union {" +nl_struct_brace = add # "struct \n {" vs "struct {" +nl_do_brace = add # "do \n {" vs "do {" +nl_if_brace = add # "if \n () {" vs "if () {" +nl_for_brace = add # "for \n () {" vs "for () {" +nl_else_brace = add # "else \n {" vs "else {" +nl_while_brace = add # "while \n () {" vs "while () {" +nl_switch_brace = add # "switch \n () {" vs "switch () {" +nl_brace_while = add # "} \n while" vs "} while" +nl_brace_else = add # "} \n else" vs "} else" +nl_func_var_def_blk = 1 +nl_fcall_brace = add # "list_for_each() \n {" vs "list_for_each() {" +nl_fdef_brace = add # "int foo() {" vs "int foo()\n{" +nl_before_case = true # Newline before 'case' statement + +# +# Source code modifications +# + +mod_full_brace_do = add # "do { a--; } while ();" vs "do a--; while ();" +mod_full_brace_for = add # "for () { a--; }" vs "for () a--;" +mod_full_brace_function = add # Add braces on single-line function definitions. (Pawn) +mod_full_brace_if = add # "if (a) { a--; }" vs "if (a) a--;" +mod_full_brace_if_chain = true # Make all if/elseif/else statements in a chain be braced +mod_full_brace_nl = 1 # Don't remove if more than 1 newlines +mod_full_brace_while = add # "while (a) { a--; } " vs "while (a) a--;" +mod_full_brace_using = add # Add braces on single-line 'using ()' statement +mod_paren_on_return = remove # "return 1;" vs "return (1);" +mod_pawn_semicolon = true # Change optional semicolons to real semicolons +mod_full_paren_if_bool = false # Don't add parens on 'while' and 'if' statement around bools +mod_remove_extra_semicolon = true # Remove superfluous semicolons +# mod_add_long_function_closebrace_comment +# mod_add_long_namespace_closebrace_comment +# mod_add_long_switch_closebrace_comment +# mod_add_long_ifdef_endif_comment +# mod_add_long_ifdef_else_comment +mod_move_case_break = false # Don't break into braced 'case' +mod_case_brace = add # Add braces around acase statements. +mod_remove_empty_return = true # Remove a void 'return;' that appears as the last statement in a function. + +# +# Comment modifications +# + +cmt_width = 78 # Wrap comments at line 78 +# cmt_reflow_mode # No reflowing +# cmt_convert_tab_to_spaces # Tabs retained in comments +# cmt_indent_multi # Don't disable multi-line comment changes +cmt_c_group = true # Group C comments that look like they are in a block +cmt_c_nl_start = true # No empty '/*' on the first line of the combined c-comment +cmt_c_nl_end = true # Add newline before the closing '*/' of the combined c-comment +cmt_cpp_group = true # Group C++ comments that look like they are in a block +cmt_cpp_nl_start = false # No '/*' on the first line of the combined cpp-comment +cmt_cpp_nl_end = true # Add newline before the closing '*/' of the combined C++ comment +cmt_cpp_to_c = true # Change C++ comments to C comments +cmt_star_cont = true # Add star to comment continuation +cmt_sp_before_star_cont = 1 # One space before star on subsequent comment lines +cmt_sp_after_star_cont = 1 # One space after star on subsequent comment lines +cmt_multi_check_last = true # Multi-line comments with a '*' lead, remove leading spaces +# cmt_insert_file_header # filename containing the file header +# cmt_insert_file_footer # filename containing the file footer +# cmt_insert_func_header # filename containing the function header +# cmt_insert_class_header # filename containing the class header +# cmt_insert_before_preproc # ? + +# +# inter-character spacing options +# + +sp_return_paren = force # "return (1);" vs "return(1);" +sp_sizeof_paren = remove # "sizeof (int)" vs "sizeof(int)" +sp_before_sparen = force # "if (" vs "if(" +sp_after_sparen = remove # "if () {" vs "if (){" +sp_after_cast = remove # "(int) a" vs "(int)a" +sp_inside_braces = add # "{ 1 }" vs "{1}" +sp_inside_braces_struct = add # "{ 1 }" vs "{1}" +sp_inside_braces_enum = add # "{ 1 }" vs "{1}" +sp_assign = add # "{ 1 }" vs "{1}" +sp_arith = add # Add spaces around assignment operators +sp_bool = add # Add spaces around boolean operators +sp_compare = add # Add spaces around comparison operators +sp_after_comma = add # Add space after comma +sp_func_def_paren = remove # "int foo (){" vs "int foo(){" +sp_func_call_paren = remove # "foo (" vs "foo(" +sp_func_proto_paren = remove # "int foo ();" vs "int foo();" + + +# +# Aligning stuff +# + +align_with_tabs = false # Use spaces to align +align_on_tabstop = true # align on tabstops +align_keep_tabs = false # Don't keep non-indenting tabs +align_enum_equ_span = 2 # '=' in enum definition +align_nl_cont = true # Align macros wrapped wht \n +align_var_def_span = 2 # Span for aligning varialbe definitions +align_var_def_inline = true # Align union/struct variable definitions +align_var_def_star_style = 2 # 2=Dangling +align_var_def_colon = true # Align colons in bit field definitions +align_assign_span = 1 # Span for aligning = +align_struct_init_span = 3 # align stuff in a structure init '= { }' +align_right_cmt_span = 3 # Span for aligning comments that end lines +align_pp_define_span = 8 # Span for aligning #define bodies +align_pp_define_gap = 2 # Min space define #define variable and value +indent_brace = 2 # Indent brace 2 from level