uncrustify.cfg (4644B)
1 input_tab_size = 2 2 output_tab_size = 2 3 4 indent_columns = 2 5 indent_with_tabs = 0 6 indent_case_brace = 2 7 indent_label=-16 8 9 # Keep code lines within the target width. Comments are intentionally only 10 # minimally formatted and may exceed this width. 11 code_width=80 12 #cmt_width=120 13 14 # Leave most comments alone for now 15 cmt_indent_multi=false 16 sp_cmt_cpp_start=add 17 18 sp_not=remove 19 # Compact "defined(FOO)" in preprocessor conditionals 20 sp_defined_paren=remove 21 22 sp_func_call_user_paren_paren=remove 23 sp_after_cast=remove 24 25 ls_for_split_full=true 26 ls_func_split_full=true 27 ls_code_width=false 28 29 # Keep macro bodies stable. This also preserves intentionally dense macro calls 30 # and avoids bad line splits in long #define bodies. 31 pp_ignore_define_body=true 32 33 # Keep nested preprocessor directives visibly nested as "# if" while leaving 34 # global include guards at column 1. 35 pp_indent=remove 36 pp_space_after=add 37 pp_space_count=2 38 pp_indent_in_guard=false 39 40 # Operators in wrapped expressions go at the start of the continuation line. 41 # This is uniform for arithmetic, bitwise, and boolean operators. 42 pos_arith=lead 43 pos_bool=lead 44 45 # Fully parenthesize boolean expressions in "if" and "return". 46 # mod_full_paren_assign_bool is intentionally left off: it wraps "for" loop 47 # increments as "(++i)". mod_full_paren_if_bool does not cover "while". 48 mod_full_paren_if_bool=true 49 mod_full_paren_return_bool=true 50 51 # Braces should be on their own line 52 nl_fdef_brace=add 53 nl_enum_brace=add 54 nl_struct_brace=add 55 nl_union_brace=add 56 nl_if_brace=add 57 nl_brace_else=add 58 nl_elseif_brace=add 59 nl_while_brace=add 60 nl_switch_brace=add 61 62 # no newline between "else" and "if" 63 nl_else_if=remove 64 65 nl_func_paren=remove 66 nl_assign_brace=remove 67 nl_after_semicolon=true 68 69 # No extra newlines that cause noisy diffs 70 nl_start_of_file=remove 71 nl_after_func_proto = 2 72 nl_after_func_body = 3 73 # If there's no new line, it's not a text file! 74 nl_end_of_file=add 75 nl_max_blank_in_func = 3 76 nl_max = 3 77 78 sp_inside_paren = remove 79 80 sp_arith = add 81 sp_arith_additive = add 82 83 # Remove misplaced spaces before commas and add missing spaces after commas. 84 sp_before_comma = remove 85 sp_after_comma = add 86 87 # C89 forbids a trailing comma after the last enum value: strip it if present. 88 mod_enum_last_comma = remove 89 90 # Add spaces around explicit enum values: "A = 0". 91 sp_enum_assign = add 92 93 # Keep a separator between macro names/signatures and replacement lists. 94 sp_macro = add 95 sp_macro_func = add 96 97 # We want spaces before and after "=" 98 sp_before_assign = add 99 sp_after_assign = add 100 101 # we want "char *foo;" 102 sp_before_ptr_star = force 103 sp_before_unnamed_ptr_star = force 104 sp_before_qualifier_ptr_star = force 105 sp_qualifier_unnamed_ptr_star = force 106 sp_after_ptr_star = remove 107 sp_after_ptr_star_func = remove 108 sp_after_ptr_star_qualifier = remove 109 sp_after_ptr_star_trailing = remove 110 sp_between_ptr_star = remove 111 sp_ptr_star_func_var = remove 112 sp_ptr_star_func_type = remove 113 sp_ptr_star_paren = remove 114 sp_before_ptr_star_func = force 115 sp_qualifier_ptr_star_func = force 116 sp_before_ptr_star_trailing = force 117 sp_qualifier_ptr_star_trailing = force 118 sp_inside_tparen = remove 119 sp_after_tparen_close = remove 120 sp_inside_paren_cast = remove 121 122 # we want "arr[10]" 123 sp_before_square = remove 124 sp_before_vardef_square = remove 125 sp_before_squares = remove 126 sp_inside_square = remove 127 128 # we want "if (foo) { ... }" 129 sp_before_sparen = force 130 131 sp_inside_fparen = remove 132 sp_inside_sparen = remove 133 134 # add space before function call and decl: "foo (x)" 135 sp_func_call_paren = force 136 sp_func_proto_paren = force 137 sp_func_proto_paren_empty = force 138 sp_func_def_paren = force 139 sp_func_def_paren_empty = force 140 141 # Keep formatter-generated boolean parentheses compact: 142 # "if ((a) || (b))", while preserving "if (m ())". 143 sp_paren_paren = remove 144 sp_bool = add 145 sp_compare = add 146 sp_cond_question = add 147 sp_cond_colon = add 148 149 nl_func_type_name = force 150 nl_func_proto_type_name = force 151 #nl_branch_else = add 152 nl_else_brace = add 153 nl_for_brace = add 154 155 # Treat function annotation macros as qualifiers so uncrustify keeps short 156 # chains of them together instead of splitting them as return type fragments. 157 set QUALIFIER MHD_INTERNAL MHD_EXTERN_ MHD_DEPR_FUNC_ MHD_NORETURN_ 158 set QUALIFIER MHD_FN_CONST_ MHD_FN_MUST_CHECK_RESULT_ MHD_FN_PURE_ 159 set QUALIFIER MHD_FN_RETURNS_NONNULL_ 160 set QUALIFIER MHD_FN_PAR_CSTR_ MHD_FN_PAR_FD_READ_ MHD_FN_PAR_FIX_ARR_SIZE_ 161 set QUALIFIER MHD_FN_PAR_DYN_ARR_SIZE_ 162 set QUALIFIER MHD_FN_PAR_IN_ MHD_FN_PAR_IN_SIZE_ MHD_FN_PAR_INOUT_ 163 set QUALIFIER MHD_FN_PAR_INOUT_SIZE_ MHD_FN_PAR_NONNULL_ 164 set QUALIFIER MHD_FN_PAR_NONNULL_ALL_ MHD_FN_PAR_OUT_ MHD_FN_PAR_OUT_SIZE_ 165 set QUALIFIER mhd_FN_OBJ_CONSTRUCTOR mhd_FN_RET_ALIGNED mhd_FN_RET_SIZED 166 set QUALIFIER mhd_FN_RET_UNALIASED