diff --git a/.clang-format b/.clang-format index a5878f28342..5ea2651baa0 100644 --- a/.clang-format +++ b/.clang-format @@ -1,54 +1,40 @@ # Copyright (c) Microsoft Corporation. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -# https://releases.llvm.org/9.0.0/tools/clang/docs/ClangFormatStyleOptions.html +# https://releases.llvm.org/10.0.0/tools/clang/docs/ClangFormatStyleOptions.html --- # Language: Cpp - BasedOnStyle: LLVM - # AccessModifierOffset: -2 AccessModifierOffset: -4 - # AlignAfterOpenBracket: Align AlignAfterOpenBracket: DontAlign - # AlignConsecutiveMacros: false AlignConsecutiveMacros: true - # AlignConsecutiveAssignments: false AlignConsecutiveAssignments: true - # AlignConsecutiveDeclarations: false - # AlignEscapedNewlines: Right AlignEscapedNewlines: Left - # AlignOperands: true - # AlignTrailingComments: true AlignTrailingComments: false - # AllowAllArgumentsOnNextLine: true # AllowAllConstructorInitializersOnNextLine: true # AllowAllParametersOfDeclarationOnNextLine: true -# AllowShortBlocksOnASingleLine: false +# AllowShortBlocksOnASingleLine: Never # AllowShortCaseLabelsOnASingleLine: false - # AllowShortFunctionsOnASingleLine: All AllowShortFunctionsOnASingleLine: Empty - # AllowShortLambdasOnASingleLine: All # AllowShortIfStatementsOnASingleLine: Never # AllowShortLoopsOnASingleLine: false # AlwaysBreakAfterDefinitionReturnType: None # AlwaysBreakAfterReturnType: None # AlwaysBreakBeforeMultilineStrings: false - # AlwaysBreakTemplateDeclarations: MultiLine AlwaysBreakTemplateDeclarations: Yes - # BinPackArguments: true # BinPackParameters: true # BraceWrapping: @@ -68,10 +54,8 @@ AlwaysBreakTemplateDeclarations: Yes # SplitEmptyFunction: true # SplitEmptyRecord: true # SplitEmptyNamespace: true - # BreakBeforeBinaryOperators: None BreakBeforeBinaryOperators: NonAssignment - # BreakBeforeBraces: Attach # BreakBeforeInheritanceComma: false # BreakInheritanceList: BeforeColon @@ -80,16 +64,16 @@ BreakBeforeBinaryOperators: NonAssignment # BreakConstructorInitializers: BeforeColon # BreakAfterJavaFieldAnnotations: false # BreakStringLiterals: true - # ColumnLimit: 80 ColumnLimit: 120 - # CommentPragmas: '^ IWYU pragma:' # CompactNamespaces: false # ConstructorInitializerAllOnOneLineOrOnePerLine: false # ConstructorInitializerIndentWidth: 4 # ContinuationIndentWidth: 4 # Cpp11BracedListStyle: true +# DeriveLineEnding: true +DeriveLineEnding: false # DerivePointerAlignment: false # DisableFormat: false # ExperimentalAutoDetectBinPacking: false @@ -98,55 +82,52 @@ ColumnLimit: 120 # - foreach # - Q_FOREACH # - BOOST_FOREACH - # IncludeBlocks: Preserve IncludeBlocks: Regroup - # IncludeCategories: # - Regex: '^"(llvm|llvm-c|clang|clang-c)/' # Priority: 2 +# SortPriority: 0 # - Regex: '^(<|"(gtest|gmock|isl|json)/)' # Priority: 3 +# SortPriority: 0 # - Regex: '.*' # Priority: 1 +# SortPriority: 0 IncludeCategories: - Regex: '^$' Priority: 1 - Regex: '^<(Windows|userenv)\.h>$' Priority: 3 + SortPriority: 3 - Regex: '^$' - Priority: 4 + Priority: 3 + SortPriority: 4 - Regex: '^<__.*\.hpp>$' Priority: 2 - Regex: '\.hpp[>"]$' Priority: 5 - Regex: '.*' Priority: 2 - # IncludeIsMainRegex: '(Test)?$' +# IncludeIsMainSourceRegex: '' # IndentCaseLabels: false +# IndentGotoLabels: true # IndentPPDirectives: None - # IndentWidth: 2 IndentWidth: 4 - # IndentWrappedFunctionNames: false IndentWrappedFunctionNames: true - # JavaScriptQuotes: Leave # JavaScriptWrapImports: true # KeepEmptyLinesAtTheStartOfBlocks: true - # NOTE: MacroBlockBegin/MacroBlockEnd don't work with _CATCH_ALL. # MacroBlockBegin: '' # MacroBlockEnd: '' - # MaxEmptyLinesToKeep: 1 MaxEmptyLinesToKeep: 2 - # NamespaceIndentation: None NamespaceIndentation: All - # ObjCBinPackProtocolList: Auto # ObjCBlockIndentWidth: 2 # ObjCSpaceAfterProperty: false @@ -159,17 +140,13 @@ NamespaceIndentation: All # PenaltyBreakTemplateDeclaration: 10 # PenaltyExcessCharacter: 1000000 # PenaltyReturnTypeOnItsOwnLine: 60 - # PointerAlignment: Right PointerAlignment: Left - # ReflowComments: true # SortIncludes: true # SortUsingDeclarations: true - # SpaceAfterCStyleCast: false SpaceAfterCStyleCast: true - # SpaceAfterLogicalNot: false # SpaceAfterTemplateKeyword: true # SpaceBeforeAssignmentOperators: true @@ -178,20 +155,22 @@ SpaceAfterCStyleCast: true # SpaceBeforeInheritanceColon: true # SpaceBeforeParens: ControlStatements # SpaceBeforeRangeBasedForLoopColon: true +# SpaceInEmptyBlock: false # SpaceInEmptyParentheses: false # SpacesBeforeTrailingComments: 1 # SpacesInAngles: false +# SpacesInConditionalStatement: false # SpacesInContainerLiterals: true # SpacesInCStyleCastParentheses: false # SpacesInParentheses: false # SpacesInSquareBrackets: false -# Standard: Cpp11 - -# NOTE: _STD_BEGIN, _STD_END, etc. aren't macros for complete statements, but telling clang-format that they are -# produces the behavior that we want (with no block indentation). +# SpaceBeforeSquareBrackets: false +# Standard: Latest # StatementMacros: # - Q_UNUSED # - QT_REQUIRE_VERSION +# NOTE: _STD_BEGIN, _STD_END, etc. aren't macros for complete statements, but telling +# clang-format that they are produces the behavior that we want (with no block indentation). StatementMacros: - _STD_BEGIN - _STD_END @@ -201,7 +180,8 @@ StatementMacros: - _END_EXTERN_C - _EXTERN_C_UNLESS_PURE - _END_EXTERN_C_UNLESS_PURE - # TabWidth: 8 +# UseCRLF: false +UseCRLF: true # UseTab: Never ... diff --git a/stl/src/filesystem.cpp b/stl/src/filesystem.cpp index 0a1d3d5a1e8..063f5f9c7a6 100644 --- a/stl/src/filesystem.cpp +++ b/stl/src/filesystem.cpp @@ -18,7 +18,6 @@ #include #include - #include // We have several switches that do not have case statements for every possible enum value. diff --git a/tests/std/tests/P0896R4_ranges_alg_is_permutation/test.cpp b/tests/std/tests/P0896R4_ranges_alg_is_permutation/test.cpp index 9cd422f5b6f..ecf2f498f1c 100644 --- a/tests/std/tests/P0896R4_ranges_alg_is_permutation/test.cpp +++ b/tests/std/tests/P0896R4_ranges_alg_is_permutation/test.cpp @@ -8,7 +8,7 @@ #include #include #include -// + #include using namespace std; diff --git a/tests/std/tests/P0896R4_ranges_alg_search/test.cpp b/tests/std/tests/P0896R4_ranges_alg_search/test.cpp index cc284d34379..09875c71996 100644 --- a/tests/std/tests/P0896R4_ranges_alg_search/test.cpp +++ b/tests/std/tests/P0896R4_ranges_alg_search/test.cpp @@ -8,7 +8,7 @@ #include #include #include -// + #include using namespace std; diff --git a/tests/std/tests/P0896R4_ranges_range_machinery/test.cpp b/tests/std/tests/P0896R4_ranges_range_machinery/test.cpp index f74ed9425d7..10e217d99ad 100644 --- a/tests/std/tests/P0896R4_ranges_range_machinery/test.cpp +++ b/tests/std/tests/P0896R4_ranges_range_machinery/test.cpp @@ -25,7 +25,7 @@ #include #include #include -// + #include // Note that many tests herein assume: diff --git a/tools/inc/stljobs.h b/tools/inc/stljobs.h index f0f82da6c03..9e494a86e14 100644 --- a/tools/inc/stljobs.h +++ b/tools/inc/stljobs.h @@ -501,7 +501,7 @@ class thread_proc_attribute_list { thread_proc_attribute_list& operator=(thread_proc_attribute_list&&) = default; explicit thread_proc_attribute_list(const unsigned long attributeCount) { - size_t size; + SIZE_T size; if (InitializeProcThreadAttributeList(nullptr, attributeCount, 0, &size)) { fputs("First call to InitializeProcThreadAttributeList should not succeed.", stderr); abort();