lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <e67388e4bdd25ca5ccb4cf20df0527d82ba31277.camel@perches.com>
Date:   Mon, 17 Jan 2022 10:05:15 -0800
From:   Joe Perches <joe@...ches.com>
To:     "Jason A. Donenfeld" <Jason@...c4.com>,
        Miguel Ojeda <miguel.ojeda.sandonis@...il.com>
Cc:     Andrew Lunn <andrew@...n.ch>, LKML <linux-kernel@...r.kernel.org>
Subject: Re: list iterator spacing: clang-format vs checkpatch

On Mon, 2022-01-17 at 13:47 +0100, Jason A. Donenfeld wrote:
> Hey again,

Rehi.

> Four years later I went through basically the same motions: "oh hey I
> should clean this up", "I'll start with clang format", "oh cool it
> adds spaces before the iterator paren so it looks like a normal for
> loop to me", "that seems so reasonable; I love clang format", "oh no
> checkpatch.pl complains; I hope it's wrong", "I wonder if anybody has
> thought about this before", "oh, look, I asked about this already in
> 2018."

Original thread:

https://lore.kernel.org/lkml/CAHmME9ofzanQTBD_WYBRW49d+gM77rCdh8Utdk4+PM9n_bmKwA@mail.gmail.com/

> So, here we are again. I'm wondering:
> - Can we switch to spaces before iterator parens?

Still doubtful because the kernel sources has ~150:1 preference
for no space, and it's still just a whitespace convention...

$ git grep -P '\b\w*for_each\w*\(' | wc -l
31920
$ git grep -P '\b\w*for_each\w*\s+\(' | wc -l
196

> - If not, is clang-format ever going to be fixed to quit adding them?

Doubtful as it's likely the .clang-format for_each list is
just out of date for your particular for_each type use and
the scripted bit that it uses to create them hasn't be
updated in awhile.  Also that scripted bit only works on files
in include/ and not anything locally defined.

in .clang-format:

# Taken from:
#   git grep -h '^#define [^[:space:]]*for_each[^[:space:]]*(' include/ \
#   | sed "s,^#define \([^[:space:]]*for_each[^[:space:]]*\)(.*$,  - '\1'," \
#   | sort | uniq

commit 4792f9dd12936ec35deced665ae3a4ca8fe98729
Author: Miguel Ojeda <ojeda@...nel.org>
Date:   Wed May 12 23:32:39 2021 +0200

    clang-format: Update with the latest for_each macro list
    
    Re-run the shell fragment that generated the original list.
    
    Signed-off-by: Miguel Ojeda <ojeda@...nel.org>

checkpatch basically just looks for any use of 'for_each'

(?:[a-z_]+|)for_each[a-z_]+)

So it has false positives for some functions and not macros.


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ