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