From 0d65b24b93e8e59b463cefa8db668bd6aa4d6afc Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Fri, 10 Jul 2020 10:02:17 +0200 Subject: [PATCH] format: some adjustments to the style and mark ForEachMacros "ForEachMacros" requires us to maintain a list of for each macros. However, that seems doable, as we only seldom add such macros. --- .clang-format | 49 ++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 46 insertions(+), 3 deletions(-) diff --git a/.clang-format b/.clang-format index 6f82654aed..47b20bb57d 100644 --- a/.clang-format +++ b/.clang-format @@ -8,8 +8,8 @@ ContinuationIndentWidth: 4 UseCRLF: false AlignAfterOpenBracket: Align -AlignConsecutiveAssignments: false -AlignConsecutiveDeclarations: false +AlignConsecutiveAssignments: true +AlignConsecutiveDeclarations: true AlignConsecutiveMacros: true AlignEscapedNewlines: Left AlignOperands: true @@ -49,11 +49,12 @@ IndentWrappedFunctionNames: false KeepEmptyLinesAtTheStartOfBlocks: false MaxEmptyLinesToKeep: 1 +DerivePointerAlignment: false PointerAlignment: Right ReflowComments: false SortIncludes: false SpaceAfterCStyleCast: true -SpaceAfterLogicalNot: true +SpaceAfterLogicalNot: false SpaceBeforeAssignmentOperators: true SpaceBeforeParens: Always SpaceBeforeSquareBrackets: false @@ -63,3 +64,45 @@ SpacesBeforeTrailingComments: 2 SpacesInCStyleCastParentheses: false SpacesInContainerLiterals: false SpacesInParentheses: false + +ForEachMacros: ['c_list_for_each', + 'c_list_for_each_continue', + 'c_list_for_each_entry', + 'c_list_for_each_entry_continue', + 'c_list_for_each_entry_safe', + 'c_list_for_each_entry_safe_continue', + 'c_list_for_each_entry_safe_unlink', + 'c_list_for_each_safe', + 'c_list_for_each_safe_continue', + 'c_list_for_each_safe_unlink', + 'c_rbtree_for_each', + 'c_rbtree_for_each_entry', + 'c_rbtree_for_each_entry_postorder', + 'c_rbtree_for_each_entry_safe', + 'c_rbtree_for_each_entry_safe_postorder', + 'c_rbtree_for_each_entry_safe_postorder_unlink', + 'c_rbtree_for_each_postorder', + 'c_rbtree_for_each_safe', + 'c_rbtree_for_each_safe_postorder', + 'c_rbtree_for_each_safe_postorder_unlink', + 'json_object_foreach_safe', + 'ndp_msg_opt_dnssl_for_each_domain', + 'ndp_msg_opt_for_each_offset', + 'ndp_msg_opt_rdnss_for_each_addr', + 'nla_for_each_attr', + 'nla_for_each_nested', + 'nm_c_list_for_each_entry_prev', + 'nm_dedup_multi_iter_for_each', + 'nm_ip_config_iter_ip4_address_for_each', + 'nm_ip_config_iter_ip4_route_for_each', + 'nm_ip_config_iter_ip6_address_for_each', + 'nm_ip_config_iter_ip6_route_for_each', + 'nm_json_array_foreach', + 'nm_json_object_foreach', + 'nm_manager_for_each_active_connection', + 'nm_manager_for_each_active_connection_safe', + 'nm_manager_for_each_device', + 'nm_manager_for_each_device_safe', + 'nmp_cache_iter_for_each', + 'nmp_cache_iter_for_each_link', + ]