From patchwork Wed Oct 9 12:51:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: karthik nayak X-Patchwork-Id: 13828394 Received: from mail-ua1-f47.google.com (mail-ua1-f47.google.com [209.85.222.47]) (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 F31351990D1 for ; Wed, 9 Oct 2024 12:51:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728478277; cv=none; b=bOD0ekADn0ao3to/64Z5cs68z8ZoGsh9+8NuFJjkjxtRyq/2L3m4UsgZP5kUvHhW0/Bw5z1760rz7LHEa0V5VZr6oeva5XE28qceoks512UsCykOqtzHOFra6C9MujTVtbr2CaXLctpPNgfq1lhHzNH3YieVzNrv7+W4XQHYBe0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728478277; c=relaxed/simple; bh=LJH0cXYbFTonO9Zu+PA1/nKmbt4HEXQbpqw2DhqCR6M=; h=From:In-Reply-To:References:MIME-Version:Date:Message-ID:Subject: To:Cc:Content-Type; b=iKO6ylFs9LG88QRzSC1Ku63I7g//9WvNN5uVlYECAjyC2c9Eb852n3R0vaBUXlpufR1rG9brPpEZstIEzHuWsNw+JcwOHW6YqvmQhFDmJmGAx+BlztVYcRnBkhaJShIlD/QT0VQMB/OtOjPeICvOeJTEJA+Ub5wrImP2m32geCI= 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=T2f9MUsE; arc=none smtp.client-ip=209.85.222.47 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="T2f9MUsE" Received: by mail-ua1-f47.google.com with SMTP id a1e0cc1a2514c-84fcb49691fso529241.3 for ; Wed, 09 Oct 2024 05:51:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1728478274; x=1729083074; darn=vger.kernel.org; h=cc:to:subject:message-id:date:mime-version:references:in-reply-to :from:from:to:cc:subject:date:message-id:reply-to; bh=Aqup1YDOyJ4x3b28qxI/cCxkTLBX+87HPrp73Yp1XCE=; b=T2f9MUsEl5s9HQHiy1Qn4nmUG2oJrRABLkvdtsxuzO74gbWigd4fy/YWubDYygh+Pl YJwfzp5dnWmtgKWxvt4AKv6YzJwumEPja0eoBfZTbDU/MUPErndKcm9muToAzRIyQqti D4OmWjYF2MKrdUEw9hCPuwtkHly7bCClL+kn1UI1zvC8jx4LCfWjcNDRf0r+C0R/JCoN m/B/+oXE6MoHni9a5Vy30FOp4Fpp5sbKgSB6y0rNFv8SHtxVTGQynsRbbtqBXDgw6mnz xZ+oecqebFtWYtk2XZW1N3oFHoVyaIRKPJg0vYY3xiS+5PahTu/Dkf9vjEzppzbZHKDS VnXA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728478274; x=1729083074; h=cc:to:subject:message-id:date:mime-version:references:in-reply-to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=Aqup1YDOyJ4x3b28qxI/cCxkTLBX+87HPrp73Yp1XCE=; b=Wc/MzhB1HRxIq18Vh93Gf84yBRjwm0rLTBPAw6DzXxQtmadmMtowpqZe/n813B9Jg6 +keJR46pRM8Y4kroOm2OMlhcc3bmQHC+7mialbV6v5eHUFrVNUG1Udh3snninoZaRAXA FDLdUsvfLlOVQgI2vSB9hNvb7PEVH7B8VB+ruBA/ZPBM0zVtnU639T9/H4Jige65CoRu Tdp/66PlwIvIEUKzL1ZxY4tDgxhgBs8PKMYOXCAz1BtPud4irgXjUgBFZskfHXbk1sZ7 1l5kXsKIBS9W656klNtNlKFjIzgtJoj4mV35sf7NBXgkGqlwCfH5+onnQSF0jqYz/1/2 rhZA== X-Gm-Message-State: AOJu0YyIzPdmANhZtub7EmnC6roe8ErZ8nyIhn0T10nfAgkoPiYUzM4u Ehhpau1X67D2UmQkNnnJSpfTPxenZNtk0yXX83LZ5qI1hzYFsD7zDFKor31WvDSJjeRbknKM7gM E3DGlGfsr2PLxIfFnIEPwuKowx1zIcyAs X-Google-Smtp-Source: AGHT+IHICevJA7Vv2HzdELO9FtHTrFMNL+uFuVov2hNbntkhj8EwetZbRbUaykFIiCioSbVe62gWE4/6BNke92uB19k= X-Received: by 2002:a05:6102:a4e:b0:4a3:c4cc:7095 with SMTP id ada2fe7eead31-4a448d7bc2cmr2739332137.15.1728478273610; Wed, 09 Oct 2024 05:51:13 -0700 (PDT) Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Wed, 9 Oct 2024 05:51:13 -0700 From: Karthik Nayak X-Mailer: git-send-email 2.46.2 In-Reply-To: <20241009125109.24422-1-karthik.188@gmail.com> References: <20241009125109.24422-1-karthik.188@gmail.com> Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Date: Wed, 9 Oct 2024 05:51:13 -0700 Message-ID: Subject: [PATCH 1/3] clang-format: don't enforce the column limit To: git@vger.kernel.org Cc: Karthik Nayak The current value for the column limit is set to 80. While this is as expected, we often prefer readability over this strict limit. This means it is common to find code which extends over 80 characters. So let's change the column limit to be 0 instead. This ensures that the formatter doesn't complain about code strictly not following the column limit. Signed-off-by: Karthik Nayak --- .clang-format | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.clang-format b/.clang-format index 41969eca4b..38910a3a53 100644 --- a/.clang-format +++ b/.clang-format @@ -12,7 +12,11 @@ UseTab: Always TabWidth: 8 IndentWidth: 8 ContinuationIndentWidth: 8 -ColumnLimit: 80 + +# While we recommend keeping column limit to 80, we don't want to +# enforce it as we generally are more lenient with this rule and +# prefer to prioritize readability. +ColumnLimit: 0 # C Language specifics Language: Cpp From patchwork Wed Oct 9 12:56:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: karthik nayak X-Patchwork-Id: 13828409 Received: from mail-ua1-f41.google.com (mail-ua1-f41.google.com [209.85.222.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 B88F5196D98 for ; Wed, 9 Oct 2024 12:56:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728478571; cv=none; b=RDOz0CRxj/0BQvwnMKHX3i7iE3F2SFze3WAG6FvbZ5D8NQ4SPJxIH1O/nDKOC/bZRYaHO0fwmLgHcp4P6qGYIDj8rjh9aV5BLuDOd8Kaa+HHPZt5Tfp9/jrdwQzXly9dZhrOXAVcGFem3rDoZ8pcE9DUUkbW+OmkAynNzZ7k7l4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728478571; c=relaxed/simple; bh=4rSDABI0v1KaG4Qb0/Rx6P9AcCOBAaOOMgrUbDnCYgA=; h=From:In-Reply-To:References:MIME-Version:Date:Message-ID:Subject: To:Cc:Content-Type; b=PQhszA0hDD7fBUFJQ450nFqkYC2UyKUkL70aOoMZDHGAfIkgYoaE/XkIwkocQEdnGVsYlDmgPkR9wLhJlqPFrStxEU+RyJHU1f8omvXT8vf32yxUlxHhgjCJIHzkgVagBEvAWEQcPEitSiSRQXPP1d1tJz5WJSgCxnRcxP2o9q0= 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=h0wV6pSS; arc=none smtp.client-ip=209.85.222.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="h0wV6pSS" Received: by mail-ua1-f41.google.com with SMTP id a1e0cc1a2514c-84ea658b647so2325920241.1 for ; Wed, 09 Oct 2024 05:56:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1728478568; x=1729083368; darn=vger.kernel.org; h=cc:to:subject:message-id:date:mime-version:references:in-reply-to :from:from:to:cc:subject:date:message-id:reply-to; bh=g0p4hikNOHVCj2ttRmpxSvyhwJWT2kuvnY0RoITqCPM=; b=h0wV6pSSHEUy6jSuQLDYag0htoMcQTM4WSomteNCfXucvAlsLRkFQZzeHznAuwOXoB Pe5tqGO6denQTRliuS4fWI6lvSIY1NvahZmVNWBDlhJNmev9XL8Nsf0bu6UEmK30xkOF 9+Sj+pd9Z88qNHZZmbwCXKgBoYjIhdNcxgLsEPU3rLCzuMuJrA9aInAY8JyET2k8x83g YDnzMGxVvLsMQrv9aA9gTGBU5DDSiWwv3tMDuSTIynoan7uYFoZ9tQWlU+K7x+be2T1W Ozd2+qJ1D0NT82p4m+qosohI9QIrNEjLy+Y2A5XP4BfXV+LdONHlQ12UkKzh6vZpshdI NBIw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728478568; x=1729083368; h=cc:to:subject:message-id:date:mime-version:references:in-reply-to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=g0p4hikNOHVCj2ttRmpxSvyhwJWT2kuvnY0RoITqCPM=; b=HqgcaZJiPngtw7kbFsTkmcGqThcQuMpnknnL0PnICUAXMFV+vuxs4rRb5EoB5bOhLj 3SQqLxcXJ4A+pRhLGAQs/CpRpEVsyfYJVj1sm+oSBNFP0WLhHGsFZnIx8XlFvvH7EQib vombINGg/v/vKfQ9jLYPDRtSAQFJB2pieCHrHiaPRnnSftihLIab74L41EgLdoIOXXB3 xIW1dHsg4NjMCR67LxV2SMReBZ2rHocQxPXG2FdqbN2eJvfGADeoZ3Qjj8NnuLZ7KrpZ eZGnnHVo6yOZPG3dFA6nYPjID/zE+/owN2qajyXtjql8bFZqtDkC+yjZ/v2tGWWoKmF2 vCcw== X-Gm-Message-State: AOJu0YyLC4fp5kXSnNttCDgZ44JydyUkNISFt/b3gVpvCwcWMl9c35Rt OPw9c2+IGm8rR4QOXS9N+7H9O2eKMJNIj7hNep/WSiVxngv8eHRDarWXqOxQ1nVbvzO7pNdDbiR KFce//npsaziiInfgxjh6KvGvMc4= X-Google-Smtp-Source: AGHT+IErFmGsdMdigxgxN6k1+zNX+lCJuXbfdgN0HwCmMa+UpB6Sh9eT/RM+taXJKLU9i8QctFU+wb0bB7J0/vQgb0U= X-Received: by 2002:a05:6102:c93:b0:4a3:a3c6:c674 with SMTP id ada2fe7eead31-4a448d1566amr2928838137.4.1728478568598; Wed, 09 Oct 2024 05:56:08 -0700 (PDT) Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Wed, 9 Oct 2024 05:56:08 -0700 From: Karthik Nayak X-Mailer: git-send-email 2.46.2 In-Reply-To: References: Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Date: Wed, 9 Oct 2024 05:56:08 -0700 Message-ID: Subject: [PATCH 2/3] clang-format: don't align expressions after linebreaks To: karthik.188@gmail.com Cc: git@vger.kernel.org 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 38910a3a53..af12a038f7 100644 --- a/.clang-format +++ b/.clang-format @@ -43,10 +43,9 @@ AlignConsecutiveDeclarations: false # 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 From patchwork Wed Oct 9 12:56:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: karthik nayak X-Patchwork-Id: 13828410 Received: from mail-vs1-f52.google.com (mail-vs1-f52.google.com [209.85.217.52]) (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 85CD5196D98 for ; Wed, 9 Oct 2024 12:56:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.217.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728478577; cv=none; b=TUROowwUKPmIPoGfo6i+usPSAtJgwX8KrwDhoQJEvHq58dvXj9E63F7k5EQtNZ9L9djjhqrH6w8INiQwv4lCE03PuiYEbRJzYA5YVCDLSDGvJCZeiX0qN8pClvxLjVwKW7vvSMLX6tybrMxRkEPDujf3tUE6dBrQ251jNpMD2ZE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728478577; c=relaxed/simple; bh=7H6H2WJq95PlEYs4xT0Aq7UCHKfjU35zThUp99oGF5Q=; h=From:In-Reply-To:References:MIME-Version:Date:Message-ID:Subject: To:Cc:Content-Type; b=iVGS6qyhs/ArYnqnYrHzhHzjXWhYCWov7h3o/1uJpWjTo0uXnqhHXVVNLil+ScoxZhJ1mh2gFDGs2LsEBb7a7RCfnwS2oO19lBASxQgXCBoFW2lcpFe96NzlQdPGBYPxups1gdAzV1hej1GObL6lA9AwwPDtx1WdFUaAbLFNfF0= 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=KresE3Cj; arc=none smtp.client-ip=209.85.217.52 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="KresE3Cj" Received: by mail-vs1-f52.google.com with SMTP id ada2fe7eead31-4a3be8c420cso1903619137.2 for ; Wed, 09 Oct 2024 05:56:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1728478574; x=1729083374; darn=vger.kernel.org; h=cc:to:subject:message-id:date:mime-version:references:in-reply-to :from:from:to:cc:subject:date:message-id:reply-to; bh=uJzS7R+JABhISt7uoW21mfVLFsm2XYnW3McdYwIps3k=; b=KresE3Cj41gDJBzO6f91qqTVL6hVh/FtZ+0/wynYnlVJfQUUS/fK7QPHkEetSvjNSQ wTqa2zBhGhycF9rBnYBRQpQ4b333o6g4Owjd5YFcKt7OsSWK2WnysA6RzmbbOiODS05Y CJ6gH2UVhFgn0qabg/u6NVpqfLViV/11QAV3Sv0N3EzdZowfuPv+fnVF3SjdOAWj0F1J eG/kUiAwOMgbuSKwYquCH4qykchT/p3J7ZsVZLIzpmA+tgVb2OklEp42a3ReattVlKqG jbdlfkQ3z3v5KnX7GALIcFBZu9C9jWD9j7ZrXItiAKM1WZzOl5UCMgsL5bOYYHgpVcyA e8Xw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728478574; x=1729083374; h=cc:to:subject:message-id:date:mime-version:references:in-reply-to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=uJzS7R+JABhISt7uoW21mfVLFsm2XYnW3McdYwIps3k=; b=HWJqpAVn/jp2X0I0HwAnJU+JktAJ1k0k2aAb7clFgEIwwDCiANLPdi9pt64IGcNQAM f4dXjuzXj3NVEghtrMmiZrK4MKmN7DfoxWg7yVvJ/Sqqcdm29CH6K7Txo+ltGig2tZCt qKC6WgvabF+ryjy9i7JmQrpFspl5dPzWNKyBDvY2yrhgx4sSmKZycRgJiKxg2VnvXwch LtYHHVtodAjp2J010opAk18ZDbKtbn4WXzYBlE9ALVlagahxgcXzBSqq02pu+HHGFEp4 l4RD0I5R7m9xkQDnzmYrx7Rqb4ABJxp/ViOsuh9iLg3zsgb/VTFZ3wlUatGCbkZZwuiJ 9+Ww== X-Gm-Message-State: AOJu0YzUJP+paVwwI9wkgKH2/GI+t5qhDKa5O9w9aB4kH2B2aNSKAifz 7VECEQ5DNcMAwaTmp7Lr2iN1+WP0s3fQDe5YXd+01M1Wo3oDOkYGre2qkP5Nvm1oj/jCSmpIHUC sfTZyGwmyMFnlzXDpCqWESrrGQpsoryGB X-Google-Smtp-Source: AGHT+IEF4ys4ZYBHrfMKNu00qhxsBQoE5SjVWDLiefZQUgWPd6K+QiD1OU+tdiCtjch9VDOjsrDdPHSP5pGyctb9B2U= X-Received: by 2002:a05:6102:945:b0:4a3:bd34:11bb with SMTP id ada2fe7eead31-4a448d82248mr1719245137.14.1728478574355; Wed, 09 Oct 2024 05:56:14 -0700 (PDT) Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Wed, 9 Oct 2024 05:56:14 -0700 From: Karthik Nayak X-Mailer: git-send-email 2.46.2 In-Reply-To: References: Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Date: Wed, 9 Oct 2024 05:56:14 -0700 Message-ID: Subject: [PATCH 3/3] clang-format: align consecutive macro definitions To: karthik.188@gmail.com Cc: git@vger.kernel.org We generally align consecutive macro definitions for better readability. 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 af12a038f7..d76d5f1e6a 100644 --- a/.clang-format +++ b/.clang-format @@ -36,6 +36,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; \