.uncrustify.cfg (6370B)
1 # Configuration options for Uncrustify specifying the Mbed TLS code style. 2 # 3 # Note: The code style represented by this file has not yet been introduced 4 # to Mbed TLS. 5 # 6 # Copyright The Mbed TLS Contributors 7 # SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later 8 9 10 # Wrap lines at 100 characters 11 code_width = 100 12 13 # Allow splitting long for statements between the condition statements 14 ls_for_split_full = true 15 16 # Allow splitting function calls between arguments 17 ls_func_split_full = true 18 19 input_tab_size = 4 20 21 # Spaces-only indentation 22 indent_with_tabs = 0 23 24 indent_columns = 4 25 26 # Indent 'case' 1 level from 'switch' 27 indent_switch_case = indent_columns 28 29 # Line-up strings broken by '\' 30 indent_align_string = true 31 32 # Braces on the same line (Egyptian-style braces) 33 nl_enum_brace = remove 34 nl_union_brace = remove 35 nl_struct_brace = remove 36 nl_do_brace = remove 37 nl_if_brace = remove 38 nl_for_brace = remove 39 nl_else_brace = remove 40 nl_while_brace = remove 41 nl_switch_brace = remove 42 43 # Braces on same line as keywords that follow them - 'else' and the 'while' in 'do {} while ()'; 44 nl_brace_else = remove 45 nl_brace_while = remove 46 # Space before else on the same line 47 sp_brace_else = add 48 # If else is on the same line as '{', force exactly 1 space between them 49 sp_else_brace = force 50 51 # Functions are the exception and have braces on the next line 52 nl_fcall_brace = add 53 nl_fdef_brace = add 54 55 # Force exactly one space between ')' and '{' in statements 56 sp_sparen_brace = force 57 58 # At least 1 space around assignment 59 sp_assign = add 60 61 # Remove spaces around the preprocessor '##' token-concatenate 62 sp_pp_concat = ignore 63 64 # At least 1 space around '||' and '&&' 65 sp_bool = add 66 67 # But no space after the '!' operator 68 sp_not = remove 69 70 # No space after the bitwise-not '~' operator 71 sp_inv = remove 72 73 # No space after the addressof '&' operator 74 sp_addr = remove 75 76 # No space around the member '.' and '->' operators 77 sp_member = remove 78 79 # No space after the dereference '*' operator 80 sp_deref = remove 81 82 # No space after a unary negation '-' 83 sp_sign = remove 84 85 # No space between the '++'/'--' operator and its operand 86 sp_incdec = remove 87 88 # At least 1 space around comparison operators 89 sp_compare = add 90 91 # Remove spaces inside all kinds of parentheses: 92 93 # Remove spaces inside parentheses 94 sp_inside_paren = remove 95 96 # No spaces inside statement parentheses 97 sp_inside_sparen = remove 98 99 # No spaces inside cast parentheses '( char )x' -> '(char)x' 100 sp_inside_paren_cast = remove 101 102 # No spaces inside function parentheses 103 sp_inside_fparen = remove 104 # (The case where the function has no parameters/arguments) 105 sp_inside_fparens = remove 106 107 # No spaces inside the first parentheses in a function type 108 sp_inside_tparen = remove 109 110 # (Uncrustify >= 0.74.0) No spaces inside parens in for statements 111 sp_inside_for = remove 112 113 # Remove spaces between nested parentheses '( (' -> '((' 114 sp_paren_paren = remove 115 # (Uncrustify >= 0.74.0) 116 sp_sparen_paren = remove 117 118 # Remove spaces between ')' and adjacent '(' 119 sp_cparen_oparen = remove 120 121 # (Uncrustify >= 0.73.0) space between 'do' and '{' 122 sp_do_brace_open = force 123 124 # (Uncrustify >= 0.73.0) space between '}' and 'while' 125 sp_brace_close_while = force 126 127 # At least 1 space before a '*' pointer star 128 sp_before_ptr_star = add 129 130 # Remove spaces between pointer stars 131 sp_between_ptr_star = remove 132 133 # No space after a pointer star 134 sp_after_ptr_star = remove 135 136 # But allow a space in the case of e.g. char * const x; 137 sp_after_ptr_star_qualifier = ignore 138 139 # Remove space after star in a function return type 140 sp_after_ptr_star_func = remove 141 142 # At least 1 space after a type in variable definition etc 143 sp_after_type = add 144 145 # Force exactly 1 space between a statement keyword (e.g. 'if') and an opening parenthesis 146 sp_before_sparen = force 147 148 # Remove a space before a ';' 149 sp_before_semi = remove 150 # (Uncrustify >= 0.73.0) Remove space before a semi in a non-empty for 151 sp_before_semi_for = remove 152 # (Uncrustify >= 0.73.0) Remove space in empty first statement of a for 153 sp_before_semi_for_empty = remove 154 # (Uncrustify >= 0.74.0) Remove space in empty middle statement of a for 155 sp_between_semi_for_empty = remove 156 157 # Add a space after a ';' (unless a comment follows) 158 sp_after_semi = add 159 # (Uncrustify >= 0.73.0) Add a space after a semi in non-empty for statements 160 sp_after_semi_for = add 161 # (Uncrustify >= 0.73.0) No space after final semi in empty for statements 162 sp_after_semi_for_empty = remove 163 164 # Remove spaces on the inside of square brackets '[]' 165 sp_inside_square = remove 166 167 # Must have at least 1 space after a comma 168 sp_after_comma = add 169 170 # Must not have a space before a comma 171 sp_before_comma = remove 172 173 # No space before the ':' in a case statement 174 sp_before_case_colon = remove 175 176 # Must have space after a cast - '(char)x' -> '(char) x' 177 sp_after_cast = add 178 179 # No space between 'sizeof' and '(' 180 sp_sizeof_paren = remove 181 182 # At least 1 space inside '{ }' 183 sp_inside_braces = add 184 185 # At least 1 space inside '{ }' in an enum 186 sp_inside_braces_enum = add 187 188 # At least 1 space inside '{ }' in a struct 189 sp_inside_braces_struct = add 190 191 # At least 1 space between a function return type and the function name 192 sp_type_func = add 193 194 # No space between a function name and its arguments/parameters 195 sp_func_proto_paren = remove 196 sp_func_def_paren = remove 197 sp_func_call_paren = remove 198 199 # No space between '__attribute__' and '(' 200 sp_attribute_paren = remove 201 202 # No space between 'defined' and '(' in preprocessor conditions 203 sp_defined_paren = remove 204 205 # At least 1 space between a macro's name and its definition 206 sp_macro = add 207 sp_macro_func = add 208 209 # Force exactly 1 space between a '}' and the name of a typedef if on the same line 210 sp_brace_typedef = force 211 212 # At least 1 space before a '\' line continuation 213 sp_before_nl_cont = add 214 215 # At least 1 space around '?' and ':' in ternary statements 216 sp_cond_colon = add 217 sp_cond_question = add 218 219 # Space between #else/#endif and comment afterwards 220 sp_endif_cmt = add 221 222 # Remove newlines at the start of a file 223 nl_start_of_file = remove 224 225 # At least 1 newline at the end of a file 226 nl_end_of_file = add 227 nl_end_of_file_min = 1 228 229 # Add braces in single-line statements 230 mod_full_brace_do = add 231 mod_full_brace_for = add 232 mod_full_brace_if = add 233 mod_full_brace_while = add 234 235 # Remove parentheses from return statements 236 mod_paren_on_return = remove 237 238 # Disable removal of leading spaces in a multi-line comment if the first and 239 # last lines are the same length 240 cmt_multi_check_last = false