On 11/19/2015 11:40 AM, Martin Liška wrote: > On 11/19/2015 12:09 AM, Sebastian Pop wrote: >> Martin, thanks for getting this patch out. I like the patch. >> Jeff, clang-format has scripts that allow formatting only the lines >> touched by a patch. >> It also has a script to integrate with git: >> https://llvm.org/svn/llvm-project/cfe/trunk/tools/clang-format/git-clang-format >> We could use those scripts in a commit hook to automatically enforce >> correct formatting of new patches. >> >> Sebastian > > Hi. > > Thanks for pointing out the script touching just modified lines, > I mentioned the script in the clang-format file. > > Sending v2 that I'm going to install. > > Thanks, > Martin > >> >> On Wed, Nov 18, 2015 at 8:10 AM, Martin Liška <mli...@suse.cz> wrote: >>> Hello. >>> >>> Following patch adds a clang-format config file that should respect the GNU >>> coding standards. >>> As the file is not part of build process, I hope the patch can be applied >>> even though >>> we've just skipped to stage3? The patch adds a hunk to Makefile which can >>> create symlink >>> to the root directory of the GCC compiler. The clang-format automatically >>> loads style from >>> the configuration file. >>> >>> clang-format (version 3.8) provides rich variety of configuration options >>> that can >>> ensure the GNU coding style. >>> >>> Limitations: >>> + placement of opening brace of an initializer can't be requested >>> + sometimes, '(' is the trailing symbol at the end of a line, which can >>> look weird >>> >>> As we've been continuously converting our source base to C++, the >>> clang-format should >>> provide better results than a collection of regular expressions >>> (check_GNU_style.sh). >>> >>> As a reference file I attach gcc/tree-ssa-uninit.c file. >>> Feel free to comment the suggested configuration file. >>> >>> Thanks, >>> Martin >>> >
There's a small follow-up where I enhance list of FOR_EACH macros as spotted by octoploid. As the change is obvious in a new file, I'm going to install the patch. Thanks, Martin
From f5571ac8379a376056aa5dc4846d3adb2d1db7b8 Mon Sep 17 00:00:00 2001 From: marxin <mli...@suse.cz> Date: Thu, 19 Nov 2015 13:48:47 +0100 Subject: [PATCH] clang-format: Enhance list of FOR_EACH macros contrib/ChangeLog: 2015-11-19 Martin Liska <mli...@suse.cz> * clang-format: Enhance list of FOR_EACH macros. --- contrib/clang-format | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/clang-format b/contrib/clang-format index 8a6fd4b..76a9d87 100644 --- a/contrib/clang-format +++ b/contrib/clang-format @@ -43,7 +43,7 @@ BreakBeforeTernaryOperators: true ColumnLimit: 80 ConstructorInitializerIndentWidth: 2 ContinuationIndentWidth: 2 -ForEachMacros: ['_FOR_EACH','_FOR_EACH_1','FOR_EACH_AGGR_INIT_EXPR_ARG','FOR_EACH_ALIAS','FOR_EACH_ALLOCNO','FOR_EACH_ALLOCNO_OBJECT','FOR_EACH_ARTIFICIAL_DEF','FOR_EACH_ARTIFICIAL_USE','FOR_EACH_BB_FN','FOR_EACH_BB_REVERSE_FN','FOR_EACH_BIT_IN_MINMAX_SET','FOR_EACH_CALL_EXPR_ARG','FOR_EACH_CLONE','FOR_EACH_CONST_CALL_EXPR_ARG','FOR_EACH_CONSTRUCTOR_ELT','FOR_EACH_CONSTRUCTOR_VALUE','FOR_EACH_COPY','FOR_EACH_DEF','FOR_EACH_DEFINED_FUNCTION','FOR_EACH_DEFINED_SYMBOL','FOR_EACH_DEFINED_VARIABLE','FOR_EACH_DEP','FOR_EACH_EDGE','FOR_EACH_EXPR','FOR_EACH_EXPR_1','FOR_EACH_FUNCTION','FOR_EACH_FUNCTION_WITH_GIMPLE_BODY','FOR_EACH_HASH_TABLE_ELEMENT','FOR_EACH_IMM_USE_FAST','FOR_EACH_IMM_USE_ON_STMT','FOR_EACH_IMM_USE_STMT','FOR_EACH_INSN','FOR_EACH_INSN_1','FOR_EACH_INSN_DEF','FOR_EACH_INSN_EQ_USE','FOR_EACH_INSN_INFO_DEF','FOR_EACH_INSN_INFO_EQ_USE','FOR_EACH_INSN_INFO_MW','FOR_EACH_INSN_INFO_USE','FOR_EACH_INSN_USE','FOR_EACH_LOCAL_DECL','FOR_EACH_LOOP','FOR_EACH_LOOP_FN','FOR_EACH_OBJECT','FOR_EACH_OBJECT_CONFLICT','FOR_EACH_PHI_ARG','FOR_EACH_PHI_OR_STMT_DEF','FOR_EACH_PHI_OR_STMT_USE','FOR_EACH_PREF','FOR_EACH_SCALAR','FOR_EACH_SSA_DEF_OPERAND','FOR_EACH_SSA_TREE_OPERAND','FOR_EACH_SSA_USE_OPERAND','FOR_EACH_STATIC_INITIALIZER','FOR_EACH_SUBRTX','FOR_EACH_SUBRTX_PTR','FOR_EACH_SUBRTX_VAR','FOR_EACH_SUCC','FOR_EACH_SUCC_1','FOR_EACH_SYMBOL','FOR_EACH_VARIABLE','FOR_EACH_VEC_ELT','FOR_EACH_VEC_ELT_FROM','FOR_EACH_VEC_ELT_REVERSE','FOR_EACH_VEC_SAFE_ELT','FOR_EACH_VEC_SAFE_ELT_REVERSE','_FOR_EACH_X','_FOR_EACH_X_1','FOREACH_FUNCTION_ARGS','FOREACH_FUNCTION_ARGS_PTR'] +ForEachMacros: ['FOR_ALL_BB_FN','FOR_ALL_EH_REGION','FOR_ALL_EH_REGION_AT','FOR_ALL_EH_REGION_FN','FOR_ALL_INHERITED_FIELDS','FOR_ALL_PREDICATES','FOR_BB_BETWEEN','FOR_BB_INSNS','FOR_BB_INSNS_REVERSE','FOR_BB_INSNS_REVERSE_SAFE','FOR_BB_INSNS_SAFE','FOR_BODY','FOR_COND','FOR_EACH_AGGR_INIT_EXPR_ARG','FOR_EACH_ALIAS','FOR_EACH_ALLOCNO','FOR_EACH_ALLOCNO_OBJECT','FOR_EACH_ARTIFICIAL_DEF','FOR_EACH_ARTIFICIAL_USE','FOR_EACH_BB_FN','FOR_EACH_BB_REVERSE_FN','FOR_EACH_BIT_IN_MINMAX_SET','FOR_EACH_CALL_EXPR_ARG','FOR_EACH_CLONE','FOR_EACH_CONST_CALL_EXPR_ARG','FOR_EACH_CONSTRUCTOR_ELT','FOR_EACH_CONSTRUCTOR_VALUE','FOR_EACH_COPY','FOR_EACH_DEF','FOR_EACH_DEFINED_FUNCTION','FOR_EACH_DEFINED_SYMBOL','FOR_EACH_DEFINED_VARIABLE','FOR_EACH_DEP','FOR_EACH_EDGE','FOR_EACH_EXPR','FOR_EACH_EXPR_1','FOR_EACH_FUNCTION','FOREACH_FUNCTION_ARGS','FOREACH_FUNCTION_ARGS_PTR','FOR_EACH_FUNCTION_WITH_GIMPLE_BODY','FOR_EACH_HASH_TABLE_ELEMENT','FOR_EACH_IMM_USE_FAST','FOR_EACH_IMM_USE_ON_STMT','FOR_EACH_IMM_USE_STMT','FOR_EACH_INSN','FOR_EACH_INSN_1','FOR_EACH_INSN_DEF','FOR_EACH_INSN_EQ_USE','FOR_EACH_INSN_INFO_DEF','FOR_EACH_INSN_INFO_EQ_USE','FOR_EACH_INSN_INFO_MW','FOR_EACH_INSN_INFO_USE','FOR_EACH_INSN_USE','FOR_EACH_LOCAL_DECL','FOR_EACH_LOOP','FOR_EACH_LOOP_FN','FOR_EACH_OBJECT','FOR_EACH_OBJECT_CONFLICT','FOR_EACH_PHI_ARG','FOR_EACH_PHI_OR_STMT_DEF','FOR_EACH_PHI_OR_STMT_USE','FOR_EACH_PREF','FOR_EACH_SCALAR','FOR_EACH_SSA_DEF_OPERAND','FOR_EACH_SSA_TREE_OPERAND','FOR_EACH_SSA_USE_OPERAND','FOR_EACH_STATIC_INITIALIZER','FOR_EACH_SUBRTX','FOR_EACH_SUBRTX_PTR','FOR_EACH_SUBRTX_VAR','FOR_EACH_SUCC','FOR_EACH_SUCC_1','FOR_EACH_SYMBOL','FOR_EACH_VARIABLE','FOR_EACH_VEC_ELT','FOR_EACH_VEC_ELT_FROM','FOR_EACH_VEC_ELT_REVERSE','FOR_EACH_VEC_SAFE_ELT','FOR_EACH_VEC_SAFE_ELT_REVERSE','FOR_EXPR','FOR_INIT_STMT','FOR_SCOPE'] IndentCaseLabels: false NamespaceIndentation: None PenaltyBreakBeforeFirstCallParameter: 100 -- 2.6.2