public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Bagas Sanjaya <bagasdotme@gmail.com>
To: Utkarsh Verma <utkarshverma294@gmail.com>
Cc: Dwaipayan Ray <dwaipayanray1@gmail.com>,
	Lukas Bulwahn <lukas.bulwahn@gmail.com>,
	Joe Perches <joe@perches.com>, Jonathan Corbet <corbet@lwn.net>,
	linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] docs: checkpatch: add some new checkpatch documentation messages
Date: Wed, 3 Aug 2022 10:05:19 +0700	[thread overview]
Message-ID: <Yunl74ozKOzV+n2A@debian.me> (raw)
In-Reply-To: <20220802055528.13726-1-utkarshverma294@gmail.com>

Hi Utkarsh,

On Tue, Aug 02, 2022 at 11:25:28AM +0530, Utkarsh Verma wrote:
> Added and documented the following new message types:
> - JIFFIES_COMPARISON
> - LONG_UDELAY
> - MSLEEP
> - INDENTED_LABEL
> - IF_0
> - IF_1
> - MISORDERED_TYPE
> - UNNECESSARY_BREAK
> - UNNECESSARY_ELSE
> - UNNECESSARY_INT
> - UNSPECIFIED_INT
> 

Use imperative mood for patch description instead.

> +  **MISORDERED_TYPE**
> +    According to section “6.7.2 Type Specifiers” in C90 standard, “type
> +    specifiers may occur in any order.” This means that "signed long long
> +    int" is same as "long long int signed". But to avoid confusion and make
> +    the code easier to read, the declaration type should use the following
> +    format::
> +
> +      [[un]signed] [short|int|long|long long]
> +
> +    Below is the list of standard integer types. Each row lists all the
> +    different ways of specifying a particular type delimited by commas.
> +    Note: Also include all the permutations of a particular type
> +    on the left column delimited by comma. For example, the permutations
> +    for "signed long int" are "signed int long", "long signed int",
> +    "long int signed", "int signed long", and "int long signed".
> +
> +    +--------------------------------------------------+--------------------+
> +    |                       Types                      |   Recommended Way  |
> +    +=======================================================================+
> +    | char                                             | char               |
> +    +-----------------------------------------------------------------------+
> +    | signed char                                      | signed char        |
> +    +-----------------------------------------------------------------------+
> +    | unsigned char                                    | unsigned char      |
> +    +-----------------------------------------------------------------------+
> +    | signed, int, signed int                          | int                |
> +    +-----------------------------------------------------------------------+
> +    | unsigned, unsigned int                           | unsigned int       |
> +    +-----------------------------------------------------------------------+
> +    | short, signed short, short int, signed short int | short              |
> +    +-----------------------------------------------------------------------+
> +    | unsigned short, unsigned short int               | unsigned short     |
> +    +-----------------------------------------------------------------------+
> +    | long, signed long, long int, signed long int     | long               |
> +    +-----------------------------------------------------------------------+
> +    | unsigned long, unsigned long int                 | unsigned long      |
> +    +-----------------------------------------------------------------------|
> +    | long long, signed long long, long long int,      | long long          |
> +    | signed long long int                             |                    |
> +    +-----------------------------------------------------------------------+
> +    | unsigned long long, unsigned long long int       | unsigned long long |
> +    +-----------------------------------------------------------------------+
> +

The table above triggers htmldocs error, so I have to apply the fixup:

---- >8 ----

From 4fcc0df4ffcf1190330c12db5352cae03f8620fb Mon Sep 17 00:00:00 2001
From: Bagas Sanjaya <bagasdotme@gmail.com>
Date: Wed, 3 Aug 2022 09:48:43 +0700
Subject: [PATCH] Documentation: checkpatch: MISORDERED_TYPE table intersection
 fixup

Sphinx reported error and warnings pointed at MISORDERED_TYPE table:

Documentation/dev-tools/checkpatch.rst:1393: (SEVERE/4) Unexpected section title or transition.
Documentation/dev-tools/checkpatch.rst:1393: WARNING: Block quote ends without a blank line; unexpected unindent.
Documentation/dev-tools/checkpatch.rst:1393: WARNING: Unexpected section title or transition.

Fix these above by marking cell intersections with plus (+) sign.

Link: https://lore.kernel.org/linux-doc/202208030829.xj2bvI7P-lkp@intel.com/
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Bagas Sanjaya <bagasdotme@gmail.com>
---
 Documentation/dev-tools/checkpatch.rst | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/Documentation/dev-tools/checkpatch.rst b/Documentation/dev-tools/checkpatch.rst
index 78abcadb522824..a9d27913e6c46f 100644
--- a/Documentation/dev-tools/checkpatch.rst
+++ b/Documentation/dev-tools/checkpatch.rst
@@ -1371,30 +1371,30 @@ Others
 
     +--------------------------------------------------+--------------------+
     |                       Types                      |   Recommended Way  |
-    +=======================================================================+
+    +==================================================+====================+
     | char                                             | char               |
-    +-----------------------------------------------------------------------+
+    +--------------------------------------------------+--------------------+
     | signed char                                      | signed char        |
-    +-----------------------------------------------------------------------+
+    +--------------------------------------------------+--------------------+
     | unsigned char                                    | unsigned char      |
-    +-----------------------------------------------------------------------+
+    +--------------------------------------------------+--------------------+
     | signed, int, signed int                          | int                |
-    +-----------------------------------------------------------------------+
+    +--------------------------------------------------+--------------------+
     | unsigned, unsigned int                           | unsigned int       |
-    +-----------------------------------------------------------------------+
+    +--------------------------------------------------+--------------------+
     | short, signed short, short int, signed short int | short              |
-    +-----------------------------------------------------------------------+
+    +--------------------------------------------------+--------------------+
     | unsigned short, unsigned short int               | unsigned short     |
-    +-----------------------------------------------------------------------+
+    +--------------------------------------------------+--------------------+
     | long, signed long, long int, signed long int     | long               |
-    +-----------------------------------------------------------------------+
+    +--------------------------------------------------+--------------------+
     | unsigned long, unsigned long int                 | unsigned long      |
-    +-----------------------------------------------------------------------|
+    +--------------------------------------------------+--------------------+
     | long long, signed long long, long long int,      | long long          |
     | signed long long int                             |                    |
-    +-----------------------------------------------------------------------+
+    +--------------------------------------------------+--------------------+
     | unsigned long long, unsigned long long int       | unsigned long long |
-    +-----------------------------------------------------------------------+
+    +--------------------------------------------------+--------------------+
 
   **NOT_UNIFIED_DIFF**
     The patch file does not appear to be in unified-diff format.  Please
---- >8 ----

> +    Also, do not change the code if there is only a single return statement
> +    inside if-else block, like::
> +
> +      if (a > b)
> +              return a;
> +      else
> +              return b;
> +
> +    now if the else statement is removed::
> +
> +      if (a > b)
> +              return a;
> +      return b;
> +
> +    there is no considerable increase in the readability and one can argue
> +    that the first form is more readable because of the indentation. So
> +    do not remove the else statement in case of a single return statement
> +    inside the if-else block.
> +

So the first indentation above is more readable for it's clear that
b is returned if the condition is false (in this case, a < b), right?

> +    See: https://lore.kernel.org/lkml/20140925032215.GK7996@ZenIV.linux.org.uk/
> +
> +  **UNNECESSARY_INT**
> +    On Sun, 2018-08-05 at 08:52 -0700, Linus Torvalds wrote:
> +    > "long unsigned int" isn't _technically_ wrong. But we normally
> +    > call that type "unsigned long".
> +

IMO, the mail quote above can be deleted.

Thanks.

-- 
An old man doll... just what I always wanted! - Clara

      parent reply	other threads:[~2022-08-03  3:05 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-02  5:55 [PATCH] docs: checkpatch: add some new checkpatch documentation messages Utkarsh Verma
2022-08-03  0:24 ` kernel test robot
2022-08-03  3:05 ` Bagas Sanjaya [this message]

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=Yunl74ozKOzV+n2A@debian.me \
    --to=bagasdotme@gmail.com \
    --cc=corbet@lwn.net \
    --cc=dwaipayanray1@gmail.com \
    --cc=joe@perches.com \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lukas.bulwahn@gmail.com \
    --cc=utkarshverma294@gmail.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