.uncrustify.cfg 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. # Ambrevar C-style
  2. # Inspired by K&R and Go, with function opening brace on the same line.
  3. # We enforce some sane properties, such as UTF-8 and LF newlines.
  4. # No alignment, tab-indented.
  5. ################################################################################
  6. # General options
  7. newlines = lf
  8. utf8_bom = remove
  9. utf8_byte = true
  10. utf8_force = true
  11. ################################################################################
  12. # Indenting
  13. # 1=indent to level only, 2=indent with tabs
  14. indent_with_tabs = 2
  15. input_tab_size = 8
  16. indent_columns = output_tab_size
  17. # How to indent goto labels
  18. # >0 : absolute column where 1 is the leftmost column
  19. # <=0 : subtract from brace indent
  20. indent_label = 0
  21. # Whether to indent comments found in first column
  22. indent_col1_comment = true # false/true
  23. # The continuation indent. If non-zero, this overrides the indent of '(' and '=' continuation indents.
  24. # For FreeBSD, this is set to 4. Negative value is absolute and not increased for each ( level
  25. indent_continue = output_tab_size # number
  26. ################################################################################
  27. # Code modifying options (non-whitespace)
  28. mod_paren_on_return = remove # "return 1;" -> "return (1);"
  29. mod_full_brace_if = force # "if (a) a--;" -> "if (a) { a--; }"
  30. mod_full_brace_for = force
  31. mod_full_brace_do = force
  32. mod_full_brace_while = force
  33. ################################################################################
  34. # Newline adding and removing options
  35. nl_enum_brace = remove # "enum \n {" -> "enum {"
  36. nl_union_brace = remove
  37. nl_struct_brace = remove
  38. nl_do_brace = remove
  39. nl_if_brace = remove
  40. nl_for_brace = remove
  41. nl_else_brace = remove
  42. nl_while_brace = remove
  43. nl_switch_brace = remove
  44. nl_fcall_brace = remove
  45. nl_fdef_brace = remove
  46. nl_brace_while = remove
  47. nl_brace_else = remove
  48. # Whether to not put blanks after '#ifxx', '#elxx', or before '#endif'
  49. # nl_squeeze_ifdef = true
  50. # Add or remove newline between return type and function name in a function definition
  51. nl_func_type_name = remove
  52. # Whether to remove blank lines before/after '}'/'{' respectively.
  53. eat_blanks_before_close_brace = true
  54. eat_blanks_after_open_brace = true
  55. # nl_after_return = true
  56. # nl_func_var_def_blk = 1
  57. # nl_before_case = 1
  58. ################################################################################
  59. # Spacing options
  60. sp_arith = force
  61. sp_assign = force
  62. sp_bool = force
  63. sp_compare = force
  64. sp_before_semi = remove
  65. sp_before_square = remove
  66. sp_before_squares = remove
  67. sp_inside_square = remove
  68. sp_after_comma = force
  69. sp_after_cast = remove # "(int) a" -> "(int)a"
  70. sp_after_sparen = force # "if (){" -> "if () {"
  71. sp_before_sparen = force # "if (" -> "if("
  72. sp_inside_paren = remove # "( 1 )" -> "(1)"
  73. sp_paren_paren = remove # space between (( and ))
  74. sp_inside_fparen = remove # "( 1 )" -> "(1)" - functions
  75. sp_inside_sparen = remove # "( 1 )" -> "(1)" - if/for/etc
  76. sp_sizeof_paren = force # "sizeof(int)" -> "sizeof (int)"
  77. sp_inside_braces = remove # "{ 1 }" -> "{1}"
  78. sp_inside_braces_struct = remove # "{ 1 }" -> "{1}"
  79. sp_inside_braces_enum = remove # "{ 1 }" -> "{1}"
  80. sp_func_def_paren = remove # "int foo () {" -> "int foo() {"
  81. sp_func_proto_paren = remove # "int foo ();" -> "int foo();"
  82. sp_func_call_paren = remove # "foo (" -> "foo("
  83. sp_return_paren = remove # "return (1);" -> "return(1);"
  84. sp_else_brace = force # "else{" -> "else {"
  85. sp_brace_else = force # "}else" -> "} else"
  86. # Add or remove space before pointer star '*'
  87. sp_before_ptr_star = force # ignore/add/remove/force
  88. # Add or remove space between pointer stars '*'
  89. sp_between_ptr_star = remove # ignore/add/remove/force
  90. # Add or remove space after pointer star '*', if followed by a word.
  91. sp_after_ptr_star = remove # ignore/add/remove/force
  92. # Add or remove space between return type and function name
  93. # A minimum of 1 is forced except for pointer return types.
  94. sp_type_func = force
  95. # Add or remove space between ')' and '(' of function
  96. sp_fparen_brace = force
  97. ################################################################################
  98. # Comment modifications
  99. # Whether to change cpp-comments into c-comments
  100. cmt_cpp_to_c = false
  101. # Whether to put a star on subsequent comment lines
  102. # cmt_star_cont = true
  103. # If false, disable all multi-line comment changes, including cmt_width. keyword substitution, and leading chars.
  104. cmt_indent_multi = false
  105. # Set the comment reflow mode (default: 0)
  106. # 0: no reflowing (apart from the line wrapping due to cmt_width)
  107. # 1: no touching at all
  108. # 2: full reflow
  109. # cmt_reflow_mode = 0
  110. ################################################################################
  111. # Preprocessor options
  112. # Add or remove space after # based on pp_level of #if blocks
  113. pp_space = remove
  114. # Whether to indent #if/#else/#endif at the brace level (true) or from column 1 (false)
  115. pp_indent_at_level = true # false/true
  116. # Whether to indent '#define' at the brace level (true) or from column 1 (false)
  117. pp_define_at_level = true # false/true