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