1*cfb92d14SAndroid Build Coastguard Worker# Configuration options for Uncrustify specifying the Mbed TLS code style. 2*cfb92d14SAndroid Build Coastguard Worker# 3*cfb92d14SAndroid Build Coastguard Worker# Note: The code style represented by this file has not yet been introduced 4*cfb92d14SAndroid Build Coastguard Worker# to Mbed TLS. 5*cfb92d14SAndroid Build Coastguard Worker# 6*cfb92d14SAndroid Build Coastguard Worker# Copyright The Mbed TLS Contributors 7*cfb92d14SAndroid Build Coastguard Worker# SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later 8*cfb92d14SAndroid Build Coastguard Worker 9*cfb92d14SAndroid Build Coastguard Worker 10*cfb92d14SAndroid Build Coastguard Worker# Wrap lines at 100 characters 11*cfb92d14SAndroid Build Coastguard Workercode_width = 100 12*cfb92d14SAndroid Build Coastguard Worker 13*cfb92d14SAndroid Build Coastguard Worker# Allow splitting long for statements between the condition statements 14*cfb92d14SAndroid Build Coastguard Workerls_for_split_full = true 15*cfb92d14SAndroid Build Coastguard Worker 16*cfb92d14SAndroid Build Coastguard Worker# Allow splitting function calls between arguments 17*cfb92d14SAndroid Build Coastguard Workerls_func_split_full = true 18*cfb92d14SAndroid Build Coastguard Worker 19*cfb92d14SAndroid Build Coastguard Workerinput_tab_size = 4 20*cfb92d14SAndroid Build Coastguard Worker 21*cfb92d14SAndroid Build Coastguard Worker# Spaces-only indentation 22*cfb92d14SAndroid Build Coastguard Workerindent_with_tabs = 0 23*cfb92d14SAndroid Build Coastguard Worker 24*cfb92d14SAndroid Build Coastguard Workerindent_columns = 4 25*cfb92d14SAndroid Build Coastguard Worker 26*cfb92d14SAndroid Build Coastguard Worker# Indent 'case' 1 level from 'switch' 27*cfb92d14SAndroid Build Coastguard Workerindent_switch_case = indent_columns 28*cfb92d14SAndroid Build Coastguard Worker 29*cfb92d14SAndroid Build Coastguard Worker# Line-up strings broken by '\' 30*cfb92d14SAndroid Build Coastguard Workerindent_align_string = true 31*cfb92d14SAndroid Build Coastguard Worker 32*cfb92d14SAndroid Build Coastguard Worker# Braces on the same line (Egyptian-style braces) 33*cfb92d14SAndroid Build Coastguard Workernl_enum_brace = remove 34*cfb92d14SAndroid Build Coastguard Workernl_union_brace = remove 35*cfb92d14SAndroid Build Coastguard Workernl_struct_brace = remove 36*cfb92d14SAndroid Build Coastguard Workernl_do_brace = remove 37*cfb92d14SAndroid Build Coastguard Workernl_if_brace = remove 38*cfb92d14SAndroid Build Coastguard Workernl_for_brace = remove 39*cfb92d14SAndroid Build Coastguard Workernl_else_brace = remove 40*cfb92d14SAndroid Build Coastguard Workernl_while_brace = remove 41*cfb92d14SAndroid Build Coastguard Workernl_switch_brace = remove 42*cfb92d14SAndroid Build Coastguard Worker 43*cfb92d14SAndroid Build Coastguard Worker# Braces on same line as keywords that follow them - 'else' and the 'while' in 'do {} while ()'; 44*cfb92d14SAndroid Build Coastguard Workernl_brace_else = remove 45*cfb92d14SAndroid Build Coastguard Workernl_brace_while = remove 46*cfb92d14SAndroid Build Coastguard Worker# Space before else on the same line 47*cfb92d14SAndroid Build Coastguard Workersp_brace_else = add 48*cfb92d14SAndroid Build Coastguard Worker# If else is on the same line as '{', force exactly 1 space between them 49*cfb92d14SAndroid Build Coastguard Workersp_else_brace = force 50*cfb92d14SAndroid Build Coastguard Worker 51*cfb92d14SAndroid Build Coastguard Worker# Functions are the exception and have braces on the next line 52*cfb92d14SAndroid Build Coastguard Workernl_fcall_brace = add 53*cfb92d14SAndroid Build Coastguard Workernl_fdef_brace = add 54*cfb92d14SAndroid Build Coastguard Worker 55*cfb92d14SAndroid Build Coastguard Worker# Force exactly one space between ')' and '{' in statements 56*cfb92d14SAndroid Build Coastguard Workersp_sparen_brace = force 57*cfb92d14SAndroid Build Coastguard Worker 58*cfb92d14SAndroid Build Coastguard Worker# At least 1 space around assignment 59*cfb92d14SAndroid Build Coastguard Workersp_assign = add 60*cfb92d14SAndroid Build Coastguard Worker 61*cfb92d14SAndroid Build Coastguard Worker# Remove spaces around the preprocessor '##' token-concatenate 62*cfb92d14SAndroid Build Coastguard Workersp_pp_concat = ignore 63*cfb92d14SAndroid Build Coastguard Worker 64*cfb92d14SAndroid Build Coastguard Worker# At least 1 space around '||' and '&&' 65*cfb92d14SAndroid Build Coastguard Workersp_bool = add 66*cfb92d14SAndroid Build Coastguard Worker 67*cfb92d14SAndroid Build Coastguard Worker# But no space after the '!' operator 68*cfb92d14SAndroid Build Coastguard Workersp_not = remove 69*cfb92d14SAndroid Build Coastguard Worker 70*cfb92d14SAndroid Build Coastguard Worker# No space after the bitwise-not '~' operator 71*cfb92d14SAndroid Build Coastguard Workersp_inv = remove 72*cfb92d14SAndroid Build Coastguard Worker 73*cfb92d14SAndroid Build Coastguard Worker# No space after the addressof '&' operator 74*cfb92d14SAndroid Build Coastguard Workersp_addr = remove 75*cfb92d14SAndroid Build Coastguard Worker 76*cfb92d14SAndroid Build Coastguard Worker# No space around the member '.' and '->' operators 77*cfb92d14SAndroid Build Coastguard Workersp_member = remove 78*cfb92d14SAndroid Build Coastguard Worker 79*cfb92d14SAndroid Build Coastguard Worker# No space after the dereference '*' operator 80*cfb92d14SAndroid Build Coastguard Workersp_deref = remove 81*cfb92d14SAndroid Build Coastguard Worker 82*cfb92d14SAndroid Build Coastguard Worker# No space after a unary negation '-' 83*cfb92d14SAndroid Build Coastguard Workersp_sign = remove 84*cfb92d14SAndroid Build Coastguard Worker 85*cfb92d14SAndroid Build Coastguard Worker# No space between the '++'/'--' operator and its operand 86*cfb92d14SAndroid Build Coastguard Workersp_incdec = remove 87*cfb92d14SAndroid Build Coastguard Worker 88*cfb92d14SAndroid Build Coastguard Worker# At least 1 space around comparison operators 89*cfb92d14SAndroid Build Coastguard Workersp_compare = add 90*cfb92d14SAndroid Build Coastguard Worker 91*cfb92d14SAndroid Build Coastguard Worker# Remove spaces inside all kinds of parentheses: 92*cfb92d14SAndroid Build Coastguard Worker 93*cfb92d14SAndroid Build Coastguard Worker# Remove spaces inside parentheses 94*cfb92d14SAndroid Build Coastguard Workersp_inside_paren = remove 95*cfb92d14SAndroid Build Coastguard Worker 96*cfb92d14SAndroid Build Coastguard Worker# No spaces inside statement parentheses 97*cfb92d14SAndroid Build Coastguard Workersp_inside_sparen = remove 98*cfb92d14SAndroid Build Coastguard Worker 99*cfb92d14SAndroid Build Coastguard Worker# No spaces inside cast parentheses '( char )x' -> '(char)x' 100*cfb92d14SAndroid Build Coastguard Workersp_inside_paren_cast = remove 101*cfb92d14SAndroid Build Coastguard Worker 102*cfb92d14SAndroid Build Coastguard Worker# No spaces inside function parentheses 103*cfb92d14SAndroid Build Coastguard Workersp_inside_fparen = remove 104*cfb92d14SAndroid Build Coastguard Worker# (The case where the function has no parameters/arguments) 105*cfb92d14SAndroid Build Coastguard Workersp_inside_fparens = remove 106*cfb92d14SAndroid Build Coastguard Worker 107*cfb92d14SAndroid Build Coastguard Worker# No spaces inside the first parentheses in a function type 108*cfb92d14SAndroid Build Coastguard Workersp_inside_tparen = remove 109*cfb92d14SAndroid Build Coastguard Worker 110*cfb92d14SAndroid Build Coastguard Worker# (Uncrustify >= 0.74.0) No spaces inside parens in for statements 111*cfb92d14SAndroid Build Coastguard Workersp_inside_for = remove 112*cfb92d14SAndroid Build Coastguard Worker 113*cfb92d14SAndroid Build Coastguard Worker# Remove spaces between nested parentheses '( (' -> '((' 114*cfb92d14SAndroid Build Coastguard Workersp_paren_paren = remove 115*cfb92d14SAndroid Build Coastguard Worker# (Uncrustify >= 0.74.0) 116*cfb92d14SAndroid Build Coastguard Workersp_sparen_paren = remove 117*cfb92d14SAndroid Build Coastguard Worker 118*cfb92d14SAndroid Build Coastguard Worker# Remove spaces between ')' and adjacent '(' 119*cfb92d14SAndroid Build Coastguard Workersp_cparen_oparen = remove 120*cfb92d14SAndroid Build Coastguard Worker 121*cfb92d14SAndroid Build Coastguard Worker# (Uncrustify >= 0.73.0) space between 'do' and '{' 122*cfb92d14SAndroid Build Coastguard Workersp_do_brace_open = force 123*cfb92d14SAndroid Build Coastguard Worker 124*cfb92d14SAndroid Build Coastguard Worker# (Uncrustify >= 0.73.0) space between '}' and 'while' 125*cfb92d14SAndroid Build Coastguard Workersp_brace_close_while = force 126*cfb92d14SAndroid Build Coastguard Worker 127*cfb92d14SAndroid Build Coastguard Worker# At least 1 space before a '*' pointer star 128*cfb92d14SAndroid Build Coastguard Workersp_before_ptr_star = add 129*cfb92d14SAndroid Build Coastguard Worker 130*cfb92d14SAndroid Build Coastguard Worker# Remove spaces between pointer stars 131*cfb92d14SAndroid Build Coastguard Workersp_between_ptr_star = remove 132*cfb92d14SAndroid Build Coastguard Worker 133*cfb92d14SAndroid Build Coastguard Worker# No space after a pointer star 134*cfb92d14SAndroid Build Coastguard Workersp_after_ptr_star = remove 135*cfb92d14SAndroid Build Coastguard Worker 136*cfb92d14SAndroid Build Coastguard Worker# But allow a space in the case of e.g. char * const x; 137*cfb92d14SAndroid Build Coastguard Workersp_after_ptr_star_qualifier = ignore 138*cfb92d14SAndroid Build Coastguard Worker 139*cfb92d14SAndroid Build Coastguard Worker# Remove space after star in a function return type 140*cfb92d14SAndroid Build Coastguard Workersp_after_ptr_star_func = remove 141*cfb92d14SAndroid Build Coastguard Worker 142*cfb92d14SAndroid Build Coastguard Worker# At least 1 space after a type in variable definition etc 143*cfb92d14SAndroid Build Coastguard Workersp_after_type = add 144*cfb92d14SAndroid Build Coastguard Worker 145*cfb92d14SAndroid Build Coastguard Worker# Force exactly 1 space between a statement keyword (e.g. 'if') and an opening parenthesis 146*cfb92d14SAndroid Build Coastguard Workersp_before_sparen = force 147*cfb92d14SAndroid Build Coastguard Worker 148*cfb92d14SAndroid Build Coastguard Worker# Remove a space before a ';' 149*cfb92d14SAndroid Build Coastguard Workersp_before_semi = remove 150*cfb92d14SAndroid Build Coastguard Worker# (Uncrustify >= 0.73.0) Remove space before a semi in a non-empty for 151*cfb92d14SAndroid Build Coastguard Workersp_before_semi_for = remove 152*cfb92d14SAndroid Build Coastguard Worker# (Uncrustify >= 0.73.0) Remove space in empty first statement of a for 153*cfb92d14SAndroid Build Coastguard Workersp_before_semi_for_empty = remove 154*cfb92d14SAndroid Build Coastguard Worker# (Uncrustify >= 0.74.0) Remove space in empty middle statement of a for 155*cfb92d14SAndroid Build Coastguard Workersp_between_semi_for_empty = remove 156*cfb92d14SAndroid Build Coastguard Worker 157*cfb92d14SAndroid Build Coastguard Worker# Add a space after a ';' (unless a comment follows) 158*cfb92d14SAndroid Build Coastguard Workersp_after_semi = add 159*cfb92d14SAndroid Build Coastguard Worker# (Uncrustify >= 0.73.0) Add a space after a semi in non-empty for statements 160*cfb92d14SAndroid Build Coastguard Workersp_after_semi_for = add 161*cfb92d14SAndroid Build Coastguard Worker# (Uncrustify >= 0.73.0) No space after final semi in empty for statements 162*cfb92d14SAndroid Build Coastguard Workersp_after_semi_for_empty = remove 163*cfb92d14SAndroid Build Coastguard Worker 164*cfb92d14SAndroid Build Coastguard Worker# Remove spaces on the inside of square brackets '[]' 165*cfb92d14SAndroid Build Coastguard Workersp_inside_square = remove 166*cfb92d14SAndroid Build Coastguard Worker 167*cfb92d14SAndroid Build Coastguard Worker# Must have at least 1 space after a comma 168*cfb92d14SAndroid Build Coastguard Workersp_after_comma = add 169*cfb92d14SAndroid Build Coastguard Worker 170*cfb92d14SAndroid Build Coastguard Worker# Must not have a space before a comma 171*cfb92d14SAndroid Build Coastguard Workersp_before_comma = remove 172*cfb92d14SAndroid Build Coastguard Worker 173*cfb92d14SAndroid Build Coastguard Worker# No space before the ':' in a case statement 174*cfb92d14SAndroid Build Coastguard Workersp_before_case_colon = remove 175*cfb92d14SAndroid Build Coastguard Worker 176*cfb92d14SAndroid Build Coastguard Worker# Must have space after a cast - '(char)x' -> '(char) x' 177*cfb92d14SAndroid Build Coastguard Workersp_after_cast = add 178*cfb92d14SAndroid Build Coastguard Worker 179*cfb92d14SAndroid Build Coastguard Worker# No space between 'sizeof' and '(' 180*cfb92d14SAndroid Build Coastguard Workersp_sizeof_paren = remove 181*cfb92d14SAndroid Build Coastguard Worker 182*cfb92d14SAndroid Build Coastguard Worker# At least 1 space inside '{ }' 183*cfb92d14SAndroid Build Coastguard Workersp_inside_braces = add 184*cfb92d14SAndroid Build Coastguard Worker 185*cfb92d14SAndroid Build Coastguard Worker# At least 1 space inside '{ }' in an enum 186*cfb92d14SAndroid Build Coastguard Workersp_inside_braces_enum = add 187*cfb92d14SAndroid Build Coastguard Worker 188*cfb92d14SAndroid Build Coastguard Worker# At least 1 space inside '{ }' in a struct 189*cfb92d14SAndroid Build Coastguard Workersp_inside_braces_struct = add 190*cfb92d14SAndroid Build Coastguard Worker 191*cfb92d14SAndroid Build Coastguard Worker# At least 1 space between a function return type and the function name 192*cfb92d14SAndroid Build Coastguard Workersp_type_func = add 193*cfb92d14SAndroid Build Coastguard Worker 194*cfb92d14SAndroid Build Coastguard Worker# No space between a function name and its arguments/parameters 195*cfb92d14SAndroid Build Coastguard Workersp_func_proto_paren = remove 196*cfb92d14SAndroid Build Coastguard Workersp_func_def_paren = remove 197*cfb92d14SAndroid Build Coastguard Workersp_func_call_paren = remove 198*cfb92d14SAndroid Build Coastguard Worker 199*cfb92d14SAndroid Build Coastguard Worker# No space between '__attribute__' and '(' 200*cfb92d14SAndroid Build Coastguard Workersp_attribute_paren = remove 201*cfb92d14SAndroid Build Coastguard Worker 202*cfb92d14SAndroid Build Coastguard Worker# No space between 'defined' and '(' in preprocessor conditions 203*cfb92d14SAndroid Build Coastguard Workersp_defined_paren = remove 204*cfb92d14SAndroid Build Coastguard Worker 205*cfb92d14SAndroid Build Coastguard Worker# At least 1 space between a macro's name and its definition 206*cfb92d14SAndroid Build Coastguard Workersp_macro = add 207*cfb92d14SAndroid Build Coastguard Workersp_macro_func = add 208*cfb92d14SAndroid Build Coastguard Worker 209*cfb92d14SAndroid Build Coastguard Worker# Force exactly 1 space between a '}' and the name of a typedef if on the same line 210*cfb92d14SAndroid Build Coastguard Workersp_brace_typedef = force 211*cfb92d14SAndroid Build Coastguard Worker 212*cfb92d14SAndroid Build Coastguard Worker# At least 1 space before a '\' line continuation 213*cfb92d14SAndroid Build Coastguard Workersp_before_nl_cont = add 214*cfb92d14SAndroid Build Coastguard Worker 215*cfb92d14SAndroid Build Coastguard Worker# At least 1 space around '?' and ':' in ternary statements 216*cfb92d14SAndroid Build Coastguard Workersp_cond_colon = add 217*cfb92d14SAndroid Build Coastguard Workersp_cond_question = add 218*cfb92d14SAndroid Build Coastguard Worker 219*cfb92d14SAndroid Build Coastguard Worker# Space between #else/#endif and comment afterwards 220*cfb92d14SAndroid Build Coastguard Workersp_endif_cmt = add 221*cfb92d14SAndroid Build Coastguard Worker 222*cfb92d14SAndroid Build Coastguard Worker# Remove newlines at the start of a file 223*cfb92d14SAndroid Build Coastguard Workernl_start_of_file = remove 224*cfb92d14SAndroid Build Coastguard Worker 225*cfb92d14SAndroid Build Coastguard Worker# At least 1 newline at the end of a file 226*cfb92d14SAndroid Build Coastguard Workernl_end_of_file = add 227*cfb92d14SAndroid Build Coastguard Workernl_end_of_file_min = 1 228*cfb92d14SAndroid Build Coastguard Worker 229*cfb92d14SAndroid Build Coastguard Worker# Add braces in single-line statements 230*cfb92d14SAndroid Build Coastguard Workermod_full_brace_do = add 231*cfb92d14SAndroid Build Coastguard Workermod_full_brace_for = add 232*cfb92d14SAndroid Build Coastguard Workermod_full_brace_if = add 233*cfb92d14SAndroid Build Coastguard Workermod_full_brace_while = add 234*cfb92d14SAndroid Build Coastguard Worker 235*cfb92d14SAndroid Build Coastguard Worker# Remove parentheses from return statements 236*cfb92d14SAndroid Build Coastguard Workermod_paren_on_return = remove 237*cfb92d14SAndroid Build Coastguard Worker 238*cfb92d14SAndroid Build Coastguard Worker# Disable removal of leading spaces in a multi-line comment if the first and 239*cfb92d14SAndroid Build Coastguard Worker# last lines are the same length 240*cfb92d14SAndroid Build Coastguard Workercmt_multi_check_last = false 241