From: Mauro Carvalho Chehab <mauro.chehab@linux.intel.com>
To: Jim Shargo <jshargo@chromium.org>
Cc: Development mailing list for IGT GPU Tools
<igt-dev@lists.freedesktop.org>,
Petri Latvala <petri.latvala@intel.com>
Subject: Re: [igt-dev] [PATCH i-g-t v3] tooling: Add linux's .clang-format
Date: Thu, 31 Aug 2023 19:03:59 +0200 [thread overview]
Message-ID: <20230831190359.25c8c37f@maurocar-mobl2> (raw)
In-Reply-To: <20220728175736.1893691-1-jshargo@chromium.org>
On Thu, 28 Jul 2022 13:57:36 -0400
Jim Shargo <jshargo@chromium.org> wrote:
> As I was authoring my first patchset for IGT, I found myself fighting
> the tooling a bit to get everything right. I had to add a bunch of extra
> command line args to use my linux checkout's formatting rules to get the
> style right.
>
> I grabbed this from a recent checkout of torvald's repo.
>
> The commit I used was: e0dccc3b76fb35bb257b4118367a883073d7390e
>
> To make this discoverable to new contributors, this change also
> updates CONTRIBUTING.md with:
>
> - A link to git-clang-format, which is a useful tool for using
> clang-format from git just on a commit's changes
> - A link to .editorconfig to make it more discoverable
>
> Changes made to the linux kernel style:
>
> - Reflowing comments, including multi-line comments (ReflowComments)
> - Support for magic code blocks (ForEachMacros, IfMacros)
>
> Signed-off-by: Jim Shargo <jshargo@chromium.org>
This is not a full validation of the results, but, running this with:
git-clang-format 8c64183a461a
I found several places where the output format is worse than what
we have. Strictly speaking, the results may be following the
documented Kernel coding style, but for sure they don't follow the usual
Kernel nor IGT practices. Also, checkpatch.pl won't be complaining
about such things as the original code already follows the Kernel
coding style.
Some examples below:
#ifndef likely
-# ifdef __GNUC__
-# define likely(x) __builtin_expect(!!(x), 1)
-# define unlikely(x) __builtin_expect(!!(x), 0)
-# else
-# define likely(x) (x)
-# define unlikely(x) (x)
-# endif
+#ifdef __GNUC__
+#define likely(x) __builtin_expect(!!(x), 1)
+#define unlikely(x) __builtin_expect(!!(x), 0)
+#else
+#define likely(x) (x)
+#define unlikely(x) (x)
+#endif
#endif
The above is a lot worse to read, making reviews harder.
Other defines also are re-formatted in a way that makes harder
to review:
-#define PIPE_CONTROL_NOWRITE 0x00
-#define PIPE_CONTROL_WRITEIMMEDIATE 0x01
-#define PIPE_CONTROL_WRITEDEPTH 0x02
-#define PIPE_CONTROL_WRITETIMESTAMP 0x03
+#define PIPE_CONTROL_NOWRITE 0x00
+#define PIPE_CONTROL_WRITEIMMEDIATE 0x01
+#define PIPE_CONTROL_WRITEDEPTH 0x02
+#define PIPE_CONTROL_WRITETIMESTAMP 0x03
Tables are also weird-formatted:
-static const char * const end_of_thread[2] = {
- [0] = "",
- [1] = "EOT"
-};
-
+static const char *const end_of_thread[2] = { [0] = "", [1] = "EOT" };
Placing multiple values per line. On a small tame like this, not
a big issue, but on bigger tables, it makes a lot harder to check
if there are gaps at the values.
Looking at function prototypes:
-static int src_ia1 (FILE *file,
- unsigned type,
- unsigned _reg_file,
- int _addr_imm,
- unsigned _addr_subreg_nr,
- unsigned _negate,
- unsigned __abs,
- unsigned _addr_mode,
- unsigned _horiz_stride,
- unsigned _width,
- unsigned _vert_stride)
+static int src_ia1(FILE *file, unsigned type, unsigned _reg_file, int _addr_imm,
+ unsigned _addr_subreg_nr, unsigned _negate, unsigned __abs,
+ unsigned _addr_mode, unsigned _horiz_stride, unsigned _width,
+ unsigned _vert_stride)
At least for functions with that many arguments, having one argument
per line makes easier for reviewers and for users.
So, I'd say it is not ready yet for merging.
Regards,
Mauro
next prev parent reply other threads:[~2023-08-31 17:04 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-26 19:01 [igt-dev] [PATCH i-g-t] tooling: Add linux's .clang-format Jim Shargo
2022-07-27 10:52 ` Petri Latvala
2022-07-27 20:10 ` Jim Shargo
2022-07-27 20:21 ` [igt-dev] [PATCH i-g-t v2] " Jim Shargo
2022-07-28 7:55 ` Petri Latvala
2022-07-28 17:55 ` Jim Shargo
2022-07-28 17:57 ` [igt-dev] [PATCH i-g-t v3] " Jim Shargo
2022-08-12 12:53 ` Petri Latvala
2022-08-12 16:00 ` Jim Shargo
2022-08-19 14:23 ` Jim Shargo
2022-08-23 11:01 ` Petri Latvala
2023-08-31 17:03 ` Mauro Carvalho Chehab [this message]
2022-07-29 9:21 ` [igt-dev] ✓ Fi.CI.BAT: success for tooling: Add linux's .clang-format (rev3) Patchwork
2022-07-29 10:38 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork
2022-08-02 22:25 ` Jim Shargo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230831190359.25c8c37f@maurocar-mobl2 \
--to=mauro.chehab@linux.intel.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=jshargo@chromium.org \
--cc=petri.latvala@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox