From patchwork Sat Oct 12 01:49:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Karthik Nayak X-Patchwork-Id: 13833481 Received: from mail-ej1-f54.google.com (mail-ej1-f54.google.com [209.85.218.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CAD3ABE65 for ; Sat, 12 Oct 2024 01:50:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728697803; cv=none; b=M4PDyVNdTviu4roXqIwtu5B2iL8qqawLFzjfjTRmvhfTYAV4+ff/IfLIcW9InZMbqc/yJNMDNZizUEBaWsoyCB12CGMvL3GqXMn46H1n/kk2IToIIxr8ZfB/oPR2p6m9kSjteQOjh2Uoq0vEwwim+8cNvFkHTCoaca2ioPDbZ1c= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728697803; c=relaxed/simple; bh=4ZP4xfDsJdNW5syTAMSbm6pEHivl+K9hdCP4cvlw2Hw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=rlMYB5puQgPQQh7dHvU8iCy6WRjshXk7WNkoBx2pbJeasHxHtwlUXUEUpMVjR5zLxA8zO56ZFugX7rrcJS7EvyosMEo0LNTikc8qav+/tmsoVtULPSKGDWR1IlA5dKIoWjXeIKdYfiIk9ZBapA6iorWvjEi8NouNpYc0LlrRdyY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=ZoLFOVdH; arc=none smtp.client-ip=209.85.218.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ZoLFOVdH" Received: by mail-ej1-f54.google.com with SMTP id a640c23a62f3a-a99ebb390a5so34964466b.1 for ; Fri, 11 Oct 2024 18:50:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1728697800; x=1729302600; darn=vger.kernel.org; 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=Q1xbwj/bdEV/vJyLMpdUUhO86jpBmMnVDrj7Xsyluz4=; b=ZoLFOVdHurpVciWglPyCjW8ETfQPRadOLd07O8YOagynyKGmuD7l6VkeqiC8SYIUSF Pain3gHus5z/oSlLykKz6WzRAhpAKpZvOOT/wD7QJ6fqdc97T8wwhPm7GKN1H1BpfjyL 9hGbYmg8crTIBjQHrXQiEyfK+L5ADr0ZfzVrPde4zmg0+g7maC9jKHsBRvjUjqyZRAoU zQsSRpU2fYXAVVFeYizVLBNK2iOSiM28alUjwT3d4urUOFAzSK6i0gjSFuar/3d5CHIH TQQ1aDe8CVKG6EI8FPRPv1D5PPCv7FE2Laqru8O1gOqLbZnlFZV9UaF/i79cBHMK5n+T 04vg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728697800; x=1729302600; 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=Q1xbwj/bdEV/vJyLMpdUUhO86jpBmMnVDrj7Xsyluz4=; b=dhaZnNsz7BYiKXnU52VgUheozTu7re2ZAuAGZkjHsdn8ZmRE08eXDNNI94oT2IgEZG TcLMZ3yZXo7XT+nS2dpbYOb4xit1t1wM/zIYoFblJOksW1NrY4cdz+XyTTynY0Crqes8 PhY9m+gwoXc1ghQG8cJytpYAMukNeVTHcZFUlU9GVG+pNUkNZ+p/ca11ng80ReYpaPp3 yywRkxhIEponP9Y7bKC2WfsfTMbvD0uuJJDkryZTmN2cmhQ8gDTND4sEp7JpEKLcQbK1 REC/cL9B95phMF1S+bWoeAqYC2rV1P8sQMf4kNTjUFCcQGgc9lsjq59AfX8sEJeTz2Lp AzeQ== X-Gm-Message-State: AOJu0Yz7CyXmkJ0Tiydhfxpb80AGXWl268ceKp8elHI8scCUmFexABpC E9JFaILRRjBx4LhNC/ezBE1Ovfj6iEf2HQpy70sl/UxyfA3q8Wn6 X-Google-Smtp-Source: AGHT+IH7Uv0+xLGy5nDEFD40EnaGUpEEnoFSsLvPAlhud8fIuqBzQeMiXOzFVNzegQuJbedBQD8NDg== X-Received: by 2002:a17:906:7307:b0:a99:4112:5e6e with SMTP id a640c23a62f3a-a99a0eb7dd7mr846083166b.3.1728697799879; Fri, 11 Oct 2024 18:49:59 -0700 (PDT) Received: from archlinux.fritz.box ([2a02:2455:825d:6a00:6bb4:436f:5699:ff21]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a99a80bfc5esm273122266b.142.2024.10.11.18.49.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Oct 2024 18:49:58 -0700 (PDT) From: Karthik Nayak To: karthik.188@gmail.com Cc: git@vger.kernel.org, gitster@pobox.com, jltobler@gmail.com, toon@iotcl.com, johannes.schindelin@gmx.de, spectral@google.com Subject: [PATCH v3 1/3] clang-format: re-adjust line break penalties Date: Sat, 12 Oct 2024 03:49:51 +0200 Message-ID: <74bbd2f9db1ddfd5210be8fde2db84f67acff27d.1728697428.git.karthik.188@gmail.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 In 42efde4c29 (clang-format: adjust line break penalties, 2017-09-29) we adjusted the line break penalties to really fine tune what we care about while doing line breaks. Modify some of those to be more inline with what we care about in the Git project now. We need to understand that the values set to penalties in '.clang-format' are relative to each other and do not hold any absolute value. The penalty arguments take an 'Unsigned' value, so we have some liberty over the values we can set. First, in that commit, we decided, that under no circumstances do we want to exceed 80 characters. This seems a bit too strict. We do overshoot this limit from time to time to prioritize readability. So let's reduce the value for 'PenaltyExcessCharacter' to 10. This means we that we add a penalty of 10 for each character that exceeds the column limit. By itself this is enough to restrict to column limit. Tuning other penalties in relation to this is what is important. The penalty `PenaltyBreakAssignment` talks about the penalty for breaking an assignment operator on to the next line. In our project, we are okay with this, so giving a value of 5, which is below the value for 'PenaltyExcessCharacter' ensures that in the end, even 1 character over the column limit is not worth keeping an assignment on the same line. Similarly set the penalty for breaking before the first call parameter 'PenaltyBreakBeforeFirstCallParameter' and the penalty for breaking comments 'PenaltyBreakComment' and the penalty for breaking string literals 'PenaltyBreakString' also to 5. Finally, we really care about not breaking the return type into its own line and we really care about not breaking before an open parenthesis. This avoids weird formatting like: static const struct strbuf * a_really_really_large_function_name(struct strbuf resolved, const char *path, int flags) or static const struct strbuf *a_really_really_large_function_name( struct strbuf resolved, const char *path, int flags) to instead have something more readable like: static const struct strbuf *a_really_really_large_function_name(struct strbuf resolved, const char *path, int flags) This is done by bumping the values of 'PenaltyReturnTypeOnItsOwnLine' and 'PenaltyBreakOpenParenthesis' to 300. This is so that we can allow a few characters above the 80 column limit to make code more readable. Signed-off-by: Karthik Nayak --- .clang-format | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/.clang-format b/.clang-format index 41969eca4b..66a2360ae5 100644 --- a/.clang-format +++ b/.clang-format @@ -209,13 +209,14 @@ KeepEmptyLinesAtTheStartOfBlocks: false # Penalties # This decides what order things should be done if a line is too long -PenaltyBreakAssignment: 10 -PenaltyBreakBeforeFirstCallParameter: 30 -PenaltyBreakComment: 10 +PenaltyBreakAssignment: 5 +PenaltyBreakBeforeFirstCallParameter: 5 +PenaltyBreakComment: 5 PenaltyBreakFirstLessLess: 0 -PenaltyBreakString: 10 -PenaltyExcessCharacter: 100 -PenaltyReturnTypeOnItsOwnLine: 60 +PenaltyBreakOpenParenthesis: 300 +PenaltyBreakString: 5 +PenaltyExcessCharacter: 10 +PenaltyReturnTypeOnItsOwnLine: 300 # Don't sort #include's SortIncludes: false From patchwork Sat Oct 12 01:49:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Karthik Nayak X-Patchwork-Id: 13833482 Received: from mail-ed1-f41.google.com (mail-ed1-f41.google.com [209.85.208.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 009BFF4E2 for ; Sat, 12 Oct 2024 01:50:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728697805; cv=none; b=lB9UBObzq6D55J+rrVM9gqUemFN2DaruYEYMpERuFO6RtEuobbYSMXblwiEWT9K+ouDsBxTGZ74eYtr/WCvoWr6fvGKzk3ZeXUSUNJbNgwl3qFnaxg4szcHNEjea4WCTpG1hYJW7KTSdQa3WxF+7mAjPLbYrLFARaeu4RodAeqs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728697805; c=relaxed/simple; bh=4ERN6am89GHqeH3BGLKrFT2DEc/4Rxylkn6UoUHVhq4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=JWn4aPTuShaYNr/GpI21ZUZ3aRmhNRVLK/j/Ms6lfNckxIFm7WBM7kRlZtZX1ihb3OOlHWtA0Glhx6mhSZzCo62HhtaTWd3Mrd24/oD1BiE/2wJ/7AbbqL/2mCgcl2nHcVBqqAt/74smzAJHvHbNzg/NQ6KlnDuvVC3aRNCB1YA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=mQ7RGy67; arc=none smtp.client-ip=209.85.208.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="mQ7RGy67" Received: by mail-ed1-f41.google.com with SMTP id 4fb4d7f45d1cf-5c87c7d6ad4so3571809a12.3 for ; Fri, 11 Oct 2024 18:50:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1728697802; x=1729302602; darn=vger.kernel.org; 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=05LnHSMb4yPosXhgCOaJwaQlNlEH8PQfessTE4QU/9c=; b=mQ7RGy67PlWqPVyzXarIQTzt3A8Ca2SdY0NOxLsuZ74N2183ZvdychhZw+MSAXBi4J fDvKx5wSYF9S6ka9zqFWgZNd3Lgm5OMjvbUYe3rFSPmDFBHhFUXr2RDHQY3qkKW69kFZ ITDRzt+WzQQYna8SXBWyTASbusAyw72YH6YLAHN3tnMY2+1RTukiu+vi1rhh0cGbSes7 FlWsFXvGSknIK/PT710e4DFNBvvQrI7vjA4fjCPiVSqVyZsfE5ezolY7WD2q07u8PEfD N7U+ZEzMmtCG/Ltd9utBsbGUF+pSQX37tJNsDIlQ+HRNK6NLpqPIDaLsr5zkatbvdz9G Z5Gg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728697802; x=1729302602; 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=05LnHSMb4yPosXhgCOaJwaQlNlEH8PQfessTE4QU/9c=; b=YONeaxU/WTIrNzXpCtagQ5BaxxscfKsZOTcTK4PKYII/y37IWSqFVBQ3W3EtRqAKOs PEG6PnzyZRwuglFSLlLeGclmN42hnX9ff/Eg0eFkDal3+H8U4lxVR7DP0Fyq2UHvj+vy HGBMbzgk+/jnWvzdd0WNT2uWFehCOBTlM9No7fPJUuBUbFHkom2KRg+HpQHiuXSA/T3U SzghsygGpHqiH/q5sMYMhUZPocYFzn2HIG7iUTAXcnTQurloVRdW+c5pvLa4eRSPKXTI GsyHHHwhiOS/ZGoH2iOszcSPx6Jm52gpajVKDEA1C6jaacs+3B+6S8mwB+PUyho1NLg1 RzIg== X-Gm-Message-State: AOJu0YykFPwd/xe5zKVhHj2xgFk6uA0leL8tiwLkq9RrPHiKSy8PkSiN L+eoge6EVMuV4WxlFoL4KI1wO+DxUjLT9fRJ/QeDDJbpddIHPCKc X-Google-Smtp-Source: AGHT+IGuYesEqCoj2OYYMFDq3Zg+/jociNiRRypF0rc/lj2HZ3kGTOfX9FZiLu7YonYG1bFMuFDUbA== X-Received: by 2002:a17:907:3da3:b0:a77:c30c:341 with SMTP id a640c23a62f3a-a99e32fa49amr150160166b.0.1728697802003; Fri, 11 Oct 2024 18:50:02 -0700 (PDT) Received: from archlinux.fritz.box ([2a02:2455:825d:6a00:6bb4:436f:5699:ff21]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a99a80bfc5esm273122266b.142.2024.10.11.18.49.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Oct 2024 18:50:01 -0700 (PDT) From: Karthik Nayak To: karthik.188@gmail.com Cc: git@vger.kernel.org, gitster@pobox.com, jltobler@gmail.com, toon@iotcl.com, johannes.schindelin@gmx.de, spectral@google.com Subject: [PATCH v3 2/3] clang-format: align consecutive macro definitions Date: Sat, 12 Oct 2024 03:49:52 +0200 Message-ID: <1586d5376915a4662c92b8c0881596952c4500bb.1728697428.git.karthik.188@gmail.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 We generally align consecutive macro definitions for better readability: #define OUTPUT_ANNOTATE_COMPAT (1U<<0) #define OUTPUT_LONG_OBJECT_NAME (1U<<1) #define OUTPUT_RAW_TIMESTAMP (1U<<2) #define OUTPUT_PORCELAIN (1U<<3) over #define OUTPUT_ANNOTATE_COMPAT (1U<<0) #define OUTPUT_LONG_OBJECT_NAME (1U<<1) #define OUTPUT_RAW_TIMESTAMP (1U<<2) #define OUTPUT_PORCELAIN (1U<<3) So let's add the rule in clang-format to follow this. Signed-off-by: Karthik Nayak --- .clang-format | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.clang-format b/.clang-format index 66a2360ae5..9547fe1b77 100644 --- a/.clang-format +++ b/.clang-format @@ -32,6 +32,9 @@ AlignConsecutiveAssignments: false # double b = 3.14; AlignConsecutiveDeclarations: false +# Align consecutive macro definitions. +AlignConsecutiveMacros: true + # Align escaped newlines as far left as possible # #define A \ # int aaaa; \ From patchwork Sat Oct 12 01:49:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Karthik Nayak X-Patchwork-Id: 13833483 Received: from mail-ed1-f44.google.com (mail-ed1-f44.google.com [209.85.208.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DA4CF1758B for ; Sat, 12 Oct 2024 01:50:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728697807; cv=none; b=CYPtw7L2tSAm6iBS/A4CogtvQVUl4TU2VEFP2ipkLozy2iT2DhkqbKfwGETO/8+7V32LQdPhgatu/QO11Cao9/1Nbnjyq/Ei5Q8D5w186gXguUAuECT6Diq2gvt8bVXZDm5zPPQiyETyvLnU05l06CV7h5v5y4TM4NVVeljHrTc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728697807; c=relaxed/simple; bh=6Rv490zObb9O7tt+3CZ39LH88N4f7Gxd84rnolFsj+g=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=gpijSGOIdkn7lGUDHLiqiECytavsnJ31u+MzBXL97xCVw9u38t1o0NMbsmE4NzD6m0JfD36vfm1FWuV7aN1zyh3u2fEmD/Hd2JX3yd3H0jZ7DQnXUh0Bd+y1qG1HecJkvbdao3Wtk2H2aHT4uu4/nYu7gQVl+Ejyet+M8cohENM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=VPlyCgRG; arc=none smtp.client-ip=209.85.208.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="VPlyCgRG" Received: by mail-ed1-f44.google.com with SMTP id 4fb4d7f45d1cf-5c9362c26d8so4140362a12.1 for ; Fri, 11 Oct 2024 18:50:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1728697804; x=1729302604; darn=vger.kernel.org; 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=pQiyu6/b8ObIzOn7Qa2T97QA6hjFZVFnL+HM6wELhYk=; b=VPlyCgRGuAUeYpSoH70uy9MfG5dfqtGBQujYUFhZV46jfvFEfcDAXfeiyQxkYYT0Tq 1rBpvTmjM1oVG6TgAYT6pnCDweeq6CgzDiumCsQDkz4NMaQ9abp/g9WSz42LLJIHJC8+ XsIr3ihlSCUtj0h9ZFg/nTnbPjnIrRhX+9hvxr/y+Of7oiVzWiYSF5eOezL6+StgYOqu 3uIpcNOvteqelrCZJijS0jt1wBbRNUBlO9tVxtKwFOEeOD+wJYR88bwZ7TWAfmjUM0w0 EZd6pCwz+nofTbYhXgFaMc8YBYbbAyexc0WkbYGbaurA17etdFkIH0pAffa7NM9jHmJV dkSw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728697804; x=1729302604; 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=pQiyu6/b8ObIzOn7Qa2T97QA6hjFZVFnL+HM6wELhYk=; b=Oouk5KBjNuf71F5irP8frqG/c8e799En06l+QI8uXW5SLKyVfhvWURXOp/MkZH4VEi zvDHQFDzEiBYBdBxEDTnGBSDD3MYkD3N/Y37+Wz0ypFOYH9Vq94fZrK7mD/7nsM6uC36 tXZbELcNXbVkR0W7pOKpYG+dsjQd4bvQYxMyF19cH/AHGeRWTcqaNO3IrdizBfY4jYvL dzNsru1wxXZxGi2YLLeBB+L7PqssvGnmPwn74YqJ11CbIiYYXTiE6SifA8BTV3v4nOdw 0dSync72iTr9Z+xUhvho/cLd7+aoCuDeHP8sKrW5Xnx02KcHQfJKIBHqV/otHKK0q0Dd PqCg== X-Gm-Message-State: AOJu0YxdHxAsw+Kiia2ehNCa4gW52+C7seGMh7IwPhzhLU9heSmP846l r2DbZBcqJMgKFcj670JQUXN7L8L/zbo0nPPJ3r2oP2JxVzOSPER2 X-Google-Smtp-Source: AGHT+IGJHy2HE9S7Lq5JzDYta0HvwAQsU92nrnhroSYg4m1C4WEg/bWDGTwFHG07IQoW3K/R3llwiQ== X-Received: by 2002:a17:907:d25:b0:a99:63fa:2686 with SMTP id a640c23a62f3a-a99a13aa2femr857315766b.20.1728697804054; Fri, 11 Oct 2024 18:50:04 -0700 (PDT) Received: from archlinux.fritz.box ([2a02:2455:825d:6a00:6bb4:436f:5699:ff21]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a99a80bfc5esm273122266b.142.2024.10.11.18.50.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Oct 2024 18:50:03 -0700 (PDT) From: Karthik Nayak To: karthik.188@gmail.com Cc: git@vger.kernel.org, gitster@pobox.com, jltobler@gmail.com, toon@iotcl.com, johannes.schindelin@gmx.de, spectral@google.com Subject: [PATCH v3 3/3] clang-format: don't align expressions after linebreaks Date: Sat, 12 Oct 2024 03:49:53 +0200 Message-ID: <36a53299c1ab1b55a09b7e1d499832e6715ebaba.1728697428.git.karthik.188@gmail.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 We enforce alignment of expressions after linebreaks. Which means for code such as return a || b; it will expect: return a || b; we instead want 'b' to be indent with tabs, which is already done by the 'ContinuationIndentWidth' variable. So let's explicitly set 'AlignOperands' to false. Signed-off-by: Karthik Nayak --- .clang-format | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.clang-format b/.clang-format index 9547fe1b77..b48e7813e4 100644 --- a/.clang-format +++ b/.clang-format @@ -42,10 +42,9 @@ AlignConsecutiveMacros: true # int cccccccc; AlignEscapedNewlines: Left -# Align operands of binary and ternary expressions -# int aaa = bbbbbbbbbbb + -# cccccc; -AlignOperands: true +# Don't enforce alignment after linebreaks and instead +# rely on the ContinuationIndentWidth value. +AlignOperands: false # Don't align trailing comments # int a; // Comment a