From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id A6C9C42805; Wed, 22 Mar 2023 18:07:05 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 27AF042B7E; Wed, 22 Mar 2023 18:07:02 +0100 (CET) Received: from mail-pf1-f181.google.com (mail-pf1-f181.google.com [209.85.210.181]) by mails.dpdk.org (Postfix) with ESMTP id 95DDE40A84 for ; Wed, 22 Mar 2023 18:07:00 +0100 (CET) Received: by mail-pf1-f181.google.com with SMTP id l14so11531655pfc.11 for ; Wed, 22 Mar 2023 10:07:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20210112.gappssmtp.com; s=20210112; t=1679504819; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=uDorUkIxJj+l9luqSQFKyYlWr7TQ+LXGKdj2SIOxf64=; b=OeMmH88yxuFzNpL/MsaNC8iRFTZrxTskd5JymrRH5L8g9MX+NwrM+Nzs7zHnKTv1rS BhIRK+dEeIYpPfAIg1mMao4Bn3uuf0SnRlE/wxUDO8YN203LR2adwcI8jLyRPIOgr1cG Yss2Wi0eMhzuP9hYQFoFuIDRb1DTPBuzfV90Q9FPzfv6UKHySoYsadSyKAnAaU9baYnV yF34cbVYGbygY/4+6C1d/RdgtB10WTNPUCi5PTIMYmStomaQSEYJkx2QaDIxlZuXUhNx uTiUCcUBTVXCLrkpwM6ldqI94SPIMToLsoRQx6SU8gkGWs9Vvj4VjagOuGdaSiKg+lPc FBCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679504819; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=uDorUkIxJj+l9luqSQFKyYlWr7TQ+LXGKdj2SIOxf64=; b=WC6YYtFmTLi10bWHgQocTCXNNZSmBgK8158nhDabrSa84+3Hu1Im6VN3DJ7nL6lYF4 Rpa5h6JxlqIvf19TVBgnJlkUKCQacI8SoNeOedqFgVtxKYCkprUzy3pKEQvgmxiWWgr4 pZlTfgQKKhsSxH3S6JN5Iz7gvwE0yoagGGqBu2+/+wreEkUgd3w3XwS6DpUNkrBpjUlz ZYVWtX7lBP/azhmnbsDGZPJoWUw6/dXYuW5Z9kDoI704LjvNl4eq//FyRhZ5IbcMYnfg UsTTuyIa1rWjYYKAuqsR2W+f3JuzxxjzZrC8Xk5bVJfxQ+jrq+VvT/JeiotgySpFJFp+ 3TZw== X-Gm-Message-State: AO0yUKUhuqteEVfFovfv8TtzE4JRCx0vGU3agQE7rmervQDnDXKK2gqF bMI0h5mAa/Tu2sICu8QrQXdZv3yMyrR/dA+HCqa2KQ== X-Google-Smtp-Source: AK7set/fQhDbrM/2Cn0ntMmFL8fLRP4TjSm1H6uG02fiSEFPaEaC76/d7ILdrCrQae7Y8cFoLRdBdQ== X-Received: by 2002:aa7:8bd4:0:b0:626:2984:8a76 with SMTP id s20-20020aa78bd4000000b0062629848a76mr3370645pfd.34.1679504819520; Wed, 22 Mar 2023 10:06:59 -0700 (PDT) Received: from hermes.local (204-195-120-218.wavecable.com. [204.195.120.218]) by smtp.gmail.com with ESMTPSA id c18-20020a62e812000000b006227c3d5e29sm10698765pfi.16.2023.03.22.10.06.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Mar 2023 10:06:59 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger Subject: [RFC 1/2] Add clang format file Date: Wed, 22 Mar 2023 10:06:54 -0700 Message-Id: <20230322170655.45166-2-stephen@networkplumber.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230322170655.45166-1-stephen@networkplumber.org> References: <20230322170655.45166-1-stephen@networkplumber.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Based off of Linux kernel style with some local modifications and DPDK foreach macros. A couple of open questions to be resolved befor merging. Is GPL license ok for config file (inherited from Linux here)? Do we want to have per-driver files for some drivers (like MLX5)? Signed-off-by: Stephen Hemminger --- .clang-format | 181 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 181 insertions(+) create mode 100644 .clang-format diff --git a/.clang-format b/.clang-format new file mode 100644 index 000000000000..ad4d30520253 --- /dev/null +++ b/.clang-format @@ -0,0 +1,181 @@ +# SPDX-License-Identifier: GPL-2.0 +# +# clang-format configuration file. Intended for clang-format >= 11. +# +# For more information, see: +# +# Documentation/process/clang-format.rst +# https://clang.llvm.org/docs/ClangFormat.html +# https://clang.llvm.org/docs/ClangFormatStyleOptions.html +# +--- +AccessModifierOffset: -4 +AlignAfterOpenBracket: Align +AlignConsecutiveAssignments: false +AlignConsecutiveDeclarations: false +AlignEscapedNewlines: Left +AlignOperands: true +AlignTrailingComments: false +AllowAllParametersOfDeclarationOnNextLine: false +AllowShortBlocksOnASingleLine: false +AllowShortCaseLabelsOnASingleLine: false +AllowShortFunctionsOnASingleLine: None +AllowShortIfStatementsOnASingleLine: false +AllowShortLoopsOnASingleLine: false +AlwaysBreakAfterDefinitionReturnType: None +AlwaysBreakAfterReturnType: All +AlwaysBreakBeforeMultilineStrings: false +BinPackArguments: true +BinPackParameters: true +BraceWrapping: + AfterClass: false + AfterControlStatement: false + AfterEnum: false + AfterFunction: true + AfterNamespace: true + AfterObjCDeclaration: false + AfterStruct: false + AfterUnion: false + AfterExternBlock: false + BeforeCatch: false + BeforeElse: false + IndentBraces: false + SplitEmptyFunction: true + SplitEmptyRecord: true + SplitEmptyNamespace: true +BreakBeforeBinaryOperators: None +BreakBeforeBraces: Custom +BreakBeforeInheritanceComma: false +BreakBeforeTernaryOperators: false +BreakConstructorInitializersBeforeComma: false +BreakConstructorInitializers: BeforeComma +BreakAfterJavaFieldAnnotations: false +BreakStringLiterals: false +ColumnLimit: 100 +CompactNamespaces: false +ConstructorInitializerAllOnOneLineOrOnePerLine: false +ConstructorInitializerIndentWidth: 8 +ContinuationIndentWidth: 8 +Cpp11BracedListStyle: false +DerivePointerAlignment: false +DisableFormat: false +ExperimentalAutoDetectBinPacking: false +FixNamespaceComments: false + +# Taken from: +# git grep -h '^#define [^[:space:]]*[A-Z_]*FOREACH[A-Z_]*' lib/ drivers/ \ +# | sed "s,^#define \([:space:]]*[A-Z_]*FOREACH[A-Z_]*\)(.*$, - \1," \ +# | LC_ALL=C sort -u +ForEachMacros: + - CIRBUF_FOREACH + - FOREACH_ABS_FUNC_IN_PORT + - FOREACH_DEVICE_ON_AUXILARY_BUS + - FOREACH_DEVICE_ON_PCIBUS + - FOREACH_DEVICE_ON_PLATFORM_BUS + - FOREACH_DEVICE_ON_VMBUS + - FOREACH_DRIVER_ON_AUXILARY_BUS + - FOREACH_DRIVER_ON_PCIBUS + - FOREACH_DRIVER_ON_PLATFORM_BUS + - FOREACH_DRIVER_ON_VMBUS + - FOREACH_SUBDEV + - FOREACH_SUBDEV_STATE + - ILIST_FOREACH + - LIST_FOREACH + - LIST_FOREACH_FROM + - LIST_FOREACH_FROM_SAFE + - LIST_FOREACH_SAFE + - MLX5_ETH_FOREACH_DEV + - MLX5_IPOOL_FOREACH + - MLX5_L3T_FOREACH + - ML_AVG_FOREACH_QP + - ML_AVG_RESET_FOREACH_QP + - ML_MAX_FOREACH_QP + - ML_MAX_RESET_FOREACH_QP + - ML_MIN_FOREACH_QP + - ML_MIN_RESET_FOREACH_QP + - PLT_TAILQ_FOREACH_SAFE + - RTE_BBDEV_FORWEACH + - RTE_DEV_FOREACH + - RTE_EAL_DEVARGS_FOREACH + - RTE_ETH_FOREACH_DEV + - RTE_ETH_FOREACH_DEV_OWNED_BY + - RTE_ETH_FOREACH_DEV_SIBLING + - RTE_ETH_FOREACH_MATCHING_DEV + - RTE_ETH_FOREACH_VALID_DEV + - RTE_GPU_FOREACH + - RTE_GPU_FOREACH_CHILD + - RTE_GPU_FOREACH_PARENT + - RTE_LCORE_FOREACH + - RTE_LCORE_FOREACH_WORKER + - RTE_TAILQ_FOREACH + - RTE_TAILQ_FOREACH_SAFE + - SILIST_FOREACH + - SLIST_FOREACH + - SLIST_FOREACH_FROM + - SLIST_FOREACH_FROM_SAFE + - SLIST_FOREACH_SAFE + - STAILQ_FOREACH + - TAILQ_FOREACH + - TAILQ_FOREACH_ENTRY + - TAILQ_FOREACH_ENTRY_SAFE + - TAILQ_FOREACH_FROM_SAFE + - TAILQ_FOREACH_SAFE + - json_array_foreach + - json_object_foreach + - rte_graph_foreach + - rte_graph_foreach_node + - vdev_netvsc_foreach_iface + +IncludeBlocks: Preserve +IncludeCategories: + - Regex: '.*' + Priority: 1 +IncludeIsMainRegex: '(Test)?$' +IndentCaseLabels: false +IndentGotoLabels: false +IndentPPDirectives: None +IndentWidth: 8 +IndentWrappedFunctionNames: false +JavaScriptQuotes: Leave +JavaScriptWrapImports: true +KeepEmptyLinesAtTheStartOfBlocks: false +MacroBlockBegin: '' +MacroBlockEnd: '' +MaxEmptyLinesToKeep: 1 +NamespaceIndentation: None +ObjCBinPackProtocolList: Auto +ObjCBlockIndentWidth: 8 +ObjCSpaceAfterProperty: true +ObjCSpaceBeforeProtocolList: true + +# Taken from git's rules +PenaltyBreakAssignment: 10 +PenaltyBreakBeforeFirstCallParameter: 30 +PenaltyBreakComment: 10 +PenaltyBreakFirstLessLess: 0 +PenaltyBreakString: 10 +PenaltyExcessCharacter: 100 +PenaltyReturnTypeOnItsOwnLine: 60 + +PointerAlignment: Right +ReflowComments: false +SortIncludes: false +SortUsingDeclarations: false +SpaceAfterCStyleCast: false +SpaceAfterTemplateKeyword: true +SpaceBeforeAssignmentOperators: true +SpaceBeforeCtorInitializerColon: true +SpaceBeforeInheritanceColon: true +SpaceBeforeParens: ControlStatementsExceptForEachMacros +SpaceBeforeRangeBasedForLoopColon: true +SpaceInEmptyParentheses: false +SpacesBeforeTrailingComments: 1 +SpacesInAngles: false +SpacesInContainerLiterals: false +SpacesInCStyleCastParentheses: false +SpacesInParentheses: false +SpacesInSquareBrackets: false +Standard: Cpp03 +TabWidth: 8 +UseTab: Always +... -- 2.39.2