<div dir="ltr">Hi! <div><br></div><div>Just checking in--is this ready to commit? Is there anything else I need to fix up?</div><div><br></div><div>Thanks!</div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Aug 12, 2022 at 12:00 PM Jim Shargo <<a href="mailto:jshargo@google.com">jshargo@google.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">It appears to be 13: <a href="https://clang.llvm.org/docs/ClangFormatStyleOptions.html" rel="noreferrer" target="_blank">https://clang.llvm.org/docs/ClangFormatStyleOptions.html</a><br>
<br>
<br>
On Fri, Aug 12, 2022 at 8:54 AM Petri Latvala <<a href="mailto:petri.latvala@intel.com" target="_blank">petri.latvala@intel.com</a>> wrote:<br>
><br>
> On Thu, Jul 28, 2022 at 01:57:36PM -0400, Jim Shargo wrote:<br>
> > As I was authoring my first patchset for IGT, I found myself fighting<br>
> > the tooling a bit to get everything right. I had to add a bunch of extra<br>
> > command line args to use my linux checkout's formatting rules to get the<br>
> > style right.<br>
> ><br>
> > I grabbed this from a recent checkout of torvald's repo.<br>
> ><br>
> > The commit I used was: e0dccc3b76fb35bb257b4118367a883073d7390e<br>
> ><br>
> > To make this discoverable to new contributors, this change also<br>
> > updates CONTRIBUTING.md with:<br>
> ><br>
> > - A link to git-clang-format, which is a useful tool for using<br>
> > clang-format from git just on a commit's changes<br>
> > - A link to .editorconfig to make it more discoverable<br>
> ><br>
> > Changes made to the linux kernel style:<br>
> ><br>
> > - Reflowing comments, including multi-line comments (ReflowComments)<br>
> > - Support for magic code blocks (ForEachMacros, IfMacros)<br>
> ><br>
> > Signed-off-by: Jim Shargo <<a href="mailto:jshargo@chromium.org" target="_blank">jshargo@chromium.org</a>><br>
> > ---<br>
> > V2 -> V3: Update CONTRIBUTING.md with a note about .editorconfig,<br>
> > remove reference to .clang-format from the .editorconfig<br>
> > V1 -> V2: Better support for IGT style and addressing comments<br>
> ><br>
> > .clang-format | 176 ++++++++++++++++++++++++++++++++++++++++++++++++<br>
> > CONTRIBUTING.md | 9 ++-<br>
> > 2 files changed, 182 insertions(+), 3 deletions(-)<br>
> > create mode 100644 .clang-format<br>
> ><br>
> > diff --git a/.clang-format b/.clang-format<br>
> > new file mode 100644<br>
> > index 00000000..da42bead<br>
> > --- /dev/null<br>
> > +++ b/.clang-format<br>
> > @@ -0,0 +1,176 @@<br>
> > +# SPDX-License-Identifier: GPL-2.0<br>
> > +#<br>
> > +# clang-format configuration file. Intended for clang-format >= 11.<br>
> > +#<br>
> > +# For more information, see:<br>
> > +#<br>
> > +# Documentation/process/clang-format.rst<br>
> > +# <a href="https://clang.llvm.org/docs/ClangFormat.html" rel="noreferrer" target="_blank">https://clang.llvm.org/docs/ClangFormat.html</a><br>
> > +# <a href="https://clang.llvm.org/docs/ClangFormatStyleOptions.html" rel="noreferrer" target="_blank">https://clang.llvm.org/docs/ClangFormatStyleOptions.html</a><br>
> > +#<br>
> > +# This file was pulled from the linux kernel at revision<br>
> > +# e0dccc3b76fb35bb257b4118367a883073d7390e.<br>
> > +#<br>
> > +# Changes made for IGT-specific styles should include a comment noting<br>
> > +# the previous value with "kernel-value". This makes it clear what we<br>
> > +# want to keep when updating this file.<br>
> > +---<br>
> > +AccessModifierOffset: -4<br>
> > +AlignAfterOpenBracket: Align<br>
> > +AlignConsecutiveAssignments: false<br>
> > +AlignConsecutiveDeclarations: false<br>
> > +AlignEscapedNewlines: Left<br>
> > +AlignOperands: true<br>
> > +AlignTrailingComments: false<br>
> > +AllowAllParametersOfDeclarationOnNextLine: false<br>
> > +AllowShortBlocksOnASingleLine: false<br>
> > +AllowShortCaseLabelsOnASingleLine: false<br>
> > +AllowShortFunctionsOnASingleLine: None<br>
> > +AllowShortIfStatementsOnASingleLine: false<br>
> > +AllowShortLoopsOnASingleLine: false<br>
> > +AlwaysBreakAfterDefinitionReturnType: None<br>
> > +AlwaysBreakAfterReturnType: None<br>
> > +AlwaysBreakBeforeMultilineStrings: false<br>
> > +AlwaysBreakTemplateDeclarations: false<br>
> > +BinPackArguments: true<br>
> > +BinPackParameters: true<br>
> > +BraceWrapping:<br>
> > + AfterClass: false<br>
> > + AfterControlStatement: false<br>
> > + AfterEnum: false<br>
> > + AfterFunction: true<br>
> > + AfterNamespace: true<br>
> > + AfterObjCDeclaration: false<br>
> > + AfterStruct: false<br>
> > + AfterUnion: false<br>
> > + AfterExternBlock: false<br>
> > + BeforeCatch: false<br>
> > + BeforeElse: false<br>
> > + IndentBraces: false<br>
> > + SplitEmptyFunction: true<br>
> > + SplitEmptyRecord: true<br>
> > + SplitEmptyNamespace: true<br>
> > +BreakBeforeBinaryOperators: None<br>
> > +BreakBeforeBraces: Custom<br>
> > +BreakBeforeInheritanceComma: false<br>
> > +BreakBeforeTernaryOperators: false<br>
> > +BreakConstructorInitializersBeforeComma: false<br>
> > +BreakConstructorInitializers: BeforeComma<br>
> > +BreakAfterJavaFieldAnnotations: false<br>
> > +BreakStringLiterals: false<br>
> > +ColumnLimit: 80<br>
> > +CommentPragmas: '^ IWYU pragma:'<br>
> > +CompactNamespaces: false<br>
> > +ConstructorInitializerAllOnOneLineOrOnePerLine: false<br>
> > +ConstructorInitializerIndentWidth: 8<br>
> > +ContinuationIndentWidth: 8<br>
> > +Cpp11BracedListStyle: false<br>
> > +DerivePointerAlignment: false<br>
> > +DisableFormat: false<br>
> > +ExperimentalAutoDetectBinPacking: false<br>
> > +FixNamespaceComments: false<br>
> > +<br>
> > +# Taken from:<br>
> > +# git grep -h '^#define [^[:space:]]*for_each[^[:space:]]*(' include/ tools/ \<br>
> > +# | sed "s,^#define \([^[:space:]]*for_each[^[:space:]]*\)(.*$, - '\1'," \<br>
> > +# | LC_ALL=C sort -u<br>
> > +ForEachMacros: # kernel-value: (long list removed)<br>
> > + # IGT rules, found via:<br>
> > + # git grep -h '^#define [^[:space:]]*for_each[^[:space:]]*(' include/ lib/ |<br>
> > + # sed "s,^#define \([^(]\+\).*,'\1'," |<br>
> > + # grep -v "__" |<br>
> > + # sort -u<br>
> > + - 'for_each_collection_data'<br>
> > + - 'for_each_combination'<br>
> > + - 'for_each_connected_output'<br>
> > + - 'for_each_connector_mode'<br>
> > + - 'for_each_ctx_cfg_engine'<br>
> > + - 'for_each_ctx_engine'<br>
> > + - 'for_each_format'<br>
> > + - 'for_each_if'<br>
> > + - 'for_each_memory_region'<br>
> > + - 'for_each_mmap_offset_type'<br>
> > + - 'for_each_physical_engine'<br>
> > + - 'for_each_physical_ring'<br>
> > + - 'for_each_pipe'<br>
> > + - 'for_each_pipe_static'<br>
> > + - 'for_each_pipe_with_single_output'<br>
> > + - 'for_each_pipe_with_valid_output'<br>
> > + - 'for_each_plane_on_pipe'<br>
> > + - 'for_each_prime_number'<br>
> > + - 'for_each_ring'<br>
> > + - 'for_each_subset'<br>
> > + - 'for_each_sysfs_gt_dirfd'<br>
> > + - 'for_each_sysfs_gt_path'<br>
> > + - 'for_each_valid_output_on_pipe'<br>
> > + - 'for_each_variation_nr'<br>
> > + - 'for_each_variation_r'<br>
> > + - 'igt_list_for_each_entry'<br>
> > + - 'igt_list_for_each_entry_reverse'<br>
> > + - 'igt_list_for_each_entry_safe'<br>
> > + - 'igt_list_for_each_entry_safe_reverse'<br>
> > +<br>
> > +IfMacros: # kernel-value: none<br>
> > + - 'igt_dynamic'<br>
> > + - 'igt_fixture'<br>
> > + - 'igt_fork'<br>
> > + - 'igt_subtest'<br>
> > + - 'igt_subtest_f'<br>
> > + - 'igt_subtest_group'<br>
> > + - 'igt_subtest_with_dynamic'<br>
> > + - 'igt_subtest_with_dynamic_f'<br>
> > + - 'igt_until_timeout'<br>
><br>
> What version of clang-format is needed for IfMacros?<br>
><br>
><br>
> --<br>
> Petri Latvala<br>
><br>
><br>
> > +<br>
> > +IncludeBlocks: Preserve<br>
> > +IncludeCategories:<br>
> > + - Regex: '.*'<br>
> > + Priority: 1<br>
> > +IncludeIsMainRegex: '(Test)?$'<br>
> > +IndentCaseLabels: false<br>
> > +IndentGotoLabels: false<br>
> > +IndentPPDirectives: None<br>
> > +IndentWidth: 8<br>
> > +IndentWrappedFunctionNames: false<br>
> > +JavaScriptQuotes: Leave<br>
> > +JavaScriptWrapImports: true<br>
> > +KeepEmptyLinesAtTheStartOfBlocks: false<br>
> > +MacroBlockBegin: ''<br>
> > +MacroBlockEnd: ''<br>
> > +MaxEmptyLinesToKeep: 1<br>
> > +NamespaceIndentation: None<br>
> > +ObjCBinPackProtocolList: Auto<br>
> > +ObjCBlockIndentWidth: 8<br>
> > +ObjCSpaceAfterProperty: true<br>
> > +ObjCSpaceBeforeProtocolList: true<br>
> > +<br>
> > +# Taken from git's rules<br>
> > +PenaltyBreakAssignment: 10<br>
> > +PenaltyBreakBeforeFirstCallParameter: 30<br>
> > +PenaltyBreakComment: 10<br>
> > +PenaltyBreakFirstLessLess: 0<br>
> > +PenaltyBreakString: 10<br>
> > +PenaltyExcessCharacter: 100<br>
> > +PenaltyReturnTypeOnItsOwnLine: 60<br>
> > +<br>
> > +PointerAlignment: Right<br>
> > +ReflowComments: true # kernel-value: false<br>
> > +SortIncludes: false<br>
> > +SortUsingDeclarations: false<br>
> > +SpaceAfterCStyleCast: false<br>
> > +SpaceAfterTemplateKeyword: true<br>
> > +SpaceBeforeAssignmentOperators: true<br>
> > +SpaceBeforeCtorInitializerColon: true<br>
> > +SpaceBeforeInheritanceColon: true<br>
> > +SpaceBeforeParens: ControlStatementsExceptForEachMacros<br>
> > +SpaceBeforeRangeBasedForLoopColon: true<br>
> > +SpaceInEmptyParentheses: false<br>
> > +SpacesBeforeTrailingComments: 1<br>
> > +SpacesInAngles: false<br>
> > +SpacesInContainerLiterals: false<br>
> > +SpacesInCStyleCastParentheses: false<br>
> > +SpacesInParentheses: false<br>
> > +SpacesInSquareBrackets: false<br>
> > +Standard: Cpp03<br>
> > +TabWidth: 8<br>
> > +UseTab: Always<br>
> > +...<br>
> > diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md<br>
> > index 6d1294ad..f2af5a18 100644<br>
> > --- a/CONTRIBUTING.md<br>
> > +++ b/CONTRIBUTING.md<br>
> > @@ -10,8 +10,10 @@ improvements for documentation and new tools and testcases.<br>
> > The Code<br>
> > --------<br>
> ><br>
> > -- The code should follow kernel coding style:<br>
> > - <a href="https://www.kernel.org/doc/html/latest/process/coding-style.html" rel="noreferrer" target="_blank">https://www.kernel.org/doc/html/latest/process/coding-style.html</a><br>
> > +- The code should follow [kernel coding style](coding-style). Before<br>
> > + sending out a patch, changes can be formatted with<br>
> > + [git-clang-format](git-clang-format). Editors can be configured<br>
> > + using .editorconfig for additional style support.<br>
> ><br>
> > - Testcases (subtests) have to use minus signs (-) as a word separator.<br>
> > The generated documentation contains glossary of commonly used terms.<br>
> > @@ -30,9 +32,10 @@ The Code<br>
> > provided by the igt library. The semantic patch lib/igt.cocci can help with<br>
> > more automatic conversions.<br>
> ><br>
> > +[coding-style]: <a href="https://www.kernel.org/doc/html/latest/process/coding-style.html" rel="noreferrer" target="_blank">https://www.kernel.org/doc/html/latest/process/coding-style.html</a><br>
> > +[git-clang-format]: <a href="https://github.com/llvm-mirror/clang/blob/master/tools/clang-format/git-clang-format" rel="noreferrer" target="_blank">https://github.com/llvm-mirror/clang/blob/master/tools/clang-format/git-clang-format</a><br>
> > [igt-describe]: <a href="https://drm.pages.freedesktop.org/igt-gpu-tools/igt-gpu-tools-Core.html#igt-describe" rel="noreferrer" target="_blank">https://drm.pages.freedesktop.org/igt-gpu-tools/igt-gpu-tools-Core.html#igt-describe</a><br>
> ><br>
> > -<br>
> > Sending Patches<br>
> > ---------------<br>
> ><br>
> > --<br>
> > 2.37.1.455.g008518b4e5-goog<br>
> ><br>
</blockquote></div>